gallic plus just delegates to the string semiring plus + the primitive semiring plus
NOTE this isn't the Union ('general') Gallic Plus from openfst (i have split this out for sanity at the expense of
elegance).
973110
@Override
  public GallicWeight plus(GallicWeight a, GallicWeight b) {
    if (isZero(a)) return b;
    if (isZero(b)) return a;
    if (mode == RESTRICT_GALLIC) {
      if (SHORTLEX_ORDERING.compare(a, b) != 0) {
        throw new IllegalArgumentException("Trying to plus two different gallic weights, which isn't allowed in " +
          "this context. Did you pass a non-functional FST where a functional one was required? a = " + a +
          "; b = " + b);
      }
      double newWeight = this.weightSemiring.plus(a.getWeight(), b.getWeight());
      return GallicWeight.create(new IntArrayList(a.getLabels()), newWeight);
    } else {
      Preconditions.checkState(mode == MIN_GALLIC);
      return this.weightSemiring.naturalLess(a.getWeight(), b.getWeight()) ? a : b;
    }
  }
730066
private static void add(State fromState, State toState, double weight, HashMap<Integer,Double>[] closure, Semiring semiring) {
    Double old = getPathWeight(fromState, toState, closure);
    if (old == null) {
      put(fromState, toState, weight, closure);
    } else {
      put(fromState, toState, semiring.plus(weight, old), closure);
    }

  }
76386
private ExprKraken parseSimpleTerm()
  {
    Token token = scanToken();

    switch (token) {
    case MINUS:
      return new UnaryExpr(UnaryOp.MINUS, parseSimpleTerm());
      
    case LPAREN:
    {
      ExprKraken expr = parseExpr();
      
      if ((token = scanToken()) != Token.RPAREN) {
        throw error("Expected ')' at '{0}'", token);
      }
      
      return expr;
    }
      
      
    case IDENTIFIER:
      {
        String name = _lexeme;

        if ((token = peekToken()) == Token.DOT) {
          return parsePath(name);
        }
        else if (token == Token.LPAREN) {
          FunExpr fun = null;
          
          /*
          if (name.equalsIgnoreCase("max"))
            fun = new MaxExpr();
          else if (name.equalsIgnoreCase("min"))
            fun = new MinExpr();
          else if (name.equalsIgnoreCase("sum"))
            fun = new SumExpr();
          else if (name.equalsIgnoreCase("avg"))
            fun = new AvgExpr();
          else if (name.equalsIgnoreCase("count")) {
            fun = new CountExpr();

            token = scanToken();
            if (token == '*') {
              fun.addArg(new UnboundStarExpr());
            }
            else
              _token = token;
          }
          else */
          {
            String funName = (Character.toUpperCase(name.charAt(0)) +
                              name.substring(1).toLowerCase(Locale.ENGLISH));

            funName = "com.caucho.v5.kraken.fun." + funName + "Expr";

            try {
              ClassLoader loader = Thread.currentThread().getContextClassLoader();
              Class<?> cl = Class.forName(funName, false, loader);

              fun = (FunExpr) cl.newInstance();
            } catch (ClassNotFoundException e) {
              log.finer(e.toString());
            } catch (Exception e) {
              log.log(Level.FINER, e.toString(), e);
              
              throw error(e.toString());
            }

            if (fun == null) {
              throw error(L.l("'{0}' is an unknown function.", name));
            }
          }

          scanToken();
          token = peekToken();
          while (token != null && token != Token.RPAREN) {
            ExprKraken arg = parseExpr();

            fun.addArg(arg);

            token = peekToken();

            if (token == Token.COMMA) {
              scanToken();
              token = peekToken();
            }
          }

          scanToken();

          return fun;
        }
        else {
          return new IdExprBuilder(name);
        }
      }

    case STRING:
      return new LiteralExpr(_lexeme);

    case DOUBLE:
      return new LiteralExpr(Double.parseDouble(_lexeme));
      
    case INTEGER:
      return new LiteralExpr(Long.parseLong(_lexeme));
      
    case LONG:
      return new LiteralExpr(Long.parseLong(_lexeme));

    case NULL:
      return new NullExpr();

    case TRUE:
      return new LiteralExpr(true);

    case FALSE:
      return new LiteralExpr(false);

    case QUESTION_MARK:
      ParamExpr param = new ParamExpr(_params.size());
      _params.add(param);
      return param;

    default:
      throw error("unexpected term {0}", token);
    }
  }
