small renames
This commit is contained in:
parent
ff612446be
commit
72de0089b2
@ -1,12 +1,12 @@
|
|||||||
module Parser
|
module Parser
|
||||||
# Compound types are Arrays and Hashes
|
# Compound types are Arrays and Hashes
|
||||||
module CompundTypes
|
module CompoundTypes
|
||||||
include Parslet
|
include Parslet
|
||||||
|
|
||||||
rule(:array) do
|
rule(:array) do
|
||||||
left_bracket >>
|
left_bracket >>
|
||||||
( ((operator_expression|value_expression).as(:element) >> space? >>
|
( ((operator_expression|value_expression).as(:array_element) >> space? >>
|
||||||
(comma >> space? >> (operator_expression|value_expression).as(:element)).repeat(0)).repeat(0,1)).as(:array) >>
|
(comma >> space? >> (operator_expression|value_expression).as(:array_element)).repeat(0)).repeat(0,1)).as(:array) >>
|
||||||
space? >> right_bracket
|
space? >> right_bracket
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ module Parser
|
|||||||
|
|
||||||
class Crystal < Parslet::Parser
|
class Crystal < Parslet::Parser
|
||||||
include BasicTypes
|
include BasicTypes
|
||||||
include CompundTypes
|
include CompoundTypes
|
||||||
include Tokens
|
include Tokens
|
||||||
include Keywords
|
include Keywords
|
||||||
include Control
|
include Control
|
||||||
|
@ -11,7 +11,7 @@ module Parser
|
|||||||
rule(:name => simple(:name)) { Ast::NameExpression.new(name.to_s) }
|
rule(:name => simple(:name)) { Ast::NameExpression.new(name.to_s) }
|
||||||
|
|
||||||
rule(:array => sequence(:array) ) { Ast::ArrayExpression.new(array) }
|
rule(:array => sequence(:array) ) { Ast::ArrayExpression.new(array) }
|
||||||
rule(:element => simple(:element)) { element }
|
rule(:array_element => simple(:array_element)) { array_element }
|
||||||
rule(:hash => sequence(:hash) ) { Ast::HashExpression.new(hash) }
|
rule(:hash => sequence(:hash) ) { Ast::HashExpression.new(hash) }
|
||||||
rule(:hash_key => simple(:hash_key) , :hash_value => simple(:hash_value)) { Ast::AssociationExpression.new(hash_key,hash_value) }
|
rule(:hash_key => simple(:hash_key) , :hash_value => simple(:hash_value)) { Ast::AssociationExpression.new(hash_key,hash_value) }
|
||||||
rule(:hash_pair => simple(:hash_pair) ) { hash_pair }
|
rule(:hash_pair => simple(:hash_pair) ) { hash_pair }
|
||||||
|
Loading…
Reference in New Issue
Block a user