Class: LexerToken
Overview
Forking lexers return LexerToken’s with the info about a matching token and the lexer to access for next tokens.
Instance Attribute Summary collapse
-
#lexeme ⇒ Object
readonly
Returns the value of attribute lexeme.
-
#lexer ⇒ Object
readonly
Returns the value of attribute lexer.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#token_type ⇒ Object
readonly
Returns the value of attribute token_type.
Instance Method Summary collapse
- #create_tree ⇒ Object
-
#initialize(lexeme, tokenType, lexer, position = nil) ⇒ LexerToken
constructor
A new instance of LexerToken.
- #inspect ⇒ Object
Constructor Details
#initialize(lexeme, tokenType, lexer, position = nil) ⇒ LexerToken
Returns a new instance of LexerToken.
213 214 215 216 |
# File 'lib/rpdf2txt-rockit/token.rb', line 213 def initialize(lexeme, tokenType, lexer, position = nil) @lexeme, @token_type, @lexer = lexeme, tokenType, lexer @position = position end |
Instance Attribute Details
#lexeme ⇒ Object (readonly)
Returns the value of attribute lexeme.
211 212 213 |
# File 'lib/rpdf2txt-rockit/token.rb', line 211 def lexeme @lexeme end |
#lexer ⇒ Object (readonly)
Returns the value of attribute lexer.
211 212 213 |
# File 'lib/rpdf2txt-rockit/token.rb', line 211 def lexer @lexer end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
211 212 213 |
# File 'lib/rpdf2txt-rockit/token.rb', line 211 def position @position end |
#token_type ⇒ Object (readonly)
Returns the value of attribute token_type.
211 212 213 |
# File 'lib/rpdf2txt-rockit/token.rb', line 211 def token_type @token_type end |
Instance Method Details
#create_tree ⇒ Object
218 219 220 |
# File 'lib/rpdf2txt-rockit/token.rb', line 218 def create_tree @token_type.create_tree(@lexeme, @position) end |
#inspect ⇒ Object
222 223 224 |
# File 'lib/rpdf2txt-rockit/token.rb', line 222 def inspect "LT(#{lexeme.inspect}, #{token_type.name})" end |