Class: LXL::Lexer
- Inherits:
-
Object
- Object
- LXL::Lexer
- Defined in:
- lib/lxl.rb
Overview
Based on John Carter’s LittleLexer (littlelexer.rubyforge.org).
Defined Under Namespace
Classes: LexerJammed
Instance Method Summary collapse
-
#initialize(re_to_chr) ⇒ Lexer
constructor
A new instance of Lexer.
- #scan(string) ⇒ Object
Constructor Details
#initialize(re_to_chr) ⇒ Lexer
Returns a new instance of Lexer.
630 631 632 |
# File 'lib/lxl.rb', line 630 def initialize(re_to_chr) @re_to_chr = re_to_chr end |
Instance Method Details
#scan(string) ⇒ Object
634 635 636 637 638 639 640 641 |
# File 'lib/lxl.rb', line 634 def scan(string) types,tokens = [],[] next_token(string) do |type,token| types << type tokens << token end [types,tokens] end |