Cut off validation matchers prefix and suffix.
@param expression
@return
174496
private static String cutOffValidationMatchersPrefix(String expression) {
        if (expression.startsWith(Citrus.VALIDATION_MATCHER_PREFIX) && expression.endsWith(Citrus.VALIDATION_MATCHER_SUFFIX)) {
            return expression.substring(Citrus.VALIDATION_MATCHER_PREFIX.length(), expression.length() - Citrus.VALIDATION_MATCHER_SUFFIX.length());
        }

        return expression;
    }
543598
function (expression, s) {
      var openCount = 0
      var offset = 0
      var i
      var ldelim = this.ldelim
      var rdelim = this.rdelim
      var skipInWhitespace = this.autoLiteral
      var expressionAny = /^\s*(.+)\s*$/i
      var expressionTag = expression ? new RegExp('^\\s*(' + expression + ')\\s*$', 'i') : expressionAny
      var sTag
      var found

      for (i = 0; i < s.length; ++i) {
        if (s.substr(i, ldelim.length) === ldelim) {
          if (skipInWhitespace && (i + 1) < s.length && s.substr((i + 1), 1).match(/\s/)) {
            continue
          }
          if (!openCount) {
            s = s.slice(i)
            offset += parseInt(i)
            i = 0
          }
          ++openCount
        } else if (s.substr(i, rdelim.length) === rdelim) {
          if (skipInWhitespace && (i - 1) >= 0 && s.substr((i - 1), 1).match(/\s/)) {
            continue
          }
          if (!--openCount) {
            sTag = s.slice(ldelim.length, i).replace(/[\r\n]/g, ' ')
            found = sTag.match(expressionTag)
            if (found) {
              found.index = offset
              found[0] = s.slice(0, (i + rdelim.length))
              return found
            }
          }
          if (openCount < 0) {
            // Ignore any number of unmatched right delimiters.
            openCount = 0
          }
        }
      }
      return null
    }
962809
private String getFirstSegment(String expression)
    {
        int indexDot = expression.indexOf('.');
        int indexBracket = expression.indexOf('[');

        if (indexBracket < 0)
        {

            return indexDot < 0 ? expression : expression.substring(0, indexDot);

        }

        if (indexDot < 0)
        {
            return expression.substring(0, indexBracket);
        }

        return expression.substring(0, Math.min(indexDot, indexBracket));

    }
682333
public StringExpression trim() {
        if (trim == null) {
            trim = Expressions.stringOperation(Ops.TRIM, mixin);
        }
        return trim;
    }
1169273
@Check
	public void checkAssertKeywordUse(SarlAssertExpression expression) {
		final XExpression condition = expression.getCondition();
		if (condition != null) {
			final LightweightTypeReference fromType = getActualType(condition);
			if (!fromType.isAssignableFrom(Boolean.TYPE)) {
				error(MessageFormat.format(
						Messages.SARLValidator_38,
						getNameOfTypes(fromType), boolean.class.getName()),
						condition,
						null,
						ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
						INCOMPATIBLE_TYPES);
				return;
			}
			if (getExpressionHelper() instanceof SARLExpressionHelper) {
				final SARLExpressionHelper helper = (SARLExpressionHelper) getExpressionHelper();
				final Boolean constant = helper.toBooleanPrimitiveWrapperConstant(condition);
				if (constant == Boolean.TRUE && !isIgnored(DISCOURAGED_BOOLEAN_EXPRESSION)) {
					addIssue(Messages.SARLValidator_51,
							condition,
							null,
							ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
							DISCOURAGED_BOOLEAN_EXPRESSION);
					return;
				}
			}
		}
	}
