Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/avra.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ enum {
enum {
TERM_END = 0,
TERM_SPACE,
TERM_WORD,
TERM_COMMA,
TERM_EQUAL,
TERM_DASH,
Expand Down
2 changes: 1 addition & 1 deletion src/directiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ parse_directive(struct prog_info *pi)
struct def *def;
struct data_list *incpath, *dl;

next = get_next_token(pi->fi->scratch, TERM_SPACE);
next = get_next_token(pi->fi->scratch + 1, TERM_WORD);

my_strupr(pi->fi->scratch);
directive = lookup_keyword(directive_list, pi->fi->scratch + 1, True);
Expand Down
2 changes: 1 addition & 1 deletion src/mnemonic.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ parse_mnemonic(struct prog_info *pi)
struct macro *macro;
char temp[MAX_MNEMONIC_LEN + 1];

operand1 = get_next_token(pi->fi->scratch, TERM_SPACE); /* we get the first word on line */
operand1 = get_next_token(pi->fi->scratch, TERM_WORD); /* we get the first word on line */
mnemonic = get_mnemonic_type(pi);
if (mnemonic == -1) { /* if -1 this must be a macro name */
macro = get_macro(pi, pi->fi->scratch); /* and so, we try to get the corresponding macro struct. */
Expand Down
9 changes: 9 additions & 0 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,15 @@ get_next_token(char *data, int term)
/* Skip to next horizontal space or EOL or start of comment. */
while (!IS_HOR_SPACE(data[i]) && !IS_END_OR_COMMENT(data[i])) i++;
break;
case TERM_WORD:
/* Skip to end of word. */
while (IS_LABEL(data[i]) || data[i] == '.') i++;
if (!isblank(data[i])) {
int k = strlen(data);
for (; k != i-1; k--) data[k+1] = data[k];
data[i] = ' ';
}
break;
case TERM_DASH:
/* Skip to next dash or EOL or start of comment. */
while ((data[i] != '-') && !IS_END_OR_COMMENT(data[i])) i++;
Expand Down
10 changes: 10 additions & 0 deletions tests/regression/issue54-parenthesis/test.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.device atmega168
.macro DEST
.dw @0
.endmacro
nop
KEYLOOP:
DEST(KEYLOOP)
.if(1)
nop
.endif
3 changes: 3 additions & 0 deletions tests/regression/issue54-parenthesis/test.hex.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:020000020000FC
:06000000000001000000F9
:00000001FF