From aa4486219ad94fcdfb7e564f9cb8b31a85403c98 Mon Sep 17 00:00:00 2001 From: yhirose Date: Wed, 5 Aug 2015 23:35:36 -0400 Subject: [PATCH] Fixed problem with unit tests. --- language/culebra/culebra.h | 11 ++++++----- language/culebra/samples/test.cul | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/language/culebra/culebra.h b/language/culebra/culebra.h index 3b84e60..e5324ef 100644 --- a/language/culebra/culebra.h +++ b/language/culebra/culebra.h @@ -12,7 +12,7 @@ const auto grammar_ = R"( STATEMENT <- DEBUGGER / RETURN / EXPRESSION DEBUGGER <- debugger - RETURN <- return nl / return EXPRESSION? + RETURN <- return End _ / return EXPRESSION EXPRESSION <- ASSIGNMENT / LOGICAL_OR @@ -50,7 +50,7 @@ const auto grammar_ = R"( UNARY_NOT_OPERATOR <- < '!' > _ MULTIPLICATIVE_OPERATOR <- < [*/%] > _ - IDENTIFIER <- < [a-zA-Z_][a-zA-Z0-9_]* > _ + IDENTIFIER <- < IdentInitChar IdentChar* > _ OBJECT <- '{' _ (OBJECT_PROPERTY (',' _ OBJECT_PROPERTY)*)? '}' _ OBJECT_PROPERTY <- MUTABLE IDENTIFIER ':' _ EXPRESSION @@ -62,7 +62,7 @@ const auto grammar_ = R"( MUTABLE <- (< 'mut' > __)? ~debugger <- 'debugger' __ - ~return <- 'return' __ + ~return <- 'return' !IdentInitChar Space* ~while <- 'while' __ ~if <- 'if' __ ~else <- 'else' __ @@ -75,13 +75,14 @@ const auto grammar_ = R"( INTERPOLATED_CONTENT <- (!["{] .) (!["{] .)* ~_ <- (Space / End)* - __ <- ![a-zA-Z0-9_] (Space / End)* - ~nl <- Space* End _ + __ <- !IdentInitChar (Space / End)* ~Space <- ' ' / '\t' / Comment ~End <- EndOfLine / EndOfFile Comment <- '/*' (!'*/' .)* '*/' / ('#' / '//') (!End .)* &End EndOfLine <- '\r\n' / '\n' / '\r' EndOfFile <- !. + IdentInitChar <- [a-zA-Z_] + IdentChar <- [a-zA-Z0-9_] )"; diff --git a/language/culebra/samples/test.cul b/language/culebra/samples/test.cul index eee7314..516e795 100644 --- a/language/culebra/samples/test.cul +++ b/language/culebra/samples/test.cul @@ -205,4 +205,4 @@ test_sum() test_fib() test_interpolated_string() -return // end \ No newline at end of file +return // end