Skip to content

Commit

Permalink
Allow dollar signs in identifiers (#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 authored Sep 3, 2024
1 parent a098213 commit 1283b0b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion man/rgbasm.5
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,9 @@ A text string that can be expanded later, similarly to a macro.
Symbol names can contain ASCII letters, numbers, underscores
.Sq _ ,
hashes
.Sq #
.Sq # ,
dollar signs
.Sq $ ,
and at signs
.Sq @ .
However, they must begin with either a letter or an underscore.
Expand Down
2 changes: 1 addition & 1 deletion src/asm/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ static bool startsIdentifier(int c) {
}

static bool continuesIdentifier(int c) {
return startsIdentifier(c) || (c <= '9' && c >= '0') || c == '#' || c == '@';
return startsIdentifier(c) || (c <= '9' && c >= '0') || c == '#' || c == '$' || c == '@';
}

static Token readIdentifier(char firstChar, bool raw) {
Expand Down
11 changes: 11 additions & 0 deletions test/asm/symbol-names.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def Alpha_Betical = 1
def A1pha_Num3r1c = 2
def C# = 3
def l@tias = 4
def ca$h = 5
def c@#$@red = 6

SECTION "test", WRAM0
wABC:: db
w123:: db
w@#$:: db

0 comments on commit 1283b0b

Please # to comment.