From 308c0efc0599cdccf2382e378e172f160b6fdf64 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Fri, 9 Oct 2015 12:42:50 +0300 Subject: [PATCH] rename value_expression to r_value --- lib/parser/basic_types.rb | 2 +- lib/parser/compound_types.rb | 6 +++--- lib/parser/control.rb | 8 ++++---- lib/parser/expression.rb | 2 +- lib/parser/operators.rb | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/parser/basic_types.rb b/lib/parser/basic_types.rb index acbf97f..f0d0c00 100644 --- a/lib/parser/basic_types.rb +++ b/lib/parser/basic_types.rb @@ -41,7 +41,7 @@ module Parser # TODO rule forbit names like if_true, because it starts with a keyword. a little looser please! rule(:name) { (keyword|type).absent? >> (match['a-z_'] >> match['a-zA-Z0-9_'].repeat).as(:name) >> space? } # fields have type - rule(:field) { type >> name >> (assign >> value_expression.as(:value) ).maybe} + rule(:field) { type >> name >> (assign >> r_value.as(:value) ).maybe} rule(:class_field) { keyword_field >> field } # and class/module names must start with capital rule(:class_name) { keyword.absent? >> (match['A-Z'] >> match['a-zA-Z0-9_'].repeat).as(:class_name) >> space? } diff --git a/lib/parser/compound_types.rb b/lib/parser/compound_types.rb index f5a6900..fb99789 100644 --- a/lib/parser/compound_types.rb +++ b/lib/parser/compound_types.rb @@ -5,12 +5,12 @@ module Parser rule(:array_constant) do left_bracket >> - ( ((operator_expression|value_expression).as(:array_element) >> space? >> - (comma >> space? >> (operator_expression|value_expression).as(:array_element)).repeat(0)).repeat(0,1)).as(:array_constant) >> + ( ((operator_expression|r_value).as(:array_element) >> space? >> + (comma >> space? >> (operator_expression|r_value).as(:array_element)).repeat(0)).repeat(0,1)).as(:array_constant) >> space? >> right_bracket end - rule(:hash_pair) { basic_type.as(:hash_key) >> association >> (operator_expression|value_expression).as(:hash_value) } + rule(:hash_pair) { basic_type.as(:hash_key) >> association >> (operator_expression|r_value).as(:hash_value) } rule(:hash_constant) { left_brace >> ((hash_pair.as(:hash_pair) >> (comma >> space? >> hash_pair.as(:hash_pair)).repeat(0)).repeat(0,1)).as(:hash_constant)>> space? >> right_brace } diff --git a/lib/parser/control.rb b/lib/parser/control.rb index 227ed98..d6938c4 100644 --- a/lib/parser/control.rb +++ b/lib/parser/control.rb @@ -3,22 +3,22 @@ module Parser include Parslet rule(:conditional) do keyword_if >> - left_parenthesis >> (operator_expression|value_expression).as(:conditional) >> right_parenthesis >> + left_parenthesis >> (operator_expression|r_value).as(:conditional) >> right_parenthesis >> expressions_else.as(:if_true) >> expressions_end.as(:if_false) end rule(:small_conditional) do keyword_if >> - left_parenthesis >> (operator_expression|value_expression).as(:conditional) >> right_parenthesis >> + left_parenthesis >> (operator_expression|r_value).as(:conditional) >> right_parenthesis >> expressions_end.as(:if_true) end rule(:while_do) do - keyword_while >> left_parenthesis >> (operator_expression|value_expression).as(:while_cond) >> + keyword_while >> left_parenthesis >> (operator_expression|r_value).as(:while_cond) >> right_parenthesis >> expressions_end.as(:body) end rule(:simple_return) do - keyword_return >> (operator_expression|value_expression).as(:return_expression) + keyword_return >> (operator_expression|r_value).as(:return_expression) end end end diff --git a/lib/parser/expression.rb b/lib/parser/expression.rb index 7185aa3..2ab0f48 100644 --- a/lib/parser/expression.rb +++ b/lib/parser/expression.rb @@ -2,7 +2,7 @@ module Parser module Expression include Parslet - rule(:value_expression) { call_site | field_access |basic_type } + rule(:r_value) { call_site | field_access |basic_type } rule(:expression) { (simple_return | while_do | small_conditional | conditional | operator_expression | call_site | class_field | field | diff --git a/lib/parser/operators.rb b/lib/parser/operators.rb index aa37bb4..cba65ff 100644 --- a/lib/parser/operators.rb +++ b/lib/parser/operators.rb @@ -23,7 +23,7 @@ module Parser #infix doing the heavy lifting here, # is defined as an expressions and array of [atoms,priority,binding] triples - rule(:operator_expression) do infix_expression(value_expression, + rule(:operator_expression) do infix_expression(r_value, [exponent, 120, :left] , [multiply, 120, :left] , [plus, 110, :left],