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

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

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: 102 / 150
Version history: 1 change(s)
Referenced in: [show references]