$ANTLR start "COMPARE_OPER"
340058
public final void mCOMPARE_OPER() throws RecognitionException {
		try {
			int _type = COMPARE_OPER;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// druidG.g:708:15: ( ( '<' | '>' ) )
			// druidG.g:
			{
			if ( input.LA(1)=='<'||input.LA(1)=='>' ) {
				input.consume();
			}
			else {
				MismatchedSetException mse = new MismatchedSetException(null,input);
				recover(mse);
				throw mse;
			}
			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
607239
public final AntlrDatatypeRuleToken ruleOpOr() throws RecognitionException {
        AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();

        Token kw=null;


        	enterRule();

        try {
            // InternalPureXbase.g:1112:2: (kw= '||' )
            // InternalPureXbase.g:1113:2: kw= '||'
            {
            kw=(Token)match(input,31,FOLLOW_2); if (state.failed) return current;
            if ( state.backtracking==0 ) {

              		current.merge(kw);
              		newLeafNode(kw, grammarAccess.getOpOrAccess().getVerticalLineVerticalLineKeyword());
              	
            }

            }

            if ( state.backtracking==0 ) {

              	leaveRule();

            }
        }

            catch (RecognitionException re) {
                recover(input,re);
                appendSkippedTokens();
            }
        finally {
        }
        return current;
    }
516600
def eval_expr(expr_str, show_tokens=False, showast=False,
              showgrammar=False, compile_mode='exec'):
    

    parser_debug = {'rules': False, 'transition': False,
                    'reduce': showgrammar,
                    'errorstack': True, 'context': True }
    parsed = parse_expr(expr_str, show_tokens=show_tokens,
                        parser_debug=parser_debug)
    if showast:
        print(parsed)

    assert parsed == 'expr', 'Should have parsed grammar start'

    evaluator = ExprEvaluator()

    # What we've been waiting for: Generate source from AST!
    return evaluator.traverse(parsed)
510109
public final void ruleOpCompare() throws RecognitionException {

        		int stackSize = keepStackSize();
        	
        try {
            // InternalXbase.g:346:2: ( ( ( rule__OpCompare__Alternatives ) ) )
            // InternalXbase.g:347:2: ( ( rule__OpCompare__Alternatives ) )
            {
            // InternalXbase.g:347:2: ( ( rule__OpCompare__Alternatives ) )
            // InternalXbase.g:348:3: ( rule__OpCompare__Alternatives )
            {
            if ( state.backtracking==0 ) {
               before(grammarAccess.getOpCompareAccess().getAlternatives()); 
            }
            // InternalXbase.g:349:3: ( rule__OpCompare__Alternatives )
            // InternalXbase.g:349:4: rule__OpCompare__Alternatives
            {
            pushFollow(FOLLOW_2);
            rule__OpCompare__Alternatives();

            state._fsp--;
            if (state.failed) return ;

            }

            if ( state.backtracking==0 ) {
               after(grammarAccess.getOpCompareAccess().getAlternatives()); 
            }

            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {

            	restoreStackSize(stackSize);

        }
        return ;
    }
1307517
def visit_Compare(self, node):
        """"""

        if len(node.ops) > 1:
            func = Name(id=self._prefix + 'napi_compare', ctx=Load())
            args = [node.left,
                    List(elts=[Str(op.__class__.__name__)
                               for op in node.ops], ctx=Load()),
                    List(elts=node.comparators, ctx=Load())]
            node = Call(func=func, args=args, keywords=self._kwargs)
            fml(node)
        self.generic_visit(node)
        return node
82550
def on_compare(self, node):  # ('left', 'ops', 'comparators')
        """"""
        lval = self.run(node.left)
        out = True
        for op, rnode in zip(node.ops, node.comparators):
            rval = self.run(rnode)
            out = op2func(op)(lval, rval)
            lval = rval
            if self.use_numpy and isinstance(out, numpy.ndarray) and out.any():
                break
            elif not out:
                break
        return out
1971
private static Parser<Expression> compare(
      Parser<Expression> operand, String name, Op op) {
    return Parsers.sequence(
        operand, term(name).retn(op), operand,
        BinaryExpression::new);
  }
736117
public final void mBOOLEAN() throws RecognitionException {
        try {
            int _type = BOOLEAN;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // /home/victor/srec/core/src/main/antlr/srec.g:114:2: ( 'true' | 'false' )
            int alt1=2;
            int LA1_0 = input.LA(1);

            if ( (LA1_0=='t') ) {
                alt1=1;
            }
            else if ( (LA1_0=='f') ) {
                alt1=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 1, 0, input);

                throw nvae;
            }
            switch (alt1) {
                case 1 :
                    // /home/victor/srec/core/src/main/antlr/srec.g:114:4: 'true'
                    {
                    match("true"); 


                    }
                    break;
                case 2 :
                    // /home/victor/srec/core/src/main/antlr/srec.g:114:13: 'false'
                    {
                    match("false"); 


                    }
                    break;

            }
            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
1063146
public final String entryRuleOpEquality() throws RecognitionException {
        String current = null;

        AntlrDatatypeRuleToken iv_ruleOpEquality = null;


        try {
            // InternalXbase.g:639:50: (iv_ruleOpEquality= ruleOpEquality EOF )
            // InternalXbase.g:640:2: iv_ruleOpEquality= ruleOpEquality EOF
            {
            if ( state.backtracking==0 ) {
               newCompositeNode(grammarAccess.getOpEqualityRule()); 
            }
            pushFollow(FOLLOW_1);
            iv_ruleOpEquality=ruleOpEquality();

            state._fsp--;
            if (state.failed) return current;
            if ( state.backtracking==0 ) {
               current =iv_ruleOpEquality.getText(); 
            }
            match(input,EOF,FOLLOW_2); if (state.failed) return current;

            }

        }

            catch (RecognitionException re) {
                recover(input,re);
                appendSkippedTokens();
            }
        finally {
        }
        return current;
    }
781343
public final void mEQUALS_ASSIGN() throws RecognitionException {
		try {
			int _type = EQUALS_ASSIGN;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:234:5: ( '=' )
			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:234:7: '='
			{
			match('='); if (state.failed) return;
			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
1000935
def _impl(lexer):
    """"""
    p = _sumterm(lexer)

    tok = next(lexer)
    # SUMTERM '=>' IMPL
    if isinstance(tok, OP_rarrow):
        q = _impl(lexer)
        return ('implies', p, q)
    # SUMTERM '<=>' IMPL
    elif isinstance(tok, OP_lrarrow):
        q = _impl(lexer)
        return ('equal', p, q)
    # SUMTERM
    else:
        lexer.unpop_token(tok)
        return p
1325547
function Compare( $a, $b )
	{
		if ( $a instanceof UntypedAtomic || $a instanceof AnyUriValue )
		{
			$a = $a->ToString();
		}

		if ( $b instanceof UntypedAtomic || $b instanceof AnyUriValue )
		{
			$b = $b->ToString();
		}

		if ( is_float( $a ) && is_nan( $a ) && is_float( $b ) && is_nan( $b )  )
		{
			return 0;
		}

		if ( ! is_null( $this->collation ) && is_string( $a ) && is_string( $b ) )
		{
			if ( $this->collation == "http://www.w3.org/2005/xpath-functions/collation/codepoint" )
			{
				$a = \normalizer_normalize( $a, \Normalizer::FORM_C );
				$b = \normalizer_normalize( $b, \Normalizer::FORM_C );

				return strcmp( $a, $b );
			}
			else
			{
				return strcoll( $a, $b ) == 0;
			}
		}

		if ( true )
		{
			$aTypeCode = $a instanceof XPath2Item ? $a->getSchemaType()->TypeCode : ( is_string( $a ) ? XmlTypeCode::String : XmlTypeCode::AnyAtomicType );
			$bTypeCode = $b instanceof XPath2Item ? $b->getSchemaType()->TypeCode : ( is_string( $b ) ? XmlTypeCode::String : XmlTypeCode::AnyAtomicType );
			$numericTypes =& DistinctComparer::$numericTypes;
			$durationTypes =& DistinctComparer::$durationTypes;

			if ( $aTypeCode != $bTypeCode )
			{
				// Handle the exceptions
				$exceptions = (
					( $aTypeCode == XmlTypeCode::Integer && in_array( $bTypeCode, $numericTypes ) ) ||
				 	( $bTypeCode == XmlTypeCode::Integer && in_array( $aTypeCode, $numericTypes ) ) ||
					( $aTypeCode == XmlTypeCode::Decimal && in_array( $bTypeCode, $numericTypes ) ) ||
					( $bTypeCode == XmlTypeCode::Decimal && in_array( $aTypeCode, $numericTypes ) ) ||
					( $aTypeCode == XmlTypeCode::Double && in_array( $bTypeCode, $numericTypes ) ) ||
					( $bTypeCode == XmlTypeCode::Double && in_array( $aTypeCode, $numericTypes ) ) ||
					( $aTypeCode == XmlTypeCode::Float && in_array( $bTypeCode, $numericTypes ) ) ||
					( $bTypeCode == XmlTypeCode::Float && in_array( $aTypeCode, $numericTypes ) ) ||

					( $aTypeCode == XmlTypeCode::YearMonthDuration && in_array( $bTypeCode, $durationTypes ) ) ||
					( $bTypeCode == XmlTypeCode::YearMonthDuration && in_array( $aTypeCode, $durationTypes ) ) ||
					( $aTypeCode == XmlTypeCode::DayTimeDuration && in_array( $bTypeCode, $durationTypes ) ) ||
					( $bTypeCode == XmlTypeCode::DayTimeDuration && in_array( $aTypeCode, $durationTypes ) )
				);
				if ( ! $exceptions )
				{
					return 1;
				}
			}

			// Check for NaN in numeric XPath2Item
			if ( in_array( $aTypeCode, $numericTypes ) && in_array( $bTypeCode, $numericTypes ) )
			{
				$aValue = $a->getTypedValue();
				$bValue = $b->getTypedValue();

				if ( ! is_object( $aValue ) && ! is_object( $bValue ) && is_nan( $aValue ) && is_nan( $bValue ) )
				{
					return 0;
				}
			}

			if ( in_array( $aTypeCode, $durationTypes ) && in_array( $bTypeCode, $durationTypes ) )
			{
				$a = $a->getTypedValue();
				$b = $b->getTypedValue();
			}
		}

		if ( ! is_object( $a ) && ! is_object( $b ) )
		{
			if ( $a == $b )
			{
				return 0;
			}
		}
		else if ( is_object( $a ) && is_object( $b ) && method_exists( $a, "Equals" ) && method_exists( $b, "Equals" ) )
		{
			if ( $a->Equals( $b ) )
			{
				return 0;
			}
		}

		$res;
		if ( ValueProxy::EqValues( $a, $b, $res ) && $res )
    		return 0;

		if ( ValueProxy::GtValues( $a, $b, $res ) && $res )
			return 1;

		return -1;
	}
1046137
private static int compareObject(Object a, Object b, final ASTNode node1, final ASTNode node2, String type)
	{
		if (a instanceof Comparable && b instanceof Comparable)
		{
			Comparable ac = (Comparable) a;
			try
			{
				int result = ac.compareTo(b);
				if (result > 0)
					return 1;
				else if (result < 0)
					return -1;
				return result;
			}

			catch (RuntimeException e)
			{
				BeetlException ex = new BeetlException(BeetlException.EXPRESSION_NOT_COMPATIBLE, e);
				GrammarToken token = GrammarToken.createToken(node1.token.text + " " + node2.token.text,
						node1.token.line);
				ex.pushToken(token);
				throw ex;
			}

		}
		else
		{
			return -2;
		}
	}
399512
def visit_compare(self, node):
        """"""
        rhs_str = " ".join(
            [
                "%s %s" % (op, self._precedence_parens(node, expr, is_left=False))
                for op, expr in node.ops
            ]
        )
        return "%s %s" % (self._precedence_parens(node, node.left), rhs_str)
1328131
def opers(self):
        
        i = [x for x in self.asm.strip(' \t\n').split(' ') if x != '']

        if len(i) == 1:
            return []

        i = ''.join(i[1:]).split(',')
        if self.condition_flag is not None:
            i = i[1:]
        else:
            i = i[0:]

        op = [x.lower() if is_register(x) else x for x in i]
        return op
341099
@Override
    public Object visitComparisonExpression(ExcellentParser.ComparisonExpressionContext ctx) {
        Pair<Object, Object> args = Conversions.toSame(visit(ctx.expression(0)), visit(ctx.expression(1)), m_evalContext);
        int compared;

        if (args.getLeft() instanceof String) {
            // string comparison is case-insensitive
            compared = ((String) args.getLeft()).compareToIgnoreCase((String) args.getRight());
        }
        else {
            compared = ((Comparable) args.getLeft()).compareTo(args.getRight());
        }

        if (ctx.LTE() != null) {
            return compared <= 0;
        } else if (ctx.LT() != null) {
            return compared < 0;
        } else if (ctx.GTE() != null) {
            return compared >= 0;
        } else { // GT
            return compared > 0;
        }
    }
253744
public final void mEQUALS() throws RecognitionException {
		try {
			int _type = EQUALS;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:312:8: ( '=' )
			// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:312:10: '='
			{
			match('='); if (state.failed) return;
			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}