"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/langDefs/js.lang" (12 May 2020, 2278 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "js.lang": 3.55_vs_3.56.

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