[SVN] PATCH: Erlang.tmbundle parenthesized expression scope
Alain O'Dea
alain.odea at gmail.com
Mon Dec 31 05:23:21 UTC 2007
Proposed Patch
==============
The following patch corrects the language definition of Erlang in
Erlang.tmbundle to correctly identify the scope of parenthesized
expressions:
--- Syntaxes/Erlang.plist (revision 8755)
+++ Syntaxes/Erlang.plist (working copy)
@@ -902,6 +902,10 @@
<array>
<dict>
<key>include</key>
+ <string>#parenthesized-expression</string>
+ </dict>
+ <dict>
+ <key>include</key>
<string>#internal-function-parts</string>
</dict>
</array>
This makes the rule 'function' include the rule 'parenthesized-
expression' in its patterns resulting in correct highlighting of code
involving parenthesized expressions.
Background
==========
There is a omission of an pattern include in the language definition
of Erlang in Erlang.tmbundle that causes incorrect syntax highlighting
following a parenthesized expression.
The following legal Erlang code does not have the correct scope
identified in the fibonnaci(1) clause using the syntax rules provided
in Erlang.tmbundle:
fibonnaci(0) -> (0);
fibonnaci(1) -> 1;
fibonnaci(N) -> fibonacci(N-1) + fibonnaci(N-2).
The second clause (starting on line 3) is identified as having scope:
source.erlang
meta.function.erlang
meta.function-call.erlang
When its scope should actually be:
source.erlang
meta.function.erlang
entity.name.function.definition.erlang
Interestingly the scope of the fibonacci(N) clause is correctly
identified.
This problem does not appear to occur with constructs like lists
([Item,Item,...]), tuples ({Item,Item,...}), or binaries
(<<Byte,Byte,...>>) as in:
f(0) -> {0};
f(1) -> {1};
f(N) -> {2}.
The same problem occurs across function definitions where f() and h()
both have correct scopes, but g() has the same incorrect scope as
fibonacci(1):
f() -> (0).
g() -> 1.
h() -> 2.
More information about the textmate-dev
mailing list