Class: Syntax::Token
- Inherits:
-
String
- Object
- String
- Syntax::Token
- Defined in:
- lib/syntax/common.rb
Overview
A single token extracted by a tokenizer. It is simply the lexeme itself, decorated with a ‘group’ attribute to identify the type of the lexeme.
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
the type of the lexeme that was extracted.
Instance Method Summary collapse
-
#initialize(text, group) ⇒ Token
constructor
Create a new Token representing the given text, and belonging to the given group.
Constructor Details
#initialize(text, group) ⇒ Token
Create a new Token representing the given text, and belonging to the given group.
15 16 17 18 |
# File 'lib/syntax/common.rb', line 15 def initialize( text, group ) super text @group = group end |
Instance Attribute Details
#group ⇒ Object (readonly)
the type of the lexeme that was extracted.
11 12 13 |
# File 'lib/syntax/common.rb', line 11 def group @group end |