static L ai_buParser_parseWeightedProductions() { ret ai_buParser_parseWeightedProductions(mL_raw(ai_language() + " bottom-up groupings")); } static L ai_buParser_parseWeightedProductions(S text) { new L l; for (S s : tlftj(text)) { s = trim(javaDropAllComments(s)); L meta = trimAll(tok_splitAtComma(trailingAngleBracketStuff(s))); s = dropTrailingAngleBracketStuff(s); //print("s=" + s +", meta=" + meta); L tok = javaTokWithAngleBracketsC(s); WeightedProduction p = null; double weight = 1.0; S f = null; for (S met : meta) if (startsWithDigit(met)) weight = parseDouble(met); else if (startsWith(met, "ai")) f = met; if (l(tok) == 5) p = WeightedProduction(tok.get(0), tok.get(2), tok.get(4), weight); else if (l(tok) == 3) p = WeightedProduction(tok.get(0), tok.get(2), weight); if (p != null) { p.plausibilityFunction = f; for (S met : meta) if (eqOneOf(met, "L", "R", "B")) { //print("Have simplification hint: " + met); p.simplificationHint = met; } l.add(p); } } ret l; }