atom / language-clojure

Clojure package for Atom
Other
49 stars 48 forks source link

Remove recursive expression matching within function names #86

Open maxbrunsfeld opened 5 years ago

maxbrunsfeld commented 5 years ago

⚠️ WIP ⚠️

Background

The entity.name.function.clojure rule matches function names: within a S-expression, it matches the entry right after the opening parenthesis. Currently, once a function name is matched, we recursively try to match for other expressions within the function name.

Problem

In GitHub.com's TextMate highlighting engine, this recursion is somehow preventing us from matching the end of the outer S-expression, leading to deeper and deeper nesting as we encounter more and more parenthesized S-expressions.

Drawbacks

Atom works fine with this Grammar. VSCode also works fine with the same grammar. This makes me thing there is a bug in our TextMate engine, but I haven't investigated deeply.

On the other hand, I don't understand why we would need to match syntactic structure within a function name. Maybe this is to handle namespaced symbols?

/cc @hanjos because you added this rule in #13. Could you explain the purpose of the $self pattern that I am removing here? I am guessing that there's a good reason for it; I'm just trying to work around some problems we're seeing.

/cc @jhawthorn @vmg @kivikakk

maxbrunsfeld commented 5 years ago

I'm gonna hold off on this for now, because I think that we may be able to fix the bug in the highlighting engine so that it can handle this rule better.

rsese commented 5 years ago

Hey @maxbrunsfeld! :wave:

I'm gonna hold off on this for now

Sounds good, if you want a review just let us know :v:

vmg commented 5 years ago

We've decided to fix the parser itself: although it doesn't look like the existing rule in the Clojure grammar is valid, we'd rather fix the parser so it doesn't choke on these bad grammars.