scope gazelle_addVarConvertersToRules. sclass #VarConverter { S var1, var2; O converter; // func(S) -> S bool debug; *() {} *(S *var1, S *var2, O *converter, bool *debug) {} SS get(SS map, LS tokC, LS tokI, RuleEngine2_MatchedRule matched) { if (map == null) null; S value = map.get(var1); if (value == null) ret map; S value2 = (S) callAndMake_orF1(converter, value); if (debug) print("VarConverter: " + value + " => " + value2); if (!strictPutIC(map, var2, value2)) null; ret map; } } svoid gazelle_addVarConvertersToRules(RuleEngine2 engine, O... _) { bool debug = boolPar debug(_) || boolPar varConverterDebug(_); for (final RuleEngine2.Rule r : engine.rules) for (Matches m : getJMatches_all("convert var * to * with *", r.comments)) r.addMapMassager(new VarConverter($1, $2, $3, debug)); } end scope
Began life as a copy of #1021811
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021872 |
Snippet name: | gazelle_addVarConvertersToRules |
Eternal ID of this version: | #1021872/14 |
Text MD5: | 3a1bd6cd7f02156a316ff5f635bd0483 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-04 15:52:31 |
Source code size: | 897 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 251 / 318 |
Version history: | 13 change(s) |
Referenced in: | [show references] |