#1420 CoffeeScript doesn't use C-style comments

Bug
closed-fixed
Scintilla (791)
5
2014-12-03
2012-11-07
Eric Promislow
No

The CoffeeScript lexer marks /* ... */ as a comment, but this is incorrect -- cs interprets it as the start of a regex.

Since there's no conclusive cs spec, just the sample page at its project site, I'm going to assume that the lexer
should always color '/' as either the start of a regex or a division operator, and ignore the possibility that it starts
a block comment.

Will add a patch....

Related

Bugs: #1518

Discussion

  • Neil Hodgson
    Neil Hodgson
    2012-12-30

    This has removed some features but has not removed all of the code for the removed features:
    Message: Variable 'keywords3' is assigned a value that is never used.
    Message: Variable 'stylingWithinPreprocessor' is assigned a value that is never used.
    Message: Variable 'styleBeforeDCKeyword' is assigned a value that is never used.
    Message: Variable 'continuationLine' is assigned a value that is never used.

    It would also be a low priority idea to completely separate this lexer from LexCPP by switching SCE_C_* to SCE_COFFEESCRIPT_*.

     
  • Neil Hodgson
    Neil Hodgson
    2012-12-30

    • milestone: --> Bug
    • status: open --> open-accepted
     
  • Attached patches should fix the issue here by removing most of the obsolete code from LexCoffeeScript.cxx.

    @nyamatongwe is there something we can do about unused styles and keywords? Removing the entries in SciLexer.h would break API so I imagine it's not an option, and same for removing/reordering keywords; but currently there are 10 unused styles, and one unused keyword set.

     
    • Neil Hodgson
      Neil Hodgson
      2014-11-26

      Committed as (probably, SourceForge Hg is failing currently) [8b5d35] and [fdc669].

      For unused styles, in this case I'd probably agree with removal despite the incompatibility except that its likely that these styles will return in the future. Most languages are used with documentation tools so need doc-comment styles. With CoffeeScript a search revealed some use of similar tools, sometimes on the generated JavaScript, but no obvious consensus on which tools or how to use them.

       

      Related

      Commit: [8b5d35]
      Commit: [fdc669]

  • For unused styles, in this case I'd probably agree with removal despite the incompatibility except that its likely that these styles will return in the future. Most languages are used with documentation tools so need doc-comment styles. With CoffeeScript a search revealed some use of similar tools, sometimes on the generated JavaScript, but no obvious consensus on which tools or how to use them.

    Yes, documentation comments and keywords are likely to be a feature someone might want to add in the future, so would reintroduce similar styles.

    But things like UUID, preprocessor or verbatim/raw strings might not.

    Anyway, if you think it is OK to drop unused styles I can prepare a patch, possibly keeping COMMENT*DOC if you think it's best to.

     
  • Neil Hodgson
    Neil Hodgson
    2014-11-26

    OK to remove styles that will not be used in future. For binary compatibility, the other styles should retain their numbers.

    CoffeeScript has """ block strings but they aren't differentiated in the current lexer.
    http://coffeescript.org/#strings

     
  • Neil Hodgson
    Neil Hodgson
    2014-11-27

    • status: open-accepted --> open-fixed
     
  • Neil Hodgson
    Neil Hodgson
    2014-11-29

    Another minor change [a797ff] fixes the word list descriptions.

     

    Related

    Commit: [a797ff]

    • Oops, good catch, thanks!

       
  • Neil Hodgson
    Neil Hodgson
    2014-12-03

    • status: open-fixed --> closed-fixed