本文整理了Java中org.mozilla.javascript.Parser.createName()
方法的一些代码示例,展示了Parser.createName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.createName()
方法的具体详情如下:
包路径:org.mozilla.javascript.Parser
类名称:Parser
方法名:createName
[英]Create a Name node using the token info from the last scanned name. In some cases we need to either synthesize a name node, or we lost the name token information by peeking. If the token parameter is not Token#NAME, then we use token info saved in instance vars.
[中]使用上次扫描的名称中的令牌信息创建名称节点。在某些情况下,我们需要合成一个名称节点,或者通过偷看丢失名称标记信息。如果token参数不是token#NAME,那么我们使用实例变量中保存的token info。
代码示例来源:origin: geogebra/geogebra
protected Node createName(int type, String name, Node child) {
Node result = createName(name);
result.setType(type);
if (child != null)
result.addChildToBack(child);
return result;
}
代码示例来源:origin: com.github.tntim96/rhino
param.getValue(), createName(param.getKey()));
destructuringNode.addChildToBack(assign);
代码示例来源:origin: ro.isdc.wro4j/rhino
protected Node createName(int type, String name, Node child) {
Node result = createName(name);
result.setType(type);
if (child != null)
result.addChildToBack(child);
return result;
}
代码示例来源:origin: io.apigee/rhino
protected Node createName(int type, String name, Node child) {
Node result = createName(name);
result.setType(type);
if (child != null)
result.addChildToBack(child);
return result;
}
代码示例来源:origin: com.github.tntim96/rhino
protected Node createName(int type, String name, Node child) {
Node result = createName(name);
result.setType(type);
if (child != null)
result.addChildToBack(child);
return result;
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Given a destructuring assignment with a left hand side parsed
* as an array or object literal and a right hand side expression,
* rewrite as a series of assignments to the variables defined in
* left from property accesses to the expression on the right.
* @param type declaration type: Token.VAR or Token.LET or -1
* @param left array or object literal containing NAME nodes for
* variables to assign
* @param right expression to assign from
* @return expression that performs a series of assignments to
* the variables defined in left
*/
Node createDestructuringAssignment(int type, Node left, Node right)
{
String tempName = currentScriptOrFn.getNextTempName();
Node result = destructuringAssignmentHelper(type, left, right,
tempName);
Node comma = result.getLastChild();
comma.addChildToBack(createName(tempName));
return result;
}
代码示例来源:origin: geogebra/geogebra
/**
* Given a destructuring assignment with a left hand side parsed
* as an array or object literal and a right hand side expression,
* rewrite as a series of assignments to the variables defined in
* left from property accesses to the expression on the right.
* @param type declaration type: Token.VAR or Token.LET or -1
* @param left array or object literal containing NAME nodes for
* variables to assign
* @param right expression to assign from
* @return expression that performs a series of assignments to
* the variables defined in left
*/
Node createDestructuringAssignment(int type, Node left, Node right)
{
String tempName = currentScriptOrFn.getNextTempName();
Node result = destructuringAssignmentHelper(type, left, right,
tempName);
Node comma = result.getLastChild();
comma.addChildToBack(createName(tempName));
return result;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Given a destructuring assignment with a left hand side parsed
* as an array or object literal and a right hand side expression,
* rewrite as a series of assignments to the variables defined in
* left from property accesses to the expression on the right.
* @param type declaration type: Token.VAR or Token.LET or -1
* @param left array or object literal containing NAME nodes for
* variables to assign
* @param right expression to assign from
* @return expression that performs a series of assignments to
* the variables defined in left
*/
Node createDestructuringAssignment(int type, Node left, Node right)
{
String tempName = currentScriptOrFn.getNextTempName();
Node result = destructuringAssignmentHelper(type, left, right,
tempName);
Node comma = result.getLastChild();
comma.addChildToBack(createName(tempName));
return result;
}
代码示例来源:origin: io.apigee/rhino
/**
* Given a destructuring assignment with a left hand side parsed
* as an array or object literal and a right hand side expression,
* rewrite as a series of assignments to the variables defined in
* left from property accesses to the expression on the right.
* @param type declaration type: Token.VAR or Token.LET or -1
* @param left array or object literal containing NAME nodes for
* variables to assign
* @param right expression to assign from
* @return expression that performs a series of assignments to
* the variables defined in left
*/
Node createDestructuringAssignment(int type, Node left, Node right)
{
String tempName = currentScriptOrFn.getNextTempName();
Node result = destructuringAssignmentHelper(type, left, right,
tempName);
Node comma = result.getLastChild();
comma.addChildToBack(createName(tempName));
return result;
}
代码示例来源:origin: com.github.tntim96/rhino
createName(tempName),
createNumber(index));
if (n.getType() == Token.NAME) {
String name = n.getString();
parent.addChildToBack(new Node(setOp,
createName(Token.BINDNAME,
name, null),
rightElem));
代码示例来源:origin: geogebra/geogebra
createName(tempName),
createNumber(index));
if (n.getType() == Token.NAME) {
String name = n.getString();
parent.addChildToBack(new Node(setOp,
createName(Token.BINDNAME,
name, null),
rightElem));
代码示例来源:origin: ro.isdc.wro4j/rhino
createName(tempName),
createNumber(index));
if (n.getType() == Token.NAME) {
String name = n.getString();
parent.addChildToBack(new Node(setOp,
createName(Token.BINDNAME,
name, null),
rightElem));
代码示例来源:origin: io.apigee/rhino
createName(tempName),
createNumber(index));
if (n.getType() == Token.NAME) {
String name = n.getString();
parent.addChildToBack(new Node(setOp,
createName(Token.BINDNAME,
name, null),
rightElem));
代码示例来源:origin: io.apigee/rhino
if (id instanceof Name) {
Node s = Node.newString(((Name)id).getIdentifier());
rightElem = new Node(Token.GETPROP, createName(tempName), s);
} else if (id instanceof StringLiteral) {
Node s = Node.newString(((StringLiteral)id).getValue());
rightElem = new Node(Token.GETPROP, createName(tempName), s);
} else if (id instanceof NumberLiteral) {
Node s = createNumber((int)((NumberLiteral)id).getNumber());
rightElem = new Node(Token.GETELEM, createName(tempName), s);
} else {
throw codeBug();
String name = ((Name)value).getIdentifier();
parent.addChildToBack(new Node(setOp,
createName(Token.BINDNAME,
name, null),
rightElem));
代码示例来源:origin: ro.isdc.wro4j/rhino
if (id instanceof Name) {
Node s = Node.newString(((Name)id).getIdentifier());
rightElem = new Node(Token.GETPROP, createName(tempName), s);
} else if (id instanceof StringLiteral) {
Node s = Node.newString(((StringLiteral)id).getValue());
rightElem = new Node(Token.GETPROP, createName(tempName), s);
} else if (id instanceof NumberLiteral) {
Node s = createNumber((int)((NumberLiteral)id).getNumber());
rightElem = new Node(Token.GETELEM, createName(tempName), s);
} else {
throw codeBug();
String name = ((Name)value).getIdentifier();
parent.addChildToBack(new Node(setOp,
createName(Token.BINDNAME,
name, null),
rightElem));
代码示例来源:origin: com.github.tntim96/rhino
if (id instanceof Name) {
Node s = Node.newString(((Name)id).getIdentifier());
rightElem = new Node(Token.GETPROP, createName(tempName), s);
} else if (id instanceof StringLiteral) {
Node s = Node.newString(((StringLiteral)id).getValue());
rightElem = new Node(Token.GETPROP, createName(tempName), s);
} else if (id instanceof NumberLiteral) {
Node s = createNumber((int)((NumberLiteral)id).getNumber());
rightElem = new Node(Token.GETELEM, createName(tempName), s);
} else {
throw codeBug();
String name = ((Name)value).getIdentifier();
parent.addChildToBack(new Node(setOp,
createName(Token.BINDNAME,
name, null),
rightElem));
代码示例来源:origin: geogebra/geogebra
createName(Token.NAME, tempName, right)));
try {
pushScope(result);
reportError("msg.bad.assign.left");
comma.addChildToBack(simpleAssignment(left, createName(tempName)));
break;
default:
代码示例来源:origin: com.github.tntim96/rhino
createName(Token.NAME, tempName, right)));
try {
pushScope(result);
reportError("msg.bad.assign.left");
comma.addChildToBack(simpleAssignment(left, createName(tempName)));
break;
default:
代码示例来源:origin: io.apigee/rhino
createName(Token.NAME, tempName, right)));
try {
pushScope(result);
reportError("msg.bad.assign.left");
comma.addChildToBack(simpleAssignment(left, createName(tempName)));
break;
default:
代码示例来源:origin: ro.isdc.wro4j/rhino
createName(Token.NAME, tempName, right)));
try {
pushScope(result);
reportError("msg.bad.assign.left");
comma.addChildToBack(simpleAssignment(left, createName(tempName)));
break;
default:
内容来源于网络,如有侵权,请联系作者删除!