Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Scheme syntax for real numbers #3159

Merged
merged 1 commit into from Oct 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/prism-scheme.js
Expand Up @@ -70,7 +70,7 @@
// non-decimal bases together. This results in a decimal (dec) and combined binary, octal, and hexadecimal (box)
// pattern:
pattern: RegExp(SortedBNF({
'<ureal dec>': /\d+(?:\/\d+)|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/.source,
'<ureal dec>': /\d+(?:\/\d+)|(?:\d+(?:\.\d*)?|\.\d+)(?:[esfdl][+-]?\d+)?/.source,
'<real dec>': /[+-]?<ureal dec>|[+-](?:inf|nan)\.0/.source,
'<imaginary dec>': /[+-](?:<ureal dec>|(?:inf|nan)\.0)?i/.source,
'<complex dec>': /<real dec>(?:@<real dec>|<imaginary dec>)?|<imaginary dec>/.source,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-scheme.min.js

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

32 changes: 32 additions & 0 deletions tests/languages/scheme/number_feature.test
Expand Up @@ -18,9 +18,23 @@
10+.1i
10+1.i

10.0E2
10.0D2
10.0L2
10.0S2
10.0F2

10.0e2
10.0d2
10.0l2
10.0s2
10.0f2

; not a number but a symbol
(define 1+2 10)

(list 10.0P2 10.0g2 10.0w2)

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

[
Expand Down Expand Up @@ -101,13 +115,31 @@
["number", "10+.1i"],
["number", "10+1.i"],

["number", "10.0E2"],
["number", "10.0D2"],
["number", "10.0L2"],
["number", "10.0S2"],
["number", "10.0F2"],

["number", "10.0e2"],
["number", "10.0d2"],
["number", "10.0l2"],
["number", "10.0s2"],
["number", "10.0f2"],

["comment", "; not a number but a symbol"],

["punctuation", "("],
["keyword", "define"],
" 1+2 ",
["number", "10"],
["punctuation", ")"],

["punctuation", "("],
["builtin", "list"],
" 10.0P2 10.0g2 10.0w2",
["punctuation", ")"]

]

----------------------------------------------------
Expand Down