Skip to content

Commit

Permalink
Julia: Highlight ‘Inf’ and ‘NaN’ as constants (#1921)
Browse files Browse the repository at this point in the history
This highlight `Inf`, `NaN` and all of their variants as constants.
  • Loading branch information
dvdhansen authored and RunDevelopment committed May 28, 2019
1 parent feb3187 commit 2141129
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/prism-julia.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ Prism.languages.julia= {
'boolean' : /\b(?:true|false)\b/,
'number' : /(?:\b(?=\d)|\B(?=\.))(?:0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:[efp][+-]?\d+)?j?/i,
'operator': /[-+*^%÷&$\\]=?|\/[\/=]?|!=?=?|\|[=>]?|<(?:<=?|[=:])?|>(?:=|>>?=?)?|==?=?|[~≠≤≥]/,
'punctuation' : /[{}[\];(),.:]/
'punctuation' : /[{}[\];(),.:]/,
'constant': /\b(?:(?:NaN|Inf)(?:16|32|64)?)\b/
};
2 changes: 1 addition & 1 deletion components/prism-julia.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions tests/languages/julia/constant_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
NaN NaN16 NaN32 NaN64
Inf Inf16 Inf32 Inf64

----------------------------------------------------

[
["constant", "NaN"],
["constant", "NaN16"],
["constant", "NaN32"],
["constant", "NaN64"],
["constant", "Inf"],
["constant", "Inf16"],
["constant", "Inf32"],
["constant", "Inf64"]
]

----------------------------------------------------

Checks for all constants.

0 comments on commit 2141129

Please sign in to comment.