org.mozilla.javascript.Parser.peekTokenOrEOL()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 JavaScript  
字(7.1k)|赞(0)|评价(0)|浏览(241)

本文整理了Java中org.mozilla.javascript.Parser.peekTokenOrEOL()方法的一些代码示例,展示了Parser.peekTokenOrEOL()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.peekTokenOrEOL()方法的具体详情如下:
包路径:org.mozilla.javascript.Parser
类名称:Parser
方法名:peekTokenOrEOL

Parser.peekTokenOrEOL介绍

暂无

代码示例

代码示例来源:origin: ro.isdc.wro4j/rhino

private LabeledStatement matchJumpLabelName()
  throws IOException
{
  LabeledStatement label = null;
  if (peekTokenOrEOL() == Token.NAME) {
    consumeToken();
    if (labelSet != null) {
      label = labelSet.get(ts.getString());
    }
    if (label == null) {
      reportError("msg.undef.label");
    }
  }
  return label;
}

代码示例来源:origin: com.github.tntim96/rhino

private LabeledStatement matchJumpLabelName()
  throws IOException
{
  LabeledStatement label = null;
  if (peekTokenOrEOL() == Token.NAME) {
    consumeToken();
    if (labelSet != null) {
      label = labelSet.get(ts.getString());
    }
    if (label == null) {
      reportError("msg.undef.label");
    }
  }
  return label;
}

代码示例来源:origin: io.apigee/rhino

private LabeledStatement matchJumpLabelName()
  throws IOException
{
  LabeledStatement label = null;
  if (peekTokenOrEOL() == Token.NAME) {
    consumeToken();
    if (labelSet != null) {
      label = labelSet.get(ts.getString());
    }
    if (label == null) {
      reportError("msg.undef.label");
    }
  }
  return label;
}

代码示例来源:origin: geogebra/geogebra

