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

16
LINES

< > BotCompany Repo | #1026295 // test_tok_findBeginningOfJavaXTerm

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

Libraryless. Click here for Pure Java version (3185L/19K).

svoid test_tok_findBeginningOfJavaXTerm() {
  LS tok = javaTok([[ a~.b ]]);
  assertEqualsVerbose("a", get(tok, tok_findBeginningOfJavaXTerm(tok, indexOf(tok, "a"))));
  assertEqualsVerbose("a", get(tok, print(tok_findBeginningOfJavaXTerm(tok, print(indexOf(tok, "b"))))));
  tok = javaTok([[ = getGuild()~.getRoles() ]]);
  assertEqualsVerbose("getGuild", get(tok, tok_findBeginningOfJavaXTerm(tok, indexOf(tok, ")"))));
  
  test_tok_findBeginningOfJavaXTerm("ret o.~a", "o");
}

svoid test_tok_findBeginningOfJavaXTerm(S src, S token) {
  LS tok = javaTok(src);
  int i = indexOfAnySubList(tok, ll(".", "", "~"), ll("~", "", "."));
  printVars_str(+i);
  assertEqualsVerbose(token, get(tok, tok_findBeginningOfJavaXTerm(tok, i)));
}

Author comment

Began life as a copy of #1025038

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1026295
Snippet name: test_tok_findBeginningOfJavaXTerm
Eternal ID of this version: #1026295/10
Text MD5: 21d7df0c41d16e761a43c793f8ceb152
Transpilation MD5: da2c9e532fa5ce2404dcb986f86c1b03
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-05 09:08:48
Source code size: 750 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 245 / 368
Version history: 9 change(s)
Referenced in: [show references]