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

17
LINES

< > BotCompany Repo | #1034871 // tok_isMethodDeclarationNotSFInvocation

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

Libraryless. Click here for Pure Java version (5257L/29K).

// i points at the identifier you think may be a standard function invocation
// This function tries to distinguish those invocations from method declarations.

scope tok_isMethodDeclarationNotSFInvocation

// these prefix tokens mark a non-invocation (TODO: expand)
static Set<S> #pre = lithashset(
  ".", "void", "S", "String", "int", "bool", "boolean", "A", "Object", "O", "]", "double", "float", "short", "char", "long");

sbool tok_isMethodDeclarationNotSFInvocation(LS tok, int i, S mainClassName, IPred<S> isKnownClassName) {
  if (i == 1) false;
  S prev = tok.get(i-2);
  if (eq(prev, ".") && eqGet(tok, i-4, mainClassName)) false;
  if (pre.contains(prev)) true;
  if (isKnownClassName != null && isKnownClassName.get(prev)) true;
  false;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034871
Snippet name: tok_isMethodDeclarationNotSFInvocation
Eternal ID of this version: #1034871/2
Text MD5: f0893b0965d66967312cf7cd519f08fd
Transpilation MD5: a205eacdde34e4717be8ec02a3876866
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-12 22:33:13
Source code size: 767 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 118 / 178
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)