From 54e7b63c81d986908706e06d9fdcba35f212a303 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Sat, 3 Aug 2024 05:13:34 -0300 Subject: [PATCH] Enumerate all emitters --- src/tartrazine.cr | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/tartrazine.cr b/src/tartrazine.cr index 4fdf5e6..45d5fc5 100644 --- a/src/tartrazine.cr +++ b/src/tartrazine.cr @@ -77,7 +77,7 @@ module Tartrazine begin rule.pattern = /#{rule_node["pattern"]}/ rescue ex : Exception - puts "Bad regex: #{rule_node["pattern"]}, #{ex}" + puts "Bad regex in #{l.config[:name]}: #{ex}" end else # And rules that include a state @@ -89,16 +89,14 @@ module Tartrazine # Rules contain maybe an emitter and maybe a transformer # emitters emit tokens, transformers do things to - # the state stack. The transformers go last, but - # both kinds are optional 😭 - + # the state stack. rule_node.children.each do |node| next unless node.element? case node.name when "pop", "push", "include", "multi", "combine" - p! "transformer", node.to_s - else - p! "emitter", node.to_s + puts "transformer: #{node.to_s}" + when "bygroups", "combined", "mutators", "token", "using", "usingbygroup", "usingself" + puts "emitter: #{node.to_s}" end end end