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

11
LINES

< > BotCompany Repo | #1009545 - tok_hasClassRef2 - leaves out ifclass blocks

JavaX fragment (include)

1  
static bool tok_hasClassRef2(L<S> tok, S className) {
2  
  int n = l(tok);
3  
  int level = 0;
4  
  for (int i = 1; i < n; i += 2) {
5  
    S t = tok.get(i);
6  
    if (eqOneOf(t, "ifclass", "ifndef")) ++level;
7  
    else if (eqOneOf(t, "endif", "endifndef")) --level;
8  
    else if (level <= 0 && eq(t, className)) true;
9  
  }
10  
  false;
11  
}

Author comment

Began life as a copy of #1007936

download  show line numbers  debug dex   

Travelled to 11 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1009545
Snippet name: tok_hasClassRef2 - leaves out ifclass blocks
Eternal ID of this version: #1009545/1
Text MD5: fa16af32503c9a171bba5a0bef28417b
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-07 17:42:41
Source code size: 327 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 259 / 277
Referenced in: [show references]

Formerly at http://tinybrain.de/1009545 & http://1009545.tinybrain.de