Download Jar. Libraryless. Click here for Pure Java version (7620L/54K).
!7 sS input = [[ Rule: /,/ [regexp] => The line contains a comma. Input: "Hello," Output: "The line contains a comma." ---- Same rule. Input: "Yo." Output: - ]]; p-exp { scoreToConsole(voidfunc(Scorer scorer) { LS tests = splitAtMultipleMinusLines(input); SS map = null; for (S test : tests) { print(); SS lastMap = map; map = parseColonProperties_withMultiLines(test, ciSS()); if (containsTrimmedLineIC(test, "Same rule.")) map.put("Rule", lastMap.get("Rule")); pnlStruct(map); S input = unquote(map.get("Input")); S output = unquote(map.get("Output")); PairS rule = splitAtDoubleArrow_pair(map.get("Rule")); S out = "-"; S in = rule.a; PairS inAndType = splitTrailingSquareBracketStuff(in); if (eqic(inAndType.b, "regexp")) if (regexpContains(dropTrailingAndLeadingSlash(inAndType.a), input)) out = rule.b; scorer.eq(out, output); } }); }
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xfasiavlzxuf
No comments. add comment
Snippet ID: | #1021532 |
Snippet name: | A Rule Test with regexp [OK] |
Eternal ID of this version: | #1021532/12 |
Text MD5: | d32f4eee8f389ecc600b83028cbcdc71 |
Transpilation MD5: | 6837d0220bfb7f102f8a0e3add96076c |
Author: | stefan |
Category: | javax / stefan's os / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-17 15:26:26 |
Source code size: | 1067 bytes / 48 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 543 / 1421 |
Version history: | 11 change(s) |
Referenced in: | [show references] |