Class: Syntax::Token

Inherits:
String
  • Object
show all
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

Instance Method Summary collapse

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

#groupObject (readonly)

the type of the lexeme that was extracted.



11
12
13
# File 'lib/syntax/common.rb', line 11

def group
  @group
end