Class: Minjs::ECMA262::MultiLineComment
- Includes:
- Ctype
- Defined in:
- lib/minjs/ecma262/literal.rb
Overview
Class of ECMA262 MultiLineComment Element
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#has_lf ⇒ Object
readonly
Returns the value of attribute has_lf.
Attributes inherited from Base
Instance Method Summary collapse
-
#==(obj) ⇒ Object
compare object.
-
#initialize(comment) ⇒ MultiLineComment
constructor
A new instance of MultiLineComment.
-
#lt? ⇒ Boolean
true if literal is line terminator.
-
#to_js(options) ⇒ Object
Returns a ECMAScript string containg the representation of element.
-
#traverse(parent, &block) ⇒ Object
Traverses this children and itself with given block.
-
#ws? ⇒ Boolean
true if literal is white space.
Methods included from Ctype
#decimal_digit?, #hex_digit?, #identifier_part?, #identifier_start?, #idname?, #line_terminator?, #octal_digit?, #white_space?
Methods inherited from Literal
Methods inherited from Base
#add_remove_paren, #concat, #deep_dup, #replace
Constructor Details
#initialize(comment) ⇒ MultiLineComment
Returns a new instance of MultiLineComment.
1134 1135 1136 |
# File 'lib/minjs/ecma262/literal.rb', line 1134 def initialize(comment) @comment = comment end |
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
1131 1132 1133 |
# File 'lib/minjs/ecma262/literal.rb', line 1131 def comment @comment end |
#has_lf ⇒ Object (readonly)
Returns the value of attribute has_lf.
1131 1132 1133 |
# File 'lib/minjs/ecma262/literal.rb', line 1131 def has_lf @has_lf end |
Instance Method Details
#==(obj) ⇒ Object
compare object
1145 1146 1147 |
# File 'lib/minjs/ecma262/literal.rb', line 1145 def ==(obj) self.class == obj.class and @comment == obj.comment end |
#lt? ⇒ Boolean
true if literal is line terminator
If MultiLineComment has one more LineTerminator, This comment is kind of line terminator. otherwise, this comment is kind of white space.
1165 1166 1167 1168 1169 1170 |
# File 'lib/minjs/ecma262/literal.rb', line 1165 def lt? @comment.codepoints.each{|char| return true if line_terminator?(char) } false end |
#to_js(options) ⇒ Object
Returns a ECMAScript string containg the representation of element.
1151 1152 1153 |
# File 'lib/minjs/ecma262/literal.rb', line 1151 def to_js() "/*#{@comment}*/" end |
#traverse(parent, &block) ⇒ Object
Traverses this children and itself with given block.
1141 1142 |
# File 'lib/minjs/ecma262/literal.rb', line 1141 def traverse(parent, &block) end |
#ws? ⇒ Boolean
true if literal is white space
1156 1157 1158 |
# File 'lib/minjs/ecma262/literal.rb', line 1156 def ws? !lt? end |