fix the spurious root expression and add conmound types back (thanks to kasper for fixing that)
This commit is contained in:
parent
a6ea45b203
commit
0b07e77782
@ -3,16 +3,16 @@ module Parser
|
||||
module CompoundTypes
|
||||
include Parslet
|
||||
|
||||
rule(:array) do
|
||||
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) >>
|
||||
(comma >> space? >> (operator_expression|value_expression).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) { left_brace >> ((hash_pair.as(:hash_pair) >>
|
||||
(comma >> space? >> hash_pair.as(:hash_pair)).repeat(0)).repeat(0,1)).as(:hash)>>
|
||||
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 }
|
||||
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ module Parser
|
||||
|
||||
class Crystal < Parslet::Parser
|
||||
include BasicTypes
|
||||
# include CompoundTypes
|
||||
include CompoundTypes
|
||||
include Tokens
|
||||
include Keywords
|
||||
include Control
|
||||
@ -29,6 +29,6 @@ module Parser
|
||||
include FunctionDefinition
|
||||
include Operators
|
||||
|
||||
rule(:root){ (function_definition | expression | operator_expression | call_site | space).repeat }
|
||||
rule(:root){ (function_definition | expression | call_site | space).repeat }
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user