From cf8718b69cbf8edfa51286b69d14aafb1dcc5ff8 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 17 May 2021 22:40:23 -0400 Subject: [PATCH] Allow token definition with no pattern --- lib/imbecile/grammar.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/imbecile/grammar.rb b/lib/imbecile/grammar.rb index b71823e..2757e72 100644 --- a/lib/imbecile/grammar.rb +++ b/lib/imbecile/grammar.rb @@ -21,7 +21,7 @@ module Imbecile @modulename = $1 elsif line =~ /^\s*class\s+(\S+)$/ @classname = $1 - elsif line =~ /^\s*token\s+(\S+)\s+(.*)$/ + elsif line =~ /^\s*token\s+(\S+)(?:\s+(.*))?$/ name, expr = $1, $2 if expr == "" expr = name