Returns all indices where the literal argument can be found in this String.
@param literal The string that should be found
@return all indices where the literal argument can be found in this String.
555989
private int[] findIndices(final Literal literal) {

        int count = 0;
        final char s = literal.getFirstChar();
        for (int i = 0; i < myChars.length; i++) {

            // Check the first char for better performance and check the complete string
            if ((myChars[i] == s || s == '?') && literal.matches(myChars, i)) {

                // This index matches
                myBuffer[count] = i;
                count++;
            }
        }

        // Check whether any match has been found
        if (count == 0) {
            return EMPTY;
        }

        // Use an existing array
        if (count == 1 && myBuffer[0] < SINGLE_VALUES.length) {
            final int index = myBuffer[0];
            return SINGLE_VALUES[index];
        }

        // Copy the values
        final int[] values = new int[count];
        for (int i = 0; i < count; i++) {
            values[i] = myBuffer[i];
        }
        return values;
    }
306746
static int countArgumentPlaceholders2(final String messagePattern, final int[] indices) {
        if (messagePattern == null) {
            return 0;
        }
        final int length = messagePattern.length();
        int result = 0;
        boolean isEscaped = false;
        for (int i = 0; i < length - 1; i++) {
            final char curChar = messagePattern.charAt(i);
            if (curChar == ESCAPE_CHAR) {
                isEscaped = !isEscaped;
                indices[0] = -1; // escaping means fast path is not available...
                result++;
            } else if (curChar == DELIM_START) {
                if (!isEscaped && messagePattern.charAt(i + 1) == DELIM_STOP) {
                    indices[result] = i;
                    result++;
                    i++;
                }
                isEscaped = false;
            } else {
                isEscaped = false;
            }
        }
        return result;
    }
1253846
def strip_literal(literal)
      literal = literal[1..-1] if literal[0] == ':'
      literal = literal[1..-2] if literal[0] == "'" || literal[0] == '"'
      literal
    end
1142079
private String quoteFormatCharacters(String literal)
   {
      StringBuilder sb = new StringBuilder();
      int length = literal.length();
      char c;

      for (int loop = 0; loop < length; loop++)
      {
         c = literal.charAt(loop);
         switch (c)
         {
            case '0':
            case '#':
            case '.':
            case '-':
            case ',':
            case 'E':
            case ';':
            case '%':
            {
               sb.append("'");
               sb.append(c);
               sb.append("'");
               break;
            }

            default:
            {
               sb.append(c);
               break;
            }
         }
      }

      return (sb.toString());
   }
655063
public static List<Type> getAllTypeArguments(Type javaType) {
        if (!(javaType instanceof ParameterizedType)) {
            return Collections.emptyList();
        }

        return Lists.immutableListOf(((ParameterizedType) javaType).getActualTypeArguments());
    }
1148732
private static boolean isParamLiteral(String param) {
    try {
      Double.parseDouble(param);
      return true;
    } catch (NumberFormatException e) {
      // Check to see if the parameter is a literal - either a quoted string or
      // numeric literal
      if (param.length() > 1
          && (param.charAt(0) == '"' || param.charAt(0) == '\'')
          && param.charAt(0) == param.charAt(param.length() - 1)) {
        return true;
      }
    }
    return false;
  }
