Class: Parser::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/amy/parser/tokens.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value, lineno) ⇒ Token

Returns a new instance of Token.



13
14
15
16
17
# File 'lib/amy/parser/tokens.rb', line 13

def initialize(type, value, lineno)
  @type   = type
  @value  = value
  @lineno = lineno
end

Instance Attribute Details

#linenoObject

Returns the value of attribute lineno.



12
13
14
# File 'lib/amy/parser/tokens.rb', line 12

def lineno
  @lineno
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/amy/parser/tokens.rb', line 12

def type
  @type
end

#valueObject

Returns the value of attribute value.



12
13
14
# File 'lib/amy/parser/tokens.rb', line 12

def value
  @value
end

Instance Method Details

#is_a?(type) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/amy/parser/tokens.rb', line 34

def is_a?(type)
  @type == type
end

#is_c?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/amy/parser/tokens.rb', line 22

def is_c?
  Tokens::COMMENT == @type or Tokens::COMMENT_TAG == @type
end

#is_ct?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/amy/parser/tokens.rb', line 19

def is_ct?
  Tokens::COMMENT_TAG == @type
end

#is_p?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/amy/parser/tokens.rb', line 26

def is_p?
  Tokens::PROPERTY == @type
end

#is_s?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/amy/parser/tokens.rb', line 30

def is_s?
  Tokens::STRING == @type
end