"Fossies" - the Fresh Open Source Software Archive

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

    1 
    2 Description="PHP"
    3 
    4 Categories = {"source", "script"}
    5 
    6 Keywords={
    7   { Id=1,
    8     List={
    9       "abstract", "and", "array", "as", "break", "case",
   10       "catch",   "cfunction", "class", "clone", "const",
   11       "continue", "declare", "default", "do", "else", "elseif",
   12       "enddeclare", "endfor", "endforeach", "endif", "endswitch",
   13       "endwhile", "extends", "final", "for", "foreach",
   14       "function", "global", "goto", "if", "implements",
   15       "interface", "instanceof", "namespace",  "new",
   16       "old_function", "or", "private", "protected",  "public",
   17       "static", "switch", "throw", "try",  "use", "var", "while",
   18       "xor", "__CLASS__", "__DIR__",  "__LINE__", "__FILE__",
   19       "__FUNCTION__", "__TRAIT__", "__METHOD__",  "__NAMESPACE__",
   20       "die", "echo", "empty", "exit", "eval", "include",
   21       "include_once", "isset", "list", "require", "require_once",
   22       "return", "print", "unset",  "true", "false", "null", "resource"
   23     },
   24   },
   25   { Id=2,
   26     List={"int", "integer", "real", "double", "float", "string", "array", "object", "bool", "mixed", "numeric"},
   27   },
   28   { Id=3,
   29     Regex=[[\$[\w\-"|'|\>]+|\$?\{.+?\}]],
   30   },
   31   { Id=4,
   32     Regex=[[(\w+)\s*\(]],
   33   },
   34 }
   35 
   36 -- hereDoc opening delimiter, see OnStateChange to handle end of string
   37 Strings={
   38   Delimiter=[["|'|<<<'?[\w_]+'?]],
   39   Escape=[=[ \\\d{3}|\\u\d{4}|\\x[[:xdigit:]]{2}|\\[ntvbrfa\\\?'"\$] ]=],
   40   --Interpolation = [[ \$\w+\[.+?\] ]]
   41 }
   42 
   43 IgnoreCase=true
   44 
   45 Comments={
   46   { Block=false,
   47     Delimiter= { [[\/\/|\#]] },
   48   },
   49   { Block=true,
   50     Nested=false,
   51     Delimiter= { [[\/\*]],[[\*\/]],}
   52   }
   53 }
   54 
   55 Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\|\+|\-|\.|\@]]
   56 
   57 function OnStateChange(oldState, newState, token)
   58 
   59   if oldState==HL_STRING and token==hereDoc then
   60     hereDoc = nil
   61     return HL_STRING_END
   62   end
   63 
   64 
   65   if (string.sub(token,1,1) =="$" or string.sub(token,1,1) =="{") and oldState==HL_STRING and newState==HL_KEYWORD then
   66     return HL_INTERPOLATION
   67   end
   68 
   69   if (string.sub(token,1,1) =="{") and  oldState~=HL_STRING and newState==HL_KEYWORD then
   70     return HL_REJECT
   71   end
   72 
   73   if hereDoc~=nil then
   74     return HL_STRING
   75   end
   76 
   77   --recognize hereDoc multine strings
   78   if oldState==HL_STANDARD and newState==HL_STRING and not string.find("\"'", token) then
   79     hereDoc = string.match(token, "<<<'?([%a_]+)" )
   80   end
   81 
   82   if oldState~=HL_STRING and newState==HL_ESC_SEQ then
   83     return oldState
   84   end
   85 
   86   return newState
   87 end