Class: CodeTools::AST::PEGLiteral
- Defined in:
- lib/rubinius/code/ast/literals.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, str) ⇒ PEGLiteral
constructor
A new instance of PEGLiteral.
Methods inherited from Node
#ascii_graph, #attributes, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #to_sexp, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, str) ⇒ PEGLiteral
Returns a new instance of PEGLiteral.
356 357 358 359 |
# File 'lib/rubinius/code/ast/literals.rb', line 356 def initialize(line, str) @line = line @source = str end |
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
354 355 356 |
# File 'lib/rubinius/code/ast/literals.rb', line 354 def source @source end |
Instance Method Details
#bytecode(g) ⇒ Object
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/rubinius/code/ast/literals.rb', line 361 def bytecode(g) pos(g) build = g.new_label done = g.new_label g.push_tagged_nil 0 build.set! g.push_memo nil g.dup g.goto_if_not_nil done g.pop g.push_rubinius g.find_const :PEG g.push_literal @source g.send :compile, 1 g.goto build done.set! end |