-- lx format
local format = require("core.format")
local common = require("format.asm.common")

format.register({
	name = "Assembly Source (GNU generic)",
	shortname = "ASM GNU generic",
	author = "liqube",
	internal = true,
	comment = "#",

	patterns = {
		-- Fallback keeps preprocessed source readable without guessing architecture
		common.preprocessor_patterns,
		common.arm_immediate_patterns,

		-- Conservative comment rules cover common GNU source while protecting '@' suffixes
		{ pattern = "#.-\n", type = "comment" },
		common.arm_comment_patterns,
		common.c_comment_patterns,

		-- Shared structure useful even when architecture evidence insufficient
		common.structure_patterns,
		common.instruction_patterns,
		common.symbol_patterns,

		{ pattern = "[%+%-=/%*%^%%<>!~|&@%?:,%[%]%(%){}]", type = "operator" },
	},

	block_comment = common.block_comment,
	outline_patterns = common.outline_patterns,
	symbols = common.with_gnu_symbols(),
})
