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

13
LINES

< > BotCompany Repo | #1033836 // tok_optionalArguments - see also: tok_optionalFields

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

Transpiled version (5463L) is out of date.

// void blu(optional S bla) { ... }
// => void blu(S bla default null) { ... }
svoid tok_optionalArguments(LS tok) {
  for (int i : jfindAll_reverse(tok, "optional <id>", (_tok, nIdx)
    -> eqGetOneOf(tok, nIdx-1, ",", "("))) {
    int iEndOfType = tok_endOfType(tok, i+2);
    S var = tok.get(iEndOfType);
    S type = joinSubList(tok, i+2, iEndOfType);
    
    tokReplace_reTok(tok, i, iEndOfType+1,
      "\*type*/ \*var*/ default null");
  }
}

Author comment

Began life as a copy of #1031988

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033836
Snippet name: tok_optionalArguments - see also: tok_optionalFields
Eternal ID of this version: #1033836/4
Text MD5: 7e108c752c6a9f5ab96da73b0669d623
Author: stefan
Category: javax / image reconstruction [dev.]
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-06 23:09:31
Source code size: 461 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 68 / 118
Version history: 3 change(s)
Referenced in: [show references]