BELScript.g:132:1: statement : outer_term ( relationship ( ( OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN ) | outer_term ) )? ( STATEMENT_COMMENT )? ;
516102
public final BELScriptParser.statement_return statement() throws RecognitionException {
        BELScriptParser.statement_return retval = new BELScriptParser.statement_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token OPEN_PAREN50=null;
        Token CLOSE_PAREN54=null;
        Token STATEMENT_COMMENT56=null;
        BELScriptParser.outer_term_return outer_term48 = null;

        BELScriptParser.relationship_return relationship49 = null;

        BELScriptParser.outer_term_return outer_term51 = null;

        BELScriptParser.relationship_return relationship52 = null;

        BELScriptParser.outer_term_return outer_term53 = null;

        BELScriptParser.outer_term_return outer_term55 = null;


        Object OPEN_PAREN50_tree=null;
        Object CLOSE_PAREN54_tree=null;
        Object STATEMENT_COMMENT56_tree=null;

         paraphrases.push("in statement."); 
        try {
            // BELScript.g:135:5: ( outer_term ( relationship ( ( OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN ) | outer_term ) )? ( STATEMENT_COMMENT )? )
            // BELScript.g:136:5: outer_term ( relationship ( ( OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN ) | outer_term ) )? ( STATEMENT_COMMENT )?
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_outer_term_in_statement677);
            outer_term48=outer_term();

            state._fsp--;

            adaptor.addChild(root_0, outer_term48.getTree());
            // BELScript.g:136:16: ( relationship ( ( OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN ) | outer_term ) )?
            int alt9=2;
            int LA9_0 = input.LA(1);

            if ( ((LA9_0>=103 && LA9_0<=130)) ) {
                alt9=1;
            }
            switch (alt9) {
                case 1 :
                    // BELScript.g:136:17: relationship ( ( OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN ) | outer_term )
                    {
                    pushFollow(FOLLOW_relationship_in_statement680);
                    relationship49=relationship();

                    state._fsp--;

                    adaptor.addChild(root_0, relationship49.getTree());
                    // BELScript.g:136:30: ( ( OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN ) | outer_term )
                    int alt8=2;
                    int LA8_0 = input.LA(1);

                    if ( (LA8_0==OPEN_PAREN) ) {
                        alt8=1;
                    }
                    else if ( ((LA8_0>=44 && LA8_0<=102)) ) {
                        alt8=2;
                    }
                    else {
                        NoViableAltException nvae =
                            new NoViableAltException("", 8, 0, input);

                        throw nvae;
                    }
                    switch (alt8) {
                        case 1 :
                            // BELScript.g:136:31: ( OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN )
                            {
                            // BELScript.g:136:31: ( OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN )
                            // BELScript.g:136:32: OPEN_PAREN outer_term relationship outer_term CLOSE_PAREN
                            {
                            OPEN_PAREN50=(Token)match(input,OPEN_PAREN,FOLLOW_OPEN_PAREN_in_statement684); 
                            OPEN_PAREN50_tree = (Object)adaptor.create(OPEN_PAREN50);
                            adaptor.addChild(root_0, OPEN_PAREN50_tree);

                            pushFollow(FOLLOW_outer_term_in_statement686);
                            outer_term51=outer_term();

                            state._fsp--;

                            adaptor.addChild(root_0, outer_term51.getTree());
                            pushFollow(FOLLOW_relationship_in_statement688);
                            relationship52=relationship();

                            state._fsp--;

                            adaptor.addChild(root_0, relationship52.getTree());
                            pushFollow(FOLLOW_outer_term_in_statement690);
                            outer_term53=outer_term();

                            state._fsp--;

                            adaptor.addChild(root_0, outer_term53.getTree());
                            CLOSE_PAREN54=(Token)match(input,CLOSE_PAREN,FOLLOW_CLOSE_PAREN_in_statement692); 
                            CLOSE_PAREN54_tree = (Object)adaptor.create(CLOSE_PAREN54);
                            adaptor.addChild(root_0, CLOSE_PAREN54_tree);


                            }


                            }
                            break;
                        case 2 :
                            // BELScript.g:136:93: outer_term
                            {
                            pushFollow(FOLLOW_outer_term_in_statement697);
                            outer_term55=outer_term();

                            state._fsp--;

                            adaptor.addChild(root_0, outer_term55.getTree());

                            }
                            break;

                    }


                    }
                    break;

            }

            // BELScript.g:136:107: ( STATEMENT_COMMENT )?
            int alt10=2;
            int LA10_0 = input.LA(1);

            if ( (LA10_0==STATEMENT_COMMENT) ) {
                alt10=1;
            }
            switch (alt10) {
                case 1 :
                    // BELScript.g:136:107: STATEMENT_COMMENT
                    {
                    STATEMENT_COMMENT56=(Token)match(input,STATEMENT_COMMENT,FOLLOW_STATEMENT_COMMENT_in_statement702); 
                    STATEMENT_COMMENT56_tree = (Object)adaptor.create(STATEMENT_COMMENT56);
                    adaptor.addChild(root_0, STATEMENT_COMMENT56_tree);


                    }
                    break;

            }


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

             paraphrases.pop(); 
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
540313
def <<(statement)
      # ActiveTriples::Resource expects: RDF::Statement, Hash, or Array
      statement = RDF::Statement.from(statement) unless statement.is_a? RDF::Statement

      # Only push statement if the statement's predicate is defined on the class
      field_name = field_from_predicate(statement.predicate)
      return unless field_name

      objects = statement.object.is_a?(RDF::Node) && block_given? ? yield : statement.object

      update_field(field_name, *objects) if fields[field_name]
      update_relation(field_name, *objects) if relations[field_name]
    end
950646
function parseConditionalExpression() {
        var expr, previousAllowIn, consequent;

        expr = parseLogicalORExpression();

        if (match('?')) {
            lex();
            previousAllowIn = state.allowIn;
            state.allowIn = true;
            consequent = parseAssignmentExpression();
            state.allowIn = previousAllowIn;
            expect(':');

            expr = {
                type: Syntax.ConditionalExpression,
                test: expr,
                consequent: consequent,
                alternate: parseAssignmentExpression()
            };
        }

        return expr;
    }
973667
function (type, table, expr, tableAlias) {
            tableAlias = tableAlias || {};
            if (type === "cross" && !isUndefinedOrNull(expr)) {
                type = "inner";
            }
            if (type === "fullOuter") {
                throw new QueryError("MySQL does not support FULL OUTER JOIN");
            }
            return this._super(arguments, [type, table, expr, tableAlias]);
        }
445787
def add_statement(self, line: str, lineno: Optional[int] = None) -> None:
        ''''''
        # there can be only one statement block
        if self.category() != 'statements':
            self.values = [line]
        else:
            self.values.append(line)
        if self.statements and self.statements[-1][0] == '!':
            self.statements[-1][-1] += line
        else:
            self.statements.append(['!', line])
        if lineno:
            self.lineno = lineno
1276119
function checkForSemicolonForVariableDeclaration(node) {
				var ancestors = context.getAncestors(),
					parentIndex = ancestors.length - 1,
					parent = ancestors[parentIndex];

				if ((parent.type !== "ForStatement" || parent.init !== node) &&
					(!/^For(?:In|Of)Statement/.test(parent.type) || parent.left !== node)
				) {
					checkForSemicolon(node);
				}
			}
1125058
private final Statement funcStatement(Data data, Body parent) throws TemplateException {
	int pos = data.srcCode.getPos();

	// read 5 tokens (returntype,access modifier,"abstract|final|static","function", function name)
	String str = variableDec(data, false);
	// if there is no token at all we have no function
	if (str == null) {
	    data.srcCode.setPos(pos);
	    return null;
	}
	comments(data);
	String[] tokens = new String[] { str, null, null, null, null };

	tokens[1] = variableDec(data, false);
	comments(data);
	if (tokens[1] != null) {
	    tokens[2] = variableDec(data, false);
	    comments(data);
	    if (tokens[2] != null) {
		tokens[3] = variableDec(data, false);
		comments(data);
		if (tokens[3] != null) {
		    tokens[4] = identifier(data, false);
		    comments(data);
		}
	    }
	}

	// function name
	String functionName = null;
	for (int i = tokens.length - 1; i >= 0; i--) {
	    // first from right is the function name
	    if (tokens[i] != null) {
		functionName = tokens[i];
		tokens[i] = null;
		break;
	    }
	}
	if (functionName == null || functionName.indexOf(',') != -1 || functionName.indexOf('[') != -1) {
	    data.srcCode.setPos(pos);
	    return null;
	}
	// throw new TemplateException(data.srcCode, "invalid syntax");

	String returnType = null;

	// search for "function"
	boolean hasOthers = false, first = true;
	for (int i = tokens.length - 1; i >= 0; i--) {
	    if ("function".equalsIgnoreCase(tokens[i])) {
		// if it is the first "function" (from right) and we had already something else, the syntax is
		// broken!
		if (hasOthers && first) throw new TemplateException(data.srcCode, "invalid syntax");
		// we already have a return type,so this is the 3th "function"!
		else if (returnType != null) throw new TemplateException(data.srcCode, "invalid syntax");
		else if (!first) returnType = tokens[i];
		first = false;
		tokens[i] = null;
	    }
	    else if (tokens[i] != null) {
		hasOthers = true;
	    }
	}
	// no "function" found
	if (first) {
	    data.srcCode.setPos(pos);
	    return null;
	}

	// access modifier
	int _access, access = -1;
	for (int i = 0; i < tokens.length; i++) {
	    if (tokens[i] != null && (_access = ComponentUtil.toIntAccess(tokens[i], -1)) != -1) {
		// we already have an access modifier
		if (access != -1) {
		    // we already have a return type
		    if (returnType != null) throw new TemplateException(data.srcCode, "invalid syntax");
		    returnType = tokens[i];
		}
		else access = _access;
		tokens[i] = null;

	    }
	}
	// no access defined
	if (access == -1) access = Component.ACCESS_PUBLIC;

	// Non access modifier
	int _modifier, modifier = Component.MODIFIER_NONE;
	boolean isStatic = false;
	for (int i = 0; i < tokens.length; i++) {
	    if (tokens[i] != null) {
		_modifier = ComponentUtil.toModifier(tokens[i], Component.MODIFIER_NONE, Component.MODIFIER_NONE);

		// abstract|final
		if (_modifier != Component.MODIFIER_NONE) {
		    // we already have an Non access modifier
		    if (modifier != Component.MODIFIER_NONE || isStatic) {
			// we already have a return type
			if (returnType != null) throw new TemplateException(data.srcCode, "invalid syntax");
			returnType = tokens[i];
		    }
		    else modifier = _modifier;
		    tokens[i] = null;
		}
		// static
		else if (tokens[i].equalsIgnoreCase("static")) {
		    // we already have an Non access modifier
		    if (modifier != Component.MODIFIER_NONE || isStatic) {
			// we already have a return type
			if (returnType != null) throw new TemplateException(data.srcCode, "invalid syntax");
			returnType = tokens[i];
		    }
		    else isStatic = true;
		    tokens[i] = null;
		}
	    }
	}

	// return type
	for (int i = 0; i < tokens.length; i++) {
	    if (tokens[i] != null) {
		if (returnType != null) throw new TemplateException(data.srcCode, "invalid syntax");
		returnType = tokens[i];
	    }
	}

	Position line = data.srcCode.getPosition();

	// comments(data);

	// Name
	if (!data.isCFC && !data.isInterface) {
	    FunctionLibFunction flf = getFLF(data, functionName);
	    try {
		if (flf != null && flf.getFunctionClassDefinition().getClazz() != CFFunction.class) {
		    PageSource ps = null;
		    if (data.srcCode instanceof PageSourceCode) {
			ps = ((PageSourceCode) data.srcCode).getPageSource();
		    }

		    String path = null;
		    if (ps != null) {
			path = ps.getDisplayPath();
			path = path.replace('\\', '/');
		    }
		    if (path == null || path.indexOf("/library/function/") == -1)// TODO make better
			throw new TemplateException(data.srcCode, "The name [" + functionName + "] is already used by a built in Function");
		}
	    }
	    catch (Throwable t) {
		ExceptionUtil.rethrowIfNecessary(t);
		throw new PageRuntimeException(Caster.toPageException(t));
	    }
	}
	Function res = closurePart(data, functionName, access, modifier, returnType, line, false);
	if (isStatic) {

	    if (data.context == CTX_INTERFACE) throw new TemplateException(data.srcCode, "static functions are not allowed within the interface body");

	    TagOther tag = createStaticTag(data, res.getStart());

	    tag.getBody().addStatement(res);
	    return tag;
	}
	return res;
    }
1334954
public void mTokens() throws RecognitionException {
        // InternalXtext.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
        int alt12=47;
        alt12 = dfa12.predict(input);
        switch (alt12) {
            case 1 :
                // InternalXtext.g:1:10: T__11
                {
                mT__11(); 

                }
                break;
            case 2 :
                // InternalXtext.g:1:16: T__12
                {
                mT__12(); 

                }
                break;
            case 3 :
                // InternalXtext.g:1:22: T__13
                {
                mT__13(); 

                }
                break;
            case 4 :
                // InternalXtext.g:1:28: T__14
                {
                mT__14(); 

                }
                break;
            case 5 :
                // InternalXtext.g:1:34: T__15
                {
                mT__15(); 

                }
                break;
            case 6 :
                // InternalXtext.g:1:40: T__16
                {
                mT__16(); 

                }
                break;
            case 7 :
                // InternalXtext.g:1:46: T__17
                {
                mT__17(); 

                }
                break;
            case 8 :
                // InternalXtext.g:1:52: T__18
                {
                mT__18(); 

                }
                break;
            case 9 :
                // InternalXtext.g:1:58: T__19
                {
                mT__19(); 

                }
                break;
            case 10 :
                // InternalXtext.g:1:64: T__20
                {
                mT__20(); 

                }
                break;
            case 11 :
                // InternalXtext.g:1:70: T__21
                {
                mT__21(); 

                }
                break;
            case 12 :
                // InternalXtext.g:1:76: T__22
                {
                mT__22(); 

                }
                break;
            case 13 :
                // InternalXtext.g:1:82: T__23
                {
                mT__23(); 

                }
                break;
            case 14 :
                // InternalXtext.g:1:88: T__24
                {
                mT__24(); 

                }
                break;
            case 15 :
                // InternalXtext.g:1:94: T__25
                {
                mT__25(); 

                }
                break;
            case 16 :
                // InternalXtext.g:1:100: T__26
                {
                mT__26(); 

                }
                break;
            case 17 :
                // InternalXtext.g:1:106: T__27
                {
                mT__27(); 

                }
                break;
            case 18 :
                // InternalXtext.g:1:112: T__28
                {
                mT__28(); 

                }
                break;
            case 19 :
                // InternalXtext.g:1:118: T__29
                {
                mT__29(); 

                }
                break;
            case 20 :
                // InternalXtext.g:1:124: T__30
                {
                mT__30(); 

                }
                break;
            case 21 :
                // InternalXtext.g:1:130: T__31
                {
                mT__31(); 

                }
                break;
            case 22 :
                // InternalXtext.g:1:136: T__32
                {
                mT__32(); 

                }
                break;
            case 23 :
                // InternalXtext.g:1:142: T__33
                {
                mT__33(); 

                }
                break;
            case 24 :
                // InternalXtext.g:1:148: T__34
                {
                mT__34(); 

                }
                break;
            case 25 :
                // InternalXtext.g:1:154: T__35
                {
                mT__35(); 

                }
                break;
            case 26 :
                // InternalXtext.g:1:160: T__36
                {
                mT__36(); 

                }
                break;
            case 27 :
                // InternalXtext.g:1:166: T__37
                {
                mT__37(); 

                }
                break;
            case 28 :
                // InternalXtext.g:1:172: T__38
                {
                mT__38(); 

                }
                break;
            case 29 :
                // InternalXtext.g:1:178: T__39
                {
                mT__39(); 

                }
                break;
            case 30 :
                // InternalXtext.g:1:184: T__40
                {
                mT__40(); 

                }
                break;
            case 31 :
                // InternalXtext.g:1:190: T__41
                {
                mT__41(); 

                }
                break;
            case 32 :
                // InternalXtext.g:1:196: T__42
                {
                mT__42(); 

                }
                break;
            case 33 :
                // InternalXtext.g:1:202: T__43
                {
                mT__43(); 

                }
                break;
            case 34 :
                // InternalXtext.g:1:208: T__44
                {
                mT__44(); 

                }
                break;
            case 35 :
                // InternalXtext.g:1:214: T__45
                {
                mT__45(); 

                }
                break;
            case 36 :
                // InternalXtext.g:1:220: T__46
                {
                mT__46(); 

                }
                break;
            case 37 :
                // InternalXtext.g:1:226: T__47
                {
                mT__47(); 

                }
                break;
            case 38 :
                // InternalXtext.g:1:232: T__48
                {
                mT__48(); 

                }
                break;
            case 39 :
                // InternalXtext.g:1:238: T__49
                {
                mT__49(); 

                }
                break;
            case 40 :
                // InternalXtext.g:1:244: T__50
                {
                mT__50(); 

                }
                break;
            case 41 :
                // InternalXtext.g:1:250: RULE_ID
                {
                mRULE_ID(); 

                }
                break;
            case 42 :
                // InternalXtext.g:1:258: RULE_INT
                {
                mRULE_INT(); 

                }
                break;
            case 43 :
                // InternalXtext.g:1:267: RULE_STRING
                {
                mRULE_STRING(); 

                }
                break;
            case 44 :
                // InternalXtext.g:1:279: RULE_ML_COMMENT
                {
                mRULE_ML_COMMENT(); 

                }
                break;
            case 45 :
                // InternalXtext.g:1:295: RULE_SL_COMMENT
                {
                mRULE_SL_COMMENT(); 

                }
                break;
            case 46 :
                // InternalXtext.g:1:311: RULE_WS
                {
                mRULE_WS(); 

                }
                break;
            case 47 :
                // InternalXtext.g:1:319: RULE_ANY_OTHER
                {
                mRULE_ANY_OTHER(); 

                }
                break;

        }

    }
71825
public final BELStatementParser.term_return term() throws RecognitionException {
        BELStatementParser.term_return retval = new BELStatementParser.term_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token OPEN_PAREN6=null;
        Token char_literal7=null;
        Token CLOSE_PAREN8=null;
        BELStatementParser.function_return pfv = null;

        BELStatementParser.term_return it = null;

        BELStatementParser.param_return pp = null;


        Object OPEN_PAREN6_tree=null;
        Object char_literal7_tree=null;
        Object CLOSE_PAREN8_tree=null;

        try {
            // BELStatement.g:114:22: (pfv= function OPEN_PAREN ( ( ',' )? (it= term | pp= param ) )* CLOSE_PAREN )
            // BELStatement.g:115:5: pfv= function OPEN_PAREN ( ( ',' )? (it= term | pp= param ) )* CLOSE_PAREN
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_function_in_term416);
            pfv=function();

            state._fsp--;

            adaptor.addChild(root_0, pfv.getTree());

                    final Term parentTerm = new Term((pfv!=null?pfv.r:null));
                
            OPEN_PAREN6=(Token)match(input,OPEN_PAREN,FOLLOW_OPEN_PAREN_in_term424); 
            OPEN_PAREN6_tree = (Object)adaptor.create(OPEN_PAREN6);
            adaptor.addChild(root_0, OPEN_PAREN6_tree);

            // BELStatement.g:119:5: ( ( ',' )? (it= term | pp= param ) )*
            loop8:
            do {
                int alt8=2;
                int LA8_0 = input.LA(1);

                if ( ((LA8_0>=NS_PREFIX && LA8_0<=QUOTED_VALUE)||(LA8_0>=16 && LA8_0<=75)) ) {
                    alt8=1;
                }


                switch (alt8) {
            	case 1 :
            	    // BELStatement.g:120:9: ( ',' )? (it= term | pp= param )
            	    {
            	    // BELStatement.g:120:9: ( ',' )?
            	    int alt6=2;
            	    int LA6_0 = input.LA(1);

            	    if ( (LA6_0==16) ) {
            	        alt6=1;
            	    }
            	    switch (alt6) {
            	        case 1 :
            	            // BELStatement.g:120:9: ','
            	            {
            	            char_literal7=(Token)match(input,16,FOLLOW_16_in_term440); 
            	            char_literal7_tree = (Object)adaptor.create(char_literal7);
            	            adaptor.addChild(root_0, char_literal7_tree);


            	            }
            	            break;

            	    }

            	    // BELStatement.g:121:9: (it= term | pp= param )
            	    int alt7=2;
            	    int LA7_0 = input.LA(1);

            	    if ( ((LA7_0>=17 && LA7_0<=75)) ) {
            	        alt7=1;
            	    }
            	    else if ( ((LA7_0>=NS_PREFIX && LA7_0<=QUOTED_VALUE)) ) {
            	        alt7=2;
            	    }
            	    else {
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 7, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt7) {
            	        case 1 :
            	            // BELStatement.g:121:10: it= term
            	            {
            	            pushFollow(FOLLOW_term_in_term454);
            	            it=term();

            	            state._fsp--;

            	            adaptor.addChild(root_0, it.getTree());

            	                        parentTerm.addFunctionArgument((it!=null?it.r:null));
            	                    

            	            }
            	            break;
            	        case 2 :
            	            // BELStatement.g:124:9: pp= param
            	            {
            	            pushFollow(FOLLOW_param_in_term470);
            	            pp=param();

            	            state._fsp--;

            	            adaptor.addChild(root_0, pp.getTree());
            	             parentTerm.addFunctionArgument((pp!=null?pp.r:null)); 

            	            }
            	            break;

            	    }


            	    }
            	    break;

            	default :
            	    break loop8;
                }
            } while (true);

            CLOSE_PAREN8=(Token)match(input,CLOSE_PAREN,FOLLOW_CLOSE_PAREN_in_term486); 
            CLOSE_PAREN8_tree = (Object)adaptor.create(CLOSE_PAREN8);
            adaptor.addChild(root_0, CLOSE_PAREN8_tree);


                    retval.r = parentTerm;
                

            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
923237
public final BELScriptParser.outer_term_return outer_term() throws RecognitionException {
        BELScriptParser.outer_term_return retval = new BELScriptParser.outer_term_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token OPEN_PAREN58=null;
        Token char_literal59=null;
        Token CLOSE_PAREN61=null;
        BELScriptParser.function_return function57 = null;

        BELScriptParser.argument_return argument60 = null;


        Object OPEN_PAREN58_tree=null;
        Object char_literal59_tree=null;
        Object CLOSE_PAREN61_tree=null;

        try {
            // BELScript.g:139:11: ( function OPEN_PAREN ( ( ',' )? argument )* CLOSE_PAREN )
            // BELScript.g:140:5: function OPEN_PAREN ( ( ',' )? argument )* CLOSE_PAREN
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_function_in_outer_term723);
            function57=function();

            state._fsp--;

            adaptor.addChild(root_0, function57.getTree());
            OPEN_PAREN58=(Token)match(input,OPEN_PAREN,FOLLOW_OPEN_PAREN_in_outer_term725); 
            OPEN_PAREN58_tree = (Object)adaptor.create(OPEN_PAREN58);
            adaptor.addChild(root_0, OPEN_PAREN58_tree);

            // BELScript.g:140:25: ( ( ',' )? argument )*
            loop12:
            do {
                int alt12=2;
                int LA12_0 = input.LA(1);

                if ( (LA12_0==OBJECT_IDENT||LA12_0==QUOTED_VALUE||LA12_0==NS_PREFIX||(LA12_0>=43 && LA12_0<=102)) ) {
                    alt12=1;
                }


                switch (alt12) {
            	case 1 :
            	    // BELScript.g:140:26: ( ',' )? argument
            	    {
            	    // BELScript.g:140:26: ( ',' )?
            	    int alt11=2;
            	    int LA11_0 = input.LA(1);

            	    if ( (LA11_0==43) ) {
            	        alt11=1;
            	    }
            	    switch (alt11) {
            	        case 1 :
            	            // BELScript.g:140:26: ','
            	            {
            	            char_literal59=(Token)match(input,43,FOLLOW_43_in_outer_term728); 
            	            char_literal59_tree = (Object)adaptor.create(char_literal59);
            	            adaptor.addChild(root_0, char_literal59_tree);


            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_argument_in_outer_term731);
            	    argument60=argument();

            	    state._fsp--;

            	    adaptor.addChild(root_0, argument60.getTree());

            	    }
            	    break;

            	default :
            	    break loop12;
                }
            } while (true);

            CLOSE_PAREN61=(Token)match(input,CLOSE_PAREN,FOLLOW_CLOSE_PAREN_in_outer_term735); 
            CLOSE_PAREN61_tree = (Object)adaptor.create(CLOSE_PAREN61);
            adaptor.addChild(root_0, CLOSE_PAREN61_tree);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
713319
public final void synpred222_Java_fragment() throws RecognitionException {
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1170:27: ( relationalOp shiftExpression )
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1170:27: relationalOp shiftExpression
		{
		pushFollow(FOLLOW_relationalOp_in_synpred222_Java5278);
		relationalOp();
		state._fsp--;
		if (state.failed) return;
		pushFollow(FOLLOW_shiftExpression_in_synpred222_Java5280);
		shiftExpression();
		state._fsp--;
		if (state.failed) return;
		}

	}
361720
StatementDMQL compileDeleteStatement(RangeVariable[] outerRanges) {

        Expression condition       = null;
        boolean    truncate        = false;
        boolean    restartIdentity = false;

        switch (token.tokenType) {

            case Tokens.TRUNCATE : {
                read();
                readThis(Tokens.TABLE);

                truncate = true;

                break;
            }
            case Tokens.DELETE : {
                read();
                readThis(Tokens.FROM);

                break;
            }
        }

        RangeVariable[] rangeVariables = {
            readSimpleRangeVariable(StatementTypes.DELETE_WHERE) };
        Table table     = rangeVariables[0].getTable();
        Table baseTable = table.getBaseTable();

        /* A VoltDB Extension.
         * Views from Streams are now updatable.
         * Comment out this guard and check if it is a view
         * from Stream or PersistentTable in planner.
        if (!table.isUpdatable()) {
            throw Error.error(ErrorCode.X_42000);
        }
        A VoltDB Extension */

        if (truncate) {
            switch (token.tokenType) {

                case Tokens.CONTINUE : {
                    read();
                    readThis(Tokens.IDENTITY);

                    break;
                }
                case Tokens.RESTART : {
                    read();
                    readThis(Tokens.IDENTITY);

                    restartIdentity = true;

                    break;
                }
            }

            for (int i = 0; i < table.constraintList.length; i++) {
                if (table.constraintList[i].getConstraintType()
                        == Constraint.MAIN) {
                    throw Error.error(ErrorCode.X_23501);
                }
            }
        }

        if (truncate && table != baseTable) {
            throw Error.error(ErrorCode.X_42000);
        }

        if (!truncate && token.tokenType == Tokens.WHERE) {
            read();

            condition = XreadBooleanValueExpression();

            HsqlList unresolved =
                condition.resolveColumnReferences(outerRanges, null);

            unresolved = Expression.resolveColumnSet(rangeVariables,
                    unresolved, null);

            ExpressionColumn.checkColumnsResolved(unresolved);
            condition.resolveTypes(session, null);

            if (condition.isParam()) {
                condition.dataType = Type.SQL_BOOLEAN;
            }

            if (condition.getDataType() != Type.SQL_BOOLEAN) {
                throw Error.error(ErrorCode.X_42568);
            }
        }

        // VoltDB Extension:
        // baseTable could be null for stream views.
        if (baseTable != null && table != baseTable) {
            QuerySpecification select =
                ((TableDerived) table).getQueryExpression().getMainSelect();

            if (condition != null) {
                condition =
                    condition.replaceColumnReferences(rangeVariables[0],
                                                      select.exprColumns);
            }

            rangeVariables[0] = new RangeVariable(select.rangeVariables[0]);
            condition = ExpressionLogical.andExpressions(select.queryCondition,
                    condition);
        }

        if (condition != null) {
            RangeVariableResolver resolver =
                new RangeVariableResolver(rangeVariables, condition,
                                          compileContext);

            resolver.processConditions();

            rangeVariables = resolver.rangeVariables;
        }

        // VoltDB Extension:
        // This needs to be done before building the compiled statement
        // so that parameters in LIMIT or OFFSET are retrieved from
        // the compileContext
        SortAndSlice sas = voltGetSortAndSliceForDelete(rangeVariables);

        StatementDMQL cs = new StatementDML(session, table, rangeVariables,
                                            compileContext, restartIdentity);

        // VoltDB Extension:
        voltAppendDeleteSortAndSlice((StatementDML)cs, sas);

        return cs;
    }
1090212
public final BELScriptWalker.outer_term_return outer_term() throws RecognitionException {
        BELScriptWalker.outer_term_return retval = new BELScriptWalker.outer_term_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        CommonTree _first_0 = null;
        CommonTree _last = null;

        CommonTree op=null;
        CommonTree c=null;
        CommonTree cp=null;
        BELScriptWalker.function_return f = null;

        BELScriptWalker.argument_return a = null;


        CommonTree op_tree=null;
        CommonTree c_tree=null;
        CommonTree cp_tree=null;


            final StringBuilder tBuilder = new StringBuilder();

        try {
            // BELScriptWalker.g:414:1: (f= function op= OPEN_PAREN ( (c= ',' )? a= argument )* cp= CLOSE_PAREN )
            // BELScriptWalker.g:415:5: f= function op= OPEN_PAREN ( (c= ',' )? a= argument )* cp= CLOSE_PAREN
            {
            root_0 = (CommonTree)adaptor.nil();

            _last = (CommonTree)input.LT(1);
            pushFollow(FOLLOW_function_in_outer_term613);
            f=function();

            state._fsp--;

            adaptor.addChild(root_0, f.getTree());

                    tBuilder.append(f.r);
                
            _last = (CommonTree)input.LT(1);
            op=(CommonTree)match(input,OPEN_PAREN,FOLLOW_OPEN_PAREN_in_outer_term619); 
            op_tree = (CommonTree)adaptor.dupNode(op);

            adaptor.addChild(root_0, op_tree);


                    tBuilder.append(op.getText());
                
            // BELScriptWalker.g:419:7: ( (c= ',' )? a= argument )*
            loop15:
            do {
                int alt15=2;
                int LA15_0 = input.LA(1);

                if ( (LA15_0==OBJECT_IDENT||LA15_0==QUOTED_VALUE||LA15_0==NS_PREFIX||(LA15_0>=43 && LA15_0<=102)) ) {
                    alt15=1;
                }


                switch (alt15) {
            	case 1 :
            	    // BELScriptWalker.g:419:8: (c= ',' )? a= argument
            	    {
            	    // BELScriptWalker.g:419:9: (c= ',' )?
            	    int alt14=2;
            	    int LA14_0 = input.LA(1);

            	    if ( (LA14_0==43) ) {
            	        alt14=1;
            	    }
            	    switch (alt14) {
            	        case 1 :
            	            // BELScriptWalker.g:419:9: c= ','
            	            {
            	            _last = (CommonTree)input.LT(1);
            	            c=(CommonTree)match(input,43,FOLLOW_43_in_outer_term626); 
            	            c_tree = (CommonTree)adaptor.dupNode(c);

            	            adaptor.addChild(root_0, c_tree);


            	            }
            	            break;

            	    }


            	            if (c != null) {
            	                tBuilder.append(c.getText());
            	            }
            	        
            	    _last = (CommonTree)input.LT(1);
            	    pushFollow(FOLLOW_argument_in_outer_term633);
            	    a=argument();

            	    state._fsp--;

            	    adaptor.addChild(root_0, a.getTree());

            	            tBuilder.append(a.r);
            	        

            	    }
            	    break;

            	default :
            	    break loop15;
                }
            } while (true);

            _last = (CommonTree)input.LT(1);
            cp=(CommonTree)match(input,CLOSE_PAREN,FOLLOW_CLOSE_PAREN_in_outer_term641); 
            cp_tree = (CommonTree)adaptor.dupNode(cp);

            adaptor.addChild(root_0, cp_tree);


                    tBuilder.append(cp.getText());
                    retval.r = tBuilder.toString();
                

            }

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return retval;
    }
394586
def parse_belscript(lines):
    

    nanopubs_metadata = {}
    annotations = {}
    assertions = []

    # # Turn a list into an iterator
    # if not isinstance(lines, collections.Iterator):
    #     lines = iter(lines)

    line_num = 0

    # for line in preprocess_belscript(lines):
    for line in set_single_line(lines):

        line_num += 1
        # Get rid of trailing comments
        line = re.sub("\/\/.*?$", "", line)

        line = line.rstrip()

        # Collapse continuation lines
        while re.search("\\\s*$", line):
            line = line.replace("\\", "") + next(lines)

        # Process lines #################################
        if re.match("\s*#", line) or re.match("\s*$", line):
            # Skip comments and empty lines
            continue
        elif re.match("SET DOCUMENT", line):
            nanopubs_metadata = process_documentline(line, nanopubs_metadata)
        elif re.match("DEFINE", line):
            nanopubs_metadata = process_definition(line, nanopubs_metadata)
        elif re.match("UNSET", line):

            # Process any assertions prior to changing annotations
            if assertions:
                yield yield_nanopub(assertions, annotations, line_num)
                assertions = []
            annotations = process_unset(line, annotations)

        elif re.match("SET", line):
            # Create nanopubs metadata prior to starting BEL Script statements section
            if nanopubs_metadata:
                yield yield_metadata(nanopubs_metadata)
                nanopubs_metadata = {}

            # Process any assertions prior to changing annotations
            if assertions:
                yield yield_nanopub(assertions, annotations, line_num)
                assertions = []

            annotations = process_set(line, annotations)

        else:
            assertions.append(line)

    # Catch any leftover bel statements
    yield_nanopub(assertions, annotations, line_num)
574339
public final void mQUOTED_VALUE() throws RecognitionException {
        try {
            int _type = QUOTED_VALUE;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // BELStatement.g:287:13: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
            // BELStatement.g:288:5: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
            {
            match('\"'); 
            // BELStatement.g:288:9: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
            loop3:
            do {
                int alt3=3;
                int LA3_0 = input.LA(1);

                if ( (LA3_0=='\\') ) {
                    alt3=1;
                }
                else if ( ((LA3_0>='\u0000' && LA3_0<='!')||(LA3_0>='#' && LA3_0<='[')||(LA3_0>=']' && LA3_0<='\uFFFF')) ) {
                    alt3=2;
                }


                switch (alt3) {
            	case 1 :
            	    // BELStatement.g:288:11: EscapeSequence
            	    {
            	    mEscapeSequence(); 

            	    }
            	    break;
            	case 2 :
            	    // BELStatement.g:288:28: ~ ( '\\\\' | '\"' )
            	    {
            	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
            	        input.consume();

            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        recover(mse);
            	        throw mse;}


            	    }
            	    break;

            	default :
            	    break loop3;
                }
            } while (true);

            match('\"'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
1049194
def p_statement_return(p):
    ''''''
    if len(p) == 3:
        p[0] = ast.Return(None, lineno=p.lineno(1))
    else:
        p[0] = ast.Return(p[2], lineno=p.lineno(1))
171275
def get_degenerate_statements(self):
        
        logger.info("Checking for 'degenerate' statements...\n")
        # Get rules of type protein X -> activity Y
        q_stmts = prefixes + """
            SELECT ?stmt
            WHERE {
                ?stmt a belvoc:Statement .
                ?stmt belvoc:hasSubject ?subj .
                ?stmt belvoc:hasObject ?obj .
                {
                  { ?stmt belvoc:hasRelationship belvoc:DirectlyIncreases . }
                  UNION
                  { ?stmt belvoc:hasRelationship belvoc:DirectlyDecreases . }
                }
                {
                  { ?subj a belvoc:ProteinAbundance . }
                  UNION
                  { ?subj a belvoc:ModifiedProteinAbundance . }
                }
                ?subj belvoc:hasConcept ?xName .
                {
                  {
                    ?obj a belvoc:ProteinAbundance .
                    ?obj belvoc:hasConcept ?yName .
                  }
                  UNION
                  {
                    ?obj a belvoc:ModifiedProteinAbundance .
                    ?obj belvoc:hasChild ?proteinY .
                    ?proteinY belvoc:hasConcept ?yName .
                  }
                  UNION
                  {
                    ?obj a belvoc:AbundanceActivity .
                    ?obj belvoc:hasChild ?objChild .
                    ?objChild a belvoc:ProteinAbundance .
                    ?objChild belvoc:hasConcept ?yName .
                  }
                }
                FILTER (?xName != ?yName)
            }
        """
        res_stmts = self.g.query(q_stmts)

        logger.info("Protein -> Protein/Activity statements:")
        logger.info("---------------------------------------")
        for stmt in res_stmts:
            stmt_str = strip_statement(stmt[0])
            logger.info(stmt_str)
            self.degenerate_stmts.append(stmt_str)