Class: Token
- Defined in:
- lib/tecsgen/core/bnf.tab.rb,
lib/tecsflow/C_parser.tab.rb,
lib/tecsgen/core/bnf-deb.tab.rb
Instance Attribute Summary collapse
-
#col ⇒ Object
SEND, RECEIVE : string ( IDENTIFIER ).
-
#file ⇒ Object
SEND, RECEIVE : string ( IDENTIFIER ).
-
#lineno ⇒ Object
SEND, RECEIVE : string ( IDENTIFIER ).
-
#val ⇒ Object
SEND, RECEIVE : string ( IDENTIFIER ).
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #get_name ⇒ Object
-
#initialize(val, file, lineno, col) ⇒ Token
constructor
A new instance of Token.
- #locale ⇒ Object
- #scan(*arg, &block) ⇒ Object
- #set_parameter(parameter) ⇒ Object
- #show_tree(indent) ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(val, file, lineno, col) ⇒ Token
Returns a new instance of Token.
5099 5100 5101 5102 5103 5104 5105 |
# File 'lib/tecsgen/core/bnf.tab.rb', line 5099 def initialize(val, file, lineno, col) @val = val @file = file @lineno = lineno @col = col end |
Instance Attribute Details
#col ⇒ Object
SEND, RECEIVE : string ( IDENTIFIER )
2396 2397 2398 |
# File 'lib/tecsflow/C_parser.tab.rb', line 2396 def col @col end |
#file ⇒ Object
SEND, RECEIVE : string ( IDENTIFIER )
2396 2397 2398 |
# File 'lib/tecsflow/C_parser.tab.rb', line 2396 def file @file end |
#lineno ⇒ Object
SEND, RECEIVE : string ( IDENTIFIER )
2396 2397 2398 |
# File 'lib/tecsflow/C_parser.tab.rb', line 2396 def lineno @lineno end |
#val ⇒ Object
SEND, RECEIVE : string ( IDENTIFIER )
2396 2397 2398 |
# File 'lib/tecsflow/C_parser.tab.rb', line 2396 def val @val end |
Instance Method Details
#<=>(other) ⇒ Object
2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 |
# File 'lib/tecsflow/C_parser.tab.rb', line 2452 def <=>(other) if other.class == Token if @val.is_a? Integer @val <=> other.val elsif @val.is_a? Symbol @val.to_s <=> other.val.to_s else raise ArgumentError end else raise ArgumentError end end |
#eql?(other) ⇒ Boolean Also known as: ==
5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 |
# File 'lib/tecsgen/core/bnf.tab.rb', line 5123 def eql?(other) if other.is_a? Symbol @val == other elsif other.is_a? Token @val == other.val elsif other.is_a? String @val.to_s == other else raise ArgumentError end end |
#get_name ⇒ Object
5115 5116 5117 |
# File 'lib/tecsgen/core/bnf.tab.rb', line 5115 def get_name @val end |
#locale ⇒ Object
5119 5120 5121 |
# File 'lib/tecsgen/core/bnf.tab.rb', line 5119 def locale [@file, @lineno, @col] end |
#scan(*arg, &block) ⇒ Object
2422 2423 2424 |
# File 'lib/tecsflow/C_parser.tab.rb', line 2422 def scan(*arg, &block) val.to_s.scan(*arg, &block) end |
#set_parameter(parameter) ⇒ Object
2418 2419 2420 |
# File 'lib/tecsflow/C_parser.tab.rb', line 2418 def set_parameter( parameter ) @parameter = parameter end |
#show_tree(indent) ⇒ Object
5137 5138 5139 5140 |
# File 'lib/tecsgen/core/bnf.tab.rb', line 5137 def show_tree( indent ) indent.times { print " " } print "#{@val}\n" end |
#to_i ⇒ Object
2426 2427 2428 2429 2430 2431 2432 |
# File 'lib/tecsflow/C_parser.tab.rb', line 2426 def to_i if @val.is_a? Integer @val.to_i else raise TypeError end end |
#to_s ⇒ Object
5107 5108 5109 |
# File 'lib/tecsgen/core/bnf.tab.rb', line 5107 def to_s @val.to_s end |
#to_sym ⇒ Object
5111 5112 5113 |
# File 'lib/tecsgen/core/bnf.tab.rb', line 5111 def to_sym @val.to_sym end |