650359
public final void primitiveType() throws RecognitionException {
		int primitiveType_StartIndex = input.index();

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

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:537:5: ( 'boolean' | 'char' | 'byte' | 'short' | 'int' | 'long' | 'float' | 'double' )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
			{
			if ( input.LA(1)==65||input.LA(1)==67||input.LA(1)==71||input.LA(1)==77||input.LA(1)==85||input.LA(1)==92||input.LA(1)==94||input.LA(1)==105 ) {
				input.consume();
				state.errorRecovery=false;
				state.failed=false;
			}
			else {
				if (state.backtracking>0) {state.failed=true; return;}
				MismatchedSetException mse = new MismatchedSetException(null,input);
				throw mse;
			}
			}

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

		}
	}
627122
public final void castExpression() throws RecognitionException {
		int castExpression_StartIndex = input.index();

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

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1211:5: ( '(' primitiveType ')' unaryExpression | '(' ( type | expression ) ')' unaryExpressionNotPlusMinus )
			int alt161=2;
			int LA161_0 = input.LA(1);
			if ( (LA161_0==36) ) {
				int LA161_1 = input.LA(2);
				if ( (LA161_1==65||LA161_1==67||LA161_1==71||LA161_1==77||LA161_1==85||LA161_1==92||LA161_1==94||LA161_1==105) ) {
					int LA161_2 = input.LA(3);
					if ( (synpred244_Java()) ) {
						alt161=1;
					}
					else if ( (true) ) {
						alt161=2;
					}

				}
				else if ( ((LA161_1 >= CharacterLiteral && LA161_1 <= DecimalLiteral)||LA161_1==FloatingPointLiteral||(LA161_1 >= HexLiteral && LA161_1 <= Identifier)||(LA161_1 >= OctalLiteral && LA161_1 <= StringLiteral)||LA161_1==29||LA161_1==36||(LA161_1 >= 40 && LA161_1 <= 41)||(LA161_1 >= 44 && LA161_1 <= 45)||LA161_1==53||LA161_1==70||(LA161_1 >= 79 && LA161_1 <= 80)||LA161_1==82||(LA161_1 >= 97 && LA161_1 <= 98)||LA161_1==108||LA161_1==111||LA161_1==115||LA161_1==118||LA161_1==126) ) {
					alt161=2;
				}

				else {
					if (state.backtracking>0) {state.failed=true; return;}
					int nvaeMark = input.mark();
					try {
						input.consume();
						NoViableAltException nvae =
							new NoViableAltException("", 161, 1, input);
						throw nvae;
					} finally {
						input.rewind(nvaeMark);
					}
				}

			}

			else {
				if (state.backtracking>0) {state.failed=true; return;}
				NoViableAltException nvae =
					new NoViableAltException("", 161, 0, input);
				throw nvae;
			}

			switch (alt161) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1211:8: '(' primitiveType ')' unaryExpression
					{
					match(input,36,FOLLOW_36_in_castExpression5610); if (state.failed) return;
					pushFollow(FOLLOW_primitiveType_in_castExpression5612);
					primitiveType();
					state._fsp--;
					if (state.failed) return;
					match(input,37,FOLLOW_37_in_castExpression5614); if (state.failed) return;
					pushFollow(FOLLOW_unaryExpression_in_castExpression5616);
					unaryExpression();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1212:8: '(' ( type | expression ) ')' unaryExpressionNotPlusMinus
					{
					match(input,36,FOLLOW_36_in_castExpression5625); if (state.failed) return;
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1212:12: ( type | expression )
					int alt160=2;
					switch ( input.LA(1) ) {
					case Identifier:
						{
						int LA160_1 = input.LA(2);
						if ( (synpred245_Java()) ) {
							alt160=1;
						}
						else if ( (true) ) {
							alt160=2;
						}

						}
						break;
					case 65:
					case 67:
					case 71:
					case 77:
					case 85:
					case 92:
					case 94:
					case 105:
						{
						switch ( input.LA(2) ) {
						case 59:
							{
							int LA160_51 = input.LA(3);
							if ( (synpred245_Java()) ) {
								alt160=1;
							}
							else if ( (true) ) {
								alt160=2;
							}

							}
							break;
						case 37:
							{
							alt160=1;
							}
							break;
						case 47:
							{
							alt160=2;
							}
							break;
						default:
							if (state.backtracking>0) {state.failed=true; return;}
							int nvaeMark = input.mark();
							try {
								input.consume();
								NoViableAltException nvae =
									new NoViableAltException("", 160, 2, input);
								throw nvae;
							} finally {
								input.rewind(nvaeMark);
							}
						}
						}
						break;
					case CharacterLiteral:
					case DecimalLiteral:
					case FloatingPointLiteral:
					case HexLiteral:
					case OctalLiteral:
					case StringLiteral:
					case 29:
					case 36:
					case 40:
					case 41:
					case 44:
					case 45:
					case 53:
					case 70:
					case 79:
					case 80:
					case 82:
					case 97:
					case 98:
					case 108:
					case 111:
					case 115:
					case 118:
					case 126:
						{
						alt160=2;
						}
						break;
					default:
						if (state.backtracking>0) {state.failed=true; return;}
						NoViableAltException nvae =
							new NoViableAltException("", 160, 0, input);
						throw nvae;
					}
					switch (alt160) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1212:13: type
							{
							pushFollow(FOLLOW_type_in_castExpression5628);
							type();
							state._fsp--;
							if (state.failed) return;
							}
							break;
						case 2 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1212:20: expression
							{
							pushFollow(FOLLOW_expression_in_castExpression5632);
							expression();
							state._fsp--;
							if (state.failed) return;
							}
							break;

					}

					match(input,37,FOLLOW_37_in_castExpression5635); if (state.failed) return;
					pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_castExpression5637);
					unaryExpressionNotPlusMinus();
					state._fsp--;
					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, 126, castExpression_StartIndex); }

		}
	}
