Browse Source

Add token DELIM in grammatic.

test
Michael Uleysky 9 years ago
parent
commit
5ed1648d7a
  1. 3
      src/parser/grammatical.y
  2. 3
      src/parser/lexical.l

3
src/parser/grammatical.y

@ -37,7 +37,7 @@ inline void conferror(YYLTYPE *locp, yyscan_t sc, const char * str)
ObjectBase* ob;
}
%token ASSIGN OBRACE CBRACE ENDL
%token ASSIGN OBRACE CBRACE ENDL DELIM
%token <r> REAL
%token <b> BOOL
@ -113,6 +113,7 @@ object:
| expression {COUT(DEBUG)<<" expression\n"; $$=$1;}
| pair {COUT(DEBUG)<<" pair\n"; $$=$1;}
| OBRACE object CBRACE {COUT(DEBUG)<<" OBRACE object CBRACE\n"; $$=$2;}
| object DELIM {COUT(DEBUG)<<" OBJECT DELIM\n"; $$=$1;}
;
call:

3
src/parser/lexical.l

@ -56,8 +56,9 @@ include\(\".+\"\); {/*
<PARSE>\) COUT(MOREDEBUG)<<" CBRACE()"; return CBRACE;
<PARSE>\; COUT(MOREDEBUG)<<" ENDL()"<<std::endl; BEGIN(0); return ENDL;
<PARSE>= COUT(MOREDEBUG)<<" ASSIGN()"; return ASSIGN;
<PARSE>, COUT(MOREDEBUG)<<" DELIM()"; return DELIM;
<PARSE>([a-zA-Z][a-zA-Z0-9_]*\.)*[a-zA-Z][a-zA-Z0-9_]* COUT(MOREDEBUG)<<" IDENTIFIER("<<yytext<<")"; yylval_param->str=new std::string(yytext); return IDENTIFIER;
<PARSE,INITIAL>[ ,\n\t]
<PARSE,INITIAL>[ \n\t]
<PARSE,INITIAL>\#.*
<PARSE>\" BEGIN(PSTRING); str.erase();
<PARSE,INITIAL>. COUT(ERROR)<<"Unknown symbol "<<yytext<<" in file "<<yyextra->filename<<" at line "<<yylineno<<std::endl; yyterminate(); return -1;

Loading…
Cancel
Save