Creates an expression from the given token and adds it
    to the stack of the given expression.

    In the case of "and" and "or" expressions the last expression
    is poped from the expression stack to link it to the new
    created one.
2259
def create_and_push_expression(token, expressions):
    
    if token == 'and':
        right_expr = expressions.pop()
        expressions.append(And(expressions.pop(), right_expr))
    elif token == 'or':
        right_expr = expressions.pop()
        expressions.append(Or(expressions.pop(), right_expr))
    elif token == 'not':
        expressions.append(Not(expressions.pop()))
    else:
        expressions.append(Literal(token))
764116
static final Parser<Expression> castOrExpression(Parser<Expression> expr) {
    Parser<Expression> explicitCast =
        Parsers.sequence(paren(TypeLiteralParser.TYPE_LITERAL), expr, CastExpression::new);
    return explicitCast.or(paren(expr));
  }
257941
public final void exclusiveOrExpression() throws RecognitionException {
		int exclusiveOrExpression_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 114) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:5: ( andExpression ( '^' andExpression )* )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:9: andExpression ( '^' andExpression )*
			{
			pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression5158);
			andExpression();
			state._fsp--;
			if (state.failed) return;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:23: ( '^' andExpression )*
			loop146:
			while (true) {
				int alt146=2;
				int LA146_0 = input.LA(1);
				if ( (LA146_0==61) ) {
					alt146=1;
				}

				switch (alt146) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:25: '^' andExpression
					{
					match(input,61,FOLLOW_61_in_exclusiveOrExpression5162); if (state.failed) return;
					pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression5164);
					andExpression();
					state._fsp--;
					if (state.failed) return;
					}
					break;

				default :
					break loop146;
				}
			}

			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 114, exclusiveOrExpression_StartIndex); }

		}
	}
592726
private final IntegerOperand getIntegerOperand(final String expression) {
        final Integer value;

        // Parses the value
        value = Integer.parseInt(expression);

        return new IntegerOperand(value);
    }
560978
@Override
  protected void pushExpression( Expression e )
  {
    assert e != null;
    maybeVerifyDoubleLiterals( e );
    _stack.push( e );
  }
795629
@NonNull
    public Expression or(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new CompoundExpression(Arrays.asList(this, expression), CompoundExpression.OpType.Or);
    }
174918
private static void pushOp(String operation, Stack<MetricExpression> expressions, Stack<String> operations) {
        if (operation.equals("(")) {
            operations.push(operation);
            return;
        }

        if (operation.equals(")")) {
            while (!operations.isEmpty()) {
                String op = operations.pop();
                if (op.equals("("))
                    return;
                doOperation(op, expressions, operations);
            }
        }


        if (operation.equals("*") || operation.equals("/")) {
            if (operations.isEmpty())
                operations.push(operation);
            else {
                String op1 = operations.peek();
                if (!op1.equals("(")) {
                    if (op1.equals("+") || op1.equals("-")) {
                        operations.push(operation);
                    } else {
                        doOperation(operations.pop(), expressions, operations);
                        operations.push(operation);
                    }
                } else {
                    operations.push(operation);
                }

            }
        }
        if (operation.equals("+") || operation.equals("-")) {
            if (operations.isEmpty())
                operations.push(operation);
            else {
                String op1 = operations.peek();
                if (!op1.equals("(")) {
                    doOperation(operations.pop(), expressions, operations);
                }
                operations.push(operation);
            }
        }
    }
1362669
@NonNull
    public Expression add(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new BinaryExpression(this, expression, BinaryExpression.OpType.Add);
    }
419210
public Token add( String word ) {
        Token t = new Token(word);
        push( t );
        return t;
    }
995460
function parseAssignment() {
                    var expr, value, token, content = [];

                    expr = parseAdditive();

                    if (typeof expr !== 'undefined' && expr.subtype === 'variable') {
                        token = lexer.peek();
                        if (matchOp(token, ':=')) {
                            lexer.next();

                            content.push(expr);
                            value = parseAssignment();

                            while (value.subtype === 'assignment') {
                                content = content.concat(value.content);
                                value = value.value;
                            }

                            return new MathLib.Expression({
                                subtype: 'assignment',
                                content: content,
                                value: value
                            });
                        }
                        return expr;
                    }

                    return expr;
                }
1094275
private void processConjunctionExpression(List<TerminalNode> conjunctions) {
    Predicate conjunctionReuse;

    for (int i = conjunctions.size() - 1; i >= 0; i--) {
      Predicate rhs = currentPredicates.removeLast();
      Predicate lhs = currentPredicates.removeLast();

      switch (conjunctions.get(i).getText().toLowerCase()) {
        case "and":
          conjunctionReuse = new And(lhs, rhs);
          break;
        case "or":
          conjunctionReuse = new Or(lhs, rhs);
          break;
        default:
          conjunctionReuse = new Xor(lhs, rhs);
          break;
      }
      currentPredicates.add(conjunctionReuse);
    }
  }
