Menu

#1224 Kotlin & Groovy langs

Completed
open
nobody
5
2021-02-11
2018-07-16
No

Please add Kotlin & Groovy lexers.

Or, what is the best way to copy LexCPP.cxx and add the new keywords from Kotlin?

Any help appreciated.

Thanks

Related

Commit: [221bd4]
Commit: [465ef8]
Commit: [769d2a]
Commit: [fe170a]

Discussion

  • Neil Hodgson

    Neil Hodgson - 2018-07-17

    Keywords are specified at runtime with SCI_SETKEYWORDS so there is no need to copy a lexer if the languages are lexically similar like C++, Java, and C# are.

     
    • felix

      felix - 2021-02-11

      Kotlin is dissimilar enough from C++ to make reusing the C++ lexer a poor choice. The language has a number of features that are incompatible with C++ lexing:

      • Most importantly, a sizable number of contextual keywords.
      • Escaped identifiers (...).
      • String interpolation "${ ... }".
      • Multiline strings """ ... """.
      • Numeric separator syntax dissimilar from C++: 1_000.
      • Attribute syntax dissimilar from C++: @JvmStatic.
      • No preprocessor; in fact, no defined use for the # character other than in a shebang line.

      I don’t know Groovy very well, but as far as I know all but the first two points above apply to it too. And all but the first three apply to Java itself as well (since Java 13), to the point where I believe writing a separate lexer for Java is warranted.

       
      👍
      1

      Last edit: felix 2021-02-11

Log in to post a comment.

MongoDB Logo MongoDB