@ 261105.1

210322.1.1 · 75285f816de0d2bfbddcbb7ac832d41e9158b5d4

Resolve "Roadmap 4.0"

reading declarations

Changes to langDefs/javascript.lang. All files

langDefs/javascript.lang

new file mode 100644@@ -0,0 +1,80 @@++Description="Javascript"++Categories = {"source", "script"}++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/][^\s]*?[^\\]/[msixpodualgcy]*]],+    Group=0+  },++  { Id=4,+    Regex=[[(\w+)(\s*[:=]\s*function)?\s*\(]],+    Group=1+  },+  { Id=4,+    Regex=[[(\w+)\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 or oldState==HL_COMMENT) and newState==HL_KEYWORD and groupID == 3 then+    return HL_REJECT+  end+  return newState+end