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

34
LINES

< > BotCompany Repo | #1033793 // Tok_FieldModifierKeyword

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

Libraryless. Click here for Pure Java version (6077L/34K).

1  
abstract srecord noeq Tok_FieldModifierKeyword(S keyword) {
2  
  settable LS tok;
3  
  int iEndOfLModifiers, iLModifiers, iRModifiers, iEndOfRModifiers,
4  
    iType, iEndOfType;
5  
  S type, var;
6  
  LS modifiers;
7  
  Cl<S> recognizedModifiers = javaModifiers();
8  
  
9  
  void run(LS tok) {
10  
    this.tok = tok;
11  
    
12  
    int i = -1;
13  
    while ((i = jfind(tok, i+1, keyword + " <id>")) >= 0) {
14  
      iEndOfLModifiers = i;
15  
      iLModifiers = leftScanModifiers(tok, iEndOfLModifiers, recognizedModifiers);
16  
      iRModifiers = i+2;
17  
      iEndOfRModifiers = tok_scanModifiers_idx(tok, iRModifiers);
18  
      iType = iEndOfRModifiers;
19  
      iEndOfType = tok_endOfType(tok, iEndOfRModifiers);
20  
      type = joinSubList_cToC(tok, iType, iEndOfType);
21  
      var = identifierOrQuestionMark(get(tok, iEndOfType);
22  
      modifiers = identifiersOnly(joinLists(
23  
        subList(tok, iLModifiers, iEndOfLModifiers),
24  
        subList(tok, iRModifiers, iEndOfRModifiers)));
25  
      S replacement = replacement();
26  
      printVars(+i, +iRModifiers, +iEndOfRModifiers, +iType, +iEndOfType, +type, +var, +replacement);
27  
      tokReplace_reTok(tok, iLModifiers, iEndOfType-1, replacement);
28  
    }
29  
  }
30  
  
31  
  S boxedType() { ret tok_toNonPrimitiveTypes(type); }
32  
  
33  
  abstract S replacement();
34  
}

Author comment

Began life as a copy of #1033078

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033793
Snippet name: Tok_FieldModifierKeyword
Eternal ID of this version: #1033793/15
Text MD5: 040e68d881c297bb08a3c461ec2e2c9e
Transpilation MD5: 6dc4052df3ad2f51cb244c37256e0500
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-07 19:43:22
Source code size: 1272 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 448
Version history: 14 change(s)
Referenced in: [show references]