Skip to content

Macro arguments shouldn't care about unterminated strings #1622

Closed as not planned
@Rangi42

Description

@Rangi42
macro foo
  println \1, " world!"
endm
  foo "hello

macro bar
  println \1 world!"
endm
  bar "goodbye
error: main.asm(4):
    Unterminated string
error: main.asm(4) -> main.asm::foo(2):
    syntax error, unexpected identifier
error: main.asm(4) -> main.asm::foo(2):
    Unterminated string
error: main.asm(9):
    Unterminated string
goodbye world!
error: Assembly aborted (4 errors)!

I don't think that lexing macro arguments should be giving an "unterminated string" error. If/when the argument is expanded, its usage will still give an unterminated string error in context (e.g. when foo "hello expands to println "hello, " world!") -- except for edge cases where the whole point is that it wouldn't (e.g. when bar "hello expands to println "goodbye world!"). For example, the above output would then be:

error: main.asm(4) -> main.asm::foo(2):
    syntax error, unexpected identifier
error: main.asm(4) -> main.asm::foo(2):
    Unterminated string
goodbye world!
error: Assembly aborted (2 errors)!

Metadata

Metadata

Assignees

Labels

bugUnexpected behavior / crashes; to be fixed ASAP!rgbasmThis affects RGBASM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions