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.

_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev

Reply via email to