atom / language-clojure

Clojure package for Atom
Other
49 stars 48 forks source link

Syntax highlighting for keywords at the beginning of line does not work #70

Open moxaj opened 7 years ago

moxaj commented 7 years ago

Description

^ Title.

Steps to Reproduce

Type any keyword at the beginning of a line.

Expected behavior: [What you expect to happen]

Keyword hightlighted as a keyword (constant.keyword.clojure)

Actual behavior: [What actually happens]

Keyword is not highlighted as a keyword.

Reproduces how often: [What percentage of the time does it reproduce?]

Always.

Versions

Any version.

Additional Information

Relevant regex:

'(?<=(\\s|\\(|\\[|\\{)):[a-zA-Z0-9\\#\\.\\-\\_\\:\\+\\=\\>\\<\\/\\!\\?\\*]+(?=(\\s|\\)|\\]|\\}|\\,))'

The positive lookbehind states that the colon should be preceded by a whitespace, (, [ or a [ character. Obviously neither of those precede the colon when the keyword is at the beginning of a line. Adding the word boundary anchor (\b) to the possible characters would fix it, however the regex engine cannot handle variable-length lookbehinds.

winstliu commented 7 years ago

Wouldn't adding ^ (start-of-line) fix it?

moxaj commented 7 years ago

I think that'd still count as variable-length lookbehind (^ probably counts as zero length).