1001923
public static Boolean checkTokenBoundaries(MatchResult r, Sentence s, JCas jcas){
		Boolean beginOK = false;
		Boolean endOK = false;
	
		// whole expression is marked as a sentence
		if ((r.end() - r.start()) == (s.getEnd() -s.getBegin())){
			return true;
		}
		
		// Only check Token boundaries if no white-spaces in front of and behind the match-result
		if ((r.start() > 0) 
				&& ((s.getCoveredText().subSequence(r.start()-1, r.start()).equals(" ")))
				&& ((r.end() < s.getCoveredText().length()) && ((s.getCoveredText().subSequence(r.end(), r.end()+1).equals(" "))))) {
			return true;
		}
	
		// other token boundaries than white-spaces
		else {
			FSIterator iterToken = jcas.getAnnotationIndex(Token.type).subiterator(s);
			while (iterToken.hasNext()) {
				Token t = (Token) iterToken.next();
			
				// Check begin
				if ((r.start() + s.getBegin()) == t.getBegin()){
					beginOK = true;
				}
				// Tokenizer does not split number from some symbols (".", "/", "-", "–"),
				// e.g., "...12 August-24 Augsut..."
				else if ((r.start() > 0)
						&& ((s.getCoveredText().subSequence(r.start()-1, r.start()).equals("."))
						|| (s.getCoveredText().subSequence(r.start()-1, r.start()).equals("/")) 
						|| (s.getCoveredText().subSequence(r.start()-1, r.start()).equals("–"))
						|| (s.getCoveredText().subSequence(r.start()-1, r.start()).equals("-")))) {
					beginOK = true;
				}
			
				// Check end
				if ((r.end() + s.getBegin()) == t.getEnd()) {
					endOK = true;
				}
				// Tokenizer does not split number from some symbols (".", "/", "-", "–"),
				// e.g., "... in 1990. New Sentence ..."
				else if ((r.end() < s.getCoveredText().length()) 
						&& ((s.getCoveredText().subSequence(r.end(), r.end()+1).equals("."))
								|| (s.getCoveredText().subSequence(r.end(), r.end()+1).equals("/"))
								|| (s.getCoveredText().subSequence(r.end(), r.end()+1).equals("–")) 
								|| (s.getCoveredText().subSequence(r.end(), r.end()+1).equals("-")))) {
					endOK = true;
				}
			
				if (beginOK && endOK)
					return true;
			}
		}
		return false;
	}
1353219
private String chooseAlternations(final String expression) {
		StrBuilder sb = new StrBuilder(expression);

		int i = 0;
		// Loop until an unescaped pipe symbol appears.
		while (UNESCAPED_PIPE_PATTERN.matcher(sb.toString()).find()) {
			for (; i < sb.length(); ++i) {
				if (sb.charAt(i) == '|') {
					if (sb.charAt(i - 1) == '\\') {
						// escapet
						continue;
					}

					int start = i;
					// Backtrack until an opening bracket is found
					// to limit the context of alternatives.
					for (int closingCount = 0; start >= 0; --start) {
						char c = sb.charAt(start);
						if (c == '(') {
							if (closingCount == 0) {
								break;
							}
							--closingCount;
						} else if (c == ')') {
							++closingCount;
						}
					}

					if (start >= 0) {
						// If an opening brace was found
						// search for a closing bracket.
						int end = i;
						for (int openingCount = 0; end < sb.length(); ++end) {
							char c = sb.charAt(end);
							if (c == '(') {
								++openingCount;
							} else if (c == ')') {
								if (openingCount == 0) {
									break;
								}
								--openingCount;
							}
						}
						String alternative = random.getBoolean() ? sb.substring(start + 1, i) : sb.substring(i + 1, end);
						sb.replace(start, end + 1, alternative);
						i = start + alternative.length();
						break;
					}
					String alternative = random.getBoolean() ? sb.substring(0, i) : sb.substring(i + 1);
					sb.replace(0, sb.length() + 1, alternative);
					break;
				}
			}
		}
		return sb.toString();
	}
675285
private static Set<Symbol> extractUniqueInternal(RowExpression expression)
    {
        if (isExpression(expression)) {
            return extractUnique(castToExpression(expression));
        }
        return extractUnique(expression);
    }
1294768
public static Expression regexpContains(Expression expression, String pattern) {
        return x("REGEXP_CONTAINS(" + expression.toString() + ", \"" + pattern + "\")");
    }
1211788
public static Set<Symbol> extractUnique(RowExpression expression)
    {
        return ImmutableSet.copyOf(extractAll(expression).stream().map(variable -> new Symbol(variable.getName())).collect(toSet()));
    }
889797
public static Expression regexpContains(String expression, String pattern) {
        return regexpContains(x(expression), pattern);
    }
