Skip to content

invokedynamic and the keywords long, boolean, final are not highlighted #3

Open

Description

@dpc00

Claude reports: invokedynamic is not highlighted, and neither are the Java keywords long, boolean and final that javap prints in method signatures.

Tested with Java Bytecode 1.0.5 on Sublime Text 4215, syntax "Java Bytecode (Custom highlighting)".

The README says the package highlights "calls to invoke..." and the "list of all bytecode instructions". invokedynamic is a JVM instruction (Java 7 and later, and javap prints it for every lambda), but the invoke pattern in both java-bytecode.tmLanguage and java-bytecode-custom.tmLanguage is

\b(invokeinterface|invokespecial|invokestatic|invokevirtual)\b

Likewise the Java keyword pattern is

\b(class|private|public|protected|static|void|int|double|float|byte|char|abstract|interface|short)\b

so long, boolean, final, synchronized, native and throws (all printed by javap, for example public static long foo();) get no scope.

Observed with this text:

public static long foo();
Code:
0: invokedynamic #2, 0
5: invokevirtual #3

Scope at invokevirtual: source.java.bytecode bytecode.invoke
Scope at invokedynamic: source.java.bytecode (nothing)
Scope at static: source.java.bytecode bytecode.javakeyword
Scope at long: source.java.bytecode (nothing)

Fix, tested in a loose copy of both files: add invokedynamic| at the start of the invoke group, and |long|boolean|final|synchronized|native|throws to the keyword group. With that, invokedynamic gets bytecode.invoke and long gets bytecode.javakeyword.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions