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
Показать файл Открыть проект

Открытые методы

Метод Описание
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