1095349
@Override
    protected String toStringInternal(final boolean useSimpleNames) {
        final StringBuilder buf = new StringBuilder();
        // Only append the base class name if not using simple names, or if there are no suffixes
        if (!useSimpleNames || suffixes.isEmpty()) {
            buf.append(useSimpleNames ? ClassInfo.getSimpleName(className) : className);
            if (!typeArguments.isEmpty()) {
                buf.append('<');
                for (int i = 0; i < typeArguments.size(); i++) {
                    if (i > 0) {
                        buf.append(", ");
                    }
                    buf.append(useSimpleNames ? typeArguments.get(i).toStringWithSimpleNames()
                            : typeArguments.get(i).toString());
                }
                buf.append('>');
            }
        }
        // Only use the last suffix if using simple names
        for (int i = useSimpleNames && !suffixes.isEmpty() ? suffixes.size() - 1 : 0; i < suffixes.size(); i++) {
            if (!useSimpleNames) {
                // Use '.' before each suffix in the toString() representation, since that is
                // how the class name will be shown in Java, e.g. OuterClass<T>.InnerClass
                buf.append('.');
            }
            buf.append(suffixes.get(i));
            final List<TypeArgument> suffixTypeArgs = suffixTypeArguments.get(i);
            if (!suffixTypeArgs.isEmpty()) {
                buf.append('<');
                for (int j = 0; j < suffixTypeArgs.size(); j++) {
                    if (j > 0) {
                        buf.append(", ");
                    }
                    buf.append(useSimpleNames ? suffixTypeArgs.get(j).toStringWithSimpleNames()
                            : suffixTypeArgs.get(j).toString());
                }
                buf.append('>');
            }
        }
        return buf.toString();
    }
278570
static String toUnsignedString(long l) {
    BigInteger b = BigInteger.valueOf(l);
    if (b.signum() < 0) {
      b = b.add(TWO_64);
    }
    return b.toString();
  }
1242858
public static void parseQueryString( String str, Map res, String encoding )
    {

        // "Within the query string, the plus sign is reserved as
        // shorthand notation for a space. Therefore, real plus signs must
        // be encoded. This method was used to make query URIs easier to
        // pass in systems which did not allow spaces." -- RFC 1630
        int i = str.indexOf( '#' );
        if ( i > 0 )
        {
            str = str.substring( 0, i );
        }
        StringTokenizer st = new StringTokenizer( str.replace( '+', ' ' ), "&" );

        while ( st.hasMoreTokens() )
        {
            String qp = st.nextToken();
            String[] pair = qp.split( "=" );  // was String[] pair = StringUtils.split(qp, '=');
            //String s = unescape(pair[1], encoding);
            res.put( unescape( pair[0], encoding ), unescape( pair[1], encoding ) );
        }
    }
