Libraryless. Click here for Pure Java version (5257L/29K).
1 | // i points at the identifier you think may be a standard function invocation |
2 | // This function tries to distinguish those invocations from method declarations. |
3 | |
4 | scope tok_isMethodDeclarationNotSFInvocation |
5 | |
6 | // these prefix tokens mark a non-invocation (TODO: expand) |
7 | static Set<S> #pre = lithashset( |
8 | ".", "void", "S", "String", "int", "bool", "boolean", "A", "Object", "O", "]", "double", "float", "short", "char", "long"); |
9 | |
10 | sbool tok_isMethodDeclarationNotSFInvocation(LS tok, int i, S mainClassName, IPred<S> isKnownClassName) {
|
11 | if (i == 1) false; |
12 | S prev = tok.get(i-2); |
13 | if (eq(prev, ".") && eqGet(tok, i-4, mainClassName)) false; |
14 | if (pre.contains(prev)) true; |
15 | if (isKnownClassName != null && isKnownClassName.get(prev)) true; |
16 | false; |
17 | } |
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: | 332 / 437 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |