nathan11g/highlight.js — pull request #1 by drdrang (2012-09-09 13:57:52+00:00)
Title: Applescript

Thanks for showing me that you could add to "keyword" and the other definitions in the "contains" section.

I've made an initial attempt to distinguish between "return" used as a command and "return" used as a constant. The heuristic is pretty simple and it's easy to write code that breaks it, but it works for most of my uses.

-- return as a constant
set a to return & "abc" & return & "def" & linefeed & "ghi"

-- return as a command
return a

-- return as a command and constant
if 4 is less than 5 then
return thing & return & a
end if

--return as a constant, misidentified as a command
set b to "abc" & ¬
return & "def"

This misidentification could be fixed, I think, with a negative lookbehind, but I haven't tried that yet. My use of JavaScript regexes has been pretty elementary to date.