Transpiled version (4477L) is out of date.
// macro declareS { S s = blubbi(); } // // void myThing { // declareS // expands to: S s = blubbi(); // print(s); // } svoid tok_localMacro(LS tok) { int i; while ping ((i = jfind_reversed(tok, "macro <id> {")) >= 0) { S macroName = tok.get(i+2); int iMacroOpeningBracket = i+4; int iMacroClosingBracket = findEndOfBlock(tok, iMacroOpeningBracket)-1; S replacement = joinSubList(tok, iMacroOpeningBracket+1, iMacroClosingBracket); // do the replacement print("Replacing macro " + macroName + " with <" + trim(replacement) + ">"); int end = findEndOfBlock(tok, iMacroClosingBracket)-1; for ping (int j = iMacroClosingBracket+2; j < end; j += 2) if (eq(tok.get(j), macroName)) tok.set(j, replacement); // delete macro declaration clearTokens(tok, i, iMacroClosingBracket+1); reTok(tok, i, end); } }
Began life as a copy of #1013759
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032653 |
Snippet name: | tok_localMacro - define a macro local to current block |
Eternal ID of this version: | #1032653/4 |
Text MD5: | 6c82df7d074b6cc02df10aeb046c6f6a |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-30 05:10:59 |
Source code size: | 917 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 153 / 225 |
Version history: | 3 change(s) |
Referenced in: | [show references] |