add instance variables and module name as basic types (as name was there already) and add tests
This commit is contained in:
@ -28,7 +28,7 @@ module Parser
|
||||
# TODO rule forbit names like if_true, because it starts with a keyword. a little looser please!
|
||||
rule(:name) { keyword.absent? >> (match['a-z_'] >> match['a-zA-Z0-9_'].repeat).as(:name) >> space? }
|
||||
# instance variables must have the @
|
||||
rule(:instance_variable) { (match('@') >> name).as(:instance_variable) }
|
||||
rule(:instance_variable) { (str('@') >> name).as(:instance_variable) }
|
||||
# and class/module names must start with capital
|
||||
# (admittatly the rule matches constants too, but one step at a time)
|
||||
rule(:module_name) { keyword.absent? >> (match['A-Z'] >> match['a-zA-Z0-9_'].repeat).as(:module_name) >> space? }
|
||||
@ -43,6 +43,6 @@ module Parser
|
||||
|
||||
rule(:float) { integer >> dot >> integer >>
|
||||
(exponent >> sign.maybe >> digit.repeat(1,3)).maybe >> space?}
|
||||
rule(:basic_type){ integer | name | string | float }
|
||||
rule(:basic_type){ integer | name | string | float | instance_variable | module_name }
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user