/** * Matches the "step" part in a for loop. */ public final void forStep( ContainerNode c ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; try { // for error handling e=optExpression(); if (e != null) c.addItem(e); } catch (RecognitionException ex) { handleParsingError(ex); } }
/** * Matches the "condition" part in a for loop. */ public final void forCondition( ContainerNode c ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; try { // for error handling e=optExpression(); if (e != null) c.addItem(e); } catch (RecognitionException ex) { handleParsingError(ex); } }
/** * Matches the "step" part in a for loop. */ public final void forStep( ContainerNode c ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; try { // for error handling e=optExpression(); if (e != null) c.addItem(e); } catch (RecognitionException ex) { handleParsingError(ex); } }
/** * Matches the "condition" part in a for loop. */ public final void forCondition( ContainerNode c ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; try { // for error handling e=optExpression(); if (e != null) c.addItem(e); } catch (RecognitionException ex) { handleParsingError(ex); } }
/** * Matches a binding expression in an XML literal attribute name. */ public final void xmlAttributeBlock( BaseLiteralContainerNode n ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; try { // for error handling match(TOKEN_E4X_BINDING_OPEN); e=lhsExpr(); if(e != null) n.getContentsNode().addItem(e); match(TOKEN_E4X_BINDING_CLOSE); } catch (RecognitionException ex) { handleParsingError(ex); } }
/** * Matches a binding expression in an XML literal. */ public final void xmlContentBlock( BaseLiteralContainerNode n ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; try { // for error handling match(TOKEN_E4X_BINDING_OPEN); e=expression(); if(e != null) n.getContentsNode().addItem(e); match(TOKEN_E4X_BINDING_CLOSE); } catch (RecognitionException ex) { handleParsingError(ex); } }
/** * Matches a binding expression in an XML literal attribute name. */ public final void xmlAttributeBlock( BaseLiteralContainerNode n ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; try { // for error handling match(TOKEN_E4X_BINDING_OPEN); e=lhsExpr(); if(e != null) n.getContentsNode().addItem(e); match(TOKEN_E4X_BINDING_CLOSE); } catch (RecognitionException ex) { handleParsingError(ex); } }
/** * Matches a binding expression in an XML literal. */ public final void xmlContentBlock( BaseLiteralContainerNode n ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; try { // for error handling match(TOKEN_E4X_BINDING_OPEN); e=expression(); if(e != null) n.getContentsNode().addItem(e); match(TOKEN_E4X_BINDING_CLOSE); } catch (RecognitionException ex) { handleParsingError(ex); } }
public static IContainerNode insertArgumentsBefore(IContainerNode argumentsNode, IASNode... nodes) { int originalLength = argumentsNode.getChildCount(); int extraLength = nodes.length; ContainerNode result = new ContainerNode(originalLength + extraLength); result.setSourcePath(argumentsNode.getSourcePath()); result.span(argumentsNode); result.setParent((NodeBase) argumentsNode.getParent()); for (int i = 0; i < extraLength; i++) { NodeBase node = (NodeBase) nodes[i]; node.setSourcePath(argumentsNode.getSourcePath()); result.addItem(node); } for (int i = 0; i < originalLength; i++) { result.addItem((NodeBase) argumentsNode.getChild(i)); } return result; }
public static IContainerNode insertArgumentsAfter(IContainerNode argumentsNode, IASNode... nodes) { int originalLength = argumentsNode.getChildCount(); int extraLength = nodes.length; ContainerNode result = new ContainerNode(originalLength + extraLength); result.setSourcePath(argumentsNode.getSourcePath()); result.span(argumentsNode); result.setParent((NodeBase) argumentsNode.getParent()); for (int i = 0; i < originalLength; i++) { result.addItem((NodeBase) argumentsNode.getChild(i)); } for (int i = 0; i < extraLength; i++) { NodeBase node = (NodeBase) nodes[i]; node.setSourcePath(argumentsNode.getSourcePath()); result.addItem(node); } return result; }
/** * Copy constructor. * * @param other The node to copy. */ protected FunctionCallNode(FunctionCallNode other) { super(other); this.newKeywordNode = other.newKeywordNode != null ? new KeywordNode(other.newKeywordNode) : null; this.nameNode = other.nameNode != null ? other.nameNode.copy() : null; this.argumentsNode = new ContainerNode(other.argumentsNode.getChildCount()); for (IExpressionNode arg : other.getArgumentNodes()) { argumentsNode.addItem(((ExpressionNodeBase)arg).copy()); } }
/** * Copy constructor. * * @param other The node to copy. */ protected FunctionCallNode(FunctionCallNode other) { super(other); this.newKeywordNode = other.newKeywordNode != null ? new KeywordNode(other.newKeywordNode) : null; this.nameNode = other.nameNode != null ? other.nameNode.copy() : null; this.argumentsNode = new ContainerNode(other.argumentsNode.getChildCount()); for (IExpressionNode arg : other.getArgumentNodes()) { argumentsNode.addItem(((ExpressionNodeBase)arg).copy()); } }
/** * Matches a "switch" statement. */ public final void switchStatement( ContainerNode c ) throws RecognitionException, TokenStreamException { Token switchT = null; SwitchNode sw = null; ExpressionNodeBase e = null; switchT = LT(1); match(TOKEN_KEYWORD_SWITCH); e=statementParenExpression(); sw = new SwitchNode((ASToken)switchT); c.addItem(sw); if(e != null) sw.setConditionalExpression(e); cases(sw); }
/** * Matches a "switch" statement. */ public final void switchStatement( ContainerNode c ) throws RecognitionException, TokenStreamException { Token switchT = null; SwitchNode sw = null; ExpressionNodeBase e = null; switchT = LT(1); match(TOKEN_KEYWORD_SWITCH); e=statementParenExpression(); sw = new SwitchNode((ASToken)switchT); c.addItem(sw); if(e != null) sw.setConditionalExpression(e); cases(sw); }
/** * Matches an "expression statement". The ASL syntax specification says the * lookahead can not be "[", "{" or "function". Legacy code requires that "<" * be excluded as well. */ public final void expressionStatement( ContainerNode c ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; if (LA(1) == TOKEN_KEYWORD_FUNCTION) { // Recover: continue parsing function as an anonymous function. logSyntaxError(LT(1)); } e=expression(); c.addItem(e); if (!matchOptionalSemicolon()) { recoverFromExpressionStatementMissingSemicolon(e); } }
/** * Matches an "expression statement". The ASL syntax specification says the * lookahead can not be "[", "{" or "function". Legacy code requires that "<" * be excluded as well. */ public final void expressionStatement( ContainerNode c ) throws RecognitionException, TokenStreamException { ExpressionNodeBase e = null; if (LA(1) == TOKEN_KEYWORD_FUNCTION) { // Recover: continue parsing function as an anonymous function. logSyntaxError(LT(1)); } e=expression(); c.addItem(e); if (!matchOptionalSemicolon()) { recoverFromExpressionStatementMissingSemicolon(e); } }
/** * Matches a "with" statement. */ public final void withStatement( ContainerNode c ) throws RecognitionException, TokenStreamException { Token withT = null; WithNode n = null; ExpressionNodeBase e = null; BlockNode b = null; withT = LT(1); match(TOKEN_KEYWORD_WITH); e=statementParenExpression(); n = new WithNode((ASToken)withT); n.setConditionalExpression(e); c.addItem(n); b = n.getContentsNode(); substatement(b); }
/** * Matches a "with" statement. */ public final void withStatement( ContainerNode c ) throws RecognitionException, TokenStreamException { Token withT = null; WithNode n = null; ExpressionNodeBase e = null; BlockNode b = null; withT = LT(1); match(TOKEN_KEYWORD_WITH); e=statementParenExpression(); n = new WithNode((ASToken)withT); n.setConditionalExpression(e); c.addItem(n); b = n.getContentsNode(); substatement(b); }
/** * Matches a "goto" statement. */ public final void gotoStatement( ContainerNode c ) throws RecognitionException, TokenStreamException { IdentifierNode id = null; IterationFlowNode n = null; final ASToken t = LT(1); try { // for error handling match(TOKEN_RESERVED_WORD_GOTO); id=identifier(); n = new IterationFlowNode(t); c.addItem(n); n.setLabel(id); matchOptionalSemicolon(); } catch (RecognitionException ex) { handleParsingError(ex); } }
/** * Matches a default XML namespace statement. For example: * * default xml namespace = "domain"; * */ public final void defaultXMLNamespaceStatement( ContainerNode c ) throws RecognitionException, TokenStreamException { Token defT = null; ExpressionNodeBase e = null; defT = LT(1); match(TOKEN_DIRECTIVE_DEFAULT_XML); match(TOKEN_OPERATOR_ASSIGNMENT); e=assignmentExpression(); DefaultXMLNamespaceNode n = new DefaultXMLNamespaceNode(new KeywordNode((IASToken)defT)); c.addItem(n); n.setExpressionNode(e); matchOptionalSemicolon(); }