Skip to content

Commit 8976a00

Browse files
committed
Drop support for octal numbers
There is not a strong case for octal numbers in modern computing outside of UNIX permissions bits, and octal has caused us a little trouble before (see 5ebe565), so let us drop support for octal constants for simplicity.
1 parent c471e13 commit 8976a00

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

scripts/tenyr.vim

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ syn region tenyrString start='"' end='"' contained contains=tenyrEscape
3232
syn region tenyrStrRegion start="\.chars\>" end="$" keepend contains=tenyrString,tenyrStrDir
3333

3434
syn match tenyrNumber '-\?\<\(0\|[1-9]\([0-9_]*[0-9]\)\?\)\>' " decimal
35-
syn match tenyrNumber '-\?\<0[0-7_]*[0-7]' " octal
3635
syn match tenyrNumber '-\?\<0x[[:xdigit:]_]*[[:xdigit:]]' " hexadecimal
3736
syn match tenyrNumber '-\?\<0b[01_]*[01]' " binary
3837

src/lexer.l

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ symbol [A-Z_][A-Z0-9_]+|[Q-Z_][A-Z0-9_]*
5555
local \.L[A-Z0-9_]+
5656
string ([^"]|\\\")+
5757
hexnum "0x"[0-9a-f_]+
58-
octnum "0"[0-7_]*[0-7]
5958
binnum "0b"[01_]*[01]
6059
decnum 0|[1-9]([0-9_]*[0-9])?
61-
bitstr {hexnum}|{octnum}|{binnum}
60+
bitstr {hexnum}|{binnum}
6261
self [][|&+*^><.,:@()~;=/-]
6362
strcon ([^"]|\\\")
6463
escchar [\\"'0nbrtfv]
@@ -102,7 +101,7 @@ illegal { return ILLEGAL; }
102101
<needarrow>"<-" { return TOL; }
103102
"->" { return TOR; }
104103
105-
{hexnum}|{octnum} { yylval->i = numberise(&yytext[0], 0); return BITSTRING; }
104+
{hexnum} { yylval->i = numberise(&yytext[0], 16); return BITSTRING; }
106105
{binnum} { yylval->i = numberise(&yytext[2], 2); return BITSTRING; }
107106
{decnum} { yylval->i = numberise(&yytext[0], 10); return INTEGER; }
108107

test/pass_compile/underscore.tas

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.word 0x1234, 0x12_34, 0x1_2_3_4
22
.word 0b0110, 0b01_10, 0b0_1_1_0
33
.word 123456, 123_456, 12_34_56
4-
.word 012345, 012_345, 01_23_45, 0_12345

0 commit comments

Comments
 (0)