Class: StructuredSearch::Token
- Inherits:
-
Object
- Object
- StructuredSearch::Token
- Defined in:
- lib/structured_search/token.rb
Overview
A token generated by the lexer
Instance Attribute Summary collapse
-
#column ⇒ Object
token- The token’s type
lexeme - The matched characters that make up the token
column - Column this token was located
line -
Line this token was located.
- Column this token was located
- The matched characters that make up the token
- The token’s type
-
#lexeme ⇒ Object
token- The token’s type
lexeme - The matched characters that make up the token
column - Column this token was located
line -
Line this token was located.
- Column this token was located
- The matched characters that make up the token
- The token’s type
-
#line ⇒ Object
token- The token’s type
lexeme - The matched characters that make up the token
column - Column this token was located
line -
Line this token was located.
- Column this token was located
- The matched characters that make up the token
- The token’s type
-
#token ⇒ Object
token- The token’s type
lexeme - The matched characters that make up the token
column - Column this token was located
line -
Line this token was located.
- Column this token was located
- The matched characters that make up the token
- The token’s type
Instance Method Summary collapse
-
#initialize(tok = {}) ⇒ Token
constructor
:nodoc:.
-
#to_s ⇒ Object
Returns a string representation of the token.
Constructor Details
#initialize(tok = {}) ⇒ Token
:nodoc:
13 14 15 16 17 18 |
# File 'lib/structured_search/token.rb', line 13 def initialize(tok = {}) #send val to key setter tok.each do |k, v| send "#{k}=", v end end |
Instance Attribute Details
#column ⇒ Object
token-
The token’s type
lexeme-
The matched characters that make up the token
column-
Column this token was located
line-
Line this token was located
10 11 12 |
# File 'lib/structured_search/token.rb', line 10 def column @column end |
#lexeme ⇒ Object
token-
The token’s type
lexeme-
The matched characters that make up the token
column-
Column this token was located
line-
Line this token was located
10 11 12 |
# File 'lib/structured_search/token.rb', line 10 def lexeme @lexeme end |
#line ⇒ Object
token-
The token’s type
lexeme-
The matched characters that make up the token
column-
Column this token was located
line-
Line this token was located
10 11 12 |
# File 'lib/structured_search/token.rb', line 10 def line @line end |
#token ⇒ Object
token-
The token’s type
lexeme-
The matched characters that make up the token
column-
Column this token was located
line-
Line this token was located
10 11 12 |
# File 'lib/structured_search/token.rb', line 10 def token @token end |
Instance Method Details
#to_s ⇒ Object
Returns a string representation of the token
21 22 23 |
# File 'lib/structured_search/token.rb', line 21 def to_s "#{@token}: '#{@lexeme}' (Line #{@line}, Column #{@column})" end |