1283304
public static Expression regexpPosition(String expression, String pattern) {
        return regexpPosition(x(expression), pattern);
    }
418060
public final Filter<S> or(String expression) {
        return or(new FilterParser<S>(mType, expression).parseRoot());
    }
557831
static Matcher extractPrefixFromOr(Matcher matcher) {
    if (matcher instanceof OrMatcher) {
      // Get the prefix for the first condition
      List<Matcher> matchers = matcher.<OrMatcher>as().matchers();
      if (matchers.isEmpty()) {
        return matcher;
      }
      Matcher prefix = PatternUtils.getPrefix(matchers.get(0));
      if (prefix.alwaysMatches()) {
        return matcher;
      }
      List<Matcher> ms = new ArrayList<>();
      ms.add(PatternUtils.getSuffix(matchers.get(0)));

      // Verify all OR conditions have the same prefix
      for (Matcher m : matchers.subList(1, matchers.size())) {
        Matcher p = PatternUtils.getPrefix(m);
        if (!prefix.equals(p)) {
          return matcher;
        }
        ms.add(PatternUtils.getSuffix(m));
      }

      return SeqMatcher.create(prefix, OrMatcher.create(ms));
    }
    return matcher;
  }
893822
private String getBetweenBoundaryValues(Expression boundExpression)
    {
        if (boundExpression instanceof IdentificationVariable || boundExpression instanceof NumericLiteral
                || boundExpression instanceof InputParameter)
        {
            Object value = (boundExpression instanceof InputParameter) ? kunderaQuery.getParametersMap().get(
                    (boundExpression).toParsedText()) : boundExpression.toParsedText();
            return value.toString();
        }
        else if (boundExpression instanceof AdditionExpression)
        {
            String leftValue = checkInputParameter(((AdditionExpression) boundExpression).getLeftExpression());
            String rightValue = checkInputParameter(((AdditionExpression) boundExpression).getRightExpression());

            return new Integer(Integer.parseInt(leftValue) + Integer.parseInt(rightValue)).toString();
        }
        else if (boundExpression instanceof SubtractionExpression)
        {
            String leftValue = checkInputParameter(((SubtractionExpression) boundExpression).getLeftExpression());
            String rightValue = checkInputParameter(((SubtractionExpression) boundExpression).getRightExpression());

            return new Integer(Integer.parseInt(leftValue) - Integer.parseInt(rightValue)).toString();
        }
        else if (boundExpression instanceof MultiplicationExpression)
        {
            String leftValue = checkInputParameter(((MultiplicationExpression) boundExpression).getLeftExpression());
            String rightValue = checkInputParameter(((MultiplicationExpression) boundExpression).getRightExpression());

            return new Integer(Integer.parseInt(leftValue) * Integer.parseInt(rightValue)).toString();
        }

        else if (boundExpression instanceof DivisionExpression)
        {
            String leftValue = checkInputParameter(((DivisionExpression) boundExpression).getLeftExpression());
            String rightValue = checkInputParameter(((DivisionExpression) boundExpression).getRightExpression());
            return new Integer(Integer.parseInt(leftValue) / Integer.parseInt(rightValue)).toString();
        }

        return null;
    }
819529
private boolean markAsDeadCode(XExpression expression) {
		if (expression instanceof XBlockExpression) {
			final XBlockExpression block = (XBlockExpression) expression;
			final EList<XExpression> expressions = block.getExpressions();
			if (!expressions.isEmpty()) {
				markAsDeadCode(expressions.get(0));
				return true;
			}
		}
		if (expression != null) {
			error("Unreachable expression.", expression, null, IssueCodes.UNREACHABLE_CODE); //$NON-NLS-1$
			return true;
		}
		return false;
	}
806972
private String transform(String expression) {
        char[] arr = expression.toCharArray();
        for (int i = 0; i < arr.length; i++) {
        	char cc=arr[i];
            if (cc == '-') {
                if (i == 0) {
                    arr[i] = '~';
                } else {
                    char c = arr[i - 1];
                    if (c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == 'E' || c == 'e') {
                        arr[i] = '~';
                    }
                }
            }
        }
        if(arr[0]=='~'||arr[1]=='('){
            arr[0]='-';
            return "0"+new String(arr);
        }else{
            return new String(arr);
        }
    }