Class: Token
- Inherits:
-
Object
- Object
- Token
- Defined in:
- lib/xmk/token.rb
Constant Summary collapse
- VAR =
variable
0- SET =
set var =
1- ADD =
append var +=
2- TAR =
target
3- WS =
whitespace
4- CMD =
commang
5- LAB =
label
6- VAL =
value
7- PLAT =
platform
8- TARLINK =
platform-target link
9- LBR =
linebreak
10- EOF =
9999
Instance Attribute Summary collapse
-
#lexeme ⇒ Object
readonly
Returns the value of attribute lexeme.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#literal ⇒ Object
readonly
Returns the value of attribute literal.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, lexeme, line) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(type, lexeme, line) ⇒ Token
Returns a new instance of Token.
19 20 21 22 23 |
# File 'lib/xmk/token.rb', line 19 def initialize(type, lexeme, line) @type = type @lexeme = lexeme @line = line end |
Instance Attribute Details
#lexeme ⇒ Object (readonly)
Returns the value of attribute lexeme.
2 3 4 |
# File 'lib/xmk/token.rb', line 2 def lexeme @lexeme end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
2 3 4 |
# File 'lib/xmk/token.rb', line 2 def line @line end |
#literal ⇒ Object (readonly)
Returns the value of attribute literal.
2 3 4 |
# File 'lib/xmk/token.rb', line 2 def literal @literal end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/xmk/token.rb', line 2 def type @type end |
Instance Method Details
#to_s ⇒ Object
25 26 27 |
# File 'lib/xmk/token.rb', line 25 def to_s "#{@type} #{@lexeme} #{@line}" end |