From e133f8bd608ec3d0174f058d2cf97eb3af8178b0 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Sat, 8 Jul 2023 21:40:23 +0900 Subject: [PATCH] Move Lrama::Union to Lrama::Grammar::Union --- lib/lrama.rb | 1 - lib/lrama/grammar.rb | 2 ++ lib/lrama/grammar/union.rb | 10 ++++++++++ lib/lrama/union.rb | 8 -------- 4 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 lib/lrama/grammar/union.rb delete mode 100644 lib/lrama/union.rb diff --git a/lib/lrama.rb b/lib/lrama.rb index ab8a034a..87824c8b 100644 --- a/lib/lrama.rb +++ b/lib/lrama.rb @@ -17,6 +17,5 @@ require "lrama/states" require "lrama/states_reporter" require "lrama/symbol" -require "lrama/union" require "lrama/version" require "lrama/warning" diff --git a/lib/lrama/grammar.rb b/lib/lrama/grammar.rb index c7d88987..04abc8ae 100644 --- a/lib/lrama/grammar.rb +++ b/lib/lrama/grammar.rb @@ -1,4 +1,6 @@ +require "lrama/grammar/union" require "lrama/lexer" + module Lrama Type = Struct.new(:id, :tag, keyword_init: true) Token = Lrama::Lexer::Token diff --git a/lib/lrama/grammar/union.rb b/lib/lrama/grammar/union.rb new file mode 100644 index 00000000..978cebf2 --- /dev/null +++ b/lib/lrama/grammar/union.rb @@ -0,0 +1,10 @@ +module Lrama + class Grammar + class Union < Struct.new(:code, :lineno, keyword_init: true) + def braces_less_code + # Remove braces + code.s_value[1..-2] + end + end + end +end diff --git a/lib/lrama/union.rb b/lib/lrama/union.rb deleted file mode 100644 index 6d8b01a6..00000000 --- a/lib/lrama/union.rb +++ /dev/null @@ -1,8 +0,0 @@ -module Lrama - class Union < Struct.new(:code, :lineno, keyword_init: true) - def braces_less_code - # Remove braces - code.s_value[1..-2] - end - end -end