private LabeledStatement matchJumpLabelName()
  throws IOException
{
  LabeledStatement label = null;
  if (peekTokenOrEOL() == Token.NAME) {
    consumeToken();
    if (labelSet != null) {
      label = labelSet.get(ts.getString());
    }
    if (label == null) {
      reportError("msg.undef.label");
    }
  }
  return label;
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

private Node matchJumpLabelName()
  throws IOException, ParserException
{
  Node label = null;
  int tt = peekTokenOrEOL();
  if (tt == Token.NAME) {
    consumeToken();
    String name = ts.getString();
    decompiler.addName(name);
    if (labelSet != null) {
      label = (Node)labelSet.get(name);
    }
    if (label == null) {
      reportError("msg.undef.label");
    }
  }
  return label;
}

代码示例来源:origin: rhino/js

private Node matchJumpLabelName()
  throws IOException, ParserException
{
  Node label = null;
  int tt = peekTokenOrEOL();
  if (tt == Token.NAME) {
    consumeToken();
    String name = ts.getString();
    decompiler.addName(name);
    if (labelSet != null) {
      label = labelSet.get(name);
    }
    if (label == null) {
      reportError("msg.undef.label");
    }
  }
  return label;
}

代码示例来源:origin: com.yahoo/yuicompressor

private Node matchJumpLabelName()
  throws IOException, ParserException
{
  Node label = null;
  int tt = peekTokenOrEOL();
  if (tt == Token.NAME) {
    consumeToken();
    String name = ts.getString();
    decompiler.addName(name);
    if (labelSet != null) {
      label = (Node)labelSet.get(name);
    }
    if (label == null) {
      reportError("msg.undef.label");
    }
  }
  return label;
}

代码示例来源:origin: io.apigee/rhino

int lineno = ts.lineno, pos = ts.tokenBeg, end = ts.tokenEnd;
Name breakLabel = null;
if (peekTokenOrEOL() == Token.NAME) {
  breakLabel = createNameNode();
  end = getNodeEnd(breakLabel);

代码示例来源:origin: geogebra/geogebra

int lineno = ts.lineno, pos = ts.tokenBeg, end = ts.tokenEnd;
Name breakLabel = null;
if (peekTokenOrEOL() == Token.NAME) {
  breakLabel = createNameNode();
  end = getNodeEnd(breakLabel);

代码示例来源:origin: ro.isdc.wro4j/rhino

int lineno = ts.lineno, pos = ts.tokenBeg, end = ts.tokenEnd;
Name breakLabel = null;
if (peekTokenOrEOL() == Token.NAME) {
  breakLabel = createNameNode();
  end = getNodeEnd(breakLabel);

代码示例来源:origin: com.github.tntim96/rhino

int lineno = ts.lineno, pos = ts.tokenBeg, end = ts.tokenEnd;
Name breakLabel = null;
if (peekTokenOrEOL() == Token.NAME) {
  breakLabel = createNameNode();
  end = getNodeEnd(breakLabel);

代码示例来源:origin: com.github.tntim96/rhino

private ThrowStatement throwStatement()
  throws IOException
{
  if (currentToken != Token.THROW) codeBug();
  consumeToken();
  int pos = ts.tokenBeg, lineno = ts.lineno;
  if (peekTokenOrEOL() == Token.EOL) {
    // ECMAScript does not allow new lines before throw expression,
    // see bug 256617
    reportError("msg.bad.throw.eol");
  }
  AstNode expr = expr();
  ThrowStatement pn = new ThrowStatement(pos, getNodeEnd(expr), expr);
  pn.setLineno(lineno);
  return pn;
}

代码示例来源:origin: geogebra/geogebra

private ThrowStatement throwStatement()
  throws IOException
{
  if (currentToken != Token.THROW) codeBug();
  consumeToken();
  int pos = ts.tokenBeg, lineno = ts.lineno;
  if (peekTokenOrEOL() == Token.EOL) {
    // ECMAScript does not allow new lines before throw expression,
    // see bug 256617
    reportError("msg.bad.throw.eol");
  }
  AstNode expr = expr();
  ThrowStatement pn = new ThrowStatement(pos, getNodeEnd(expr), expr);
  pn.setLineno(lineno);
  return pn;
}

代码示例来源:origin: ro.isdc.wro4j/rhino

private ThrowStatement throwStatement()
  throws IOException
{
  if (currentToken != Token.THROW) codeBug();
  consumeToken();
  int pos = ts.tokenBeg, lineno = ts.lineno;
  if (peekTokenOrEOL() == Token.EOL) {
    // ECMAScript does not allow new lines before throw expression,
    // see bug 256617
    reportError("msg.bad.throw.eol");
  }
  AstNode expr = expr();
  ThrowStatement pn = new ThrowStatement(pos, getNodeEnd(expr), expr);
  pn.setLineno(lineno);
  return pn;
}

代码示例来源:origin: io.apigee/rhino

private ThrowStatement throwStatement()
  throws IOException
{
  if (currentToken != Token.THROW) codeBug();
  consumeToken();
  int pos = ts.tokenBeg, lineno = ts.lineno;
  if (peekTokenOrEOL() == Token.EOL) {
    // ECMAScript does not allow new lines before throw expression,
    // see bug 256617
    reportError("msg.bad.throw.eol");
  }
  AstNode expr = expr();
  ThrowStatement pn = new ThrowStatement(pos, getNodeEnd(expr), expr);
  pn.setLineno(lineno);
  return pn;
}

代码示例来源:origin: io.apigee/rhino

int lineno = ts.lineno, pos = ts.tokenBeg, end = ts.tokenEnd;
Name label = null;
if (peekTokenOrEOL() == Token.NAME) {
  label = createNameNode();
  end = getNodeEnd(label);

代码示例来源:origin: com.github.tntim96/rhino

int lineno = ts.lineno, pos = ts.tokenBeg, end = ts.tokenEnd;
Name label = null;
if (peekTokenOrEOL() == Token.NAME) {
  label = createNameNode();
  end = getNodeEnd(label);

代码示例来源:origin: rhino/js

private Node statement()
  throws IOException
{
  try {
    Node pn = statementHelper(null);
    if (pn != null) {
      if (compilerEnv.isStrictMode() && !pn.hasSideEffects())
        addStrictWarning("msg.no.side.effects", "");
      return pn;
    }
  } catch (ParserException e) { }
  // skip to end of statement
  int lineno = ts.getLineno();
  guessingStatementEnd: for (;;) {
    int tt = peekTokenOrEOL();
    consumeToken();
    switch (tt) {
     case Token.ERROR:
     case Token.EOF:
     case Token.EOL:
     case Token.SEMI:
      break guessingStatementEnd;
    }
  }
  return nf.createExprStatement(nf.createName("error"), lineno);
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

private Node statement()
  throws IOException
{
  try {
    Node pn = statementHelper(null);
    if (pn != null) {
      if (compilerEnv.isStrictMode() && !pn.hasSideEffects())
        addStrictWarning("msg.no.side.effects", "");
      return pn;
    }
  } catch (ParserException e) { }
  // skip to end of statement
  int lineno = ts.getLineno();
  guessingStatementEnd: for (;;) {
    int tt = peekTokenOrEOL();
    consumeToken();
    switch (tt) {
     case Token.ERROR:
     case Token.EOF:
     case Token.EOL:
     case Token.SEMI:
      break guessingStatementEnd;
    }
  }
  return nf.createExprStatement(nf.createName("error"), lineno);
}

代码示例来源:origin: com.yahoo/yuicompressor

private Node statement()
  throws IOException
{
  try {
    Node pn = statementHelper(null);
    if (pn != null) {
      if (compilerEnv.isStrictMode() && !pn.hasSideEffects())
        addStrictWarning("msg.no.side.effects", "");
      return pn;
    }
  } catch (ParserException e) { }
  // skip to end of statement
  int lineno = ts.getLineno();
  guessingStatementEnd: for (;;) {
    int tt = peekTokenOrEOL();
    consumeToken();
    switch (tt) {
     case Token.ERROR:
     case Token.EOF:
     case Token.EOL:
     case Token.SEMI:
      break guessingStatementEnd;
    }
  }
  return nf.createExprStatement(nf.createName("error"), lineno);
}

相关文章

Parser类方法