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

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

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

Parser.codeBug介绍

暂无

代码示例

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

void pushScope(Scope scope) {
  Scope parent = scope.getParentScope();
  // During codegen, parent scope chain may already be initialized,
  // in which case we just need to set currentScope variable.
  if (parent != null) {
    if (parent != currentScope)
      codeBug();
  } else {
    currentScope.addChildScope(scope);
  }
  currentScope = scope;
}

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

void pushScope(Scope scope) {
  Scope parent = scope.getParentScope();
  // During codegen, parent scope chain may already be initialized,
  // in which case we just need to set currentScope variable.
  if (parent != null) {
    if (parent != currentScope)
      codeBug();
  } else {
    currentScope.addChildScope(scope);
  }
  currentScope = scope;
}

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

void pushScope(Scope scope) {
  Scope parent = scope.getParentScope();
  // During codegen, parent scope chain may already be initialized,
  // in which case we just need to set currentScope variable.
  if (parent != null) {
    if (parent != currentScope)
      codeBug();
  } else {
    currentScope.addChildScope(scope);
  }
  currentScope = scope;
}

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

void pushScope(Scope scope) {
  Scope parent = scope.getParentScope();
  // During codegen, parent scope chain may already be initialized,
  // in which case we just need to set currentScope variable.
  if (parent != null) {
    if (parent != currentScope)
      codeBug();
  } else {
    currentScope.addChildScope(scope);
  }
  currentScope = scope;
}

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

private AstNode letStatement()
  throws IOException
{
  if (currentToken != Token.LET) codeBug();
  consumeToken();
  int lineno = ts.lineno, pos = ts.tokenBeg;
  AstNode pn;
  if (peekToken() == Token.LP) {
    pn = let(true, pos);
  } else {
    pn = variables(Token.LET, pos, true);  // else, e.g.: let x=6, y=7;
  }
  pn.setLineno(lineno);
  return pn;
}

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

private AstNode letStatement()
  throws IOException
{
  if (currentToken != Token.LET) codeBug();
  consumeToken();
  int lineno = ts.lineno, pos = ts.tokenBeg;
  AstNode pn;
  if (peekToken() == Token.LP) {
    pn = let(true, pos);
  } else {
    pn = variables(Token.LET, pos, true);  // else, e.g.: let x=6, y=7;
  }
  pn.setLineno(lineno);
  return pn;
}

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

private AstNode letStatement()
  throws IOException
{
  if (currentToken != Token.LET) codeBug();
  consumeToken();
  int lineno = ts.lineno, pos = ts.tokenBeg;
  AstNode pn;
  if (peekToken() == Token.LP) {
    pn = let(true, pos);
  } else {
    pn = variables(Token.LET, pos, true);  // else, e.g.: let x=6, y=7;
  }
  pn.setLineno(lineno);
  return pn;
}

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

private AstNode letStatement()
  throws IOException
{
  if (currentToken != Token.LET) codeBug();
  consumeToken();
  int lineno = ts.lineno, pos = ts.tokenBeg;
  AstNode pn;
  if (peekToken() == Token.LP) {
    pn = let(true, pos);
  } else {
    pn = variables(Token.LET, pos, true);  // else, e.g.: let x=6, y=7;
  }
  pn.setLineno(lineno);
  return pn;
}

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

private AstNode statements(AstNode parent) throws IOException {
  if (currentToken != Token.LC  // assertion can be invalid in bad code
    && !compilerEnv.isIdeMode()) codeBug();
  int pos = ts.tokenBeg;
  AstNode block = parent != null ? parent : new Block(pos);
  block.setLineno(ts.lineno);
  int tt;
  while ((tt = peekToken()) > Token.EOF && tt != Token.RC) {
    block.addChild(statement());
  }
  block.setLength(ts.tokenBeg - pos);
  return block;
}

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

private AstNode statements(AstNode parent) throws IOException {
  if (currentToken != Token.LC  // assertion can be invalid in bad code
    && !compilerEnv.isIdeMode()) codeBug();
  int pos = ts.tokenBeg;
  AstNode block = parent != null ? parent : new Block(pos);
  block.setLineno(ts.lineno);
  int tt;
  while ((tt = peekToken()) > Token.EOF && tt != Token.RC) {
    block.addChild(statement());
  }
  block.setLength(ts.tokenBeg - pos);
  return block;
}

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

private AstNode statements(AstNode parent) throws IOException {
  if (currentToken != Token.LC  // assertion can be invalid in bad code
    && !compilerEnv.isIdeMode()) codeBug();
  int pos = ts.tokenBeg;
  AstNode block = parent != null ? parent : new Block(pos);
  block.setLineno(ts.lineno);
  int tt;
  while ((tt = peekToken()) > Token.EOF && tt != Token.RC) {
    block.addChild(statement());
  }
  block.setLength(ts.tokenBeg - pos);
  return block;
}

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

private AstNode statements(AstNode parent) throws IOException {
  if (currentToken != Token.LC  // assertion can be invalid in bad code
    && !compilerEnv.isIdeMode()) codeBug();
  int pos = ts.tokenBeg;
  AstNode block = parent != null ? parent : new Block(pos);
  block.setLineno(ts.lineno);
  int tt;
  while ((tt = peekToken()) > Token.EOF && tt != Token.RC) {
    block.addChild(statement());
  }
  block.setLength(ts.tokenBeg - pos);
  return block;
}

代码示例来源: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: com.github.tntim96/rhino

private AstNode block()
  throws IOException
{
  if (currentToken != Token.LC) codeBug();
  consumeToken();
  int pos = ts.tokenBeg;
  Scope block = new Scope(pos);
  block.setLineno(ts.lineno);
  pushScope(block);
  try {
    statements(block);
    mustMatchToken(Token.RC, "msg.no.brace.block");
    block.setLength(ts.tokenEnd - pos);
    return block;
  } finally {
    popScope();
  }
}

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

private AstNode block()
  throws IOException
{
  if (currentToken != Token.LC) codeBug();
  consumeToken();
  int pos = ts.tokenBeg;
  Scope block = new Scope(pos);
  block.setLineno(ts.lineno);
  pushScope(block);
  try {
    statements(block);
    mustMatchToken(Token.RC, "msg.no.brace.block");
    block.setLength(ts.tokenEnd - pos);
    return block;
  } finally {
    popScope();
  }
}

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

private AstNode block()
  throws IOException
{
  if (currentToken != Token.LC) codeBug();
  consumeToken();
  int pos = ts.tokenBeg;
  Scope block = new Scope(pos);
  block.setLineno(ts.lineno);
  pushScope(block);
  try {
    statements(block);
    mustMatchToken(Token.RC, "msg.no.brace.block");
    block.setLength(ts.tokenEnd - pos);
    return block;
  } finally {
    popScope();
  }
}

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

private WhileLoop whileLoop()
  throws IOException
{
  if (currentToken != Token.WHILE) codeBug();
  consumeToken();
  int pos = ts.tokenBeg;
  WhileLoop pn = new WhileLoop(pos);
  pn.setLineno(ts.lineno);
  enterLoop(pn);
  try {
    ConditionData data = condition();
    pn.setCondition(data.condition);
    pn.setParens(data.lp - pos, data.rp - pos);
    AstNode body = statement();
    pn.setLength(getNodeEnd(body) - pos);
    pn.setBody(body);
  } finally {
    exitLoop();
  }
  return pn;
}

相关文章

微信公众号

Parser类方法