• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Comment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.mozilla.javascript.ast.Comment的典型用法代码示例。如果您正苦于以下问题:Java Comment类的具体用法?Java Comment怎么用?Java Comment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Comment类属于org.mozilla.javascript.ast包,在下文中一共展示了Comment类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: recordComment

import org.mozilla.javascript.ast.Comment; //导入依赖的package包/类
private void recordComment(int lineno, String comment) {
    if (scannedComments == null) {
        scannedComments = new ArrayList<Comment>();
    }
    Comment commentNode = new Comment(ts.tokenBeg,
                                      ts.getTokenLength(),
                                      ts.commentType,
                                      comment);
    if (ts.commentType == Token.CommentType.JSDOC &&
        compilerEnv.isRecordingLocalJsDocComments()) {
        currentJsDocComment = commentNode;
    }
    commentNode.setLineno(lineno);
    scannedComments.add(commentNode);
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:16,代码来源:Parser.java


示例2: withStatement

import org.mozilla.javascript.ast.Comment; //导入依赖的package包/类
private WithStatement withStatement()
    throws IOException
{
    if (currentToken != Token.WITH) codeBug();
    consumeToken();

    Comment withComment = getAndResetJsDoc();

    int lineno = ts.lineno, pos = ts.tokenBeg, lp = -1, rp = -1;
    if (mustMatchToken(Token.LP, "msg.no.paren.with"))
        lp = ts.tokenBeg;

    AstNode obj = expr();

    if (mustMatchToken(Token.RP, "msg.no.paren.after.with"))
        rp = ts.tokenBeg;

    AstNode body = statement();

    WithStatement pn = new WithStatement(pos, getNodeEnd(body) - pos);
    pn.setJsDocNode(withComment);
    pn.setExpression(obj);
    pn.setStatement(body);
    pn.setParens(lp, rp);
    pn.setLineno(lineno);
    return pn;
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:28,代码来源:Parser.java


示例3: parenExpr

import org.mozilla.javascript.ast.Comment; //导入依赖的package包/类
private AstNode parenExpr() throws IOException {
    boolean wasInForInit = inForInit;
    inForInit = false;
    try {
        Comment jsdocNode = getAndResetJsDoc();
        int lineno = ts.lineno;
        int begin = ts.tokenBeg;
        AstNode e = (peekToken() == Token.RP ? new EmptyExpression(begin) : expr());
        if (peekToken() == Token.FOR) {
            return generatorExpression(e, begin);
        }
        ParenthesizedExpression pn = new ParenthesizedExpression(e);
        if (jsdocNode == null) {
            jsdocNode = getAndResetJsDoc();
        }
        if (jsdocNode != null) {
            pn.setJsDocNode(jsdocNode);
        }
        mustMatchToken(Token.RP, "msg.no.paren");
        if (e.getType() == Token.EMPTY && peekToken() != Token.ARROW) {
          reportError("msg.syntax");
          return makeErrorNode();
        }
        pn.setLength(ts.tokenEnd - pn.getPosition());
        pn.setLineno(lineno);
        return pn;
    } finally {
        inForInit = wasInForInit;
    }
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:31,代码来源:Parser.java


示例4: getJsDoc

import org.mozilla.javascript.ast.Comment; //导入依赖的package包/类
/**
 * Gets the JsDoc comment string attached to this node.
 * @return the comment string or {@code null} if no JsDoc is attached to
 *     this node
 */
public String getJsDoc() {
    Comment comment = getJsDocNode();
    if (comment != null) {
      return comment.getValue();
    }
    return null;
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:13,代码来源:Node.java


示例5: getAndResetJsDoc

import org.mozilla.javascript.ast.Comment; //导入依赖的package包/类
private Comment getAndResetJsDoc() {
    Comment saved = currentJsDocComment;
    currentJsDocComment = null;
    return saved;
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:6,代码来源:Parser.java


示例6: parseFunctionParams

import org.mozilla.javascript.ast.Comment; //导入依赖的package包/类
private void  parseFunctionParams(FunctionNode fnNode)
    throws IOException
{
    if (matchToken(Token.RP)) {
        fnNode.setRp(ts.tokenBeg - fnNode.getPosition());
        return;
    }
    // Would prefer not to call createDestructuringAssignment until codegen,
    // but the symbol definitions have to happen now, before body is parsed.
    Map<String, Node> destructuring = null;
    Set<String> paramNames = new HashSet<String>();
    do {
        int tt = peekToken();
        if (tt == Token.LB || tt == Token.LC) {
            AstNode expr = destructuringPrimaryExpr();
            markDestructuring(expr);
            fnNode.addParam(expr);
            // Destructuring assignment for parameters: add a dummy
            // parameter name, and add a statement to the body to initialize
            // variables from the destructuring assignment
            if (destructuring == null) {
                destructuring = new HashMap<String, Node>();
            }
            String pname = currentScriptOrFn.getNextTempName();
            defineSymbol(Token.LP, pname, false);
            destructuring.put(pname, expr);
        } else {
            if (mustMatchToken(Token.NAME, "msg.no.parm")) {
                Name paramNameNode = createNameNode();
                Comment jsdocNodeForName = getAndResetJsDoc();
                if (jsdocNodeForName != null) {
                  paramNameNode.setJsDocNode(jsdocNodeForName);
                }
                fnNode.addParam(paramNameNode);
                String paramName = ts.getString();
                defineSymbol(Token.LP, paramName);
                if (this.inUseStrictDirective) {
                    if ("eval".equals(paramName) ||
                        "arguments".equals(paramName))
                    {
                        reportError("msg.bad.id.strict", paramName);
                    }
                    if (paramNames.contains(paramName))
                        addError("msg.dup.param.strict", paramName);
                    paramNames.add(paramName);
                }
            } else {
                fnNode.addParam(makeErrorNode());
            }
        }
    } while (matchToken(Token.COMMA));

    if (destructuring != null) {
        Node destructuringNode = new Node(Token.COMMA);
        // Add assignment helper for each destructuring parameter
        for (Map.Entry<String, Node> param: destructuring.entrySet()) {
            Node assign = createDestructuringAssignment(Token.VAR,
                    param.getValue(), createName(param.getKey()));
            destructuringNode.addChildToBack(assign);

        }
        fnNode.putProp(Node.DESTRUCTURING_PARAMS, destructuringNode);
    }

    if (mustMatchToken(Token.RP, "msg.no.paren.after.parms")) {
        fnNode.setRp(ts.tokenBeg - fnNode.getPosition());
    }
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:69,代码来源:Parser.java


示例7: setJsDocNode

import org.mozilla.javascript.ast.Comment; //导入依赖的package包/类
/**
 * Sets the JsDoc comment string attached to this node.
 */
public void setJsDocNode(Comment jsdocNode) {
    putProp(JSDOC_PROP, jsdocNode);
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:7,代码来源:Node.java


示例8: getJsDocNode

import org.mozilla.javascript.ast.Comment; //导入依赖的package包/类
/**
 * Gets the JsDoc Comment object attached to this node.
 * @return the Comment or {@code null} if no JsDoc is attached to
 *     this node
 */
public Comment getJsDocNode() {
    return (Comment) getProp(JSDOC_PROP);
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:9,代码来源:Node.java



注:本文中的org.mozilla.javascript.ast.Comment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JvmWildcardTypeReference类代码示例发布时间:2022-05-22
下一篇:
Java Unifier类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap