1 | static WoodyRule getWoodyRuleFromSource(L<S> lines, int lineIndex) { |
2 | S s = lines.get(lineIndex); |
3 | Explain e = explain(s, ctxParsingRules(), "rule"); |
4 | if (e == null) |
5 | fail("Bad rule: " + s); |
6 | |
7 | new WoodyRule rule; |
8 | rule.nameInFile = e.sub(0).string(); |
9 | rule.lineInFile = lineIndex; |
10 | rule.condition = e.sub(1).string(); |
11 | pcall { |
12 | rule.parsedCondition = ctxParseExpression(e.sub(1)); |
13 | } |
14 | |
15 | Pair<SS, Int> p = ctxParseProperties(lines, lineIndex+1); |
16 | rule.properties.putAll(p.a); |
17 | |
18 | int opening = indexOfTrim(lines, "{", lineIndex); |
19 | if (opening >= 0) { |
20 | int closing = indexOfClosingCurlyBracket(lines, opening); |
21 | rule.body = lines(subList(lines, opening+1, closing)); |
22 | } |
23 | ret rule; |
24 | } |
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: | 518 / 576 |
Version history: | 5 change(s) |
Referenced in: | [show references] |