Skip to content

Instantly share code, notes, and snippets.

@AntGeorge
Last active November 6, 2018 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntGeorge/f98d89e86e696eb39f9221a10b6a5c77 to your computer and use it in GitHub Desktop.
Save AntGeorge/f98d89e86e696eb39f9221a10b6a5c77 to your computer and use it in GitHub Desktop.
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
# syntax highlighting based on WinMIPS64 instruction set
# https://www.computing.dcu.ie/~ray/teaching/CA226/mips/winmips64.html
name: WinMIPS64
file_extensions: [s, asm]
scope: source.winmips64
contexts:
main:
- match: \.\b(data|text|code)\b
comment: "Segments"
scope: entity.name.section.winmips64
- match: \.\b(org|space|asciiz|ascii|align|word|byte|word32|word16|double)\b
comment: "Directives"
scope: storage.modifier.winmips64
- match: \b(r|R)([0-9]|[1-2][0-9]|3[0-1])\b
comment: "Registers: r0 - r31 or R0 - R31"
scope: variable.parameter.winmips64
- match: \$([0-9]|[1-2][0-9]|3[0-1])\b
comment: "Registers: $0 - $31"
scope: variable.parameter.winmips64
- match: \b(f|F)([0-9]|[1-2][0-9]|3[0-1])\b
comment: "Floating point registers"
scope: variable.parameter.winmips64
- match: \b(halt|nop)\b
comment: "Miscellaneous"
scope: keyword.control.winmips64
- match: \b(lb|lbu|sb|lh|lhu|sh|lw|lwu|sw|ld|sd|l.d|s.d|lui)\b
comment: "Loads/Stores"
scope: keyword.operator.assignment.winmips64
- match: \b(daddi|daddui|dadd|daddu|dsub|dsubu|dmul|dmulu|ddiv|ddivu|add.d|sub.d|mul.d|div.d)\b
comment: "Arithmetic"
scope: keyword.operator.arithmetic.winmips64
- match: \b(and|or|xor|andi|ori|xori)\b
comment: "Logical"
scope: keyword.operator.logical
- match: \b(slt|sltu|slti|sltiu)\b
comment: "Set"
scope: keyword.control.winmips64
- match: \b(beq|bne|beqz|bnez|j|jr|jal|jalr)\b
comment: "Branch/Jump"
scope: keyword.control.winmips64
- match: \b(dsll|dsrl|dsra|dsllv|dsrlv|dsrav)\b
comment: "Shifts"
scope: keyword.operator.arithmetic.winmips64
- match: \b(movz|movn|mov.d|mtc1|mfc1)\b
comment: "Moves"
scope: keyword.operator.assignment.winmips64
- match: \b(cvt.d.l|cvt.l.d|c.lt.d|c.le.d|c.eq.d|bc1f|bc1t)\b
comment: "Misc. Floating Point"
scope: keyword.control.winmips64
# copied from package "MIPS Syntax" by contradictioned
######################################################
- match: '\$(((3[01])|([12]?[0-9])|[0-9])|zero|at|v[01]|a[0-3]|s[0-7]|t[0-9]|k[01]|gp|sp|fp|ra)'
comment: "Registers: standard MIPS pseudo-names"
scope: variable.parameter.winmips64
- match: '"'
comment: Strings
push:
- meta_scope: string.quoted.double.winmips64
- match: '"'
pop: true
- match: .
scope: string.ssraw
- match: '\b((0(x|X)[0-9A-Fa-f]*)|((\-)?[0-9]*))\b'
comment: Numbers like +12, -3, 55, 0x3F
scope: constant.numeric.winmips64
- match: '\b[\w]+\b:'
comment: "Labels at line start: begin_repeat: add ..."
scope: entity.name.tag.winmips64
- match: "#.*$"
comment: Single line comments
scope: comment.line.number-sign.winmips64
######################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment