Skip to content

Commit

Permalink
ca65 improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksherlock committed Sep 26, 2017
1 parent 9238695 commit 174710a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
47 changes: 30 additions & 17 deletions Syntaxes/ca65.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ contexts:

main:
- meta_include_prototype: false


- match: \b({{ident}})\s*(:?=)
push: operand
captures:
1: entity.name.constant.ca65
2: keyword.operator.assignment.ca65


- match: '\b{{ident}}:'
scope: entity.name.label
push: opcode
Expand Down Expand Up @@ -51,11 +60,7 @@ contexts:
push: macro-parms


- match: \b({{ident}})\s*(=)
push: operand
captures:
1: entity.name.constant.ca65
2: keyword.operator.assignment.ca65


- match: '(?=\S)'
push: opcode
Expand Down Expand Up @@ -88,59 +93,61 @@ contexts:

directives:


- match: '(\.(?i:define))\s+({{ident}})\s*\('
captures:
1: keyword.ca65
1: meta.directive keyword.ca65
2: entity.name.define.ca65
set: define-parms

- match: '(\.(?i:define))\s+({{ident}})\b'
captures:
1: keyword.ca65
1: meta.directive keyword.ca65
2: entity.name.define.ca65
set: operand

- match: '(\.(?i:enum))\s+({{ident}})\b'
captures:
1: keyword.ca65
1: meta.directive keyword.ca65
2: entity.name.enum.ca65
set: operand


- match: '(\.(?i:struct|union))\s+({{ident}})\b'
captures:
1: keyword.ca65
1: meta.directive keyword.ca65
2: entity.name.struct.ca65
set: operand



- match: \.(?i:if|endif|else)\b
scope: keyword.control.ca65
scope: meta.directive keyword.control.ca65
set: operand

- match: \.(?i:include|incbin)\b
scope: keyword.control.import
scope: meta.directive keyword.control.import.ca65
set: operand



- match: '\.(?i:A16|A8|ADDR|ALIGN|ASCIIZ|ASSERT|AUTOIMPORT|BANKBYTES|BSS|BYT|BYTE|CASE|CHARMAP|CODE|CONDES|CONSTRUCTOR)\b'
scope: keyword.ca65
scope: meta.directive keyword.ca65
set: operand
- match: '\.(?i:DATA|DBYT|DEBUGINFO|DEF|DEFINE|DEFINED|DESTRUCTOR|DWORD|ELSE|ELSE|END|ENDENUM|ENDIF|ENDMAC|ENDMACRO|ENDPROC|ENDREP|ENDREPEAT|ENDSCOPE|ENDSTRUCT|ENUM|ERROR|EXITMAC|EXITMACRO|EXPORT|EXPORTZP)\b'
scope: keyword.ca65
scope: meta.directive keyword.ca65
set: operand
- match: '\.(?i:FARADDR|FEATURE|FILEOPT|FOPT|FORCEIMPORT|GLOBAL|GLOBALZP|HIBYTES|I16|I8|IF|IFCONST|IFDEF|IFNBLANK|IFNDEF|IFP02|IFP816|IFPC02|IFPSC02|IFREF|IMPORT|IMPORTZP|INCBIN|INCLUDE|INTERRUPTOR)\b'
scope: keyword.ca65
scope: meta.directive keyword.ca65
set: operand
- match: '\.(?i:LINECONT|LIST|LISTBYTES|LOBYTES|LOCAL|LOCALCHAR|MACPACK|MAC|MACRO|ORG|OUT|PO2|P816|PAGELEN|PAGELENGTH|PC02|POPSEG|PROC|PSC02|PUSHSEG)\b'
scope: keyword.ca65
scope: meta.directive keyword.ca65
set: operand
- match: '\.(?i:RELOC|REPEAT|RES|RODATA|SCOPE|SEGMENT|SETCPU|SMART|STRUCT|SUNPLUS|TAG|WARNING|WORD|ZEROPAGE)\b'
scope: keyword.ca65
scope: meta.directive keyword.ca65
set: operand

- match: \.{{ident}}
scope: meta.directive

operand:
- include: numbers
Expand All @@ -152,6 +159,12 @@ contexts:
scope: support.constant.ca65
- match: \.(?i:BANKBYTE|BLANK|CONCAT|CONST|HIBYTE|HIWORD|IDENT|LEFT|LOBYTE|LOWORD|MATCH|MID|REF|REFERENCED|RIGHT|SIZEOF|STRAT|SPRINTF|STRING|STRLEN|TCOUNT|XMATCH)\b
scope: support.function.ca65
- match: \.(?i:BITNOT|MOD|BITAND|BITXOR|SHL|SHR|BITOR|AND|XOR|OR|NOT)\b
scope: keyword.operator.ca65
- match: '<<|>>|<>|<=|>=|\|\||&&'
scope: keyword.operator.ca65
- match: '[-+~<>^*/&|=!]'
scope: keyword.operator.ca65

numbers:
- match: \b\d+\b
Expand Down
2 changes: 1 addition & 1 deletion ca65 directives.sublime-completions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"scope": "source.asm.ca65 meta.opcode",
"scope": "source.asm.ca65 meta.directive",
"completions":
[
".a16",
Expand Down

0 comments on commit 174710a

Please sign in to comment.