My favorites
▼
|
Sign in
lemon-parser-generator
Lemon parser generator
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
1
attachment: lemon_headers.patch
(1.7 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
7a8,13
> **
> ** WARNING -- asp edited this file to change the header format slightly
> ** if you redownload the lemon source, you must re-add these
> ** changes!!
> **
> **
4012a4019,4054
> /* Output function headers --asp */
> fputs("#include <stdio.h>\n", out);
> fputs("#include <stddef.h>\n", out);
> fprintf(out, "void *%sAlloc(void *(*mallocProc)(size_t));\n", lemp->name);
> fprintf(out, "void %sFree(void *p, void (*freeProc)(void*));\n", lemp->name);
> fprintf(out, "int %sStackPeak(void *p);\n", lemp->name);
> fprintf(out, "void %sTrace(FILE *TraceFILE, char *zTracePrompt);\n", lemp->name);
>
> /* Forward-declare structs */
> if(lemp->tokentype && strstr(lemp->tokentype, "struct")) {
> char *tt = strdup(lemp->tokentype);
> if(tt) {
> char *s = strtok(tt, " \n\t");
> fprintf(out, "%s ", s);
> s = strtok(NULL, "* \n\t");
> fprintf(out, "%s;\n", s);
> }
> free(tt);
> }
> if(lemp->arg && strstr(lemp->arg, "struct")) {
> char *tt = strdup(lemp->arg);
> if(tt) {
> char *s = strtok(tt, " \n\t");
> fprintf(out, "%s ", s);
> s = strtok(NULL, "* \n\t");
> fprintf(out, "%s;\n", s);
> }
> free(tt);
> }
> /* Output Parse() declaration */
> if(lemp->arg && lemp->arg[0])
> fprintf(out, "void %s(void *yyp, int yymajor, %s yyminor, %s);\n", lemp->name, lemp->tokentype ? lemp->tokentype : "void*", lemp->arg);
> else
> fprintf(out, "void %s(void *yyp, int yymajor, %s yyminor);\n", lemp->name, lemp->tokentype ? lemp->tokentype : "void*");
>
> /* Output defines --end asp */
Powered by
Google Project Hosting