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

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

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

Parser.generatorExpression介绍

暂无

代码示例

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

if (peekToken() == Token.FOR) {
  try {
    result.add(generatorExpression(en, 0, true));

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

private AstNode generatorExpression(AstNode result, int pos, boolean inFunctionParams)
  throws IOException
{
  
  List<GeneratorExpressionLoop> loops =
      new ArrayList<GeneratorExpressionLoop>();
  while (peekToken() == Token.FOR) {
    loops.add(generatorExpressionLoop());
  }
  int ifPos = -1;
  ConditionData data = null;
  if (peekToken() == Token.IF) {
    consumeToken();
    ifPos = ts.tokenBeg - pos;
    data = condition();
  }
  if(!inFunctionParams) {
    mustMatchToken(Token.RP, "msg.no.paren.let");
  }
  GeneratorExpression pn = new GeneratorExpression(pos, ts.tokenEnd - pos);
  pn.setResult(result);
  pn.setLoops(loops);
  if (data != null) {
    pn.setIfPosition(ifPos);
    pn.setFilter(data.condition);
    pn.setFilterLp(data.lp - pos);
    pn.setFilterRp(data.rp - pos);
  }
  return pn;
}

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

private AstNode generatorExpression(AstNode result, int pos, boolean inFunctionParams)
  throws IOException
{
  
  List<GeneratorExpressionLoop> loops =
      new ArrayList<GeneratorExpressionLoop>();
  while (peekToken() == Token.FOR) {
    loops.add(generatorExpressionLoop());
  }
  int ifPos = -1;
  ConditionData data = null;
  if (peekToken() == Token.IF) {
    consumeToken();
    ifPos = ts.tokenBeg - pos;
    data = condition();
  }
  if(!inFunctionParams) {
    mustMatchToken(Token.RP, "msg.no.paren.let");
  }
  GeneratorExpression pn = new GeneratorExpression(pos, ts.tokenEnd - pos);
  pn.setResult(result);
  pn.setLoops(loops);
  if (data != null) {
    pn.setIfPosition(ifPos);
    pn.setFilter(data.condition);
    pn.setFilterLp(data.lp - pos);
    pn.setFilterRp(data.rp - pos);
  }
  return pn;
}

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

if (peekToken() == Token.FOR) {
  try {
    result.add(generatorExpression(en, 0, true));

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

private AstNode generatorExpression(AstNode result, int pos, boolean inFunctionParams)
  throws IOException
{
  
  List<GeneratorExpressionLoop> loops =
      new ArrayList<GeneratorExpressionLoop>();
  while (peekToken() == Token.FOR) {
    loops.add(generatorExpressionLoop());
  }
  int ifPos = -1;
  ConditionData data = null;
  if (peekToken() == Token.IF) {
    consumeToken();
    ifPos = ts.tokenBeg - pos;
    data = condition();
  }
  if(!inFunctionParams) {
    mustMatchToken(Token.RP, "msg.no.paren.let");
  }
  GeneratorExpression pn = new GeneratorExpression(pos, ts.tokenEnd - pos);
  pn.setResult(result);
  pn.setLoops(loops);
  if (data != null) {
    pn.setIfPosition(ifPos);
    pn.setFilter(data.condition);
    pn.setFilterLp(data.lp - pos);
    pn.setFilterRp(data.rp - pos);
  }
  return pn;
}

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

if (peekToken() == Token.FOR) {
  try {
    result.add(generatorExpression(en, 0, true));

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

private AstNode generatorExpression(AstNode result, int pos, boolean inFunctionParams)
  throws IOException
{
  
  List<GeneratorExpressionLoop> loops =
      new ArrayList<GeneratorExpressionLoop>();
  while (peekToken() == Token.FOR) {
    loops.add(generatorExpressionLoop());
  }
  int ifPos = -1;
  ConditionData data = null;
  if (peekToken() == Token.IF) {
    consumeToken();
    ifPos = ts.tokenBeg - pos;
    data = condition();
  }
  if(!inFunctionParams) {
    mustMatchToken(Token.RP, "msg.no.paren.let");
  }
  GeneratorExpression pn = new GeneratorExpression(pos, ts.tokenEnd - pos);
  pn.setResult(result);
  pn.setLoops(loops);
  if (data != null) {
    pn.setIfPosition(ifPos);
    pn.setFilter(data.condition);
    pn.setFilterLp(data.lp - pos);
    pn.setFilterRp(data.rp - pos);
  }
  return pn;
}

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

if (peekToken() == Token.FOR) {
  try {
    result.add(generatorExpression(en, 0, true));

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

private AstNode parenExpr() throws IOException {
  boolean wasInForInit = inForInit;
  inForInit = false;
  try {
    Comment jsdocNode = getAndResetJsDoc();
    int lineno = ts.lineno;
    int begin = ts.tokenBeg;
    AstNode e = 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");
    pn.setLength(ts.tokenEnd - pn.getPosition());
    pn.setLineno(lineno);
    return pn;
  } finally {
    inForInit = wasInForInit;
  }
}

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

private AstNode parenExpr() throws IOException {
  boolean wasInForInit = inForInit;
  inForInit = false;
  try {
    Comment jsdocNode = getAndResetJsDoc();
    int lineno = ts.lineno;
    int begin = ts.tokenBeg;
    AstNode e = 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");
    pn.setLength(ts.tokenEnd - pn.getPosition());
    pn.setLineno(lineno);
    return pn;
  } finally {
    inForInit = wasInForInit;
  }
}

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

private AstNode parenExpr() throws IOException {
  boolean wasInForInit = inForInit;
  inForInit = false;
  try {
    Comment jsdocNode = getAndResetJsDoc();
    int lineno = ts.lineno;
    int begin = ts.tokenBeg;
    AstNode e = 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");
    pn.setLength(ts.tokenEnd - pn.getPosition());
    pn.setLineno(lineno);
    return pn;
  } finally {
    inForInit = wasInForInit;
  }
}

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

private AstNode parenExpr() throws IOException {
  boolean wasInForInit = inForInit;
  inForInit = false;
  try {
    Comment jsdocNode = getAndResetJsDoc();
    int lineno = ts.lineno;
    int begin = ts.tokenBeg;
    AstNode e = 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");
    pn.setLength(ts.tokenEnd - pn.getPosition());
    pn.setLineno(lineno);
    return pn;
  } finally {
    inForInit = wasInForInit;
  }
}

相关文章

Parser类方法