Retrieves "&lt;expression&gt; WHERE 1=1" in string
775156
private StringBuffer toQueryPrefixNoSelect(String t) {

        StringBuffer sb = new StringBuffer(255);

        return sb.append(t).append(whereTrue);
    }
1337310
public String next(String expression) {
    if (expression == null || expression.length() == 0) { return null; }
    boolean indexed = false;
    boolean mapped = false;
    for (int i = 0; i < expression.length(); i++) {
      char c = expression.charAt(i);
      if (indexed) {
        if (c == IndexedEnd) { return expression.substring(0, i + 1); }
      } else if (mapped) {
        if (c == MappedEnd) { return expression.substring(0, i + 1); }
      } else {
        if (c == Nested) {
          return expression.substring(0, i);
        } else if (c == MappedStart) {
          mapped = true;
        } else if (c == IndexedStart) {
          indexed = true;
        }
      }
    }
    return expression;
  }
536573
public static Query withValue(String expression) {
        String[] parts = split(expression);
        if (parts != null) {
            String field = parts[0];
            String operator = parts[1];
            String value = parts[2];

            BinOp binOp = BinOp.getOp(operator);
            if (binOp != null) {
                return withValue(field, binOp, value);
            }
            NaryOp naryOp = NaryOp.getOp(operator);
            if (naryOp != null) {
                Literal[] values = Literal.values(value.substring(1, value.length() - 1).split("\\s*,\\s*"));
                return withValues(field, naryOp, values);
            }
        }
        throw new IllegalArgumentException("'" + expression + "' is incorrect");
    }
215020
def _compile(self, expression):
        

        x = self.RE_PYTHON_VAR.sub('(?:\\1,)', expression)
        x = self.RE_SPACES.sub('', x)
        return re.compile(x)
828433
function _expression()
    {
        // If it's a string return a string node
        if (preg_match("/^\"[^\"]{0,255}\"$/", $this->_current_token)) {
            $result = $this->_createTree($this->_current_token, '', '');
            $this->_advance();
            return $result;
        } elseif ($this->_current_token == SPREADSHEET_EXCEL_WRITER_SUB) {
            // catch "-" Term
            $this->_advance();
            $result2 = $this->_expression();
            $result = $this->_createTree('ptgUminus', $result2, '');
            return $result;
        }
        $result = $this->_term();
        if (PEAR::isError($result)) {
            return $result;
        }
        while (($this->_current_token == SPREADSHEET_EXCEL_WRITER_ADD) or
               ($this->_current_token == SPREADSHEET_EXCEL_WRITER_SUB)) {
        /**/
            if ($this->_current_token == SPREADSHEET_EXCEL_WRITER_ADD) {
                $this->_advance();
                $result2 = $this->_term();
                if (PEAR::isError($result2)) {
                    return $result2;
                }
                $result = $this->_createTree('ptgAdd', $result, $result2);
            } else {
                $this->_advance();
                $result2 = $this->_term();
                if (PEAR::isError($result2)) {
                    return $result2;
                }
                $result = $this->_createTree('ptgSub', $result, $result2);
            }
        }
        return $result;
    }
554622
function getConditional ( parser ) {
  	var start, expression, ifTrue, ifFalse;

  	expression = readLogicalOr$1( parser );
  	if ( !expression ) {
  		return null;
  	}

  	start = parser.pos;

  	parser.allowWhitespace();

  	if ( !parser.matchString( '?' ) ) {
  		parser.pos = start;
  		return expression;
  	}

  	parser.allowWhitespace();

  	ifTrue = readExpression( parser );
  	if ( !ifTrue ) {
  		parser.error( expectedExpression );
  	}

  	parser.allowWhitespace();

  	if ( !parser.matchString( ':' ) ) {
  		parser.error( 'Expected ":"' );
  	}

  	parser.allowWhitespace();

  	ifFalse = readExpression( parser );
  	if ( !ifFalse ) {
  		parser.error( expectedExpression );
  	}

  	return {
  		t: CONDITIONAL,
  		o: [ expression, ifTrue, ifFalse ]
  	};
  }
