Download Jar. Libraryless. Click here for Pure Java version (7941L/56K).
!7 static withToList record Did$HappenBefore$(O event1, O event2) {} static withToList record WhenDid$Happen(O event) {} static withToList record $HappensAtSecond$(O event, O y) {} static cached L<Class> recordClasses() { ret (L) myNonAbstractClassesImplementing(IFieldsToList); } static cached LPair<Class, S> classesAndPatterns() { ret map(recordClasses(), c -> pair(c, dollarsToStarsAndSplitCamelCase(classNameRelativeToMC(c)))); } sO parseArg(S s) { ret isInteger(s) ? parseInt(s) : s; } sO parse(S s) { new Matches m; for (Pair<Class, S> p : classesAndPatterns()) { if (match3_plusBrackets_uncurly(p.b, s, m)) ret nuObject(p.a, mapToObjectArray parseArg(m.m)); } null; } p-exp { pnl(pairsB(classesAndPatterns())); testFunctionValues parse( "Did X happen before Y?" := Did$HappenBefore$("X", "Y"), "when did Z happen" := WhenDid$Happen("Z"), "{event 1} happens at second 100" := $HappensAtSecond$("event 1", 100) ); }
Began life as a copy of #1025431
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, omdjrrnzbjjv, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025442 |
Snippet name: | Propositions to objects, step 6 - parsing (OK) |
Eternal ID of this version: | #1025442/28 |
Text MD5: | 10263169b2cc208b1304492e0ecffd6b |
Transpilation MD5: | 325f63048670d0fa40856e9ca653d940 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-29 01:14:02 |
Source code size: | 1000 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 289 / 983 |
Version history: | 27 change(s) |
Referenced in: | [show references] |