201214.1 · 3bf2b47b1c067ac30d4213c5670b2d7ec35ddb49
improved PHP8 syntax support
reading declarations
@@ -9,8 +9,9 @@ == highlight 3.60 -05.12.2020+14.12.2020 + - improved PHP 8 syntax support - fixed single argument and truecolor output of mark_lines.lua plug-in (https://gitlab.com/saalen/highlight/-/issues/164) - added lineno and column parameters to Decorate hook
@@ -2,6 +2,7 @@ Description="Java" Categories = {"source"} +-- def is a Groovy reserved word. Added here for convenience Keywords={ { Id=1, List={"abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const",@@ -9,7 +10,7 @@ Keywords={ "float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws",- "transient", "try", "void", "volatile", "while", "var"},+ "transient", "try", "void", "volatile", "while", "var", "def"}, }, { Id=2, List={"false", "true", "null"},
@@ -23,10 +23,10 @@ Keywords={ }, }, { Id=2,- List={"int", "integer", "real", "double", "float", "string", "array", "object", "bool", "mixed", "numeric"},+ List={"int", "integer", "real", "double", "float", "string", "array", "object", "bool", "mixed", "numeric", "void" }, }, { Id=3,- Regex=[[\$[\w\-"|'|\>]+|\$?\{.+?\}]],+ Regex=[[\$[\w\-"|']+|\$?\{.+?\}]], }, { Id=4, Regex=[[(\w+)\s*\(]],@@ -44,7 +44,7 @@ IgnoreCase=true Comments={ { Block=false,- Delimiter= { [[\/\/|\#]] },+ Delimiter= { [[\/\/|\#(?!\[)]] }, -- distinct comment from PHP8 attribute }, { Block=true, Nested=false,@@ -52,7 +52,8 @@ Comments={ } } -Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\|\+|\-|\.|\@]]+-- add #\[ as opening delimiter for PHP 8 attributes+Operators=[=[ \(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\|\+|\-|\.|\@|\||#\[|\? ]=] function OnStateChange(oldState, newState, token)
@@ -71,6 +71,8 @@ function syntaxUpdate(desc) function OnStateChange(oldState, newState, token, groupID, lineno, column) + -- a bit rough using cursor movement and resetting space properties but+ -- this kind of stuff is not intended at all in the core code if (HL_OUTPUT==HL_FORMAT_TRUECOLOR or HL_OUTPUT==HL_FORMAT_XTERM256) then if linesToMark[currentLineNumber] then OverrideParam("format.spacer", ansiOpenSeq.." ")@@ -86,10 +88,8 @@ function syntaxUpdate(desc) end io.write(ansiOpenSeq) if markStarts then- io.write(string.rep(" ", column)) io.write("\x1B["..string.format("%d", column+1).."D")- elseif not linesNoIdent[currentLineNumber] then io.write(string.rep(" ", column)) end