static WoodyRule getWoodyRuleFromSource(L<S> 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<SS, Int> 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; }
Began life as a copy of #1008873
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1008881 |
| Snippet name: | getWoodyRuleFromSource |
| Eternal ID of this version: | #1008881/6 |
| Text MD5: | 8f8ec1cefe7001e1cfe5af94a5f77334 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-06-18 20:09:39 |
| Source code size: | 735 bytes / 24 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 734 / 797 |
| Version history: | 5 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1008925 - ctxParseProperties |