1328610
function(val, ctx, partials, inverted, start, end, tags) {
      var cx = ctx[ctx.length - 1],
          t = null;

      if (!inverted && this.c && val.length > 0) {
        return this.ho(val, cx, partials, this.text.substring(start, end), tags);
      }

      t = val.call(cx);

      if (typeof t == 'function') {
        if (inverted) {
          return true;
        } else if (this.c) {
          return this.ho(t, cx, partials, this.text.substring(start, end), tags);
        }
      }

      return t;
    }
1328740
private void voltConvertBinaryLiteralOperandsToBigint() {
        // Strange that CONCAT is an arithmetic operator.
        // You could imagine using it for VARBINARY, so
        // definitely don't convert its operands to BIGINT!
        assert(opType != OpTypes.CONCAT);

        for (int i = 0; i < nodes.length; ++i) {
            Expression e = nodes[i];
            ExpressionValue.voltMutateToBigintType(e, this, i);
        }
    }
1024184
public final void mPLUS_ASSIGN() throws RecognitionException {
		try {
			int _type = PLUS_ASSIGN;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:156:5: ( '+=' )
			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:156:7: '+='
			{
			match("+="); if (state.failed) return;

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
405862
def string_end_with_semicolon?(str)
      i = str.size - 1
      while i >= 0
        c = str[i].ord
        i -= 1

        next if WHITESPACE_ORDINALS[c]

        return c === 0x3B
      end

      true
    end
139249
public final void additiveExpression() throws RecognitionException {
		int additiveExpression_StartIndex = input.index();

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

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1188:5: ( multiplicativeExpression ( ( '+' | '-' ) multiplicativeExpression )* )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1188:9: multiplicativeExpression ( ( '+' | '-' ) multiplicativeExpression )*
			{
			pushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression5410);
			multiplicativeExpression();
			state._fsp--;
			if (state.failed) return;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1188:34: ( ( '+' | '-' ) multiplicativeExpression )*
			loop154:
			while (true) {
				int alt154=2;
				int LA154_0 = input.LA(1);
				if ( (LA154_0==40||LA154_0==44) ) {
					alt154=1;
				}

				switch (alt154) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1188:36: ( '+' | '-' ) multiplicativeExpression
					{
					if ( input.LA(1)==40||input.LA(1)==44 ) {
						input.consume();
						state.errorRecovery=false;
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						throw mse;
					}
					pushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression5422);
					multiplicativeExpression();
					state._fsp--;
					if (state.failed) return;
					}
					break;

				default :
					break loop154;
				}
			}

			}

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

		}
	}
626908
def type_str(c)
      ret = c.type.to_s
      ret << ", primary" if c.primary
      ret << ", default=#{truncate_default(c.default)}" if c.default
      ret << ", not null" unless c.null
      ret << ", limit=#{c.limit}" if c.limit && (c.limit != 255 && c.type != :string)
      ret
    end
842248
private static int postfixLen(String o1, String o2, int prefix) {
    int postfix = 0;
    int p1 = o1.length(), p2 = o2.length();
    while(p1 > prefix && p2 > prefix && (o1.charAt(--p1) == o2.charAt(--p2))) {
      ++postfix;
    }
    return postfix;
  }
814894
final public Selector Primary(boolean negated) throws ParseException {
                                      Selector ans; int op = Operator.PLUS;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 11:
    case TRUE:
    case FALSE:
    case IDENTIFIER:
    case QUOTED_IDENTIFIER:
    case INTEGER_LITERAL:
    case FLOATING_POINT_LITERAL:
    case STRING_LITERAL:
      ans = PrimaryNotPlusMinus(negated);
      break;
    case 7:
    case 8:
      op = PlusMinus();
                         negated ^= (op == Operator.MINUS);
      ans = Primary(negated);
      break;
    default:
      jj_la1[9] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    {if (true) return ans;}
    throw new Error("Missing return statement in function");
  }
897624
function(termination) {
        var ch_i,
          args = [],
          node,
          closed = false;
        while (index < length) {
          gobbleSpaces();
          ch_i = exprICode(index);
          if (ch_i === termination) {
            // done parsing
            closed = true;
            index++;
            break;
          } else if (ch_i === COMMA_CODE) {
            // between expressions
            index++;
          } else {
            node = gobbleExpression();
            if (!node || node.type === code.COMPOUND) {
              throwError("Expected comma", index);
            }
            args.push(node);
          }
        }
        if (!closed) {
          throwError("Expected " + String.fromCharCode(termination), index);
        }
        return args;
      }