Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for s-expression comments #36

Open
cwfoo opened this issue Sep 17, 2018 · 3 comments
Open

Add support for s-expression comments #36

cwfoo opened this issue Sep 17, 2018 · 3 comments

Comments

@cwfoo
Copy link

cwfoo commented Sep 17, 2018

Add support for s-expression comments. For example:

#;(define (double x)
  (* 2 x))

Currently, the second line is highlighted as code. It should be highlighted as a comment.

@c42f
Copy link

c42f commented Mar 23, 2020

Something like the following seems to do it:

    syn region racketData start=/(/ end=/)/ contained transparent contains=racketData
    syn region racketSExpressionComment matchgroup=racketSExpressionComment start=/#;(/ end=/)/ contains=racketData
    syn cluster racketNormal  add=racketSExpressionComment
    syn cluster racketQuotedOrNormal  add=racketSExpressionComment
    hi def link racketSExpressionComment Comment

@cwfoo
Copy link
Author

cwfoo commented Mar 27, 2021

@c42f Your proposed solution does not handle this case:

(/ 6 #;0 2)

The 2) part will be incorrectly highlighted as a comment.

Refer to SRFI 62: S-expression comments for more examples.

@cwfoo
Copy link
Author

cwfoo commented Mar 27, 2021

A solution already exists in Vim's Scheme syntax file:

https://github.com/vim/vim/blob/v8.2.2663/runtime/syntax/scheme.vim#L70-L74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants