Class: Scanner::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/scanner/token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, content, line, column) ⇒ Token

Returns a new instance of Token.



5
6
7
8
9
10
# File 'lib/scanner/token.rb', line 5

def initialize(symbol, content, line, column)
  @symbol = symbol
  @content = content
  @line = line
  @column = column
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



3
4
5
# File 'lib/scanner/token.rb', line 3

def column
  @column
end

#contentObject (readonly)

Returns the value of attribute content.



3
4
5
# File 'lib/scanner/token.rb', line 3

def content
  @content
end

#lineObject (readonly)

Returns the value of attribute line.



3
4
5
# File 'lib/scanner/token.rb', line 3

def line
  @line
end

#symbolObject (readonly)

Returns the value of attribute symbol.



3
4
5
# File 'lib/scanner/token.rb', line 3

def symbol
  @symbol
end

Instance Method Details

#is?(symbol) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/scanner/token.rb', line 12

def is?(symbol)
  @symbol == symbol
end

#is_not?(symbol) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/scanner/token.rb', line 16

def is_not?(symbol)
  not is? symbol
end