C# 클래스 Rhino.Ast.Comment

Node representing comments.
Node representing comments. Node type is Rhino.Token.COMMENT .

JavaScript effectively has five comment types:

  1. // line comments
  2. /* block comments *\/
  3. /** jsdoc comments *\/
  4. <!-- html-open line comments
  5. ^\\s*--> html-close line comments

The first three should be familiar to Java programmers. JsDoc comments are really just block comments with some conventions about the formatting within the comment delimiters. Line and block comments are described in the Ecma-262 specification.

SpiderMonkey and Rhino also support HTML comment syntax, but somewhat counterintuitively, the syntax does not produce a block comment. Instead, everything from the string <!-- through the end of the line is considered a comment, and if the token --> is the first non-whitespace on the line, then the line is considered a line comment. This is to support parsing JavaScript in <script> HTML tags that has been "hidden" from very old browsers by surrounding it with HTML comment delimiters.

Note the node start position for Comment nodes is still relative to the parent, but Comments are always stored directly in the AstRoot node, so they are also effectively absolute offsets.

상속: AstNode
파일 보기 프로젝트 열기: hazzik/Rhino.Net

공개 메소드들

메소드 설명
Comment ( int pos, int len, Token type, string value ) : System.Text

Constructs a new Comment

GetCommentType ( ) : Token.CommentType

Returns the comment style

GetValue ( ) : string

Returns a string of the comment value.

Returns a string of the comment value.

SetCommentType ( Token type ) : void

Sets the comment style

ToSource ( int depth ) : string
Visit ( NodeVisitor v ) : void

Comment nodes are not visited during normal visitor traversals, but comply with the AstNode.Visit(NodeVisitor) interface.

메소드 상세

Comment() 공개 메소드

Constructs a new Comment
public Comment ( int pos, int len, Token type, string value ) : System.Text
pos int the start position
len int the length including delimiter(s)
type Rhino.Token the comment type
value string the value of the comment, as a string
리턴 System.Text

GetCommentType() 공개 메소드

Returns the comment style
public GetCommentType ( ) : Token.CommentType
리턴 Token.CommentType

GetValue() 공개 메소드

Returns a string of the comment value.
Returns a string of the comment value.
public GetValue ( ) : string
리턴 string

SetCommentType() 공개 메소드

Sets the comment style
public SetCommentType ( Token type ) : void
type Rhino.Token /// the comment style, a /// Rhino.Token.CommentType ///
리턴 void

ToSource() 공개 메소드

public ToSource ( int depth ) : string
depth int
리턴 string

Visit() 공개 메소드

Comment nodes are not visited during normal visitor traversals, but comply with the AstNode.Visit(NodeVisitor) interface.
public Visit ( NodeVisitor v ) : void
v NodeVisitor
리턴 void