flix / highlightjs-flix

Apache License 2.0
1 stars 3 forks source link

`enum` keyword is not highlighted as a keyword #28

Closed jaschdoc closed 11 months ago

magnus-madsen commented 1 year ago

Any idea why this happens?

jaschdoc commented 1 year ago

Yes, I think the regex on keywords may be wrong, so line https://github.com/flix/highlightjs-flix/blob/775018968dde26cf3ea348e599338f76152b9167/src/flix.js#L44 should be beginKeywords: /class|enum/ (or something similar). I.e., a proper regex and not just a string literal with some regex stuff inside.

jaschdoc commented 1 year ago

Another possible solution is just to copy-paste the object and replace class with enum in the beginKeywords literal, thus creating something like const ENUM = { ... };

jaschdoc commented 1 year ago

Another possible fix may simply be to add a list of string literals instead of a regex, but I'm not sure about this. I'll have to check the documentation.