Skip to content

Commit 4c672c6

Browse files
committed
Add ability to specify comments
1 parent 49272ed commit 4c672c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/luasm.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function LuASM:new(instructions, settings)
3737
setmetatable(settings, { __index = {
3838
separator = "[^,%s]+",
3939
label = "^([%a]+):%s*(.*)",
40+
comment = "[;#].*$",
4041
syntax = {
4142
imm = "^[%d]+",
4243
reg = "^%a[%w]*",
@@ -228,6 +229,11 @@ function LuASM:parse(tokenizer)
228229

229230
if token ~= nil then
230231

232+
-- Remove comments
233+
if self.settings.comment ~= nil then
234+
token = token:gsub(self.settings.comment, "")
235+
end
236+
231237
--[[
232238
This is very basic label processing as labels could be
233239
nested and there could be priorities assigned with labels.

0 commit comments

Comments
 (0)