mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-12 22:42:23 +00:00
Enumerate all emitters
This commit is contained in:
parent
1bcd979cf6
commit
54e7b63c81
@ -77,7 +77,7 @@ module Tartrazine
|
|||||||
begin
|
begin
|
||||||
rule.pattern = /#{rule_node["pattern"]}/
|
rule.pattern = /#{rule_node["pattern"]}/
|
||||||
rescue ex : Exception
|
rescue ex : Exception
|
||||||
puts "Bad regex: #{rule_node["pattern"]}, #{ex}"
|
puts "Bad regex in #{l.config[:name]}: #{ex}"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# And rules that include a state
|
# And rules that include a state
|
||||||
@ -89,16 +89,14 @@ module Tartrazine
|
|||||||
|
|
||||||
# Rules contain maybe an emitter and maybe a transformer
|
# Rules contain maybe an emitter and maybe a transformer
|
||||||
# emitters emit tokens, transformers do things to
|
# emitters emit tokens, transformers do things to
|
||||||
# the state stack. The transformers go last, but
|
# the state stack.
|
||||||
# both kinds are optional 😭
|
|
||||||
|
|
||||||
rule_node.children.each do |node|
|
rule_node.children.each do |node|
|
||||||
next unless node.element?
|
next unless node.element?
|
||||||
case node.name
|
case node.name
|
||||||
when "pop", "push", "include", "multi", "combine"
|
when "pop", "push", "include", "multi", "combine"
|
||||||
p! "transformer", node.to_s
|
puts "transformer: #{node.to_s}"
|
||||||
else
|
when "bygroups", "combined", "mutators", "token", "using", "usingbygroup", "usingself"
|
||||||
p! "emitter", node.to_s
|
puts "emitter: #{node.to_s}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user