From 9c2dfe79da8306a2b8ee24a8b0f2f73cdc16bc07 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Thu, 8 May 2014 18:42:24 +0300 Subject: [PATCH] at least basic tests work again --- lib/parser/basic_types.rb | 8 ++++---- lib/parser/composed.rb | 6 +++--- test/parser/test_basic.rb | 4 +--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/parser/basic_types.rb b/lib/parser/basic_types.rb index 2e6e54da..8cc9d21c 100644 --- a/lib/parser/basic_types.rb +++ b/lib/parser/basic_types.rb @@ -19,13 +19,13 @@ module Parser rule(:plus) { str('+') } rule(:equal_sign) { str('=') >> space?} rule(:sign) { plus | minus } - rule(:dot) { str('.') } + rule(:dot) { str('.') } rule(:digit) { match('[0-9]') } rule(:exponent) { (str('e')| str('E')) } - rule(:true) { str('true').as(:true) >> space?} - rule(:false) { str('false').as(:false) >> space?} - rule(:nil) { str('null').as(:nil) >> space?} + rule(:true) { str('true').as(:true) >> space?} + rule(:false){ str('false').as(:false) >> space?} + rule(:nil) { str('null').as(:nil) >> space?} # identifier must start with lower case rule(:name) { (match['a-z'] >> match['a-zA-Z0-9'].repeat).as(:name) >> space? } diff --git a/lib/parser/composed.rb b/lib/parser/composed.rb index a715d076..d2ed39e3 100644 --- a/lib/parser/composed.rb +++ b/lib/parser/composed.rb @@ -26,11 +26,11 @@ module Parser rule(:function_call) { name.as(:function_call) >> argument_list } rule(:assignment) { name.as(:asignee) >> equal_sign >> expression.as(:asigned) } - - rule(:expression) { conditional | function_call | integer | string | (name >> space? >> equal_sign.absent?) } + #| (name >> space? >> equal_sign.absent?) + rule(:expression) { conditional | function_call | integer | string } def delimited_expressions( delimit ) - ( space? >> (delimit.absent? >> (assignment | expression)).repeat(1)).as(:expressions) >> delimit + ( (delimit.absent? >> (assignment | expression)).repeat(1)).as(:expressions) >> delimit end rule(:conditional) { diff --git a/test/parser/test_basic.rb b/test/parser/test_basic.rb index b0401706..a178ecd5 100644 --- a/test/parser/test_basic.rb +++ b/test/parser/test_basic.rb @@ -26,9 +26,7 @@ class TestBasic < MiniTest::Test end def test_string - @string_input = <"hello"} @transform_output = Ast::StringExpression.new('hello') @parser = @parser.string