%YAML 1.2 --- name: EXAPUNKS file_extensions: - exa - exapunks scope: source.exapunks first_line_match: '^(?i:NOTE\sEXAPUNKS)\b' contexts: prototype: - match: ';' scope: punctuation.definition.comment.exapunks push: - meta_scope: comment.line.semicolon.exapunks - match: $\n? pop: true main: - include: instructions - include: macro # invalid @END or substitution macro outside of repeat block - match: '@END|@{|{|,|}' scope: invalid.illegal.exapunks instructions: # comment - match: \b(?i:NOTE)\b push: - meta_scope: comment.line.note.exapunks - match: $\n? pop: true # manipulating values - match: '\b(?i:COPY|ADDI|SUBI|MULI|DIVI|MODI|SWIZ|RAND)\b' scope: meta.function-call.exapunks support.function.arithmetic.exapunks push: function-arguments # lifecycle - match: '\b(?i:REPL)' scope: meta.function-call.exapunks support.function.lifecycle.exapunks push: - meta_content_scope: meta.label-name.exapunks # label names when referenced - match: \w+ scope: variable.label.exapunks - include: number-substitution - match: $\n? scope: meta.label-name.exapunks pop: true - match: '\b(?i:HALT|KILL)\b' scope: meta.function-call.exapunks support.function.lifecycle.exapunks # movement - match: '\b(?i:LINK|HOST)\b' scope: meta.function-call.exapunks support.function.movement.exapunks push: function-arguments # communication - match: '\b(?i:MODE|VOID(?=\sM))\b' scope: meta.function-call.exapunks support.function.communication.exapunks push: function-arguments # file manipulation - match: '\b(?i:MAKE|GRAB|FILE|SEEK|DROP|WIPE|VOID(?=\sF))\b' scope: meta.function-call.exapunks support.function.file-manipulation.exapunks push: function-arguments # testing values - match: '\b(?i:TEST)\b' scope: meta.function-call.exapunks support.function.test.exapunks push: test-arguments # label definition - match: '\b(?i:MARK)\b' scope: keyword.declaration.label.exapunks push: - meta_content_scope: meta.label-name.exapunks # label names when defined - match: \w+ scope: entity.name.label.exapunks - include: number-substitution - match: $\n? scope: meta.label-name.exapunks pop: true # branching - match: '\b(?i:JUMP|TJMP|FJMP)\b' scope: keyword.control.flow.goto.exapunks push: - meta_content_scope: meta.label-name.exapunks # label names when referenced - match: \w+ scope: variable.label.exapunks - include: number-substitution - match: $\n? scope: meta.label-name.exapunks pop: true # miscellaneous - match: '\b(?i:NOOP|VOID)\b' scope: meta.function-call.exapunks support.function.exapunks push: function-arguments macro: # macro instruction: repeat block - match: '(?i:@REP)\b' scope: keyword.control.directive.exapunks push: - meta_scope: meta.macro.repeat.exapunks - include: numbers - match: $\n? set: - meta_content_scope: meta.macro.repeat.exapunks - include: instructions - match: '(?i:@END)\b' scope: meta.macro.repeat.exapunks keyword.control.directive.exapunks pop: true function-arguments: - meta_content_scope: meta.function-call.arguments.exapunks - include: variables - include: numbers - match: $\n? scope: meta.function-call.arguments.exapunks pop: true test-arguments: - meta_content_scope: meta.function-call.arguments.exapunks - include: variables - include: numbers - include: operators # special parameters for the test instruction - match: '\b(?i:MRD|EOF)\b' scope: support.constant.exapunks - match: $\n? scope: meta.function-call.arguments.exapunks pop: true variables: # registers - match: '\b(?i:[XTFM])\b' scope: variable.language.register.exapunks # predefined hardware registers - match: '#(?i:ADDR|AUTH|AZIM|CASH|CLRS|CONT|COOL|COPY|CTRL|DATA|DATE|DIAL|DISP|ELEV|EN3D|FILE|FIRE|FREQ|HEAT|INVS|LOCK|MOTR|NERV|NEXT|NSE0|NUKE|PADX|PADY|PADB|PAGE|PASS|POWR|RATE|SAFE|SQR0|SQR1|TEMP|TIME|TRAK|TRI0|ZGC0|ZGC1|ZGC2|ZGC3|ZGC4)\b' scope: variable.language.hardware-register.exapunks # user defined hardware registers - match: '#\w{4}\b' scope: variable.other.hardware-register.exapunks - include: number-substitution numbers: # numbers - match: '-?\b\d{1,4}\b' scope: constant.numeric.integer.exapunks # invalid numbers - match: '-?\b\d{5,}\b' scope: invalid.illegal.outsized-number.exapunks number-substitution: # macro instruction: number substitution @{N,M} - match: '(@)({)' captures: 1: keyword.control.directive.exapunks 2: punctuation.section.braces.begin.exapunks push: - meta_scope: meta.macro.substitution.exapunks - match: ',' scope: punctuation.separator.exapunks - match: '}' scope: punctuation.section.braces.end.exapunks pop: true - include: numbers - match: $\n? pop: true operators: - match: '=|<|>' scope: keyword.operator.comparison.exapunks