I wrote the following Erlang statement to split a tilde-delimited line:
{ok, Fields} = regexp:split(Line, "~").

The "~" is not highlighted correctly. It displays as a malformed string. If I put my cursor right before the closing bracket and check the scope I get:
source.erlang
meta.function.erlang
meta.function-call.erlang
string.quoted.double.erlang
invalid.illegal.string.erlang

The tilde (~) in Erlang is like the percent (%) in C/C++ printf. It is only parsed by formatting functions. It is not an inherent part of the string data structure. So instead of being a compile-time error in all strings it is a runtime error when passed as to a formatting function.

Erlang.tmbundle's language could be extended to treat strings in the scope of known formatting function calls with the format string syntax rules. I am not sure off the top of my head how to do this, but I will try.

In the meantime I will get around the highlighting by using an alternative syntax:
{ok, Fields} = regexp:split(Line, $~)

I would imagine the thought behind the current language rules is that static strings are primarily written as the arguments of formatting functions. In my experience this seems to be a legitimate conclusion.

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

Reply via email to