updated code to support the radixed number with 'r'
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-24 19:41:42 +09:00
parent 4651fadcea
commit 2abda37861
8 changed files with 207 additions and 90 deletions

View File

@ -108,6 +108,9 @@ i := 0xAbCd93481FFAABBCCDDEeFa12837281
j := 0o125715446440377652567463357357502240671201
k := 0b1010101111001101100100110100100000011111111110101010101110111100110011011101111011101111101000010010100000110111001010000001
l := 14272837210234798094990047170340811393
m := 16rAbCd93481FFAABBCCDDEeFa12837281
n := 36rMVV36DNKTQ0Z2Q3L027T3NGH
o := +35r18Q4OPTU2KRS7FVR09B5MORY3
if (== i j) { printf "OK: i is equal to j\n" } \
else { printf "ERROR: i is not equal to j\n" }
@ -115,4 +118,16 @@ if (== i k) { printf "OK: i is equal to k\n" } \
else { printf "ERROR: i is not equal to k\n" }
if (== i l) { printf "OK: i is equal to l\n" } \
else { printf "ERROR: i is not equal to l\n" }
if (== i m) { printf "OK: i is equal to m\n" } \
else { printf "ERROR: i is not equal to m\n" }
if (== i n) { printf "OK: i is equal to n\n" } \
else { printf "ERROR: i is not equal to n\n" }
if (== i o) { printf "OK: i is equal to o\n" } \
else { printf "ERROR: i is not equal to o\n" }
i := (- -16r123abcd128738279878172387123aabbea19849d8282882822332332 123)
k := -1919784483373631008405784517212288102153752573650638404319957951405
if (== i k) { printf "OK: i is %d\n" i k } \
else { printf "ERROR: i is not equal to %d\n" k }
} ## END

View File

@ -14,10 +14,13 @@ $include 10 ##ERROR: syntax error - $include target expected in place of '10'
---
0b ##ERROR: invalid numeric literal with no digit '0b'
0b ##ERROR: syntax error - invalid numeric literal with no digit after '0b'
---
16r ##ERROR: syntax error - invalid numeric literal with no digit after '16r'
---
##
x := (+ 10 20) "aaaa"; ##ERROR: syntax error - too many rvalues
@ -87,7 +90,28 @@ printf "[%c]\n" b'★'; ##ERROR: syntax error - wrong character literal
printf "%O\n" #b[ 10 20 30 ];
printf "%010b\n" 0b0101;
printf "%O\n" #bxy; ##ERROR: syntax error - neither valid radixed number nor valid directive '#bxy'
printf "%O\n" 0bxy; ##ERROR: syntax error - invalid numeric literal character 'x' after '0b'
---
printf "%O\n" 0b12xy ##ERROR: syntax error - invalid numeric literal character '2' after '0b1'
---
printf "%O\n" 0b0b11 ##ERROR: syntax error - invalid numeric literal character 'b' after '0b0'
---
printf "%O\n" 0o0127890 ##ERROR: syntax error - invalid numeric literal character '8' after '0o0127'
---
printf "%O\n" 35rabcdefghijklzabcd ##ERROR: syntax error - invalid numeric literal character 'z' after '35rabcdefghijkl'
---
+ 12389127398127389217382197283197321897r11221 1 ##ERROR: syntax error - radix too large '12389127398127389217382197283197321897' before 'r'
---