Class: Minjs::ECMA262::ECMA262RegExp
- Defined in:
- lib/minjs/ecma262/literal.rb
Overview
Class of ECMA262 RegExp element
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
Attributes inherited from Base
Instance Method Summary collapse
-
#==(obj) ⇒ Object
compare object.
-
#deep_dup ⇒ Object
duplicate object.
-
#initialize(body, flags) ⇒ ECMA262RegExp
constructor
A new instance of ECMA262RegExp.
-
#left_hand_side_exp? ⇒ Boolean
True if expression is kind of LeftHandSideExpression.
-
#to_ecma262_boolean ⇒ Boolean
Returns results of ToBoolean().
-
#to_js(options = {}) ⇒ Object
Returns a ECMAScript string containg the representation of element.
-
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
Methods inherited from Literal
#lt?, #priority, #side_effect?, #ws?
Methods inherited from Base
#add_remove_paren, #concat, #replace
Constructor Details
#initialize(body, flags) ⇒ ECMA262RegExp
Returns a new instance of ECMA262RegExp.
919 920 921 922 |
# File 'lib/minjs/ecma262/literal.rb', line 919 def initialize(body, flags) @body = body @flags = flags end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
917 918 919 |
# File 'lib/minjs/ecma262/literal.rb', line 917 def body @body end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
917 918 919 |
# File 'lib/minjs/ecma262/literal.rb', line 917 def flags @flags end |
Instance Method Details
#==(obj) ⇒ Object
compare object
950 951 952 |
# File 'lib/minjs/ecma262/literal.rb', line 950 def ==(obj) self.class == obj.class and @body == obj.body and @flags == obj.flags end |
#deep_dup ⇒ Object
duplicate object
926 927 928 |
# File 'lib/minjs/ecma262/literal.rb', line 926 def deep_dup self.class.new(@body, @flags) end |
#left_hand_side_exp? ⇒ Boolean
Returns true if expression is kind of LeftHandSideExpression.
961 962 963 |
# File 'lib/minjs/ecma262/literal.rb', line 961 def left_hand_side_exp? true end |
#to_ecma262_boolean ⇒ Boolean
Returns results of ToBoolean()
Returns true or false if trivial, otherwise nil.
945 946 947 |
# File 'lib/minjs/ecma262/literal.rb', line 945 def to_ecma262_boolean true end |
#to_js(options = {}) ⇒ Object
Returns a ECMAScript string containg the representation of element.
956 957 958 |
# File 'lib/minjs/ecma262/literal.rb', line 956 def to_js( = {}) "/#{@body}/#{@flags}" end |
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
933 934 935 |
# File 'lib/minjs/ecma262/literal.rb', line 933 def traverse(parent) yield parent, self end |