"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/langDefs/slim.lang" (12 May 2020, 1681 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 "slim.lang": 3.53_vs_3.54.

    1 
    2 --https://gitlab.com/saalen/highlight/merge_requests/85
    3 
    4 Description="Slim (experimental)"
    5 
    6 Categories = {"template"}
    7 
    8 Keywords={
    9 
   10     {   Id=1,
   11         Regex=[[^\s*(([.#]?[\w]+[\:\-]*)+)]],
   12         Group=1,
   13     },
   14     {   Id=2,
   15         Regex=[[([-\w\.\-\:]+)=]],
   16     },
   17     {   Id=3,
   18         Regex=[[^\s*([-']|==?)\s*?]],
   19     },
   20     {   Id=3,
   21         Regex=[[.(=).]],
   22     },
   23     {   Id=4,
   24         Regex = [[ [#]\{.*?\} ]],
   25     },
   26     {   Id=4,
   27         Regex = [[ [#]\{\{.*?\}\} ]],
   28     }
   29 }
   30 
   31 Strings={
   32 
   33     Delimiter=[["|'|`|\|]],
   34     Interpolation = [[ [#]\{[^}]*?\} ]],
   35     -- DelimiterPairs= {{ Open=[[ \( ]], Close=[[ \) ]] }},
   36 }
   37 
   38 Comments={
   39 
   40     { Block=false,
   41     Delimiter= { [[^\s*(/)]] },
   42     },
   43 
   44     { Block=true,
   45     Nested=false,
   46     Delimiter= { [[<!\-\-]],[[\-\->]] }
   47     }
   48 }
   49 
   50 IgnoreCase=true
   51 
   52 specialString = 0
   53 lastColumn=-1
   54 wsPrefix = nil
   55 
   56 -- new args in 3.50: lineno and column
   57 function OnStateChange(oldState, newState, token, groupID, lineno, column)
   58 
   59     if specialString == 0 and newState==HL_STRING and token=='|' then
   60         specialString = 1
   61         return newState
   62     end
   63 
   64     if specialString==1 and newState==HL_STANDARD and wsPrefix == nil  then
   65 
   66         if #token > 1 and not string.match(token, "^%s") then
   67             wsPrefix = token
   68             lastColumn = column
   69             return HL_STRING
   70         end
   71     end
   72 
   73     if specialString==1  and (lastColumn > column)  then
   74         wsPrefix = nil
   75         specialString=0
   76         -- experimental syntax: second arg with state to define a reject continuation hint
   77         return HL_REJECT, HL_STRING_END
   78     elseif lastColumn == column and wsPrefix==token then
   79         return HL_STRING
   80     end
   81 
   82 end