static WoodyRule getWoodyRuleFromSource(L lines, int lineIndex) { S s = lines.get(lineIndex); Explain e = explain(s, ctxParsingRules(), "rule"); if (e == null) fail("Bad rule: " + s); new WoodyRule rule; rule.nameInFile = e.sub(0).string(); rule.lineInFile = lineIndex; rule.condition = e.sub(1).string(); pcall { rule.parsedCondition = ctxParseExpression(e.sub(1)); } Pair p = ctxParseProperties(lines, lineIndex+1); rule.properties.putAll(p.a); int opening = indexOfTrim(lines, "{", lineIndex); if (opening >= 0) { int closing = indexOfClosingCurlyBracket(lines, opening); rule.body = lines(subList(lines, opening+1, closing)); } ret rule; }