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).

abstract srecord noeq Tok_FieldModifierKeyword(S keyword) {
  settable LS tok;
  int iEndOfLModifiers, iLModifiers, iRModifiers, iEndOfRModifiers,
    iType, iEndOfType;
  S type, var;
  LS modifiers;
  Cl<S> recognizedModifiers = javaModifiers();
  
  void run(LS tok) {
    this.tok = tok;
    
    int i = -1;
    while ((i = jfind(tok, i+1, keyword + " <id>")) >= 0) {
      iEndOfLModifiers = i;
      iLModifiers = leftScanModifiers(tok, iEndOfLModifiers, recognizedModifiers);
      iRModifiers = i+2;
      iEndOfRModifiers = tok_scanModifiers_idx(tok, iRModifiers);
      iType = iEndOfRModifiers;
      iEndOfType = tok_endOfType(tok, iEndOfRModifiers);
      type = joinSubList_cToC(tok, iType, iEndOfType);
      var = identifierOrQuestionMark(get(tok, iEndOfType);
      modifiers = identifiersOnly(joinLists(
        subList(tok, iLModifiers, iEndOfLModifiers),
        subList(tok, iRModifiers, iEndOfRModifiers)));
      S replacement = replacement();
      printVars(+i, +iRModifiers, +iEndOfRModifiers, +iType, +iEndOfType, +type, +var, +replacement);
      tokReplace_reTok(tok, iLModifiers, iEndOfType-1, replacement);
    }
  }
  
  S boxedType() { ret tok_toNonPrimitiveTypes(type); }
  
  abstract S replacement();
}

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: 164 / 446
Version history: 14 change(s)
Referenced in: [show references]