Search in sources :

Example 6 with ExpressionStatement

use of org.mozilla.javascript.ast.ExpressionStatement in project HL4A by HL4A.

the class Parser method defaultXmlNamespace.

private AstNode defaultXmlNamespace() throws IOException {
    if (currentToken != Token.DEFAULT)
        codeBug();
    consumeToken();
    mustHaveXML();
    setRequiresActivation();
    int lineno = ts.lineno, pos = ts.tokenBeg;
    if (!(matchToken(Token.NAME) && "xml".equals(ts.getString()))) {
        reportError("msg.bad.namespace");
    }
    if (!(matchToken(Token.NAME) && "namespace".equals(ts.getString()))) {
        reportError("msg.bad.namespace");
    }
    if (!matchToken(Token.ASSIGN)) {
        reportError("msg.bad.namespace");
    }
    AstNode e = expr();
    UnaryExpression dxmln = new UnaryExpression(pos, getNodeEnd(e) - pos);
    dxmln.setOperator(Token.DEFAULTNAMESPACE);
    dxmln.setOperand(e);
    dxmln.setLineno(lineno);
    ExpressionStatement es = new ExpressionStatement(dxmln, true);
    return es;
}
Also used : ExpressionStatement(org.mozilla.javascript.ast.ExpressionStatement) UnaryExpression(org.mozilla.javascript.ast.UnaryExpression) AstNode(org.mozilla.javascript.ast.AstNode)

Aggregations

ExpressionStatement (org.mozilla.javascript.ast.ExpressionStatement)6 AstNode (org.mozilla.javascript.ast.AstNode)5 VariableDeclaration (org.mozilla.javascript.ast.VariableDeclaration)2 EmptyStatement (org.mozilla.javascript.ast.EmptyStatement)1 FunctionNode (org.mozilla.javascript.ast.FunctionNode)1 KeywordLiteral (org.mozilla.javascript.ast.KeywordLiteral)1 Label (org.mozilla.javascript.ast.Label)1 LabeledStatement (org.mozilla.javascript.ast.LabeledStatement)1 LetNode (org.mozilla.javascript.ast.LetNode)1 Name (org.mozilla.javascript.ast.Name)1 ReturnStatement (org.mozilla.javascript.ast.ReturnStatement)1 UnaryExpression (org.mozilla.javascript.ast.UnaryExpression)1 Yield (org.mozilla.javascript.ast.Yield)1