Skip to content
Permalink
Browse files
Scheme: Updates syntax for reals (#3159)
According to R7RS spec, you can use different mnemonics
for the scientific notation that indicated the precision of the number.
  • Loading branch information
jcubic committed Oct 23, 2021
1 parent 3755120 commit 4eb81fa1d67926d61767f00b775c5a11a48b1edf
Showing with 34 additions and 2 deletions.
  1. +1 −1 components/prism-scheme.js
  2. +1 −1 components/prism-scheme.min.js
  3. +32 −0 tests/languages/scheme/number_feature.test
@@ -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,

Some generated files are not rendered by default. Learn more.

@@ -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)

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

[
@@ -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", ")"]

]

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

0 comments on commit 4eb81fa

Please sign in to comment.