restrict the root, but expand for testing
This commit is contained in:
parent
486e24514b
commit
77cb8ce90a
@ -31,8 +31,7 @@ module Parser
|
|||||||
include Operators
|
include Operators
|
||||||
include ModuleDef
|
include ModuleDef
|
||||||
|
|
||||||
rule(:root_body) {( class_definition | function_definition |
|
rule(:root_body) {( class_definition | function_definition )}
|
||||||
expression | operator_expression | call_site )}
|
|
||||||
rule(:root) { root_body.repeat.as(:expression_list) }
|
rule(:root) { root_body.repeat.as(:expression_list) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,3 +17,10 @@ require 'salama-reader'
|
|||||||
|
|
||||||
require "minitest"
|
require "minitest"
|
||||||
require "minitest/autorun"
|
require "minitest/autorun"
|
||||||
|
|
||||||
|
# for testing add expression as allowed root
|
||||||
|
# bit of a hack: the directory name should be passed as the root if the parse fails
|
||||||
|
# but moving on (and coming back)
|
||||||
|
Parser::Salama.class_eval do
|
||||||
|
rule(:root_body) {( class_definition | function_definition | expression )}
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user