Change rule syntax
This commit is contained in:
parent
c0c3353fd7
commit
2685c05360
@ -49,7 +49,7 @@ module Imbecile
|
||||
elsif input.slice!(/\Adrop\s+(\S+)\n/)
|
||||
pattern = $1
|
||||
@tokens << Token.new(nil, pattern, @tokens.size)
|
||||
elsif input.slice!(/\Arule\s+(\S+)\s+\[(.*?)\] <<\n(.*?)^>>\n/m)
|
||||
elsif input.slice!(/\A(\S+)\s*:\s*\[(.*?)\] <<\n(.*?)^>>\n/m)
|
||||
rule_name, rule, code = $1, $2, $3
|
||||
@rules << Rule.new(rule_name, rule, code)
|
||||
else
|
||||
|
@ -31,7 +31,7 @@ token int \\d+
|
||||
token plus \\+
|
||||
token times \\*
|
||||
drop \\s+
|
||||
rule Start [] <<
|
||||
Start: [] <<
|
||||
>>
|
||||
EOF
|
||||
build_parser
|
||||
|
Loading…
x
Reference in New Issue
Block a user