diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/code.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/code.js b/docs/code.js index bfeaeb1..71ca75d 100644 --- a/docs/code.js +++ b/docs/code.js @@ -1,13 +1,14 @@ // high-quality syntax highlighter // TODO: Implement actual parser (or fix MANY regex bugs) +// TODO: bug: -0 in (-0 0) is not highlighted as index const term = (t) => t .replaceAll( - /(?<!\([+-]\d*)(?<![a-z][^&; ]*)([0-9])/g, + /(?<!\([+-]\d*)(?<![a-z][^&; ]*)(?<!["'])([0-9])/g, "<span class='index'>$1</span>", ) - .replaceAll(/'(.)'/g, "<span class='string'>'$1'</span>") + .replaceAll(/'([^\'])'/g, "<span class='string'>'$1'</span>") .replaceAll(/"([^\"]*)"/g, "<span class='string'>\"$1\"</span>") .replaceAll(/(\([+-][0-9]+[ubtd]?\))/g, "<span class='number'>$1</span>") .replaceAll(/(?<!\>)(\()/g, "<span class='left-app'>(</span>") |