Much improved error messages for ca65. For most errors it will now say what

was expected and what was found instead. Also improved error recovery in a few
places.
This commit is contained in:
Kugel Fuhr
2025-07-04 17:11:34 +02:00
parent 500b86f1e2
commit bcd29de443
46 changed files with 779 additions and 342 deletions

View File

@@ -1,6 +1,4 @@
.macpack cpu
; step 1: try to assemble an instruction that's exclusive to this set
; (when possible)

View File

@@ -0,0 +1 @@
0:

View File

@@ -0,0 +1 @@
foo

View File

@@ -0,0 +1,3 @@
.struct x
.word
.endstruct

View File

@@ -0,0 +1 @@
lda #$00 foo

View File

@@ -0,0 +1 @@
lda ($00),a

View File

@@ -0,0 +1 @@
lda ($00,a)

View File

@@ -0,0 +1,3 @@
.struct foo
bar
.endstruct

View File

@@ -0,0 +1 @@
127

View File

@@ -0,0 +1 @@
.fileopt author

View File

@@ -0,0 +1 @@
.assert 1

View File

@@ -0,0 +1,2 @@
lda |

View File

@@ -0,0 +1 @@
.byte 0 1

View File

@@ -1,6 +1,6 @@
110-capabilities.s:3: Error: Arguments to .CAPABILITY must be identifiers
110-capabilities.s:8: Error: Arguments to .CAPABILITY must be identifiers
110-capabilities.s:8: Error: ')' expected
110-capabilities.s:3: Error: Expected a capability name but found ')'
110-capabilities.s:8: Error: Expected a capability name but found 'end-of-line'
110-capabilities.s:8: Error: Expected ')' but found 'end-of-line'
110-capabilities.s:12: Error: Not a valid capability name: CPU_HAS_BR
110-capabilities.s:17: Error: ')' expected
110-capabilities.s:17: Error: Unexpected trailing garbage characters
110-capabilities.s:17: Error: Expected ')' but found 'cpu_has_bra8'
110-capabilities.s:17: Error: Expected 'end-of-line' but found 'cpu_has_bra8'

View File

@@ -0,0 +1 @@
120-errormsg.s:1: Error: Expected 'end-of-line' but found '0'

View File

@@ -0,0 +1 @@
121-errormsg.s:1: Error: Expected ':' after identifier to form a label but found 'end-of-line'

View File

@@ -0,0 +1 @@
122-errormsg.s:1: Error: Expected a struct/union name but found 'X'

View File

@@ -0,0 +1 @@
123-errormsg.s:1: Error: Expected 'end-of-line' but found 'foo'

View File

@@ -0,0 +1 @@
124-errormsg.s:1: Error: Expected 'Y' but found 'A'

View File

@@ -0,0 +1,2 @@
125-errormsg.s:1: Error: Expected 'X' or 'S' but found 'A'
125-errormsg.s:1: Error: Illegal addressing mode

View File

@@ -0,0 +1 @@
126-errormsg.s:2: Error: Expected a storage allocator after the field name but found 'end-of-line'

View File

@@ -0,0 +1 @@
127-errormsg.s:1: Error: Expected a mnemonic but found '127'

View File

@@ -0,0 +1 @@
128-errormsg.s:1: Error: Expected ',' but found 'end-of-line'

View File

@@ -0,0 +1 @@
129-errormsg.s:1: Error: Expected ',' but found 'end-of-line'

View File

@@ -0,0 +1,2 @@
130-errormsg.s:1: Error: Expected an expression but found '|'
130-errormsg.s:1: Error: Expected an expression but found 'end-of-line'

View File

@@ -0,0 +1 @@
131-errormsg.s:1: Error: Expected 'end-of-line' but found '1'