Paul,
The first bug that you mention was corrected some time ago. What version of TM are you using?
The second one has been corrected in the latest SVN.
- AJ
On Nov 23, 2006, at 7:23 PM, Paul Williamson wrote:
I have discovered a couple of oddities in the Python language grammar:
Function names containing digits are not handled the same as functions names that do not contain digits. You can see this by looking at how the following code is highlighted:
def foo(self): pass
def foo2(self): pass I have not spent much time studying TextMate language grammars yet, but it appears that the "begin" regular expression for meta.function.python should be modified to allow digits in the function name.
Type names are highlighted as type names even in contexts where they couldn't possibly be type names. For example, in:
foo.set(x) the member function "set" is highlighted as if it were a type.
A negative look-behind RE could distinguish this specific case. I don't know how many other such cases are lurking in Python.
One could argue that it's bad practice to use type names as method names. Probably so, but it's not always avoidable. In particular, "set" wasn't even a type name until recently, and it's used as a method name in the standard library (e.g., in Tkinter). It's also a very nice verb to use as a method name.
Both of these came up while typing in a single recipe from _Python Cookbook_ (Recipe 11.11 from the 2nd Edition). I hope that's not typical. Syntax coloring needs to be *more* reliable than eyeballing the code.
-Paul paul@mustbeart.com
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate