Browse Source

- fixed grammar to handle include correctly

development
Andreas Romeyke 2 years ago
parent
commit
7e0f9f871c
2 changed files with 229 additions and 101 deletions
  1. +208
    -98
      src/parser/config_dsl.grammar.c
  2. +21
    -3
      src/parser/config_dsl.grammar.peg

+ 208
- 98
src/parser/config_dsl.grammar.c View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define YYRULECOUNT 43
#define YYRULECOUNT 46
#ifndef YY_MALLOC
#define YY_MALLOC(C, N) malloc(N)
#endif
@ -272,38 +272,41 @@ YY_LOCAL(void) yySet(yycontext *yy, char *text, int count) { yy->__val[count]=
#define YYACCEPT yyAccept(yy, yythunkpos0)
YY_RULE(int) yy_EscapedPCRE(yycontext *yy); /* 43 */
YY_RULE(int) yy_PCRE(yycontext *yy); /* 42 */
YY_RULE(int) yy_Value(yycontext *yy); /* 41 */
YY_RULE(int) yy_ValueList(yycontext *yy); /* 40 */
YY_RULE(int) yy_Digit(yycontext *yy); /* 39 */
YY_RULE(int) yy_Iccprofile(yycontext *yy); /* 38 */
YY_RULE(int) yy_Datetime(yycontext *yy); /* 37 */
YY_RULE(int) yy_ValueReference(yycontext *yy); /* 36 */
YY_RULE(int) yy_Dot(yycontext *yy); /* 35 */
YY_RULE(int) yy_OptDepends(yycontext *yy); /* 34 */
YY_RULE(int) yy_IfDepends(yycontext *yy); /* 33 */
YY_RULE(int) yy_Space(yycontext *yy); /* 32 */
YY_RULE(int) yy_TagReference(yycontext *yy); /* 31 */
YY_RULE(int) yy_Content(yycontext *yy); /* 30 */
YY_RULE(int) yy_Requirements(yycontext *yy); /* 29 */
YY_RULE(int) yy_Semicolon(yycontext *yy); /* 28 */
YY_RULE(int) yy_Tag(yycontext *yy); /* 27 */
YY_RULE(int) yy_Colon(yycontext *yy); /* 26 */
YY_RULE(int) yy_PrintableAscii(yycontext *yy); /* 25 */
YY_RULE(int) yy_RegEx(yycontext *yy); /* 24 */
YY_RULE(int) yy_NTupel(yycontext *yy); /* 23 */
YY_RULE(int) yy_Number(yycontext *yy); /* 22 */
YY_RULE(int) yy_Only(yycontext *yy); /* 21 */
YY_RULE(int) yy_Range(yycontext *yy); /* 20 */
YY_RULE(int) yy_Any(yycontext *yy); /* 19 */
YY_RULE(int) yy_LogicalOrListElement(yycontext *yy); /* 18 */
YY_RULE(int) yy_LogicalOrClose(yycontext *yy); /* 17 */
YY_RULE(int) yy_LogicalOrList(yycontext *yy); /* 16 */
YY_RULE(int) yy_LogicalOrOpen(yycontext *yy); /* 15 */
YY_RULE(int) yy_LogicalOr(yycontext *yy); /* 14 */
YY_RULE(int) yy_Mode(yycontext *yy); /* 13 */
YY_RULE(int) yy_ClosingBracket(yycontext *yy); /* 12 */
YY_RULE(int) yy_EscapedPCRE(yycontext *yy); /* 46 */
YY_RULE(int) yy_PCRE(yycontext *yy); /* 45 */
YY_RULE(int) yy_Value(yycontext *yy); /* 44 */
YY_RULE(int) yy_ValueList(yycontext *yy); /* 43 */
YY_RULE(int) yy_Digit(yycontext *yy); /* 42 */
YY_RULE(int) yy_Iccprofile(yycontext *yy); /* 41 */
YY_RULE(int) yy_Datetime(yycontext *yy); /* 40 */
YY_RULE(int) yy_ValueReference(yycontext *yy); /* 39 */
YY_RULE(int) yy_Dot(yycontext *yy); /* 38 */
YY_RULE(int) yy_OptDepends(yycontext *yy); /* 37 */
YY_RULE(int) yy_IfDepends(yycontext *yy); /* 36 */
YY_RULE(int) yy_Space(yycontext *yy); /* 35 */
YY_RULE(int) yy_TagReference(yycontext *yy); /* 34 */
YY_RULE(int) yy_Content(yycontext *yy); /* 33 */
YY_RULE(int) yy_Requirements(yycontext *yy); /* 32 */
YY_RULE(int) yy_Semicolon(yycontext *yy); /* 31 */
YY_RULE(int) yy_Tag(yycontext *yy); /* 30 */
YY_RULE(int) yy_Colon(yycontext *yy); /* 29 */
YY_RULE(int) yy_PrintableAscii(yycontext *yy); /* 28 */
YY_RULE(int) yy_RegEx(yycontext *yy); /* 27 */
YY_RULE(int) yy_NTupel(yycontext *yy); /* 26 */
YY_RULE(int) yy_Number(yycontext *yy); /* 25 */
YY_RULE(int) yy_Only(yycontext *yy); /* 24 */
YY_RULE(int) yy_Range(yycontext *yy); /* 23 */
YY_RULE(int) yy_Any(yycontext *yy); /* 22 */
YY_RULE(int) yy_LogicalOrListElement(yycontext *yy); /* 21 */
YY_RULE(int) yy_LogicalOrClose(yycontext *yy); /* 20 */
YY_RULE(int) yy_LogicalOrList(yycontext *yy); /* 19 */
YY_RULE(int) yy_LogicalOrOpen(yycontext *yy); /* 18 */
YY_RULE(int) yy_LogicalOr(yycontext *yy); /* 17 */
YY_RULE(int) yy_Mode(yycontext *yy); /* 16 */
YY_RULE(int) yy_Subpath(yycontext *yy); /* 15 */
YY_RULE(int) yy_SlashorBackslash(yycontext *yy); /* 14 */
YY_RULE(int) yy_ClosingBracket(yycontext *yy); /* 13 */
YY_RULE(int) yy_Path(yycontext *yy); /* 12 */
YY_RULE(int) yy_OpenBracket(yycontext *yy); /* 11 */
YY_RULE(int) yy_IncludeLine(yycontext *yy); /* 10 */
YY_RULE(int) yy_SpaceLine(yycontext *yy); /* 9 */
@ -323,6 +326,7 @@ YY_ACTION(void) yy_1_EndOfLine(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_EndOfLine\n"));
{
#line 0
incrlineno();;
}
#undef yythunkpos
@ -336,6 +340,7 @@ YY_ACTION(void) yy_1_RegEx(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_RegEx\n"));
{
#line 0
regex_push ( yytext ); ;
}
#undef yythunkpos
@ -349,6 +354,7 @@ YY_ACTION(void) yy_1_Only(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_Only\n"));
{
#line 0
;
}
#undef yythunkpos
@ -362,6 +368,7 @@ YY_ACTION(void) yy_6_ValueReference(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_6_ValueReference\n"));
{
#line 0
parser_state.any_reference = only_ref; ;
}
#undef yythunkpos
@ -375,6 +382,7 @@ YY_ACTION(void) yy_5_ValueReference(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_5_ValueReference\n"));
{
#line 0
parser_state.any_reference = ntupel_ref; ;
}
#undef yythunkpos
@ -388,6 +396,7 @@ YY_ACTION(void) yy_4_ValueReference(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_4_ValueReference\n"));
{
#line 0
parser_state.any_reference = range_ref; ;
}
#undef yythunkpos
@ -401,6 +410,7 @@ YY_ACTION(void) yy_3_ValueReference(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_3_ValueReference\n"));
{
#line 0
parser_state.any_reference = regex_ref; ;
}
#undef yythunkpos
@ -414,6 +424,7 @@ YY_ACTION(void) yy_2_ValueReference(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_2_ValueReference\n"));
{
#line 0
parser_state.any_reference = only_ref; i_push(atol(yytext) );;
}
#undef yythunkpos
@ -427,6 +438,7 @@ YY_ACTION(void) yy_1_ValueReference(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_ValueReference\n"));
{
#line 0
parser_state.any_reference = any_ref; ;
}
#undef yythunkpos
@ -440,6 +452,7 @@ YY_ACTION(void) yy_1_NTupel(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_NTupel\n"));
{
#line 0
int v=parser_state.valuelist; i_push(v); reset_valuelist(); ;
}
#undef yythunkpos
@ -453,6 +466,7 @@ YY_ACTION(void) yy_1_Value(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_Value\n"));
{
#line 0
incr_values(); ;
}
#undef yythunkpos
@ -466,6 +480,7 @@ YY_ACTION(void) yy_3_Number(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_3_Number\n"));
{
#line 0
i_push(atol(yytext) );;
}
#undef yythunkpos
@ -479,6 +494,7 @@ YY_ACTION(void) yy_2_Number(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_2_Number\n"));
{
#line 0
i_push(2<<atol(yytext) ); ;
}
#undef yythunkpos
@ -492,6 +508,7 @@ YY_ACTION(void) yy_1_Number(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_Number\n"));
{
#line 0
i_push(strtol(yytext, NULL, 0) ); ;
}
#undef yythunkpos
@ -505,6 +522,7 @@ YY_ACTION(void) yy_8_Content(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_8_Content\n"));
{
#line 0
v_push( iccprofile ); ;
}
#undef yythunkpos
@ -518,6 +536,7 @@ YY_ACTION(void) yy_7_Content(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_7_Content\n"));
{
#line 0
v_push( datetime ); ;
}
#undef yythunkpos
@ -531,6 +550,7 @@ YY_ACTION(void) yy_6_Content(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_6_Content\n"));
{
#line 0
v_push( printable_ascii ); ;
}
#undef yythunkpos
@ -544,6 +564,7 @@ YY_ACTION(void) yy_5_Content(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_5_Content\n"));
{
#line 0
v_push( regex ); ;
}
#undef yythunkpos
@ -557,6 +578,7 @@ YY_ACTION(void) yy_4_Content(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_4_Content\n"));
{
#line 0
v_push( ntupel ); reset_valuelist() ;
}
#undef yythunkpos
@ -570,6 +592,7 @@ YY_ACTION(void) yy_3_Content(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_3_Content\n"));
{
#line 0
v_push( only ); ;
}
#undef yythunkpos
@ -583,6 +606,7 @@ YY_ACTION(void) yy_2_Content(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_2_Content\n"));
{
#line 0
v_push( range); ;
}
#undef yythunkpos
@ -596,6 +620,7 @@ YY_ACTION(void) yy_1_Content(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_Content\n"));
{
#line 0
v_push( any ); ;
}
#undef yythunkpos
@ -609,6 +634,7 @@ YY_ACTION(void) yy_4_Requirements(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_4_Requirements\n"));
{
#line 0
set_optional(); ;
}
#undef yythunkpos
@ -622,6 +648,7 @@ YY_ACTION(void) yy_3_Requirements(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_3_Requirements\n"));
{
#line 0
set_optdepends(); ;
}
#undef yythunkpos
@ -635,6 +662,7 @@ YY_ACTION(void) yy_2_Requirements(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_2_Requirements\n"));
{
#line 0
set_ifdepends(); ;
}
#undef yythunkpos
@ -648,6 +676,7 @@ YY_ACTION(void) yy_1_Requirements(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_Requirements\n"));
{
#line 0
set_mandatory(); ;
}
#undef yythunkpos
@ -661,6 +690,7 @@ YY_ACTION(void) yy_1_TagReference(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_TagReference\n"));
{
#line 0
int tag = i_pop();
if (tag < 254) set_parse_error("wrong tagreference (should be >253)", yytext);
@ -679,6 +709,7 @@ YY_ACTION(void) yy_1_Tag(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_Tag\n"));
{
#line 0
int tag = i_pop();
/* rule_tagorder_in_dsl( tag ); */
@ -698,6 +729,7 @@ YY_ACTION(void) yy_2_TagLine(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_2_TagLine\n"));
{
#line 0
set_rule_logical_close(); ;
}
#undef yythunkpos
@ -711,6 +743,7 @@ YY_ACTION(void) yy_1_TagLine(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_TagLine\n"));
{
#line 0
rule_addtag_config(); ;
}
#undef yythunkpos
@ -724,6 +757,7 @@ YY_ACTION(void) yy_5_Mode(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_5_Mode\n"));
{
#line 0
i_push(mode_enable_deep_geotiff_checks); ;
}
#undef yythunkpos
@ -737,6 +771,7 @@ YY_ACTION(void) yy_4_Mode(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_4_Mode\n"));
{
#line 0
i_push(mode_enable_ifd_checks); ;
}
#undef yythunkpos
@ -750,6 +785,7 @@ YY_ACTION(void) yy_3_Mode(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_3_Mode\n"));
{
#line 0
i_push(mode_enable_offset_checks); ;
}
#undef yythunkpos
@ -763,6 +799,7 @@ YY_ACTION(void) yy_2_Mode(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_2_Mode\n"));
{
#line 0
i_push(mode_enable_type_checks); ;
}
#undef yythunkpos
@ -776,6 +813,7 @@ YY_ACTION(void) yy_1_Mode(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_Mode\n"));
{
#line 0
i_push(mode_baseline ); ;
}
#undef yythunkpos
@ -789,6 +827,7 @@ YY_ACTION(void) yy_7_LogicalOrListElement(yycontext *yy, char *yytext, int yylen
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_7_LogicalOrListElement\n"));
{
#line 0
v_push( printable_ascii ); incr_logical_elements();;
}
#undef yythunkpos
@ -802,6 +841,7 @@ YY_ACTION(void) yy_6_LogicalOrListElement(yycontext *yy, char *yytext, int yylen
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_6_LogicalOrListElement\n"));
{
#line 0
v_push( regex ); incr_logical_elements();;
}
#undef yythunkpos
@ -815,6 +855,7 @@ YY_ACTION(void) yy_5_LogicalOrListElement(yycontext *yy, char *yytext, int yylen
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_5_LogicalOrListElement\n"));
{
#line 0
v_push( ntupel); incr_logical_elements();;
}
#undef yythunkpos
@ -828,6 +869,7 @@ YY_ACTION(void) yy_4_LogicalOrListElement(yycontext *yy, char *yytext, int yylen
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_4_LogicalOrListElement\n"));
{
#line 0
v_push( only ); incr_logical_elements();;
}
#undef yythunkpos
@ -841,6 +883,7 @@ YY_ACTION(void) yy_3_LogicalOrListElement(yycontext *yy, char *yytext, int yylen
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_3_LogicalOrListElement\n"));
{
#line 0
v_push( only ); incr_logical_elements();;
}
#undef yythunkpos
@ -854,6 +897,7 @@ YY_ACTION(void) yy_2_LogicalOrListElement(yycontext *yy, char *yytext, int yylen
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_2_LogicalOrListElement\n"));
{
#line 0
v_push( range); incr_logical_elements();;
}
#undef yythunkpos
@ -867,6 +911,7 @@ YY_ACTION(void) yy_1_LogicalOrListElement(yycontext *yy, char *yytext, int yylen
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_LogicalOrListElement\n"));
{
#line 0
v_push( any ); incr_logical_elements();;
}
#undef yythunkpos
@ -880,6 +925,7 @@ YY_ACTION(void) yy_1_LogicalOrClose(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_LogicalOrClose\n"));
{
#line 0
;
}
#undef yythunkpos
@ -893,6 +939,7 @@ YY_ACTION(void) yy_1_LogicalOrOpen(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_LogicalOrOpen\n"));
{
#line 0
set_rule_logical_open();;
}
#undef yythunkpos
@ -906,6 +953,7 @@ YY_ACTION(void) yy_1_ModeLine(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_ModeLine\n"));
{
#line 0
int i = i_pop(); set_mode( i ); ;
}
#undef yythunkpos
@ -919,7 +967,8 @@ YY_ACTION(void) yy_1_IncludeLine(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_IncludeLine\n"));
{
set_include ( yytext ); ;
#line 0
set_include ( yytext ); ;
}
#undef yythunkpos
#undef yypos
@ -932,6 +981,7 @@ YY_ACTION(void) yy_1_CommentLine(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_CommentLine\n"));
{
#line 0
commentline(); ;
}
#undef yythunkpos
@ -945,6 +995,7 @@ YY_ACTION(void) yy_1_Line(yycontext *yy, char *yytext, int yyleng)
#define yythunkpos yy->__thunkpos
yyprintf((stderr, "do yy_1_Line\n"));
{
#line 0
fprintf(stderr, "grammar parser error at line %i (error at '%s')\n", parser_state.lineno, yytext); exit(EXIT_FAILURE); ;
}
#undef yythunkpos
@ -1397,185 +1448,244 @@ YY_RULE(int) yy_Mode(yycontext *yy)
yyprintf((stderr, " fail %s @ %s\n", "Mode", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_Subpath(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "Subpath"));
{ int yypos91= yy->__pos, yythunkpos91= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l92; goto l91;
l92:; yy->__pos= yypos91; yy->__thunkpos= yythunkpos91; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\000\000\000\000\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l93; goto l91;
l93:; yy->__pos= yypos91; yy->__thunkpos= yythunkpos91; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l94; goto l91;
l94:; yy->__pos= yypos91; yy->__thunkpos= yythunkpos91; if (!yymatchChar(yy, '.')) goto l95; goto l91;
l95:; yy->__pos= yypos91; yy->__thunkpos= yythunkpos91; if (!yymatchChar(yy, '_')) goto l96; goto l91;
l96:; yy->__pos= yypos91; yy->__thunkpos= yythunkpos91; if (!yymatchChar(yy, '-')) goto l90;
}
l91:;
yyprintf((stderr, " ok %s @ %s\n", "Subpath", yy->__buf+yy->__pos));
return 1;
l90:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "Subpath", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_SlashorBackslash(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "SlashorBackslash"));
{ int yypos98= yy->__pos, yythunkpos98= yy->__thunkpos; if (!yymatchChar(yy, '/')) goto l99; goto l98;
l99:; yy->__pos= yypos98; yy->__thunkpos= yythunkpos98; if (!yymatchChar(yy, '\\')) goto l97;
}
l98:;
yyprintf((stderr, " ok %s @ %s\n", "SlashorBackslash", yy->__buf+yy->__pos));
return 1;
l97:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "SlashorBackslash", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_ClosingBracket(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "ClosingBracket")); if (!yymatchChar(yy, ')')) goto l90;
yyprintf((stderr, "%s\n", "ClosingBracket")); if (!yymatchChar(yy, ')')) goto l100;
yyprintf((stderr, " ok %s @ %s\n", "ClosingBracket", yy->__buf+yy->__pos));
return 1;
l90:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l100:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "ClosingBracket", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_Path(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "Path")); if (!yy_SlashorBackslash(yy)) goto l101; if (!yy_Subpath(yy)) goto l101;
l104:;
{ int yypos105= yy->__pos, yythunkpos105= yy->__thunkpos; if (!yy_Subpath(yy)) goto l105; goto l104;
l105:; yy->__pos= yypos105; yy->__thunkpos= yythunkpos105;
}
l102:;
{ int yypos103= yy->__pos, yythunkpos103= yy->__thunkpos; if (!yy_SlashorBackslash(yy)) goto l103; if (!yy_Subpath(yy)) goto l103;
l106:;
{ int yypos107= yy->__pos, yythunkpos107= yy->__thunkpos; if (!yy_Subpath(yy)) goto l107; goto l106;
l107:; yy->__pos= yypos107; yy->__thunkpos= yythunkpos107;
} goto l102;
l103:; yy->__pos= yypos103; yy->__thunkpos= yythunkpos103;
}
yyprintf((stderr, " ok %s @ %s\n", "Path", yy->__buf+yy->__pos));
return 1;
l101:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "Path", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_OpenBracket(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "OpenBracket")); if (!yymatchChar(yy, '(')) goto l91;
yyprintf((stderr, "%s\n", "OpenBracket")); if (!yymatchChar(yy, '(')) goto l108;
yyprintf((stderr, " ok %s @ %s\n", "OpenBracket", yy->__buf+yy->__pos));
return 1;
l91:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l108:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "OpenBracket", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_IncludeLine(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "IncludeLine")); if (!yymatchString(yy, "include")) goto l92; if (!yy_OpenBracket(yy)) goto l92; yyText(yy, yy->__begin, yy->__end); {
yyprintf((stderr, "%s\n", "IncludeLine")); if (!yymatchString(yy, "include")) goto l109; if (!yy_OpenBracket(yy)) goto l109; yyText(yy, yy->__begin, yy->__end); {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l92;
if (!(YY_BEGIN)) goto l109;
#undef yytext
#undef yyleng
} if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\340\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l92;
l93:;
{ int yypos94= yy->__pos, yythunkpos94= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\340\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l94; goto l93;
l94:; yy->__pos= yypos94; yy->__thunkpos= yythunkpos94;
} yyText(yy, yy->__begin, yy->__end); {
} if (!yy_Path(yy)) goto l109; yyText(yy, yy->__begin, yy->__end); {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l92;
if (!(YY_END)) goto l109;
#undef yytext
#undef yyleng
} if (!yy_ClosingBracket(yy)) goto l92; yyDo(yy, yy_1_IncludeLine, yy->__begin, yy->__end);
} if (!yy_ClosingBracket(yy)) goto l109; yyDo(yy, yy_1_IncludeLine, yy->__begin, yy->__end);
yyprintf((stderr, " ok %s @ %s\n", "IncludeLine", yy->__buf+yy->__pos));
return 1;
l92:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l109:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "IncludeLine", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_SpaceLine(yycontext *yy)
{
yyprintf((stderr, "%s\n", "SpaceLine"));
l96:;
{ int yypos97= yy->__pos, yythunkpos97= yy->__thunkpos; if (!yy_Space(yy)) goto l97; goto l96;
l97:; yy->__pos= yypos97; yy->__thunkpos= yythunkpos97;
l111:;
{ int yypos112= yy->__pos, yythunkpos112= yy->__thunkpos; if (!yy_Space(yy)) goto l112; goto l111;
l112:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112;
}
yyprintf((stderr, " ok %s @ %s\n", "SpaceLine", yy->__buf+yy->__pos));
return 1;
}
YY_RULE(int) yy_CommentLine(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "CommentLine")); if (!yymatchChar(yy, '#')) goto l98;
l99:;
{ int yypos100= yy->__pos, yythunkpos100= yy->__thunkpos;
{ int yypos101= yy->__pos, yythunkpos101= yy->__thunkpos; if (!yy_EndOfLine(yy)) goto l101; goto l100;
l101:; yy->__pos= yypos101; yy->__thunkpos= yythunkpos101;
} if (!yymatchDot(yy)) goto l100; goto l99;
l100:; yy->__pos= yypos100; yy->__thunkpos= yythunkpos100;
yyprintf((stderr, "%s\n", "CommentLine")); if (!yymatchChar(yy, '#')) goto l113; yyText(yy, yy->__begin, yy->__end); {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l113;
#undef yytext
#undef yyleng
}
l114:;
{ int yypos115= yy->__pos, yythunkpos115= yy->__thunkpos;
{ int yypos116= yy->__pos, yythunkpos116= yy->__thunkpos; if (!yy_EndOfLine(yy)) goto l116; goto l115;
l116:; yy->__pos= yypos116; yy->__thunkpos= yythunkpos116;
} if (!yymatchDot(yy)) goto l115; goto l114;
l115:; yy->__pos= yypos115; yy->__thunkpos= yythunkpos115;
} yyText(yy, yy->__begin, yy->__end); {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l113;
#undef yytext
#undef yyleng
} yyDo(yy, yy_1_CommentLine, yy->__begin, yy->__end);
yyprintf((stderr, " ok %s @ %s\n", "CommentLine", yy->__buf+yy->__pos));
return 1;
l98:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l113:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "CommentLine", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_ModeLine(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "ModeLine")); if (!yymatchString(yy, "mode")) goto l102; if (!yy_OpenBracket(yy)) goto l102; yyText(yy, yy->__begin, yy->__end); {
yyprintf((stderr, "%s\n", "ModeLine")); if (!yymatchString(yy, "mode")) goto l117; if (!yy_OpenBracket(yy)) goto l117; yyText(yy, yy->__begin, yy->__end); {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l102;
if (!(YY_BEGIN)) goto l117;
#undef yytext
#undef yyleng
} if (!yy_Mode(yy)) goto l102; yyText(yy, yy->__begin, yy->__end); {
} if (!yy_Mode(yy)) goto l117; yyText(yy, yy->__begin, yy->__end); {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l102;
if (!(YY_END)) goto l117;
#undef yytext
#undef yyleng
} if (!yy_ClosingBracket(yy)) goto l102; yyDo(yy, yy_1_ModeLine, yy->__begin, yy->__end);
} if (!yy_ClosingBracket(yy)) goto l117; yyDo(yy, yy_1_ModeLine, yy->__begin, yy->__end);
yyprintf((stderr, " ok %s @ %s\n", "ModeLine", yy->__buf+yy->__pos));
return 1;
l102:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l117:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "ModeLine", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_TagLine(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "TagLine"));
{ int yypos104= yy->__pos, yythunkpos104= yy->__thunkpos; if (!yy_Tag(yy)) goto l105; if (!yy_Semicolon(yy)) goto l105; if (!yy_Requirements(yy)) goto l105; if (!yy_Semicolon(yy)) goto l105; if (!yy_Content(yy)) goto l105; yyDo(yy, yy_1_TagLine, yy->__begin, yy->__end); goto l104;
l105:; yy->__pos= yypos104; yy->__thunkpos= yythunkpos104; if (!yy_Tag(yy)) goto l103; if (!yy_Semicolon(yy)) goto l103; if (!yy_Requirements(yy)) goto l103; if (!yy_Semicolon(yy)) goto l103; if (!yy_LogicalOr(yy)) goto l103; yyDo(yy, yy_2_TagLine, yy->__begin, yy->__end);
{ int yypos119= yy->__pos, yythunkpos119= yy->__thunkpos; if (!yy_Tag(yy)) goto l120; if (!yy_Semicolon(yy)) goto l120; if (!yy_Requirements(yy)) goto l120; if (!yy_Semicolon(yy)) goto l120; if (!yy_Content(yy)) goto l120; yyDo(yy, yy_1_TagLine, yy->__begin, yy->__end); goto l119;
l120:; yy->__pos= yypos119; yy->__thunkpos= yythunkpos119; if (!yy_Tag(yy)) goto l118; if (!yy_Semicolon(yy)) goto l118; if (!yy_Requirements(yy)) goto l118; if (!yy_Semicolon(yy)) goto l118; if (!yy_LogicalOr(yy)) goto l118; yyDo(yy, yy_2_TagLine, yy->__begin, yy->__end);
}
l104:;
l119:;
yyprintf((stderr, " ok %s @ %s\n", "TagLine", yy->__buf+yy->__pos));
return 1;
l103:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l118:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "TagLine", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_EndOfLine(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "EndOfLine")); if (!yymatchClass(yy, (unsigned char *)"\000\044\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l106; yyDo(yy, yy_1_EndOfLine, yy->__begin, yy->__end);
yyprintf((stderr, "%s\n", "EndOfLine")); if (!yymatchClass(yy, (unsigned char *)"\000\044\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l121; yyDo(yy, yy_1_EndOfLine, yy->__begin, yy->__end);
yyprintf((stderr, " ok %s @ %s\n", "EndOfLine", yy->__buf+yy->__pos));
return 1;
l106:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l121:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "EndOfLine", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_LineType(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "LineType"));
{ int yypos108= yy->__pos, yythunkpos108= yy->__thunkpos; if (!yy_TagLine(yy)) goto l109; goto l108;
l109:; yy->__pos= yypos108; yy->__thunkpos= yythunkpos108; if (!yy_ModeLine(yy)) goto l110; goto l108;
l110:; yy->__pos= yypos108; yy->__thunkpos= yythunkpos108; if (!yy_CommentLine(yy)) goto l111; goto l108;
l111:; yy->__pos= yypos108; yy->__thunkpos= yythunkpos108; if (!yy_SpaceLine(yy)) goto l112; goto l108;
l112:; yy->__pos= yypos108; yy->__thunkpos= yythunkpos108; if (!yy_IncludeLine(yy)) goto l107;
{ int yypos123= yy->__pos, yythunkpos123= yy->__thunkpos; if (!yy_TagLine(yy)) goto l124; goto l123;
l124:; yy->__pos= yypos123; yy->__thunkpos= yythunkpos123; if (!yy_ModeLine(yy)) goto l125; goto l123;
l125:; yy->__pos= yypos123; yy->__thunkpos= yythunkpos123; if (!yy_CommentLine(yy)) goto l126; goto l123;
l126:; yy->__pos= yypos123; yy->__thunkpos= yythunkpos123; if (!yy_SpaceLine(yy)) goto l127; goto l123;
l127:; yy->__pos= yypos123; yy->__thunkpos= yythunkpos123; if (!yy_IncludeLine(yy)) goto l122;
}
l108:;
l123:;
yyprintf((stderr, " ok %s @ %s\n", "LineType", yy->__buf+yy->__pos));
return 1;
l107:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l122:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "LineType", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_EndOfFile(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "EndOfFile"));
{ int yypos114= yy->__pos, yythunkpos114= yy->__thunkpos; if (!yymatchDot(yy)) goto l114; goto l113;
l114:; yy->__pos= yypos114; yy->__thunkpos= yythunkpos114;
{ int yypos129= yy->__pos, yythunkpos129= yy->__thunkpos; if (!yymatchDot(yy)) goto l129; goto l128;
l129:; yy->__pos= yypos129; yy->__thunkpos= yythunkpos129;
}
yyprintf((stderr, " ok %s @ %s\n", "EndOfFile", yy->__buf+yy->__pos));
return 1;
l113:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l128:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "EndOfFile", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_Line(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "Line"));
{ int yypos116= yy->__pos, yythunkpos116= yy->__thunkpos; if (!yy_LineType(yy)) goto l117; if (!yy_EndOfLine(yy)) goto l117; goto l116;
l117:; yy->__pos= yypos116; yy->__thunkpos= yythunkpos116; yyText(yy, yy->__begin, yy->__end); {
{ int yypos131= yy->__pos, yythunkpos131= yy->__thunkpos; if (!yy_LineType(yy)) goto l132; if (!yy_EndOfLine(yy)) goto l132; goto l131;
l132:; yy->__pos= yypos131; yy->__thunkpos= yythunkpos131; yyText(yy, yy->__begin, yy->__end); {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_BEGIN)) goto l115;
if (!(YY_BEGIN)) goto l130;
#undef yytext
#undef yyleng
} if (!yymatchClass(yy, (unsigned char *)"\377\333\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l115;
l118:;
{ int yypos119= yy->__pos, yythunkpos119= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\377\333\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l119; goto l118;
l119:; yy->__pos= yypos119; yy->__thunkpos= yythunkpos119;
} if (!yymatchClass(yy, (unsigned char *)"\377\333\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l130;
l133:;
{ int yypos134= yy->__pos, yythunkpos134= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\377\333\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l134; goto l133;
l134:; yy->__pos= yypos134; yy->__thunkpos= yythunkpos134;
} yyText(yy, yy->__begin, yy->__end); {
#define yytext yy->__text
#define yyleng yy->__textlen
if (!(YY_END)) goto l115;
if (!(YY_END)) goto l130;
#undef yytext
#undef yyleng
} if (!yy_EndOfLine(yy)) goto l115; yyDo(yy, yy_1_Line, yy->__begin, yy->__end);
} if (!yy_EndOfLine(yy)) goto l130; yyDo(yy, yy_1_Line, yy->__begin, yy->__end);
}
l116:;
l131:;
yyprintf((stderr, " ok %s @ %s\n", "Line", yy->__buf+yy->__pos));
return 1;
l115:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l130:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "Line", yy->__buf+yy->__pos));
return 0;
}
YY_RULE(int) yy_start(yycontext *yy)
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
yyprintf((stderr, "%s\n", "start")); if (!yy_Line(yy)) goto l120;
l121:;
{ int yypos122= yy->__pos, yythunkpos122= yy->__thunkpos; if (!yy_Line(yy)) goto l122; goto l121;
l122:; yy->__pos= yypos122; yy->__thunkpos= yythunkpos122;
} if (!yy_EndOfFile(yy)) goto l120;
yyprintf((stderr, "%s\n", "start")); if (!yy_Line(yy)) goto l135;
l136:;
{ int yypos137= yy->__pos, yythunkpos137= yy->__thunkpos; if (!yy_Line(yy)) goto l137; goto l136;
l137:; yy->__pos= yypos137; yy->__thunkpos= yythunkpos137;
} if (!yy_EndOfFile(yy)) goto l135;
yyprintf((stderr, " ok %s @ %s\n", "start", yy->__buf+yy->__pos));
return 1;
l120:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
l135:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "start", yy->__buf+yy->__pos));
return 0;
}


+ 21
- 3
src/parser/config_dsl.grammar.peg View File

@ -14,8 +14,23 @@ LineType <- TagLine
/ CommentLine
/ SpaceLine
/ IncludeLine
CommentLine <- '#' ( !EndOfLine .)* { commentline(); }
IncludeLine <- 'include' OpenBracket < ( [A-Za-z0-9_./\-]+ ) > ClosingBracket { set_include ( yytext ); }
CommentLine <- '#' < ( !EndOfLine .)* > { commentline(); }
IncludeLine <- 'include' OpenBracket < Path > ClosingBracket { set_include ( yytext ); }
SlashorBackslash <- '/'
/ '\\'
Path <- ( SlashorBackslash (Subpath)+ )+
Subpath <- [A-Z]
/ [a-z]
/ [0-9]
/ '.'
/ '_'
/ '-'
ModeLine <- 'mode' OpenBracket < Mode > ClosingBracket { int i = i_pop(); set_mode( i ); }
LogicalOr <- 'logical_or' LogicalOrOpen LogicalOrList LogicalOrClose
@ -72,10 +87,13 @@ Content <- Any { v_push( any );
/ Datetime { v_push( datetime ); }
/ Iccprofile { v_push( iccprofile ); }
# / SBit { v_push( sbit ); }
Range <- 'range' OpenBracket Number Colon Number ClosingBracket
Number <- < '0x' ( [0-9a-f]+ ) > { i_push(strtol(yytext, NULL, 0) ); }
Number <- < '0x' [0-9a-f]+ > { i_push(strtol(yytext, NULL, 0) ); }
/ '2^' < ( Digit )+ > { i_push(2<<atol(yytext) ); }
/ < ( Digit )+ > { i_push(atol(yytext) );}
Colon <- ',' (Space )*
Dot <- '.' (Space )*
OpenBracket <- '('


Loading…
Cancel
Save