case 30: { match(30);
case 50: { match(50);
	public final Expression  function_call(		PathExpr expr	) throws RecognitionException, TokenStreamException, PermissionDeniedException,EXistException {		Expression step;				Token  l = null;		Token  l2 = null;		Token  arg = null;		Token  l3 = null;		Token  l4 = null;		Token  i = null;		Token  f1 = null;		Token  f2 = null;					step = null;			PathExpr path = new PathExpr(pool);			PathExpr arg1 = new PathExpr(pool);			PathExpr arg2 = null;			Function fun = null;		int distance = 1;						switch ( LA(1)) {		case LITERAL_text:		{			match(LITERAL_text);			match(LPAREN);			match(RPAREN);			if ( inputState.guessing==0 ) {											step = new LocationStep(pool, -1, new TypeTest(Constants.TEXT_NODE));							expr.add(step);								}			break;		}		case 29:		{			match(29);			match(LPAREN);			or_expr(path);			match(COMMA);			l = LT(1);			match(CONST);			match(RPAREN);			if ( inputState.guessing==0 ) {										if(path.returnsType() == Constants.TYPE_NODELIST) {				String val = l.getText() + "%";						   step = new OpEquals(pool, path, new Literal(val), Constants.EQ);				expr.add(step);						} else {						   step = new FunStartsWith(pool, path, new Literal(l.getText()));						   expr.add(step);					    }							}			break;		}		case 30:		{			match(30);			match(LPAREN);			or_expr(path);			match(COMMA);			l2 = LT(1);			match(CONST);			match(RPAREN);			if ( inputState.guessing==0 ) {										if(path.returnsType() == Constants.TYPE_NODELIST) {				String val = l2.getText();						   step = new OpEquals(pool, path, new Literal(l2.getText()), 				Constants.EQ);				expr.add(step);						} else {						   step = new FunEndsWith(pool, path, new Literal(l2.getText()));						   expr.add(step);					    }								}			break;		}		case LITERAL_contains:		{			match(LITERAL_contains);			match(LPAREN);			or_expr(path);			match(COMMA);			arg = LT(1);			match(CONST);			match(RPAREN);			if ( inputState.guessing==0 ) {								String term = "%" + arg.getText() + "%";							step =							  new OpEquals(pool, path, new Literal(term), Constants.EQ);				System.out.println(step.pprint());							expr.add(step);								}			break;		}		case LITERAL_match:		{			match(LITERAL_match);			match(LPAREN);			or_expr(path);			match(COMMA);			l3 = LT(1);			match(CONST);			match(RPAREN);			if ( inputState.guessing==0 ) {								if(path.returnsType() == Constants.TYPE_NODELIST) {						step = new OpEquals(pool, path, new Literal(l3.getText()), 				Constants.REGEXP);				expr.add(step);					     }								}			break;		}		case LITERAL_near:		{			match(LITERAL_near);			match(LPAREN);			or_expr(path);			match(COMMA);			l4 = LT(1);			match(CONST);			{			switch ( LA(1)) {			case COMMA:			{				match(COMMA);				i = LT(1);				match(INT);				if ( inputState.guessing==0 ) {					distance = Integer.parseInt(i.getText());				}				break;			}			case RPAREN:			{				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			match(RPAREN);			if ( inputState.guessing==0 ) {								FunNear near = new FunNear(pool);				near.setDistance(distance);				near.setPath(path);					    DBBroker broker = null;					    try {					      broker = pool.get();				Tokenizer tok = broker.getTextEngine().getTokenizer();				tok.setText(l4.getText());				org.exist.storage.analysis.TextToken token;				String next;				while((token = tok.nextToken(true)) != null) {				next = token.getText();				near.addTerm(next);				}					     } finally {					       pool.release(broker);					     }				expr.addPath(near);								}			break;		}		default:			boolean synPredMatched41 = false;			if (((LA(1)==NCNAME) && (LA(2)==LPAREN))) {				int _m41 = mark();				synPredMatched41 = true;				inputState.guessing++;				try {					{					match(NCNAME);					match(LPAREN);					match(RPAREN);					}				}				catch (RecognitionException pe) {					synPredMatched41 = false;				}				rewind(_m41);				inputState.guessing--;			}			if ( synPredMatched41 ) {				f1 = LT(1);				match(NCNAME);				if (!( env.hasFunction(f1.getText()) ))				  throw new SemanticException(" env.hasFunction(f1.getText()) ");				match(LPAREN);				match(RPAREN);				if ( inputState.guessing==0 ) {												fun = Function.createFunction(pool, env.getFunction(f1.getText()));							expr.addPath(fun);										}			}			else {				boolean synPredMatched43 = false;				if (((LA(1)==NCNAME) && (LA(2)==LPAREN))) {					int _m43 = mark();					synPredMatched43 = true;					inputState.guessing++;					try {						{						match(NCNAME);						match(LPAREN);						}					}					catch (RecognitionException pe) {						synPredMatched43 = false;					}					rewind(_m43);					inputState.guessing--;				}				if ( synPredMatched43 ) {					f2 = LT(1);					match(NCNAME);					match(LPAREN);					if ( inputState.guessing==0 ) {														fun = Function.createFunction(pool, env.getFunction(f2.getText()));								expr.addPath(fun);												}					or_expr(arg1);					if ( inputState.guessing==0 ) {						fun.addArgument(arg1);					}					{					_loop45:					do {						if ((LA(1)==COMMA)) {							match(COMMA);							if ( inputState.guessing==0 ) {								arg2 = new PathExpr(pool);							}							or_expr(arg2);							if ( inputState.guessing==0 ) {								fun.addArgument(arg2);							}						}						else {							break _loop45;						}											} while (true);					}					match(RPAREN);				}			else {				throw new NoViableAltException(LT(1), getFilename());			}			}}			return step;		}