break;
primaryExpr_AST= (org.exist.xquery.parser.XQueryAST)astFactory.create(VARIABLE_REF,varName); primaryExpr_AST.copyLexInfo(v_AST);  currentAST.root = primaryExpr_AST; currentAST.child = primaryExpr_AST!=null &&primaryExpr_AST.getFirstChild()!=null ? primaryExpr_AST.getFirstChild() : primaryExpr_AST; currentAST.advanceChildToEnd();
	public final void primaryExpr() throws RecognitionException, TokenStreamException {				traceIn("primaryExpr");		try { // debugging			returnAST = null;			ASTPair currentAST = new ASTPair();			org.exist.xquery.parser.XQueryAST primaryExpr_AST = null;			org.exist.xquery.parser.XQueryAST v_AST = null;			String varName= null;						switch ( LA(1)) {			case NCNAME:			case LITERAL_module:			case LITERAL_namespace:			case XQUERY:			case VERSION:			case LITERAL_default:			case LITERAL_function:			case LITERAL_variable:			case LITERAL_import:			case LITERAL_at:			case LITERAL_as:			case LITERAL_empty:			case LITERAL_item:			case LITERAL_for:			case LITERAL_let:			case LITERAL_some:			case LITERAL_every:			case LITERAL_if:			case LITERAL_order:			case LITERAL_by:			case LITERAL_then:			case LITERAL_else:			case LITERAL_or:			case LITERAL_and:			case LITERAL_cast:			case LITERAL_is:			case LITERAL_isnot:			case LITERAL_div:			case LITERAL_mod:			case LITERAL_union:			case LITERAL_intersect:			case LITERAL_except:			case LITERAL_text:			case LITERAL_node:			case LITERAL_child:			case LITERAL_self:			case LITERAL_attribute:			case LITERAL_descendant:			case 123:			case 124:			case LITERAL_parent:			case LITERAL_ancestor:			case 127:			case 128:			case LITERAL_comment:			case LITERAL_document:			case LITERAL_collection:			{				functionCall();				astFactory.addASTChild(currentAST, returnAST);				primaryExpr_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;				break;			}			case SELF:			{				contextItemExpr();				astFactory.addASTChild(currentAST, returnAST);				primaryExpr_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;				break;			}			case LPAREN:			{				parenthesizedExpr();				astFactory.addASTChild(currentAST, returnAST);				primaryExpr_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;				break;			}			case DOLLAR:			{				match(DOLLAR);				varName=qName();				v_AST = (org.exist.xquery.parser.XQueryAST)returnAST;				astFactory.addASTChild(currentAST, returnAST);				if ( inputState.guessing==0 ) {					primaryExpr_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;										primaryExpr_AST= (org.exist.xquery.parser.XQueryAST)astFactory.create(VARIABLE_REF,varName);					primaryExpr_AST.copyLexInfo(v_AST);										currentAST.root = primaryExpr_AST;					currentAST.child = primaryExpr_AST!=null &&primaryExpr_AST.getFirstChild()!=null ?						primaryExpr_AST.getFirstChild() : primaryExpr_AST;					currentAST.advanceChildToEnd();				}				primaryExpr_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;				break;			}			case LT:			case XML_COMMENT:			case XML_PI:			{				constructor();				astFactory.addASTChild(currentAST, returnAST);				primaryExpr_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;				break;			}			case STRING_LITERAL:			case DOUBLE_LITERAL:			case DECIMAL_LITERAL:			case INTEGER_LITERAL:			{				literal();				astFactory.addASTChild(currentAST, returnAST);				primaryExpr_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			returnAST = primaryExpr_AST;		} finally { // debugging			traceOut("primaryExpr");		}	}