374763
public SortedSet<Literal> literals() {
    final SortedSet<Literal> literals = new TreeSet<>();
    for (final Formula f : this.formulas)
      literals.addAll(f.literals());
    return literals;
  }

  /**
   * Returns the variable profile of this formula list.  For each variable the number of occurrences is counted.
   * @return the variable profile of this formula list
   */
  public SortedMap<Variable, Integer> varProfile() {
    final VariableProfileFunction variableProfileFunction = new VariableProfileFunction();
    final SortedMap<Variable, Integer> profile = new TreeMap<>();
    for (final Formula f : this.formulas)
      for (final Map.Entry<Variable, Integer> entry : f.apply(variableProfileFunction).entrySet()) {
        final Integer currentCount = profile.get(entry.getKey());
        if (currentCount == null)
          profile.put(entry.getKey(), entry.getValue());
        else
          profile.put(entry.getKey(), entry.getValue() + currentCount);
      }
    return profile;
  }

  /**
   * Returns the literal profile of this formula list.  For each literal the number of occurrences is counted.
   * @return the literal profile of this formula list
   */
  public SortedMap<Literal, Integer> litProfile() {
    final LiteralProfileFunction literalProfileFunction = new LiteralProfileFunction();
    final SortedMap<Literal, Integer> profile = new TreeMap<>();
    for (final Formula f : this.formulas)
      for (final Map.Entry<Literal, Integer> entry : f.apply(literalProfileFunction).entrySet()) {
        final Integer currentCount = profile.get(entry.getKey());
        if (currentCount == null)
          profile.put(entry.getKey(), entry.getValue());
        else
          profile.put(entry.getKey(), entry.getValue() + currentCount);
      }
    return profile;
  }

  /**
   * Performs a given substitution on this formula list.
   * @param substitution the substitution
   * @return a new substituted formula
   */
  public ImmutableFormulaList substitute(final Substitution substitution) {
    final Formula[] subst = new Formula[this.formulas.length];
    for (int i = 0; i < this.formulas.length; i++)
      subst[i] = this.formulas[i].substitute(substitution);
    return new ImmutableFormulaList(this.operator, false, subst);
  }

  /**
   * Returns a copy of this formula list as array.
   * @return a copy of this formula list as array
   */
  public Formula[] toArray() {
    return Arrays.copyOf(this.formulas, this.formulas.length);
  }

  /**
   * Returns a copy of this formula list as list.
   * @return a copy of this formula list as list
   */
  public List<Formula> toList() {
    return Arrays.asList(this.formulas);
  }

  @Override
  public int hashCode() {
    return Objects.hash(this.operator, Arrays.hashCode(this.formulas));
  }

  @Override
  public boolean equals(final Object other) {
    return this == other || (other instanceof ImmutableFormulaList) && this.operator == ((ImmutableFormulaList) other).operator
            && Arrays.equals(this.formulas, ((ImmutableFormulaList) other).formulas);
  }

  @Override
  public String toString() {
    final StringBuilder sb = new StringBuilder();
    sb.append(this.operator).append("[");
    for (int i = 0; i < this.formulas.length; i++) {
      sb.append(this.formulas[i]);
      if (i != this.formulas.length - 1)
        sb.append(", ");
    }
    sb.append("]");
    return sb.toString();
  }

  @Override
  public Iterator<Formula> iterator() {
    return new Iterator<Formula>() {
      private int i;

      @Override
      public boolean hasNext() {
        return this.i < ImmutableFormulaList.this.formulas.length;
      }

      @Override
      public Formula next() {
        if (this.i == ImmutableFormulaList.this.formulas.length)
          throw new NoSuchElementException();
        return ImmutableFormulaList.this.formulas[this.i++];
      }

      @Override
      public void remove() {
        throw new UnsupportedOperationException();
      }
    };
  }
}
186187
public final void literal() throws RecognitionException {
		int literal_StartIndex = input.index();

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

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:587:5: ( integerLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | booleanLiteral | 'null' )
			int alt84=6;
			switch ( input.LA(1) ) {
			case DecimalLiteral:
			case HexLiteral:
			case OctalLiteral:
				{
				alt84=1;
				}
				break;
			case FloatingPointLiteral:
				{
				alt84=2;
				}
				break;
			case CharacterLiteral:
				{
				alt84=3;
				}
				break;
			case StringLiteral:
				{
				alt84=4;
				}
				break;
			case 82:
			case 115:
				{
				alt84=5;
				}
				break;
			case 98:
				{
				alt84=6;
				}
				break;
			default:
				if (state.backtracking>0) {state.failed=true; return;}
				NoViableAltException nvae =
					new NoViableAltException("", 84, 0, input);
				throw nvae;
			}
			switch (alt84) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:587:9: integerLiteral
					{
					pushFollow(FOLLOW_integerLiteral_in_literal2150);
					integerLiteral();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:588:9: FloatingPointLiteral
					{
					match(input,FloatingPointLiteral,FOLLOW_FloatingPointLiteral_in_literal2160); if (state.failed) return;
					}
					break;
				case 3 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:589:9: CharacterLiteral
					{
					match(input,CharacterLiteral,FOLLOW_CharacterLiteral_in_literal2170); if (state.failed) return;
					}
					break;
				case 4 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:590:9: StringLiteral
					{
					match(input,StringLiteral,FOLLOW_StringLiteral_in_literal2180); if (state.failed) return;
					}
					break;
				case 5 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:591:9: booleanLiteral
					{
					pushFollow(FOLLOW_booleanLiteral_in_literal2190);
					booleanLiteral();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 6 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:592:9: 'null'
					{
					match(input,98,FOLLOW_98_in_literal2200); if (state.failed) return;
					}
					break;

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

		}
	}
617524
function Literal(node) {
  var value = node.value;
  if (typeof value === "string") return t.stringTypeAnnotation();
  if (typeof value === "number") return t.numberTypeAnnotation();
  if (typeof value === "boolean") return t.booleanTypeAnnotation();
  if (value === null) return t.voidTypeAnnotation();
  if (node.regex) return t.genericTypeAnnotation(t.identifier("RegExp"));
}
331605
public String getArgs(){
		int count = (this.tokenPosition==0)?1:this.tokenPosition+1;
		String[] ar = StringUtils.split(this.line, null, count);
		if(ar!=null && ar.length>(this.tokenPosition)){
			return StringUtils.trim(ar[this.tokenPosition]);
		}
		return null;
	}
26145
public Map<String,String> getResolvedArguments(String filterArgs, AnalyzedTokenReadings[] patternTokens, List<Integer> tokenPositions) {
    Map<String,String> result = new HashMap<>();
    String[] arguments = filterArgs.split("\\s+");
    for (String arg : arguments) {
      int delimPos = arg.indexOf(':');
      if (delimPos == -1) {
        throw new RuntimeException("Invalid syntax for key/value, expected 'key:value', got: '" + arg + "'");
      }
      String key = arg.substring(0, delimPos);
      String val = arg.substring(delimPos + 1);
      if (val.startsWith("\\")) {
        int refNumber = Integer.parseInt(val.replace("\\", ""));
        if (refNumber > tokenPositions.size()) {
          throw new RuntimeException("Your reference number " + refNumber + " is bigger than the number of tokens: " + tokenPositions.size());
        }
        int correctedRef = getSkipCorrectedReference(tokenPositions, refNumber);
        if (correctedRef >= patternTokens.length) {
          throw new RuntimeException("Your reference number " + refNumber +
                  " is bigger than number of matching tokens: " + patternTokens.length);
        }
        if (result.containsKey(key)) {
          throw new RuntimeException("Duplicate key '" + key + "'");
        }
        result.put(key, patternTokens[correctedRef].getToken());
      } else {
        result.put(key, val);
      }
    }
    return result;
  }
280522
static Selector parseIntegerLiteral(String val) {
    // Determine if this is a long constant by checking the suffix
    char tag = val.charAt(val.length()-1);
    boolean mustBeLong = false;
    if (tag == 'l' || tag == 'L') 
    {
      val = val.substring(0, val.length()-1);
      mustBeLong = true;
    }
    long longVal = Long.decode(val).longValue();
    if (mustBeLong || longVal > Integer.MAX_VALUE || longVal < Integer.MIN_VALUE)
      return new LiteralImpl(new Long(longVal));
    else
      return new LiteralImpl(new Integer((int) longVal));
  }
359687
function () {
      var e = {
        type: 'literal',
        value: this.value.toString()
      };
      if (this.lang !== undefined) {
        e.lang = this.lang;
      } else if (this.datatype !== undefined) {
        e.datatype = this.datatype.toString();
      }
      return e;
    }
468776
private LiteralToken nextRegularExpressionLiteralToken() {
    LiteralToken token = scanner.nextRegularExpressionLiteralToken();
    lastSourcePosition = token.location.end;
    return token;
  }
59863
function getArgs (fn) {
  const fnString = fn.toString();
  const argList = /[(]([^)]*)[)]/.exec(fnString)[ 1 ].split(',');
  return argList.map(String.prototype.trim);
}
993162
public static String print(final Literal literal) {
        return literal.match(new Literal.MatchBlock<String>() {
            @Override
            public String _case(StringLiteral x) {
                return x.content;
            }

            @Override
            public String _case(FloatingPointLiteral x) {
                return x.content;
            }

            @Override
            public String _case(IntegerLiteral x) {
                return x.content;
            }

            @Override
            public String _case(CharLiteral x) {
                return x.content;
            }

            @Override
            public String _case(BooleanLiteral x) {
                return x.content;
            }

            @Override
            public String _case(NullLiteral x) {
                return "null";
            }
        });
    }
851968
public char match(ISense source, ISense target) throws MatcherLibraryException {
        String sSynset = source.getGloss();
        String tSynset = target.getGloss();
        StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'();");
        StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'();");
        String lemma;
        int counter = 0;
        while (stSource.hasMoreTokens()) {
            lemma = stSource.nextToken();
            if (!meaninglessWords.contains(lemma)) {
                List<String> lemmas = target.getLemmas();
                for (String lemmaToCompare : lemmas) {
                    if (lemma.equals(lemmaToCompare)) {
                        counter++;
                    }
                }
            }
        }
        if (counter >= threshold) {
            return IMappingElement.LESS_GENERAL;
        }

        while (stTarget.hasMoreTokens()) {
            lemma = stTarget.nextToken();
            if (!meaninglessWords.contains(lemma)) {
                List<String> lemmas = source.getLemmas();
                for (String lemmaToCompare : lemmas) {
                    if (lemma.equals(lemmaToCompare)) {
                        counter++;
                    }
                }
            }
        }
        if (counter >= threshold) {
            return IMappingElement.MORE_GENERAL;
        }
        return IMappingElement.IDK;
    }