Class: Minjs::ECMA262::MultiLineComment

Inherits:
Literal show all
Includes:
Ctype
Defined in:
lib/minjs/ecma262/lit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Ctype

#decimal_digit?, #hex_digit?, #identifier_part?, #identifier_start?, #idname?, #line_terminator?, #octal_digit?, #white_space?

Methods inherited from Literal

#priority, #to_exp?

Methods inherited from Base

#add_remove_paren, #concat, #deep_dup, #replace, #to_s

Constructor Details

#initialize(comment) ⇒ MultiLineComment

Returns a new instance of MultiLineComment.



826
827
828
# File 'lib/minjs/ecma262/lit.rb', line 826

def initialize(comment)
  @comment = comment
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



823
824
825
# File 'lib/minjs/ecma262/lit.rb', line 823

def comment
  @comment
end

#has_lfObject (readonly)

Returns the value of attribute has_lf.



823
824
825
# File 'lib/minjs/ecma262/lit.rb', line 823

def has_lf
  @has_lf
end

Instance Method Details

#==(obj) ⇒ Object



833
834
835
# File 'lib/minjs/ecma262/lit.rb', line 833

def ==(obj)
  self.class == obj.class and @comment == obj.comment
end

#lt?Boolean

Returns:



845
846
847
848
849
850
# File 'lib/minjs/ecma262/lit.rb', line 845

def lt?
  @comment.codepoints.each{|char|
    return true if line_terminator?(char)
  }
  false
end

#to_js(options) ⇒ Object



837
838
839
# File 'lib/minjs/ecma262/lit.rb', line 837

def to_js(options)
  "/*#{@comment}*/"
end

#traverse(parent, &block) ⇒ Object



830
831
# File 'lib/minjs/ecma262/lit.rb', line 830

def traverse(parent, &block)
end

#ws?Boolean

Returns:



841
842
843
# File 'lib/minjs/ecma262/lit.rb', line 841

def ws?
  !lt?
end