mirror of
https://github.com/sigmasternchen/libparcival
synced 2025-03-15 03:48:55 +00:00
fixed non-reachable token in lexer
This commit is contained in:
parent
0eb49b5161
commit
c2b97854d3
2 changed files with 6 additions and 6 deletions
|
@ -51,11 +51,12 @@ template: metaSection SECTION mainSection
|
|||
$$ = $1;
|
||||
$$.tree = $3;
|
||||
}
|
||||
| mainSection
|
||||
/* | mainSection
|
||||
{
|
||||
$$ = newTemplate();
|
||||
$$.tree = $1;
|
||||
}
|
||||
*/
|
||||
;
|
||||
|
||||
metaSection: /* empty */
|
||||
|
|
|
@ -19,7 +19,7 @@ id [a-zA-Z_][a-zA-Z0-9_]*
|
|||
type_prefixes "enum"|"struct"
|
||||
type_prefix {type_prefixes}{whitespace}+
|
||||
type_pointer {whitespace}*"*"
|
||||
type {type_prefix}?{id}{type_pointer}?
|
||||
type_or_id {type_prefix}?{id}{type_pointer}?
|
||||
|
||||
%option noyywrap
|
||||
%option nounput
|
||||
|
@ -52,11 +52,10 @@ type {type_prefix}?{id}{type_pointer}?
|
|||
<INITIAL,META_SECTION>{statement_begin} { BEGIN(STATEMENT); return STATEMENT_BEGIN; }
|
||||
<INITIAL,META_SECTION>{section} { isMetaSection = false; BEGIN(MAIN_SECTION); return SECTION; }
|
||||
<INITIAL,META_SECTION>{output_begin} { fprintf(stderr, "error: output block not allowed in meta section (line %d)\n", yylineno); exit(1); }
|
||||
<INITIAL,META_SECTION>{whitespace}+ { /* ignore whitespaces */ }
|
||||
<INITIAL,META_SECTION>. { fprintf(stderr, "error: raw text not allowed in meta section (line %d)\n", yylineno); exit(1); }
|
||||
<INITIAL,META_SECTION>{whitespace}+ { /* ignore whitespaces */ }
|
||||
<INITIAL,META_SECTION>. { fprintf(stderr, "error: raw text not allowed in meta section (line %d)\n", yylineno); exit(1); }
|
||||
|
||||
<PARAMS>{type} { yylval.text = strdup(yytext); return TEXT; }
|
||||
<PARAMS>{id} { yylval.text = strdup(yytext); return TEXT; }
|
||||
<PARAMS>{type_or_id} { yylval.text = strdup(yytext); return TEXT; }
|
||||
<PARAMS>{params_end} { BEGIN(META_SECTION); return PARAMS_END; }
|
||||
<PARAMS>"," { return COMMA; }
|
||||
<PARAMS>{whitespace}+ { /* ignore whitespaces */ }
|
||||
|
|
Loading…
Reference in a new issue