Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1036306 // tok_ifdef

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (10562L/59K).

1  
// process ifdef x ... endifdef blocks
2  
static void tok_ifdef(LS tok, IPred<S> isDefined) {
3  
  // ifdef x or y
4  
  jreplace_dyn(tok, "ifdef <id> or <id>", (_tok, cIdx) -> {
5  
    S flag1 = tok.get(cIdx+2), flag2 = tok.get(cIdx+6);
6  
    bool value = isDefined.get(flag1) || isDefined.get(flag2);
7  
    //print("ifdef: " + flag1 + " | " + flag2 + " = " + value);
8  
    ret "ifdef " + value;
9  
  });
10  
  
11  
  tok_conditionals(tok, "ifdef", "endifdef", isDefined, true, false);
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036306
Snippet name: tok_ifdef
Eternal ID of this version: #1036306/3
Text MD5: 94af180afc93f1979bb568aa12ee2d0f
Transpilation MD5: 12ccb02191406494ec34804dd0452c8c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-15 18:19:06
Source code size: 469 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 136 / 194
Version history: 2 change(s)
Referenced in: [show references]