Restrict custom binary and graphics digits (#1693)

* Restrict custom binary and graphics digits

* Update documentation

* Fix build error
This commit is contained in:
Rangi
2025-05-22 04:52:51 -04:00
committed by GitHub
parent 126b1e5726
commit 5d998ef483
9 changed files with 211 additions and 90 deletions

View File

@@ -1,5 +1,13 @@
opt b123
opt b_1
opt b10
opt b00
opt g12345
opt g012_
opt g$123
opt g0234
opt gxxyy
opt gxyzy
opt pxy
opt p1234
opt Qxy

View File

@@ -1,23 +1,39 @@
error: invalid-opt.asm(1):
Must specify exactly 2 characters for option 'b'
error: invalid-opt.asm(2):
Must specify exactly 4 characters for option 'g'
Invalid digit for binary constant '_'
error: invalid-opt.asm(3):
Invalid argument for option 'p'
Changed digit for binary constant '1'
error: invalid-opt.asm(4):
Invalid argument for option 'p'
Repeated digit for binary constant '0'
error: invalid-opt.asm(5):
Invalid argument for option 'Q'
Must specify exactly 4 characters for option 'g'
error: invalid-opt.asm(6):
Invalid argument for option 'Q'
Invalid digit for graphics constant '_'
error: invalid-opt.asm(7):
Argument for option 'Q' must be between 1 and 31
Invalid digit for graphics constant '$'
error: invalid-opt.asm(8):
Argument to 'r' is out of range ("99999999999999999999999999")
Changed digit for graphics constant '2'
error: invalid-opt.asm(9):
Must specify an argument for option 'W'
Repeated digit for graphics constant 'x'
error: invalid-opt.asm(10):
syntax error, unexpected end of line, expecting string
Repeated digit for graphics constant 'y'
error: invalid-opt.asm(11):
Invalid argument for option 'p'
error: invalid-opt.asm(12):
Invalid argument for option 'p'
error: invalid-opt.asm(13):
Invalid argument for option 'Q'
error: invalid-opt.asm(14):
Invalid argument for option 'Q'
error: invalid-opt.asm(15):
Argument for option 'Q' must be between 1 and 31
error: invalid-opt.asm(16):
Argument to 'r' is out of range ("99999999999999999999999999")
error: invalid-opt.asm(17):
Must specify an argument for option 'W'
error: invalid-opt.asm(18):
syntax error, unexpected end of line, expecting string
error: invalid-opt.asm(19):
No entries in the option stack
error: Assembly aborted (11 errors)!
error: Assembly aborted (19 errors)!

View File

@@ -1,7 +1,7 @@
SECTION "test", ROM0
; '\0' is not special here; it's lexed as a line continuation...
DEF foo\0bar EQU 42
db foo\0bar
DEF foo\0qux EQU 42
db foo\0qux
; ...just like any other non-whitespace character
DEF spam\Xeggs EQU 69
db spam\Xeggs

View File

@@ -1,4 +1,4 @@
PRINTLN `pqpq_rsrs
OPT g.x0X
PRINTLN `.x.x_0X0X
OPT g.xOX
PRINTLN `.x.x_OXOX

View File

@@ -22,7 +22,7 @@ _1234::
dl 6_._283_185 ; fixed point
dw `0123_3210, `00_33_22_11_ ; gfx
; underscores as digits
opt g_ABC, b_X
db %_X_X__XX
dw `_A_B_C__
; underscores with custom digits
opt g.ABC, b.X
db %.X.X_..XX_
dw `.A.B_.C.._