Browse Source

- fixed peg to handle include correctly

development
Andreas Romeyke 2 years ago
parent
commit
2220d1775e
3 changed files with 276 additions and 313 deletions
  1. +270
    -309
      src/parser/config_dsl.grammar.c
  2. +5
    -3
      src/parser/config_dsl.grammar.peg
  3. +1
    -1
      src/parser/config_parser.c

+ 270
- 309
src/parser/config_dsl.grammar.c
File diff suppressed because it is too large
View File


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

@ -8,11 +8,12 @@
#
start <- ( Line )+ EndOfFile
Line <- LineType EndOfLine
/ < [^\r\n]+ > EndOfLine {fprintf(stderr, "grammar parser error at line %i (error at '%s')\n", parser_state.lineno, yytext); exit(EXIT_FAILURE); }
# / < [^\r\n]+ > EndOfLine {fprintf(stderr, "grammar parser error at line %i (error at '%s')\n", parser_state.lineno, yytext); exit(EXIT_FAILURE); }
LineType <- TagLine
/ ModeLine
/ CommentLine
/ IncludeLine
/ CommentLine
/ SpaceLine
CommentLine <- '#' < ( !EndOfLine .)* > { commentline(); }
IncludeLine <- 'include' OpenBracket < Path > ClosingBracket { set_include ( yytext ); }
@ -20,7 +21,7 @@ IncludeLine <- 'include' OpenBracket < Path > ClosingBracket { set_include
SlashorBackslash <- '/'
/ '\\'
Path <- ( SlashorBackslash (Subpath)+ )+
Path <- ( Subpath )+
Subpath <- [A-Z]
/ [a-z]
@ -28,6 +29,7 @@ Subpath <- [A-Z]
/ '.'
/ '_'
/ '-'
/ SlashorBackslash
ModeLine <- 'mode' OpenBracket < Mode > ClosingBracket { int i = i_pop(); set_mode( i ); }


+ 1
- 1
src/parser/config_parser.c View File

@ -1156,7 +1156,7 @@ void set_include( const char * include_file ) {
exit (EXIT_FAILURE);
}
parser_state.includedepth++;
printf("Include=%s\n", include_file);
printf("Include='%s'\n", include_file);
FILE * cfg = fopen(include_file, "r");
if (NULL == cfg) {
fprintf( stderr, "file '%s' could not be opened\n", include_file);


Loading…
Cancel
Save