Hey again,
I worked with AlexRoss in ##textmate and found a possible solution (we don't know if anything else broke but it looks good so far). I also fixed something else in the process. I don't know who maintains the language but maybe they can make an assessment on wether or not this affects any edge cases (the comma change seems rather dangerous). If all looks good I think it would be good to merge into the bundle. Maybe change the "comment = 'JavaScript Syntax: version 2.0';" at the top to update the version number? Here goes:
My changes and tests: ------------------------------
Test Cases: [Make it obvious] http://pastie.textmate.org/private/tmwxc0nhbjh0guwfltw7g [1000 lines should be good to test] http://code.google.com/p/google-code-prettify/source/browse/trunk/src/pretti...
New Definition File: (I don't think I can attach it to the list so I pastie'd) http://pastie.textmate.org/223002
Diff: (changes to "meta.delimiter.object.comma.js" and "string.regexp.js") joe$ diff old.textmate new.textmate 62c62 < match = '\b(function)\s+([a-zA-Z_$]\w*)?\s*(()(.*?)())'; ---
match = '\b(function)(\s+[a-zA-Z_$]\w*)?\s*(\()(.*?)(\))';
214c214 < begin = '(?<=[=(:]|^|return)\s*(/)(?![/*+{}?])'; ---
begin = '(?<=[\[,&=(:]|^|return)\s*(/)(?![/*+{}?])';
228c228 < match = ',[ |\t]*'; ---
match = ',';
For those who want to see what actually changed: -------------------------------------------------------------------
Old Definition Image: (shows errors) http://www.grabup.com/uploads/19a58ab51574cc91d0ba8dcf070387d4.png
New Definition Image: (shows correctly) http://www.grabup.com/uploads/31ef744364e7d43b55bbd72c4a270603.png
Thanks, Joseph Pecoraro
On Jun 26, 2008, at 6: 13PM, Joseph Pecoraro wrote:
Hello All,
The JavaScript language highlighter doesn't highlight regular expressions inside of an array. Here is a code sample that shows some simple test cases and only a few pass:
/test/ [/test/] [1,2,/test/] [1,2,/test/,'blah',/test/] [ /test/, /test/ ,/test/ ] new Array(1,2,3) new Array(/test/, /test/, /test/) "blah".match(/test/);
I haven't worked much with languages before, but I assume all that would be needed would be including "string.regexp.js" inside of an array class or maybe modify "punctuation.definition.string.begin.js". I couldn't find any way to do that. I also tried adding a "," to the list of characters that could come before the regexp itself but it didn't seem to work, but I'm still new.
Can anyone recommend a solution?
Also, can anyone point me to where I can find the definition of "punctuation.definition.*" and the like?
References I have look at: http://blog.macromates.com/2005/introduction-to-scopes/ http://manual.macromates.com/en/language_grammars.html#naming_conventions
Thanks in Advance, Joseph Pecoraro