31331
private String checkInputParameter(Expression expression)
    {
        return (expression instanceof InputParameter) ? kunderaQuery.getParametersMap()
                .get((expression).toParsedText()).toString() : expression.toParsedText().toString();
    }
455635
private String formatString(String exp)
    {
        exp = exp.replaceAll("\\s",""); // why
        exp = exp.toLowerCase();

        int count = 0;

        if(exp.substring(0, 1).equals("-")) { // if expression starts with a minus sign, it is a unary one
            exp = "$" + exp.substring(1); // replace
        }

        for(int i = 0; i < exp.length(); i++) {
            if(exp.substring(i,  i + 1).equals("("))
                count++;
            else if(exp.substring(i, i + 1).equals(")"))
                count--;
        }
        while(count > 0) {
            exp += ")";
            count--;
        }

        // At the operators, when the operator is "-" and it is preceded by another operator,
        // or preceded by a left parenthesis, or when it is the first character of the input
        // it is a unary minus rather than binary. In this case, I change it to another
        // character, '$', and make its precedence the same as that of '^'.
        for(int i = 0; i < exp.length() - 1; i++) {
            String tmp1 = exp.substring(i, i + 1);
            String tmp2 = exp.substring(i + 1, i + 2);
            if(tmp2.equals("-") && (ExpressionParser.isOperator(tmp1) || tmp1.equals("(")))
                exp = exp.substring(0, i + 1) + "$" + exp.substring(i + 2);
            else if((tmp1.matches("[0-9]+") || tmp1.equals(var)) && (tmp2.equals("(") || tmp2.equals(var)))
                exp = exp.substring(0, i + 1) + "*" + exp.substring(i + 1);
        }

        return exp;
    }
598543
public Object resolveExpression(String expression) {
    if (StringUtils.isBlank(expression)) {
      return null;
    }

    interpreter.getContext().addResolvedExpression(expression.trim());

    try {
      String elExpression = EXPRESSION_START_TOKEN + expression.trim() + EXPRESSION_END_TOKEN;
      ValueExpression valueExp = expressionFactory.createValueExpression(elContext, elExpression, Object.class);
      Object result = valueExp.getValue(elContext);

      validateResult(result);

      return result;

    } catch (PropertyNotFoundException e) {
      interpreter.addError(new TemplateError(ErrorType.WARNING, ErrorReason.UNKNOWN, ErrorItem.PROPERTY, e.getMessage(), "", interpreter.getLineNumber(), interpreter.getPosition(), e,
          BasicTemplateErrorCategory.UNKNOWN, ImmutableMap.of("exception", e.getMessage())));
    } catch (TreeBuilderException e) {
      int position = interpreter.getPosition() + e.getPosition();
      // replacing the position in the string like this isn't great, but JUEL's parser does not allow passing in a starting position
      String errorMessage = StringUtils.substringAfter(e.getMessage(), "': ").replaceFirst("position [0-9]+", "position " + position);
      interpreter.addError(TemplateError.fromException(new TemplateSyntaxException(expression.substring(e.getPosition() - EXPRESSION_START_TOKEN.length()),
          "Error parsing '" + expression + "': " + errorMessage, interpreter.getLineNumber(), position, e)));
    }
    catch (ELException e) {
      if (e.getCause() != null && e.getCause() instanceof DeferredValueException) {
        throw (DeferredValueException) e.getCause();
      }
      if (e.getCause() != null && e.getCause() instanceof TemplateSyntaxException) {
        interpreter.addError(TemplateError.fromException((TemplateSyntaxException) e.getCause()));
      }
      else if (e.getCause() != null && e.getCause() instanceof InvalidInputException) {
        interpreter.addError(TemplateError.fromInvalidInputException((InvalidInputException) e.getCause()));
      }
      else if (e.getCause() != null && e.getCause() instanceof InvalidArgumentException) {
        interpreter.addError(TemplateError.fromInvalidArgumentException((InvalidArgumentException) e.getCause()));
      }
      else {
        interpreter.addError(TemplateError.fromException(new TemplateSyntaxException(expression, e.getMessage(), interpreter.getLineNumber(), e)));
      }
    }
    catch (DisabledException e) {
      interpreter.addError(new TemplateError(ErrorType.FATAL, ErrorReason.DISABLED, ErrorItem.FUNCTION, e.getMessage(), expression, interpreter.getLineNumber(), interpreter.getPosition(), e));
    } catch (UnknownTokenException e) {
      // Re-throw the exception because you only get this when the config failOnUnknownTokens is enabled.
      throw e;
    } catch (DeferredValueException e) {
      // Re-throw so that it can be handled in JinjavaInterpreter
      throw e;
    } catch (InvalidInputException e) {
      interpreter.addError(TemplateError.fromInvalidInputException(e));
    } catch (InvalidArgumentException e) {
      interpreter.addError(TemplateError.fromInvalidArgumentException(e));
    } catch (Exception e) {
      interpreter.addError(TemplateError.fromException(new InterpretException(
          String.format("Error resolving expression [%s]: " + getRootCauseMessage(e), expression), e, interpreter.getLineNumber(), interpreter.getPosition())));
    }

    return null;
  }
