Skip to content

Commit

Permalink
Move Type under Grammar
Browse files Browse the repository at this point in the history
Because `Type` is mainly used inside `Grammar`.
  • Loading branch information
yui-knk committed Nov 26, 2023
1 parent a49ab82 commit b2d9feb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/lrama.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
require "lrama/state"
require "lrama/states"
require "lrama/states_reporter"
require "lrama/type"
require "lrama/version"
require "lrama/warning"
2 changes: 1 addition & 1 deletion lib/lrama/grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
require "lrama/grammar/rule"
require "lrama/grammar/rule_builder"
require "lrama/grammar/symbol"
require "lrama/grammar/type"
require "lrama/grammar/union"
require "lrama/lexer"
require "lrama/type"

module Lrama
# Grammar is the result of parsing an input grammar file
Expand Down
6 changes: 6 additions & 0 deletions lib/lrama/grammar/type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Lrama
class Grammar
class Type < Struct.new(:id, :tag, keyword_init: true)
end
end
end
4 changes: 0 additions & 4 deletions lib/lrama/type.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/lrama/parser_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RSpec.describe Lrama::Parser do
T ||= Lrama::Lexer::Token
Type = Lrama::Type
Type = Lrama::Grammar::Type
Sym = Lrama::Grammar::Symbol
Precedence = Lrama::Grammar::Precedence
Rule = Lrama::Grammar::Rule
Expand Down

0 comments on commit b2d9feb

Please sign in to comment.