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

13
LINES

< > BotCompany Repo | #1033088 - tok_exclamPostfix

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

Libraryless. Click here for Pure Java version (4648L/27K).

// "<id>!", "?!" etc.
svoid tok_exclamPostfix(LS tok) {
  jreplace(tok, "*!", "$1.get()", tokcondition {
    S l = tok.get(i+1);
    if (!(isIdentifier(l) || eqOneOf(l, ")", "?"))) false;
    if (tok.get(i+2).contains("\n")) false; // no line break between <id> and !
    if (nempty(tok.get(i+4))) true; // space after = ok
    S t = _get(tok, i+5);
    if (t == null) ret false;
    if (isIdentifier(t) || eqOneOf(t, "=", "(")) false;
    true;
  });
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033088
Snippet name: tok_exclamPostfix
Eternal ID of this version: #1033088/2
Text MD5: 74a186d4cbb0ac44c6cacadb2eb21960
Transpilation MD5: b16f62eb6d4bf65fd985b08fc7bd20db
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-14 04:04:54
Source code size: 465 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 5 / 23
Version history: 1 change(s)
Referenced in: [show references]