Bug: IDL inline comments not recognized

Issue #1469 new
Amir Caspi
created an issue

In IDL syntax, comments that are inlined after code are not recognized properly. Standalone comments work fine. For example:

; This comment renders properly
x = 5  ; this comment does not

renders as:


This is also shown here: Pygments demo

Doing a similar thing with, for example, perl highlighting (using # as the comment char) works as expected... but IDL does not.

Hopefully an easy fix...

Comments (1)

  1. Amir Caspi reporter

    Looks like it was an easy fix after all. Modify lexer file idl.py with following patch:

    --- idl.py  2018-08-23 12:17:13.000000000 -0600
    +++ idl_new.py      2018-08-23 12:17:23.000000000 -0600
    @@ -249,7 +249,7 @@
         tokens = {
             'root': [
    -            (r'^\s*;.*?\n', Comment.Singleline),
    +            (r';.*\n', Comment.Single),
                 (words(_RESERVED, prefix=r'\b', suffix=r'\b'), Keyword),
                 (words(_BUILTIN_LIB, prefix=r'\b', suffix=r'\b'), Name.Builtin),
                 (r'\+=|-=|\^=|\*=|/=|#=|##=|<=|>=|=', Operator),

    Testing this locally now yields the correct behavior: Screen Shot 2018-08-23 at 12.22.35 PM.png

    Hopefully this can be pushed to distro. Thanks!

  2. Log in to comment