/usr/share/highlight/langDefs/js.lang is in highlight-common 3.41-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | Description="Javascript"
Digits=[[ (?:0x)[0-9a-fA-F]+|(?:0b)[01]+|(?:0o)[0-8]+|\d*[\.]?\d+(?:[eE][\-\+]\d+)?[lLuU]* ]]
Keywords={
{ Id=1,
List={"abstract", "break", "class", "const", "continue", "debugger",
"default", "delete", "enum", "export", "extends", "finally",
"instanceof", "import", "implements", "in", "goto", "native", "package",
"private", "protected", "public", "super", "throw", "throws",
"transient", "typeof", "void", "false", "with", "for", "this", "switch", "try",
"while", "if", "do", "else", "return", "null", "case", "catch", "true", "new",
"prototype", "var", "function", "namespace","use", "internal", "interface",
"yields", "let", "get", "set", "of", "from", "constructor", "move", "yield", "static",
},
},
{ Id=2,
List={"boolean", "byte", "char", "double", "float", "int", "long", "short",
"decimal", "enum", "sbyte", "uint", "ulong", "ushort", "void", "undefined"},
},
-- may be replaced by NestedSections
{ Id=3,
Regex=[[\/[^*\s/].*?[^\\]/[msixpodualgcy]*]],
Group=0
},
{ Id=4,
Regex=[[(\w+)(\s*[:=]\s*function)?\s*\(]],
Group=1
},
}
Strings={
Delimiter=[["|'|`]],
Interpolation=[[ \$\{.+?\} ]],
Escape = [=[ \\u\{?[[:xdigit:]]{4,6}\}?|\\\d{3}|\\x[[:xdigit:]]{2}|\\[ntvbrfa\\\?'\"] ]=]
}
IgnoreCase=false
Comments={
{ Block=false,
Delimiter= { [[\/\/]] },
},
{ Block=true,
Nested=false,
Delimiter= { [[\/\*]],[[\*\/]],}
}
}
-- FIXME: division oerator, comments
--NestedSections = { -- regex as nested language seems to work?
-- {
-- Lang = "js_regex", -- js.lang might want to use this too
-- Delimiter = { [[/(?![/\*])]], [[/[msixpodualgcy]*]] },
-- --State=HL_STRING
-- }
--}
Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|.]]
EnableIndentation=true
-- resolve issue with regex expression which spans strings like "</i>" + VAR + "</i>"
function OnStateChange(oldState, newState, token, groupID)
if string.sub(token,1,1)=="/" and oldState==HL_STRING and newState==HL_KEYWORD and groupID == 3 then
return HL_REJECT
end
return newState
end
|