Rename TokenDFA -> LexerDFA
This commit is contained in:
parent
aa92970c31
commit
c6bac6d3a1
@ -10,7 +10,7 @@ require_relative "imbecile/regex/fa/state"
|
|||||||
require_relative "imbecile/regex/fa/state/transition"
|
require_relative "imbecile/regex/fa/state/transition"
|
||||||
require_relative "imbecile/regex/nfa"
|
require_relative "imbecile/regex/nfa"
|
||||||
require_relative "imbecile/regex/unit"
|
require_relative "imbecile/regex/unit"
|
||||||
require_relative "imbecile/token_dfa"
|
require_relative "imbecile/lexer_dfa"
|
||||||
require_relative "imbecile/version"
|
require_relative "imbecile/version"
|
||||||
|
|
||||||
module Imbecile
|
module Imbecile
|
||||||
@ -27,8 +27,8 @@ module Imbecile
|
|||||||
grammar.tokens.each do |token|
|
grammar.tokens.each do |token|
|
||||||
puts token.nfa
|
puts token.nfa
|
||||||
end
|
end
|
||||||
token_dfa = TokenDFA.new(grammar.tokens)
|
lexer_dfa = LexerDFA.new(grammar.tokens)
|
||||||
puts token_dfa
|
puts lexer_dfa
|
||||||
rescue Error => e
|
rescue Error => e
|
||||||
$stderr.puts e.message
|
$stderr.puts e.message
|
||||||
return 2
|
return 2
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Imbecile
|
module Imbecile
|
||||||
|
|
||||||
class TokenDFA < Regex::FA
|
class LexerDFA < Regex::FA
|
||||||
|
|
||||||
def initialize(tokens)
|
def initialize(tokens)
|
||||||
super()
|
super()
|
@ -51,7 +51,7 @@ end
|
|||||||
|
|
||||||
def run(grammar, input)
|
def run(grammar, input)
|
||||||
g = Imbecile::Grammar.new(grammar)
|
g = Imbecile::Grammar.new(grammar)
|
||||||
token_dfa = Imbecile::TokenDFA.new(g.tokens)
|
token_dfa = Imbecile::LexerDFA.new(g.tokens)
|
||||||
test_lexer = TestLexer.new(token_dfa)
|
test_lexer = TestLexer.new(token_dfa)
|
||||||
test_lexer.lex(input)
|
test_lexer.lex(input)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user