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

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

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

Parser.statement介绍

[英]Whether the "catch (e: e instanceof Exception) { ... }" syntax is implemented.
[中]是否“catch(e:e instanceof Exception){…}”实现了语法。

代码示例

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

private Node statements(Node scope)
  throws IOException
{
  Node pn = scope != null ? scope : nf.createBlock(ts.getLineno());
  int tt;
  while ((tt = peekToken()) > Token.EOF && tt != Token.RC) {
    nf.addChildToBack(pn, statement());
  }
  return pn;
}

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

private Node statements()
  throws IOException
{
  Node pn = nf.createBlock(ts.getLineno());
  int tt;
  while((tt = peekToken()) > Token.EOF && tt != Token.RC) {
    nf.addChildToBack(pn, statement());
  }
  return pn;
}

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

private Node statements()
  throws IOException
{
  Node pn = nf.createBlock(ts.getLineno());
  int tt;
  while((tt = peekToken()) > Token.EOF && tt != Token.RC) {
    nf.addChildToBack(pn, statement());
  }
  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 IfStatement ifStatement()
  throws IOException
{
  if (currentToken != Token.IF) codeBug();
  consumeToken();
  int pos = ts.tokenBeg, lineno = ts.lineno, elsePos = -1;
  ConditionData data = condition();
  AstNode ifTrue = statement(), ifFalse = null;
  if (matchToken(Token.ELSE)) {
    elsePos = ts.tokenBeg - pos;
    ifFalse = statement();
  }
  int end = getNodeEnd(ifFalse != null ? ifFalse : ifTrue);
  IfStatement pn = new IfStatement(pos, end - pos);
  pn.setCondition(data.condition);
  pn.setParens(data.lp - pos, data.rp - pos);
  pn.setThenPart(ifTrue);
  pn.setElsePart(ifFalse);
  pn.setElsePosition(elsePos);
  pn.setLineno(lineno);
  return pn;
}

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

private IfStatement ifStatement()
  throws IOException
{
  if (currentToken != Token.IF) codeBug();
  consumeToken();
  int pos = ts.tokenBeg, lineno = ts.lineno, elsePos = -1;
  ConditionData data = condition();
  AstNode ifTrue = statement(), ifFalse = null;
  if (matchToken(Token.ELSE)) {
    elsePos = ts.tokenBeg - pos;
    ifFalse = statement();
  }
  int end = getNodeEnd(ifFalse != null ? ifFalse : ifTrue);
  IfStatement pn = new IfStatement(pos, end - pos);
  pn.setCondition(data.condition);
  pn.setParens(data.lp - pos, data.rp - pos);
  pn.setThenPart(ifTrue);
  pn.setElsePart(ifFalse);
  pn.setElsePosition(elsePos);
  pn.setLineno(lineno);
  return pn;
}

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

private IfStatement ifStatement()
  throws IOException
{
  if (currentToken != Token.IF) codeBug();
  consumeToken();
  int pos = ts.tokenBeg, lineno = ts.lineno, elsePos = -1;
  ConditionData data = condition();
  AstNode ifTrue = statement(), ifFalse = null;
  if (matchToken(Token.ELSE)) {
    elsePos = ts.tokenBeg - pos;
    ifFalse = statement();
  }
  int end = getNodeEnd(ifFalse != null ? ifFalse : ifTrue);
  IfStatement pn = new IfStatement(pos, end - pos);
  pn.setCondition(data.condition);
  pn.setParens(data.lp - pos, data.rp - pos);
  pn.setThenPart(ifTrue);
  pn.setElsePart(ifFalse);
  pn.setElsePosition(elsePos);
  pn.setLineno(lineno);
  return pn;
}

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

private IfStatement ifStatement()
  throws IOException
{
  if (currentToken != Token.IF) codeBug();
  consumeToken();
  int pos = ts.tokenBeg, lineno = ts.lineno, elsePos = -1;
  ConditionData data = condition();
  AstNode ifTrue = statement(), ifFalse = null;
  if (matchToken(Token.ELSE)) {
    elsePos = ts.tokenBeg - pos;
    ifFalse = statement();
  }
  int end = getNodeEnd(ifFalse != null ? ifFalse : ifTrue);
  IfStatement pn = new IfStatement(pos, end - pos);
  pn.setCondition(data.condition);
  pn.setParens(data.lp - pos, data.rp - pos);
  pn.setThenPart(ifTrue);
  pn.setElsePart(ifFalse);
  pn.setElsePosition(elsePos);
  pn.setLineno(lineno);
  return pn;
}

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

break;
default:
 n = statement();
 break;

代码示例来源: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;
}

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

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;
}

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

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;
}

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

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;
}

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

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;
}

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

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;
}

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

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;
}

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

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;
}

相关文章

Parser类方法