Skip to content
Merged
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
14 changes: 11 additions & 3 deletions asmlex.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@
tuple(preprocessor.values())
)

keywords = set(
flags.keys()).union(
regs16.keys()).union(
regs8.keys()).union(
pseudo.keys()).union(
reserved_instructions.keys())


def get_uniques(l):
""" Returns a list with no repeated elements.
Expand Down Expand Up @@ -248,12 +255,13 @@ def t_INITIAL_ID(self, t):
tmp = t.value # Saves original value
if tmp[-1] == ':':
c = self.find_column(t)
if not self.input_data[t.lexpos - c + 1: t.lexpos].strip():
tmp = t.value = t.value[:-1].strip() # remove the colon ':'

if not self.input_data[t.lexpos - c + 1: t.lexpos].strip() and tmp.lower() not in keywords:
t.type = 'LABEL'
t.value = tmp[:-1].strip()
t.value = tmp
return t

tmp = t.value = t.value[:-1].strip() # remove the colon ':'
t.lexer.lexpos -= 1

t.value = tmp.upper() # Convert it to uppercase, since our internal tables uses uppercase
Expand Down
1 change: 1 addition & 0 deletions tests/functional/and_err.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
and : a, 0
2 changes: 2 additions & 0 deletions tests/functional/nop_nop.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nop:nop

Binary file added tests/functional/nop_nop.bin
Binary file not shown.