From 5ed1648d7afc24990ff5be1b0db9e46440b9efe7 Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Fri, 4 Sep 2015 15:21:42 +1000 Subject: [PATCH] Add token DELIM in grammatic. --- src/parser/grammatical.y | 3 ++- src/parser/lexical.l | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/parser/grammatical.y b/src/parser/grammatical.y index e4766ad..7e13372 100644 --- a/src/parser/grammatical.y +++ b/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 REAL %token 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: diff --git a/src/parser/lexical.l b/src/parser/lexical.l index fe85317..7ac72b4 100644 --- a/src/parser/lexical.l +++ b/src/parser/lexical.l @@ -56,8 +56,9 @@ include\(\".+\"\); {/* \) COUT(MOREDEBUG)<<" CBRACE()"; return CBRACE; \; COUT(MOREDEBUG)<<" ENDL()"<= COUT(MOREDEBUG)<<" ASSIGN()"; return ASSIGN; +, COUT(MOREDEBUG)<<" DELIM()"; return DELIM; ([a-zA-Z][a-zA-Z0-9_]*\.)*[a-zA-Z][a-zA-Z0-9_]* COUT(MOREDEBUG)<<" IDENTIFIER("<str=new std::string(yytext); return IDENTIFIER; -[ ,\n\t] +[ \n\t] \#.* \" BEGIN(PSTRING); str.erase(); . COUT(ERROR)<<"Unknown symbol "<filename<<" at line "<