# Version of the language definition syntax used in the file
version = "1"

%include "c_style_preprocessors_internal.gsc"
# To define the color for preprocessors, use a statement like the
# following one, otherwise, the default color is used:
# language.preprocessor.color = "#008080"

# language specification for syntax coloring and
# auto-indention in MULTI's editor.
language {
    general {
	# Official name for the language, like
	# 	C/C++/Pascal/Java/Ada/Fortran
	# or
	# 	GHS-Script/GHS-Linmake	ker/GHS-LanguageDefinition etc.
	name = "GHS-RISCV"
	description = "RISC-V Assembly Language"
	# File extensions for the language
	extension = {"rv"}

	# The following are some other information about the language

	# Is the language case-sensitive? If no explicit specification
	# for it, the default value is true.
	case_sensitive = true

	# Priority conflict solution.
	# Comment, string and character have the same priority.
	# When preprocessor conflicts with them, some language, like
	# C/C++, let comment, string and character have higher priority,
	# other language, like PASCAL, do the other choice.
	# We choose the behavior of C/C++ as the default behavior.
	# If you want to change, like for PASCAL, use the following 
	# statement:
	# pascal_style_priority = true

	# Separator of the language to delimit syntax tokens
	separator = "@\\\"+-*/<=>:,;\'\t()[]^%!~|& {}?"

	# Escape sequence leader: one character(like the one in C).
	# escape = "\\"
    }

    keyword {
	# You can define keyword name list, the color to show the
	# keywords(optional), and indicate if to auto-complete keywords
	# when the auto-completion mechanism is on.
	# C-keywords
	name += {"add"}
	name += {"addi"}
	name += {"addiw"}
	name += {"addw"}
	name += {"amoadd", "amoadd.d", "amoadd.w.rl", "amoadd.w.aq", "amoadd.d.aqrl", "amoadd.d.aq", "amoadd.w.aqrl", "amoadd.d.rl", "amoadd.w"}
	name += {"amoand", "amoand.w.rl", "amoand.d.aq", "amoand.d.aqrl", "amoand.w.aq", "amoand.d", "amoand.w.aqrl", "amoand.d.rl", "amoand.w"}
	name += {"amomax", "amomax.w.aqrl", "amomax.w", "amomax.d.rl", "amomax.w.aq", "amomax.d.aqrl", "amomax.d.aq", "amomax.w.rl", "amomax.d"}
	name += {"amomaxu", "amomaxu.d.aq", "amomaxu.d.aqrl", "amomaxu.d.rl", "amomaxu.d", "amomaxu.w.rl", "amomaxu.w.aqrl", "amomaxu.w.aq", "amomaxu.w"}
	name += {"amomin", "amomin.d.aqrl", "amomin.d.rl", "amomin.w", "amomin.w.aq", "amomin.w.aqrl", "amomin.w.rl", "amomin.d.aq", "amomin.d"}
	name += {"amominu", "amominu.d", "amominu.d.rl", "amominu.w.rl", "amominu.w.aqrl", "amominu.d.aq", "amominu.w", "amominu.w.aq", "amominu.d.aqrl"}
	name += {"amoor", "amoor.d.aqrl", "amoor.w.aqrl", "amoor.d.aq", "amoor.w.rl", "amoor.d", "amoor.d.rl", "amoor.w.aq", "amoor.w"}
	name += {"amoswap", "amoswap.d.aq", "amoswap.w.rl", "amoswap.d.aqrl", "amoswap.w.aq", "amoswap.d", "amoswap.d.rl", "amoswap.w.aqrl", "amoswap.w"}
	name += {"amoxor", "amoxor.w.aq", "amoxor.w", "amoxor.d.aqrl", "amoxor.d.rl", "amoxor.d", "amoxor.w.aqrl", "amoxor.d.aq", "amoxor.w.rl"}
	name += {"and"}
	name += {"andi"}
	name += {"auipc"}
	name += {"beq"}
	name += {"beqz"}
	name += {"bge"}
	name += {"bgeu"}
	name += {"bgez"}
	name += {"bgt"}
	name += {"bgtu"}
	name += {"bgtz"}
	name += {"ble"}
	name += {"bleu"}
	name += {"blez"}
	name += {"blt"}
	name += {"bltu"}
	name += {"bltz"}
	name += {"bne"}
	name += {"bnez"}
	name += {"c.add"}
	name += {"c.addi"}
	name += {"c.addi16sp"}
	name += {"c.addi4spn"}
	name += {"c.addiw"}
	name += {"c.addw"}
	name += {"c.and"}
	name += {"c.andi"}
	name += {"c.beqz"}
	name += {"c.bnez"}
	name += {"c.ebreak"}
	name += {"c.fld"}
	name += {"c.fldsp"}
	name += {"c.flw"}
	name += {"c.flwsp"}
	name += {"c.fsd"}
	name += {"c.fsdsp"}
	name += {"c.fsw"}
	name += {"c.fswsp"}
	name += {"c.j"}
	name += {"c.jal"}
	name += {"c.jalr"}
	name += {"c.jr"}
	name += {"c.ld"}
	name += {"c.ldsp"}
	name += {"c.li"}
	name += {"c.lui"}
	name += {"c.lw"}
	name += {"c.lwsp"}
	name += {"c.mv"}
	name += {"c.nop"}
	name += {"c.or"}
	name += {"c.sd"}
	name += {"c.sdsp"}
	name += {"c.slli"}
	name += {"c.srai"}
	name += {"c.srli"}
	name += {"c.sub"}
	name += {"c.subw"}
	name += {"c.sw"}
	name += {"c.swsp"}
	name += {"c.xor"}
	name += {"call"}
	name += {"csrc"}
	name += {"csrci"}
	name += {"csrr"}
	name += {"csrrc"}
	name += {"csrrci"}
	name += {"csrrs"}
	name += {"csrrsi"}
	name += {"csrrw"}
	name += {"csrrwi"}
	name += {"csrs"}
	name += {"csrsi"}
	name += {"csrw"}
	name += {"csrwi"}
	name += {"div"}
	name += {"divu"}
	name += {"divuw"}
	name += {"divw"}
	name += {"ebreak"}
	name += {"ecall"}
	name += {"fabs", "fabs.d", "fabs.s"}
	name += {"fadd", "fadd.s", "fadd.d"}
	name += {"fclass", "fclass.d", "fclass.s"}
	name += {"fcvt", "fcvt.s.d", "fcvt.wu.d", "fcvt.w.s", "fcvt.s.l", "fcvt.w.d", "fcvt.d.l", "fcvt.l.s", "fcvt.s.wu", "fcvt.lu.s", "fcvt.d.w", "fcvt.s.w", "fcvt.d.wu", "fcvt.d.lu", "fcvt.lu.d", "fcvt.d.s", "fcvt.wu.s", "fcvt.l.d", "fcvt.s.lu"}
	name += {"fdiv", "fdiv.d", "fdiv.s"}
	name += {"fence", "fence.i", "fence.tso"}
	name += {"feq", "feq.s", "feq.d"}
	name += {"fge", "fge.d", "fge.s"}
	name += {"fgt", "fgt.s", "fgt.d"}
	name += {"fld"}
	name += {"fle", "fle.d", "fle.s"}
	name += {"flt", "flt.s", "flt.d"}
	name += {"flw"}
	name += {"fmadd", "fmadd.s", "fmadd.d"}
	name += {"fmax", "fmax.s", "fmax.d"}
	name += {"fmin", "fmin.d", "fmin.s"}
	name += {"fmsub", "fmsub.d", "fmsub.s"}
	name += {"fmul", "fmul.s", "fmul.d"}
	name += {"fmv", "fmv.d.x", "fmv.s.x", "fmv.x.s", "fmv.d", "fmv.x.d", "fmv.x.w", "fmv.s", "fmv.w.x"}
	name += {"fneg", "fneg.s", "fneg.d"}
	name += {"fnmadd", "fnmadd.s", "fnmadd.d"}
	name += {"fnmsub", "fnmsub.s", "fnmsub.d"}
	name += {"frcsr"}
	name += {"frflags"}
	name += {"frrm"}
	name += {"fscsr"}
	name += {"fsd"}
	name += {"fsflags"}
	name += {"fsgnj", "fsgnj.s", "fsgnj.d"}
	name += {"fsgnjn", "fsgnjn.s", "fsgnjn.d"}
	name += {"fsgnjx", "fsgnjx.d", "fsgnjx.s"}
	name += {"fsqrt", "fsqrt.d", "fsqrt.s"}
	name += {"fsrm"}
	name += {"fsub", "fsub.d", "fsub.s"}
	name += {"fsw"}
	name += {"hfence", "hfence.gvma", "hfence.bvma"}
	name += {"j"}
	name += {"jal"}
	name += {"jalr"}
	name += {"jr"}
	name += {"la"}
	name += {"lb"}
	name += {"lbu"}
	name += {"ld"}
	name += {"lh"}
	name += {"lhu"}
	name += {"li"}
	name += {"lla"}
	name += {"lr", "lr.d.aqrl", "lr.d", "lr.w.aqrl", "lr.d.aq", "lr.w", "lr.w.aq"}
	name += {"lui"}
	name += {"lw"}
	name += {"lwu"}
	name += {"mret"}
	name += {"mul"}
	name += {"mulh"}
	name += {"mulhsu"}
	name += {"mulhu"}
	name += {"mulw"}
	name += {"mv"}
	name += {"neg"}
	name += {"negw"}
	name += {"nop"}
	name += {"not"}
	name += {"or"}
	name += {"ori"}
	name += {"rdcycle"}
	name += {"rdcycleh"}
	name += {"rdinstret"}
	name += {"rdinstreth"}
	name += {"rdtime"}
	name += {"rdtimeh"}
	name += {"rem"}
	name += {"remu"}
	name += {"remuw"}
	name += {"remw"}
	name += {"ret"}
	name += {"sb"}
	name += {"sc", "sc.d", "sc.w.aqrl", "sc.w.rl", "sc.w", "sc.d.rl", "sc.d.aqrl"}
	name += {"sd"}
	name += {"seqz"}
	name += {"sext", "sext.w"}
	name += {"sfence", "sfence.vma"}
	name += {"sgt"}
	name += {"sgtu"}
	name += {"sgtz"}
	name += {"sh"}
	name += {"sll"}
	name += {"slli"}
	name += {"slliw"}
	name += {"sllw"}
	name += {"slt"}
	name += {"slti"}
	name += {"sltiu"}
	name += {"sltu"}
	name += {"sltz"}
	name += {"snez"}
	name += {"sra"}
	name += {"srai"}
	name += {"sraiw"}
	name += {"sraw"}
	name += {"sret"}
	name += {"srl"}
	name += {"srli"}
	name += {"srliw"}
	name += {"srlw"}
	name += {"sub"}
	name += {"subi"}
	name += {"subw"}
	name += {"sw"}
	name += {"tail"}
	name += {"uret"}
	name += {"wfi"}
	name += {"xor"}
	name += {"xori"}

	# If color is not defined for keyword, default color is used.
	# color = "#0000ff"
	# If auto-completion is not explicitly specified, it is true
	# by default.
	# autocomplete = false
    }

    line_comment {
	# Because multiple line comment leaders can be defined,
	# use an index for each of them.
	1 = "#"
	# If color is not defined for line_comment, default color is used.
	# color = "#008000"
    }

    comment {
	# Because multiple pairs of comment delimiters can be defined,
	# use a index for each of them.
	1 { begin = "/*"; end = "*/" }
	# If color is not defined for comment, default color is used.
	# color = "#008000"
    }

    string {
	# Because multiple pair of string delimiters can be defined,
	# use an index for each of them.
	1 { begin = "\""; end = "\"" }
	# If color is not defined for string, default color is used.
	# color = "#008000"
    }

    character {
	# Because multiple pair of string delimiters can be defined,
	# use an index for each of them.
	1 { begin = "\'"; end = "\'" }
	# If color is not defined for character, default color is used.
	# color = "#008000"
    }

    integer {
	# Support hex integer?
	hex = true
	# Case-sensitive for integer suffix? Default is true.
	# case_sensitive = true
	# decimal_suffix = {"l", "u", "lu", "ul", "llu", "lul", "ull"}
	# hex_suffix = {"l", "u", "lu", "ul", "llu", "lul", "ull"}
	# If color is not defined for integer, default color is used.
	# color = "#008000"
    }

    float {
	# Support scientific float?
	# scientific = true
	# Case-sensitive for float suffix? Default is true.
	# case_sensitive = false
	# suffix = {"f", "l", "fl", "fl"}
	# If color is not defined for float, default color is used.
	# color = "#008000"
    }

    customized {
	# pattern = {"gen_*"}
	# More customized stuff.
	# If auto-completion is not explicitly specified, it is true
	# by default
	# autocomplete = false
	# If color is not defined for customized items, default color is used.
	# color = "#0080a0"
    }

    autocomplete {
	# "match" is used to defined match algorithm, it has 
	# the following values:
	#	"best" - default value
	#	"first"
	# As an example, if there are 3 strings for auto-completion:
	# 	"main", "mail" and "misc"
	# When you type in "m", "best match" will not auto-complete it,
	# because the 3 strings do not have a common prefix beginning with
	# "m", but "first match" will auto-complete it into "main".
	# When you type in "ma", "best match" will auto-complete it
	# into "mai", but "first match" will still auto-complete it
	# into "main".
	match = "best"
	
	# By default, you can use the following key-strokes in MULTI Editor
	# to manually find an auto-completed string for the string ending
	# at the caret:
	# 1. "ctrl+]": navigate to the next matched string.
	# 2. "ctrl+[": navigate to the previous matched string.
	# You can continuously press the keys to scan the matched
	# string list until you find the one you want.
	# 3. "ctrl+/": launch a popup menu to show a list of matched
	# strings(up to a certain number configured by the following option).
	# Then you can pick what you want form the popup menu.

	# Max number of strings to match when user types "ctrl+/".
	# The default value is 10. Use the following statement to change it.
	# max_match = 15

	# Minimum length for a string to which auto-completion can be applied.
	# The default value is 1. Use the following statement to change it.
	min_string_length = 3

	# "autocomplete" let you can turn on/off the whole
	# auto-completion mechanism. The default value is true.
	# When the setting here is true, you can still turn on/off
	# about if using keywords, preprocessors or customized items
	# not containing wild card as the auto-completion source.
	# autocomplete = false

	# Define extra auto-completion items in addition to
	# 1. keywords
	# 2. preprocessors
	# 3. customized items not containing wild card

	# Auto-complete strings
	# name = {"main"}
	# name += {"strcasecmp"}
	# More stuff from library for auto-completion
	
	# More stuff from GHS-library for auto-completion
    }
}
