Skip to content

Commit

Permalink
Merge pull request #37 from scrivo/feature/9.14.x
Browse files Browse the repository at this point in the history
Port highlight.js 9.14.x changes
  • Loading branch information
allejo authored Feb 8, 2019
2 parents 27e8acc + d62439b commit 4f76c84
Show file tree
Hide file tree
Showing 83 changed files with 794 additions and 32 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ php:
- 5.5
- 5.4

matrix:
fast_finish: true
allow_failures:
# Since PHP 8.0.0-dev is the new nightly, some dependencies don't support
# it in their Composer files
- php: nightly

install:
- composer install --no-interaction --no-progress

Expand Down
4 changes: 3 additions & 1 deletion AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Language and style definitions (copied from the highlight.js project)
Domen Kožar <[email protected]>
Dotan Dimet <[email protected]>
Dr. Drang <[email protected]>
Duncan Paterson <[email protected]>
Edwin Dalorzo <[email protected]>
Egor Rogov <[email protected]>
Eric Bailey <[email protected]>
Expand Down Expand Up @@ -167,6 +168,7 @@ Language and style definitions (copied from the highlight.js project)
Kurt Emch <[email protected]>
Ladislav Prskavec <[email protected]>
Lars Schulna <[email protected]>
Laurent Voullemier <[email protected]>
Loren Segal <[email protected]>
Louis Barranqueiro <[email protected]>
Lucas Mazza <[email protected]>
Expand All @@ -183,7 +185,6 @@ Language and style definitions (copied from the highlight.js project)
Marvin Saignat <[email protected]>
Matt Diephouse <[email protected]>
Matt Evans <[email protected]>
Matt Evans <[email protected]>
Matthew Daly <[email protected]>
Max Mikhailov <[email protected]>
Maxim Dikun <[email protected]>
Expand Down Expand Up @@ -238,6 +239,7 @@ Language and style definitions (copied from the highlight.js project)
Ruslan Keba <[email protected]>
Sam Wu <[email protected]>
Samuel Reed <[email protected]>
Sean T. Allen <[email protected]>
Seongwon Lee <[email protected]>
Sergey Baranov <[email protected]>
Sergey Bronnikov <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions Highlight/Highlighter.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,9 @@ public function highlight($language, $code, $ignoreIllegals = true, $continuatio
$index = 0;

while ($this->top && $this->top->terminators) {
$test = preg_match($this->top->terminators, $code, $match, PREG_OFFSET_CAPTURE, $index);
$test = @preg_match($this->top->terminators, $code, $match, PREG_OFFSET_CAPTURE, $index);
if ($test === false) {
throw new \Exception("Invalid regExp " . var_export($this->top->terminators, true));
throw new \Exception("Invalid " . $this->language->name . " regExp " . var_export($this->top->terminators, true));
} elseif ($test === 0) {
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Highlight/languages/clean.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"aliases":["clean","icl","dcl"],"keywords":{"keyword":"if let in with where case of class instance otherwise implementation definition system module from import qualified as special code inline foreign export ccall stdcall generic derive infix infixl infixr","literal":"True False"},"contains":[{"className":"comment","begin":"//","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"comment","begin":"/\\*","end":"\\*/","contains":[{"$ref":"#contains.0.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"string","begin":"'","end":"'","illegal":"\\n","contains":[{"begin":"\\\\[\\s\\S]","relevance":0}]},{"className":"string","begin":"\"","end":"\"","illegal":"\\n","contains":[{"$ref":"#contains.2.contains.0"}]},{"className":"number","begin":"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)","relevance":0},{"begin":"->|<-[|:]?|::|#!?|>>=|\\{\\||\\|\\}|:==|=:|\\.\\.|<>|`"}]}
{"aliases":["clean","icl","dcl"],"keywords":{"keyword":"if let in with where case of class instance otherwise implementation definition system module from import qualified as special code inline foreign export ccall stdcall generic derive infix infixl infixr","built_in":"Int Real Char Bool","literal":"True False"},"contains":[{"className":"comment","begin":"//","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"comment","begin":"/\\*","end":"\\*/","contains":[{"$ref":"#contains.0.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"string","begin":"'","end":"'","illegal":"\\n","contains":[{"begin":"\\\\[\\s\\S]","relevance":0}]},{"className":"string","begin":"\"","end":"\"","illegal":"\\n","contains":[{"$ref":"#contains.2.contains.0"}]},{"className":"number","begin":"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)","relevance":0},{"begin":"->|<-[|:]?|#!?|>>=|\\{\\||\\|\\}|:==|=:|<>"}]}
2 changes: 1 addition & 1 deletion Highlight/languages/clojure-repl.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contains":[{"className":"meta","begin":"^([\\w.-]+|\\s*#_)=>","starts":{"end":"$","subLanguage":"clojure"}}]}
{"contains":[{"className":"meta","begin":"^([\\w.-]+|\\s*#_)?=>","starts":{"end":"$","subLanguage":"clojure"}}]}
2 changes: 1 addition & 1 deletion Highlight/languages/crystal.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"aliases":["cr"],"lexemes":"[a-zA-Z_]\\w*[!?=]?","keywords":{"keyword":"abstract alias as as? asm begin break case class def do else elsif end ensure enum extend for fun if include instance_sizeof is_a? lib macro module next nil? of out pointerof private protected rescue responds_to? return require select self sizeof struct super then type typeof union uninitialized unless until when while with yield __DIR__ __END_LINE__ __FILE__ __LINE__","literal":"false nil true"},"contains":[{"className":"template-variable","variants":[{"begin":"\\{\\{","end":"\\}\\}"},{"begin":"\\{%","end":"%\\}"}],"keywords":{"$ref":"#keywords"},"contains":[{"className":"string","contains":[{"begin":"\\\\[\\s\\S]","relevance":0},{"className":"subst","begin":"#{","end":"}","keywords":{"$ref":"#keywords"},"contains":{"$ref":"#contains"}}],"variants":[{"begin":"'","end":"'"},{"begin":"\"","end":"\""},{"begin":"`","end":"`"},{"begin":"%w?\\(","end":"\\)","contains":[{"begin":"\\(","end":"\\)","contains":{"$ref":"#contains.0.contains.0.variants.3.contains"}}]},{"begin":"%w?\\[","end":"\\]","contains":[{"begin":"\\[","end":"\\]","contains":{"$ref":"#contains.0.contains.0.variants.4.contains"}}]},{"begin":"%w?{","end":"}","contains":[{"begin":"{","end":"}","contains":{"$ref":"#contains.0.contains.0.variants.5.contains"}}]},{"begin":"%w?<","end":">","contains":[{"begin":"<","end":">","contains":{"$ref":"#contains.0.contains.0.variants.6.contains"}}]},{"begin":"%w?/","end":"/"},{"begin":"%w?%","end":"%"},{"begin":"%w?-","end":"-"},{"begin":"%w?\\|","end":"\\|"},{"begin":"<<-\\w+$","end":"^\\s*\\w+$"}],"relevance":0},{"className":"string","variants":[{"begin":"%q\\(","end":"\\)","contains":[{"begin":"\\(","end":"\\)","contains":{"$ref":"#contains.0.contains.1.variants.0.contains"}}]},{"begin":"%q\\[","end":"\\]","contains":[{"begin":"\\[","end":"\\]","contains":{"$ref":"#contains.0.contains.1.variants.1.contains"}}]},{"begin":"%q{","end":"}","contains":[{"begin":"{","end":"}","contains":{"$ref":"#contains.0.contains.1.variants.2.contains"}}]},{"begin":"%q<","end":">","contains":[{"begin":"<","end":">","contains":{"$ref":"#contains.0.contains.1.variants.3.contains"}}]},{"begin":"%q/","end":"/"},{"begin":"%q%","end":"%"},{"begin":"%q-","end":"-"},{"begin":"%q\\|","end":"\\|"},{"begin":"<<-'\\w+'$","end":"^\\s*\\w+$"}],"relevance":0},{"begin":"(!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~)\\s*","contains":[{"className":"regexp","contains":[{"$ref":"#contains.0.contains.0.contains.0"},{"$ref":"#contains.0.contains.0.contains.1"}],"variants":[{"begin":"//[a-z]*","relevance":0},{"begin":"/","end":"/[a-z]*"},{"begin":"%r\\(","end":"\\)","contains":[{"begin":"\\(","end":"\\)","contains":{"$ref":"#contains.0.contains.2.contains.0.variants.2.contains"}}]},{"begin":"%r\\[","end":"\\]","contains":[{"begin":"\\[","end":"\\]","contains":{"$ref":"#contains.0.contains.2.contains.0.variants.3.contains"}}]},{"begin":"%r{","end":"}","contains":[{"begin":"{","end":"}","contains":{"$ref":"#contains.0.contains.2.contains.0.variants.4.contains"}}]},{"begin":"%r<","end":">","contains":[{"begin":"<","end":">","contains":{"$ref":"#contains.0.contains.2.contains.0.variants.5.contains"}}]},{"begin":"%r/","end":"/"},{"begin":"%r%","end":"%"},{"begin":"%r-","end":"-"},{"begin":"%r\\|","end":"\\|"}]}],"relevance":0},{"className":"regexp","contains":[{"$ref":"#contains.0.contains.0.contains.0"},{"$ref":"#contains.0.contains.0.contains.1"}],"variants":[{"begin":"%r\\(","end":"\\)","contains":[{"begin":"\\(","end":"\\)","contains":{"$ref":"#contains.0.contains.3.variants.0.contains"}}]},{"begin":"%r\\[","end":"\\]","contains":[{"begin":"\\[","end":"\\]","contains":{"$ref":"#contains.0.contains.3.variants.1.contains"}}]},{"begin":"%r{","end":"}","contains":[{"begin":"{","end":"}","contains":{"$ref":"#contains.0.contains.3.variants.2.contains"}}]},{"begin":"%r<","end":">","contains":[{"begin":"<","end":">","contains":{"$ref":"#contains.0.contains.3.variants.3.contains"}}]},{"begin":"%r/","end":"/"},{"begin":"%r%","end":"%"},{"begin":"%r-","end":"-"},{"begin":"%r\\|","end":"\\|"}],"relevance":0},{"className":"meta","begin":"@\\[","end":"\\]","contains":[{"className":"meta-string","begin":"\"","end":"\"","illegal":"\\n","contains":[{"$ref":"#contains.0.contains.0.contains.0"}]}]},{"className":"comment","begin":"#","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"class","beginKeywords":"class module struct","end":"$|;","illegal":"=","contains":[{"$ref":"#contains.0.contains.5"},{"className":"title","begin":"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?","relevance":0},{"begin":"<"}]},{"className":"class","beginKeywords":"lib enum union","end":"$|;","illegal":"=","contains":[{"$ref":"#contains.0.contains.5"},{"className":"title","begin":"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?","relevance":0}],"relevance":10},{"className":"function","beginKeywords":"def","end":"\\B\\b","contains":[{"className":"title","begin":"[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?","relevance":0,"endsParent":true}]},{"className":"function","beginKeywords":"fun macro","end":"\\B\\b","contains":[{"className":"title","begin":"[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?","relevance":0,"endsParent":true}],"relevance":5},{"className":"symbol","begin":"[a-zA-Z_]\\w*(\\!|\\?)?:","relevance":0},{"className":"symbol","begin":":","contains":[{"$ref":"#contains.0.contains.0"},{"begin":"[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?"}],"relevance":0},{"className":"number","variants":[{"begin":"\\b0b([01_]*[01])(_[uif](8|16|32|64))?"},{"begin":"\\b0o([0-7_]*[0-7])(_[uif](8|16|32|64))?"},{"begin":"\\b0x([A-Fa-f0-9_]*[A-Fa-f0-9])(_[uif](8|16|32|64))?"},{"begin":"\\b(([0-9][0-9_]*[0-9]|[0-9])(\\.[0-9_]*[0-9])?([eE][+-]?[0-9_]*[0-9])?)(_[uif](8|16|32|64))?"}],"relevance":0}]},{"$ref":"#contains.0.contains.0"},{"$ref":"#contains.0.contains.1"},{"$ref":"#contains.0.contains.2"},{"$ref":"#contains.0.contains.3"},{"$ref":"#contains.0.contains.4"},{"$ref":"#contains.0.contains.5"},{"$ref":"#contains.0.contains.6"},{"$ref":"#contains.0.contains.7"},{"$ref":"#contains.0.contains.8"},{"$ref":"#contains.0.contains.9"},{"$ref":"#contains.0.contains.10"},{"$ref":"#contains.0.contains.11"},{"$ref":"#contains.0.contains.12"}]}
{"aliases":["cr"],"lexemes":"[a-zA-Z_]\\w*[!?=]?","keywords":{"keyword":"abstract alias annotation as as? asm begin break case class def do else elsif end ensure enum extend for fun if include instance_sizeof is_a? lib macro module next nil? of out pointerof private protected rescue responds_to? return require select self sizeof struct super then type typeof union uninitialized unless until verbatim when while with yield __DIR__ __END_LINE__ __FILE__ __LINE__","literal":"false nil true"},"contains":[{"className":"template-variable","variants":[{"begin":"\\{\\{","end":"\\}\\}"},{"begin":"\\{%","end":"%\\}"}],"keywords":{"$ref":"#keywords"},"contains":[{"className":"string","contains":[{"begin":"\\\\[\\s\\S]","relevance":0},{"className":"subst","begin":"#{","end":"}","keywords":{"$ref":"#keywords"},"contains":{"$ref":"#contains"}}],"variants":[{"begin":"'","end":"'"},{"begin":"\"","end":"\""},{"begin":"`","end":"`"},{"begin":"%[Qwi]?\\(","end":"\\)","contains":[{"begin":"\\(","end":"\\)","contains":{"$ref":"#contains.0.contains.0.variants.3.contains"}}]},{"begin":"%[Qwi]?\\[","end":"\\]","contains":[{"begin":"\\[","end":"\\]","contains":{"$ref":"#contains.0.contains.0.variants.4.contains"}}]},{"begin":"%[Qwi]?{","end":"}","contains":[{"begin":"{","end":"}","contains":{"$ref":"#contains.0.contains.0.variants.5.contains"}}]},{"begin":"%[Qwi]?<","end":">","contains":[{"begin":"<","end":">","contains":{"$ref":"#contains.0.contains.0.variants.6.contains"}}]},{"begin":"%[Qwi]?\\|","end":"\\|"},{"begin":"<<-\\w+$","end":"^\\s*\\w+$"}],"relevance":0},{"className":"string","variants":[{"begin":"%q\\(","end":"\\)","contains":[{"begin":"\\(","end":"\\)","contains":{"$ref":"#contains.0.contains.1.variants.0.contains"}}]},{"begin":"%q\\[","end":"\\]","contains":[{"begin":"\\[","end":"\\]","contains":{"$ref":"#contains.0.contains.1.variants.1.contains"}}]},{"begin":"%q{","end":"}","contains":[{"begin":"{","end":"}","contains":{"$ref":"#contains.0.contains.1.variants.2.contains"}}]},{"begin":"%q<","end":">","contains":[{"begin":"<","end":">","contains":{"$ref":"#contains.0.contains.1.variants.3.contains"}}]},{"begin":"%q\\|","end":"\\|"},{"begin":"<<-'\\w+'$","end":"^\\s*\\w+$"}],"relevance":0},{"className":"regexp","contains":[{"$ref":"#contains.0.contains.0.contains.0"},{"$ref":"#contains.0.contains.0.contains.1"}],"variants":[{"begin":"%r\\(","end":"\\)","contains":[{"begin":"\\(","end":"\\)","contains":{"$ref":"#contains.0.contains.2.variants.0.contains"}}]},{"begin":"%r\\[","end":"\\]","contains":[{"begin":"\\[","end":"\\]","contains":{"$ref":"#contains.0.contains.2.variants.1.contains"}}]},{"begin":"%r{","end":"}","contains":[{"begin":"{","end":"}","contains":{"$ref":"#contains.0.contains.2.variants.2.contains"}}]},{"begin":"%r<","end":">","contains":[{"begin":"<","end":">","contains":{"$ref":"#contains.0.contains.2.variants.3.contains"}}]},{"begin":"%r\\|","end":"\\|"}],"relevance":0},{"begin":"(?!%})(!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~|\\n|\\b(case|if|select|unless|until|when|while)\\b)\\s*","keywords":"case if select unless until when while","contains":[{"className":"regexp","contains":[{"$ref":"#contains.0.contains.0.contains.0"},{"$ref":"#contains.0.contains.0.contains.1"}],"variants":[{"begin":"//[a-z]*","relevance":0},{"begin":"/(?!\\/)","end":"/[a-z]*"}]}],"relevance":0},{"className":"meta","begin":"@\\[","end":"\\]","contains":[{"className":"meta-string","begin":"\"","end":"\"","illegal":"\\n","contains":[{"$ref":"#contains.0.contains.0.contains.0"}]}]},{"className":"comment","begin":"#","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"class","beginKeywords":"class module struct","end":"$|;","illegal":"=","contains":[{"$ref":"#contains.0.contains.5"},{"className":"title","begin":"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?","relevance":0},{"begin":"<"}]},{"className":"class","beginKeywords":"lib enum union","end":"$|;","illegal":"=","contains":[{"$ref":"#contains.0.contains.5"},{"className":"title","begin":"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?","relevance":0}],"relevance":10},{"beginKeywords":"annotation","end":"$|;","illegal":"=","contains":[{"$ref":"#contains.0.contains.5"},{"className":"title","begin":"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?","relevance":0}],"relevance":10},{"className":"function","beginKeywords":"def","end":"\\B\\b","contains":[{"className":"title","begin":"[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?","relevance":0,"endsParent":true}]},{"className":"function","beginKeywords":"fun macro","end":"\\B\\b","contains":[{"className":"title","begin":"[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?","relevance":0,"endsParent":true}],"relevance":5},{"className":"symbol","begin":"[a-zA-Z_]\\w*(\\!|\\?)?:","relevance":0},{"className":"symbol","begin":":","contains":[{"$ref":"#contains.0.contains.0"},{"begin":"[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?"}],"relevance":0},{"className":"number","variants":[{"begin":"\\b0b([01_]+)(_*[ui](8|16|32|64|128))?"},{"begin":"\\b0o([0-7_]+)(_*[ui](8|16|32|64|128))?"},{"begin":"\\b0x([A-Fa-f0-9_]+)(_*[ui](8|16|32|64|128))?"},{"begin":"\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_*[-+]?[0-9_]*)?(_*f(32|64))?(?!_)"},{"begin":"\\b([1-9][0-9_]*|0)(_*[ui](8|16|32|64|128))?"}],"relevance":0}]},{"$ref":"#contains.0.contains.0"},{"$ref":"#contains.0.contains.1"},{"$ref":"#contains.0.contains.2"},{"$ref":"#contains.0.contains.3"},{"$ref":"#contains.0.contains.4"},{"$ref":"#contains.0.contains.5"},{"$ref":"#contains.0.contains.6"},{"$ref":"#contains.0.contains.7"},{"$ref":"#contains.0.contains.8"},{"$ref":"#contains.0.contains.9"},{"$ref":"#contains.0.contains.10"},{"$ref":"#contains.0.contains.11"},{"$ref":"#contains.0.contains.12"},{"$ref":"#contains.0.contains.13"}]}
Loading

0 comments on commit 4f76c84

Please sign in to comment.