1222814
public void addExpression() {
        SWRL expression = getOWLModel().createSWRLExpression(null);
        if (getOWLValueObject().owlValue().isIndividual()) {
            SWRLIndividual swrlIndividual = swrl().wrapIndividual(getOWLValueObject().owlValue().castTo(OWLIndividual.class));
            Atom atom = swrl().createSameIndividualAtom(swrlIndividual, swrlIndividual);
            expression.setBody(swrl().createList(atom));
            asOWLSResult().addEffect(expression);
        }       
    }
1233528
public static <E> Apply<E> buildAst(List<Expression<E>> rpn) {
        if (rpn.isEmpty()) {
            return null;
        }

        Stack<Apply<E>> stack = new Stack<Apply<E>>();
        for (Expression<E> tok : rpn) {
            if (tok instanceof Arg<?>) {
                stack.push((Arg<E>) tok);
            } else if (tok instanceof Op<?>) {
                try {
                    if (tok instanceof Op.Mon<?>){
                       Apply<E> sub = stack.pop();

                        Op.Mon<E> mon = (Op.Mon<E>) tok;

                        mon.sub = sub;

                        stack.push(mon);
                    }
                    if (tok instanceof Op.Bin<?>) {
                        Apply<E> arg2 = stack.pop();
                        Apply<E> arg1 = stack.pop();

                        Op.Bin<E> bin = (Op.Bin<E>) tok;

                        bin.left = arg1;
                        bin.right = arg2;

                        stack.push(bin);
                    }
                }
                catch (EmptyStackException e) {
                    throw new CompileLogicException(
                            "No argument for operator (stack empty): "
                            + tok.toString());
                }
            }
        }

        if (stack.size() > 1) {
            throw new ApplyLogicException(
                    "Stack has multiple elements after apply: " + stack.toString());
        }

        if (stack.size() == 0) {
            throw new ApplyLogicException(
                    "Stack has zero elements after apply.");
        }

        if (!(stack.peek() instanceof Apply<?>)) {
            throw new ApplyLogicException(
                    "Stack contains non-appliable tokens after apply: " + stack.toString());
        }

        return (stack.pop());
    }
917281
function newLineAfterCompositeExpressions(previous) {
    if (previous.type === 'ExpressionStatement') {
        var expression = previous.expression;

        switch (expression.type) {
            case 'AssignmentExpression':
            case 'BinaryExpression':
                return NEED_EXTRA_NEWLINE_AFTER[expression.right.type];}}}
784139
public ExpressionBuilder or() {
		GroupExpression lastGroupExpression = stack.isEmpty() ? null : stack.peek();

		if (lhsExpression == null) {
			throw new SyntaxException("Syntax exception: OR missing LHS operand");
		} else if (lastGroupExpression == null) {
			GroupExpression or = new GroupExpression(GroupExpression.Type.OR);
			or.add(lhsExpression);
			stack.push(or);
			expression.setExpression(or);
			lhsExpression = null;
		} else if (lastGroupExpression.getType().equals(GroupExpression.Type.OR)) {
			// Keep using the existing OR
			lhsExpression = null;
			return this;
		} else if (lastGroupExpression.getType().equals(GroupExpression.Type.AND)) {
			// AND takes precedence over OR, so we wrap the AND
			// by removing it from any parent expressions and inserting the OR in its place

			GroupExpression and = stack.pop();
			GroupExpression or = new GroupExpression(GroupExpression.Type.OR);

			if (stack.isEmpty()) {
				expression.setExpression(or);
				or.add(and);
			} else {
				// need to get at the parent
				GroupExpression parent = stack.pop();
				parent.remove(and);
				parent.add(or);
				or.add(and);
			}

			stack.push(and);
			stack.push(or);
			lhsExpression = null;
		}

		return this;
	}
888831
void moveExpression(Node expression) {
    // TODO(johnlenz): This is not currently used by the function inliner,
    // as moving the call out of the expression before the actual function call
    // causes additional variables to be introduced.  As the variable
    // inliner is improved, this might be a viable option.

    String resultName = getResultValueName();
    Node injectionPoint = findInjectionPoint(expression);
    checkNotNull(injectionPoint);
    Node injectionPointParent = injectionPoint.getParent();
    checkNotNull(injectionPointParent);
    checkState(NodeUtil.isStatementBlock(injectionPointParent));

    // Replace the expression with a reference to the new name.
    Node expressionParent = expression.getParent();
    expressionParent.replaceChild(
        expression, withType(IR.name(resultName), expression.getJSType()));

    // Re-add the expression at the appropriate place.
    Node newExpressionRoot = NodeUtil.newVarNode(resultName, expression);
    newExpressionRoot.getFirstChild().setJSType(expression.getJSType());
    injectionPointParent.addChildBefore(newExpressionRoot, injectionPoint);

    compiler.reportChangeToEnclosingScope(injectionPointParent);
  }
1169350
def p_andnode_expression(self, t):
    ''' '''
    self.accu.add(Term('vertex', ["and(\""+t[2]+"\")"]))
    t[0] = "and(\""+t[2]+"\")"