1222168
public static Query withField(String expression) {
        String[] parts = split(expression);
        if (parts != null) {
            String field = parts[0];
            String operator = parts[1];
            String rfield = parts[2];

            BinOp binOp = BinOp.getOp(operator);
            if (binOp != null) {
                return withField(field, binOp, rfield);
            }
            NaryOp naryOp = NaryOp.getOp(operator);
            if (naryOp != null) {
                return withFieldValues(field, naryOp, rfield);
            }
        }
        throw new IllegalArgumentException("'" + expression + "' is incorrect");
    }
1001151
public String conditionalExpression() throws RecognitionException {
        int first = input.index();
        exprParser.conditionalExpression();
        if ( state.failed ) return null;

        if ( state.backtracking == 0 && input.index() > first ) {
            // expression consumed something
            String expr = input.toString( first,
                                          input.LT( -1 ).getTokenIndex() );
            return expr;
        }
        return null;
    }
1135786
def get_value(self, expression):
        """"""
        self._check_valid()
        return super(Result, self).get_value(expression)
222867
private synchronized Expression getExpression(String spel) {
		Expression expression = expressionCache.get(spel);
		if (expression == null) {
			expression = parser.parseExpression(spel);
			expressionCache.put(spel, expression);
		}
		return expression;
	}
1318709
def get_match(self, elem):
        """"""
        for m in self.matches:
            if (m.expression is not None and eval(m.expression)==True) \
            or (m.xpath is not None and len(elem.xpath(m.xpath, namespaces=m.namespaces)) > 0):
                LOG.debug("=> match: %r" % m.expression)
                return m
962495
public String stripExpression(String expression) {
        if (expression == null) {
            throw new IllegalArgumentException("Cannot strip NULL expression!");
        }
        expression = expression.replaceAll("^\\$\\{", "").replaceAll("\\}$", "");
        expression = expression.replaceAll("^#\\{", "").replaceAll("\\}$", "");
        return expression;
    }
1146220
def where_exp(input, variable, expression)
      return input unless input.respond_to?(:select)

      input = input.values if input.is_a?(Hash) # FIXME

      condition = parse_condition(expression)
      @context.stack do
        input.select do |object|
          @context[variable] = object
          condition.evaluate(@context)
        end
      end || []
    end
909562
function any(expression) {

        //Define output
		var outData;
		
		//If there's no expression
		if (!expression){
		
			//Just assign current items
			outData = this.items;
		}
		else{
		
			//Otherwise apply where condition
			outData = jslinq(this.items)
				.where(expression)
				.toList();
		}
			
		//Returns true if at least one elements was found
		return outData.length > 0;
    }