Class: CodeTools::AST::RegexLiteral
- Defined in:
- lib/rubinius/code/ast/literals.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#source ⇒ Object
Returns the value of attribute source.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
- #defined(g) ⇒ Object
-
#initialize(line, str, flags) ⇒ RegexLiteral
constructor
A new instance of RegexLiteral.
- #to_sexp ⇒ Object
Methods inherited from Node
#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, str, flags) ⇒ RegexLiteral
Returns a new instance of RegexLiteral.
387 388 389 390 391 |
# File 'lib/rubinius/code/ast/literals.rb', line 387 def initialize(line, str, flags) @line = line @source = str @options = flags end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
385 386 387 |
# File 'lib/rubinius/code/ast/literals.rb', line 385 def @options end |
#source ⇒ Object
Returns the value of attribute source.
385 386 387 |
# File 'lib/rubinius/code/ast/literals.rb', line 385 def source @source end |
Instance Method Details
#bytecode(g) ⇒ Object
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/rubinius/code/ast/literals.rb', line 393 def bytecode(g) pos(g) build = g.new_label done = g.new_label g.push_nil build.set! g.push_memo nil g.dup g.goto_if_not_nil done g.pop g.push_cpath_top g.find_const :Regexp g.push_literal @source g.push_int @options g.send :new, 2 g.goto build done.set! end |
#defined(g) ⇒ Object
417 418 419 |
# File 'lib/rubinius/code/ast/literals.rb', line 417 def defined(g) g.push_literal "expression" end |
#to_sexp ⇒ Object
421 422 423 |
# File 'lib/rubinius/code/ast/literals.rb', line 421 def to_sexp [:regex, @source, @options] end |