Add Lexer class; Move LexerDFA to Lexer::DFA
This commit is contained in:
1 parent
28591907c1
commit
9459883e74
6 files changed
+99
-91
No files matched your search
@@ -51,12 +51,12 @@ end
|
||||
|
||||
def run(grammar, input)
|
||||
g = Imbecile::Grammar.new(grammar)
|
||||
token_dfa = Imbecile::LexerDFA.new(g.tokens)
|
||||
token_dfa = Imbecile::Lexer::DFA.new(g.tokens)
|
||||
test_lexer = TestLexer.new(token_dfa)
|
||||
test_lexer.lex(input)
|
||||
end
|
||||
|
||||
describe Imbecile::LexerDFA do
|
||||
describe Imbecile::Lexer::DFA do
|
||||
it "lexes a simple token" do
|
||||
expect(run(<<EOF, "foo")).to eq [["foo", "foo"]]
|
||||
token foo
|
||||
Reference in new issue
Block a user