From cf574c0d54a373caa45154a24cecdf46e580438b Mon Sep 17 00:00:00 2001 From: Georg Ziegler Date: Sun, 3 Jun 2018 02:26:43 +0200 Subject: [PATCH 1/4] Fixed acme --- grammars/acme.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/acme.cson b/grammars/acme.cson index e0ee8b8..0e16851 100644 --- a/grammars/acme.cson +++ b/grammars/acme.cson @@ -82,7 +82,7 @@ repository: } # Macro control { - match: '\\b(?i:\!macro|\+[a-zA-Z0-9)\\b' + match: '\\b(?i:!macro|\\+[a-zA-Z0-9])\\b' name: 'support.function.pseudo.acme' } # Conditional control From bbc826f2cd2227a55995cf936e083371189141dc Mon Sep 17 00:00:00 2001 From: Georg Ziegler Date: Sun, 3 Jun 2018 02:58:07 +0200 Subject: [PATCH 2/4] Add missing pseudo opcodes to acme --- grammars/acme.cson | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/grammars/acme.cson b/grammars/acme.cson index 0e16851..23566c1 100644 --- a/grammars/acme.cson +++ b/grammars/acme.cson @@ -72,22 +72,27 @@ repository: patterns: [ # File and Symbol control { - match: '\\b\!(?i:source|src|eof|endoffile|pseudopc|zn|zone|set|to|bin(ary)?|sl|warn|error|serious)\\b' + match: '!\\b(?i:source|src|eof|endoffile|realpc|pseudopc|zn|(sub)?zone|set|to|bin(ary)?|sl|symbollist|warn|error|serious|initmem|cbm|addr(ess)?)\\b' name: 'support.function.pseudo.acme' } # Parsing control { - match: '\\b\!(?i:cpu|al|as|rl|rs|8|by|byte|16|wo|word|24|32|h|hex|fi|fill|align|skip|ct|convtab|tx|text|pet|scr|scrxor|raw)\\b' + match: '!\\b(?i:cpu|al|as|rl|rs|08|by|byte|([bl]e)?(16|24|32)|wo|word|h|hex|fi|fill|align|skip|ct|convtab|tx|text|pet|scr|scrxor|raw)\\b' name: 'support.function.pseudo.acme' } # Macro control { - match: '\\b(?i:!macro|\\+[a-zA-Z0-9])\\b' + match: '(?i:!\\bmacro|\\+[a-zA-Z0-9])\\b' name: 'support.function.pseudo.acme' } # Conditional control { - match: '\\b(?i:\!if|else|\!if(n)?def|\!for|\!do|while|until)\\b' + match: '!\\b(?i:if|if(n)?def|for|do|while|until)\\b' + name: 'keyword.control.conditional.acme' + } + # Conditional control II + { + match: '\\b(?i:else|while|until)\\b' name: 'keyword.control.conditional.acme' } # Operators From 356800f90e7ab2ecaabf16bf2272eef634cbec9e Mon Sep 17 00:00:00 2001 From: Georg Ziegler Date: Sun, 3 Jun 2018 04:12:44 +0200 Subject: [PATCH 3/4] Add generic 65816 and 6502 grammars --- grammars/65816 Assembly.cson | 42 ------------ grammars/65816-generic.cson | 65 +++++++++++++++++++ grammars/65816l-opcodes.cson | 23 +++++++ grammars/65c02-generic.cson | 65 +++++++++++++++++++ grammars/cc65-816-toolchain.cson | 9 +-- grammars/cc65-directives.cson | 14 +--- grammars/cc65-toolchain.cson | 8 +-- ...-toolchain.cson => wdc-816-toolchain.cson} | 8 +-- grammars/wdc-directives.cson | 14 +--- grammars/wdc-toolchain.cson | 4 +- 10 files changed, 174 insertions(+), 78 deletions(-) delete mode 100644 grammars/65816 Assembly.cson create mode 100644 grammars/65816-generic.cson create mode 100644 grammars/65816l-opcodes.cson create mode 100644 grammars/65c02-generic.cson rename grammars/{wdc816-toolchain.cson => wdc-816-toolchain.cson} (50%) diff --git a/grammars/65816 Assembly.cson b/grammars/65816 Assembly.cson deleted file mode 100644 index a9412db..0000000 --- a/grammars/65816 Assembly.cson +++ /dev/null @@ -1,42 +0,0 @@ -'fileTypes': [] -'name': '65816 Assembly' -'patterns': [ - { - 'include': '#M6502' - } - { - 'include': '#M65C02' - } - { - 'include': '#M65816L' - } - { - 'include': '#M65816' - } -] -'repository': - 'M6502': - 'match': '\\b(?i:ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\\b' - 'name': 'keyword.mnemonic.6502' - 'M65816': - 'match': '\\b(?i:BRL|COP|JML|JSL|MVN|MVP|PEA|PEI|PER|PHB|PHD|PHK|PLB|PLD|REP|RTL|SEP|TCD|TCS|TDC|TSC|TXY|TYX|WDM|XBA|XCE)\\b' - 'name': 'keyword.mnemonic.65816' - 'M65816L': - 'match': '\\b(?i:ADCL|ANDL|CMPL|EORL|LDAL|ORAL|SBCL|STAL)\\b' - 'name': 'keyword.mnemonic.65816.long' - 'M65C02': - 'match': '\\b(?i:BRA|PHX|PHY|PLX|PLY|STP|STZ|TRB|TSB|WAI)\\b' - 'name': 'keyword.mnemonic.65c02' - 'binary_number': - 'match': '%[01]+' - 'name': 'constant.numeric.binary' - 'decimal_number': - 'match': '\\b([0-9]+)\\b' - 'name': 'constant.numeric.decimal' - 'hex_number': - 'match': '\\$[A-Fa-f0-9]+' - 'name': 'constant.numeric.hex' - 'octal_number': - 'match': '@([0-7]+)\\b' - 'name': 'constant.numeric.octal' -'scopeName': 'source.assembly.65816' diff --git a/grammars/65816-generic.cson b/grammars/65816-generic.cson new file mode 100644 index 0000000..4807f6c --- /dev/null +++ b/grammars/65816-generic.cson @@ -0,0 +1,65 @@ +# Generic 65816 grammar with semicolon comments + +scopeName: 'source.assembly.65816.65816-generic' +fileTypes: [] +name: '65816 Assembly' +patterns: [ + { include: 'source.65816-opcodes' } # add basic 65816 instruction set, includes 6502 and 65c02 opcodes + { include: 'source.65816l-opcodes' } # extend with 6502X opcodes + { include: '#comments' } + { include: '#symbols' } +] + +# Repository starts here ------------------------------------------------------ +repository: + + # comments + comments: + patterns: [ + # semicolon comments + { + match: ';.*$' + name: 'comment.line.semicolon.65816-generic' + } + ] + + # symbols + symbols: + patterns: [ + { + begin: '"' + beginCaptures: + 0: + name: 'punctuation.definition.string.begin.65816-generic' + end: '"' + endCaptures: + 0: + name: 'punctuation.definition.string.end.65816-generic' + name: 'string.quoted.double.assembly.65816-generic' + } + # absolut address/number + { + match: '\\#(\'.\'|[^\\s\']+)' + name: 'constant.numeric.hex.65816-generic' + } + # hex, prefixed with ampersand($) + { + match: '-?\\$[A-Fa-f0-9]+' + name: 'constant.numeric.hex.65816-generic' + } + # hex, suffixed with h(h) + { + match: '-?([0-9]+)h' + name: 'constant.numeric.hex.65816-generic' + } + # binary + { + match: '%[01]+' + name: 'constant.numeric.binary.65816-generic' + } + # decimal + { + match: '\\b([0-9]+)\\b' + name: 'constant.numeric.decimal.65816-generic' + } + ] diff --git a/grammars/65816l-opcodes.cson b/grammars/65816l-opcodes.cson new file mode 100644 index 0000000..b528963 --- /dev/null +++ b/grammars/65816l-opcodes.cson @@ -0,0 +1,23 @@ +# Pseudo opcodes for the 65816 used by some assemblers + +scopeName: 'source.65816l-opcodes' + +patterns: [ + # The 65816 instruction set + { + include: '#mnemonics-65816l' + } +] + +# Respository starts here ----------------------------------------------------- +repository: + + # 65816 instruction set + 'mnemonics-65816l': + patterns: [ + # mnemonics + { + match: '\\b(?i:ADCL|ANDL|CMPL|EORL|LDAL|ORAL|SBCL|STAL)\\b' + name: 'keyword.mnemonic.65816.65816l-opcodes' + } + ] diff --git a/grammars/65c02-generic.cson b/grammars/65c02-generic.cson new file mode 100644 index 0000000..4b007cc --- /dev/null +++ b/grammars/65c02-generic.cson @@ -0,0 +1,65 @@ +# Generic 65C02 grammar with semicolon comments + +scopeName: 'source.assembly.6502.65c02-generic' +fileTypes: [] +name: '6502 Assembly' +patterns: [ + { include: 'source.65c02-opcodes' } # add basic 65816 instruction set, includes 6502 and 65c02 opcodes + { include: 'source.6502x-opcodes' } + { include: '#comments' } + { include: '#symbols' } +] + +# Repository starts here ------------------------------------------------------ +repository: + + # comments + comments: + patterns: [ + # semicolon comments + { + match: ';.*$' + name: 'comment.line.semicolon.65c02-generic' + } + ] + + # symbols + symbols: + patterns: [ + { + begin: '"' + beginCaptures: + 0: + name: 'punctuation.definition.string.begin.65c02-generic' + end: '"' + endCaptures: + 0: + name: 'punctuation.definition.string.end.65c02-generic' + name: 'string.quoted.double.assembly.65c02-generic' + } + # absolut address/number + { + match: '\\#(\'.\'|[^\\s\']+)' + name: 'constant.numeric.hex.65c02-generic' + } + # hex, prefixed with ampersand($) + { + match: '-?\\$[A-Fa-f0-9]+' + name: 'constant.numeric.hex.65c02-generic' + } + # hex, suffixed with h(h) + { + match: '-?([0-9]+)h' + name: 'constant.numeric.hex.65c02-generic' + } + # binary + { + match: '%[01]+' + name: 'constant.numeric.binary.65c02-generic' + } + # decimal + { + match: '\\b([0-9]+)\\b' + name: 'constant.numeric.decimal.65c02-generic' + } + ] diff --git a/grammars/cc65-816-toolchain.cson b/grammars/cc65-816-toolchain.cson index 69fed09..37c32aa 100644 --- a/grammars/cc65-816-toolchain.cson +++ b/grammars/cc65-816-toolchain.cson @@ -1,13 +1,14 @@ # Syntax Highlighting for the cc65 toolchain and 65816 support -scopeName: 'source.cc65-816-toolchain' +scopeName: 'source.assembly.cc65-816-toolchain' name: '65816 Assembly (cc65)' # Name shown in Atom Editor grammar selection # File extensions associated with this grammar fileTypes: [ 's' ] +# include all opcodes and directives the toolchain supports patterns: [ - { include: 'source.65816-opcodes' } # add basic 65816 instruction set, includes 6502 and 65c02 opcodes - { include: 'source.6502x-opcodes' } # extend with 6502X opcodes - { include: 'source.cc65-directives' } # include the directives for the cc65 toolchain + { include: 'source.65816-opcodes' } # add basic 65816 instruction set, includes 6502 and 65c02 opcodes + { include: 'source.6502x-opcodes' } # extend with 6502X opcodes + { include: 'source.cc65-directives' } # include the directives for the cc65 toolchain ] diff --git a/grammars/cc65-directives.cson b/grammars/cc65-directives.cson index 25e79c6..88b1e86 100644 --- a/grammars/cc65-directives.cson +++ b/grammars/cc65-directives.cson @@ -3,17 +3,9 @@ scopeName: 'source.cc65-directives' patterns: [ - { - include: '#comments' - } - # symbols, constants, numbers - { - include: '#symbols' - } - # directives - { - include: '#directives' - } + { include: '#comments' } # comments + { include: '#symbols' } # symbols, constants, numbers + { include: '#directives' } # cc65 assembler directives ] # Repository starts here ------------------------------------------------------ diff --git a/grammars/cc65-toolchain.cson b/grammars/cc65-toolchain.cson index 4b4f2ff..589d5d4 100644 --- a/grammars/cc65-toolchain.cson +++ b/grammars/cc65-toolchain.cson @@ -1,6 +1,6 @@ # Syntax Highlighting for the cc65 toolchain ans 6502 support -scopeName: 'source.cc65-toolchain' +scopeName: 'source.assembly.cc65-toolchain' name: '6502 Assembly (cc65)' # Name shown in Atom Editor grammar selection # File extensions associated with this grammar fileTypes: [ @@ -8,7 +8,7 @@ fileTypes: [ ] # include all opcodes and directives the toolchain supports patterns: [ - { include: 'source.65c02-opcodes' } # the 65c02 opcodes, includes the basic 6502 instruction set - { include: 'source.6502x-opcodes' } # extend with 6502X opcodes - { include: 'source.cc65-directives' } # include the directives for the cc65 toolchain + { include: 'source.65c02-opcodes' } # the 65c02 opcodes, includes the basic 6502 instruction set + { include: 'source.6502x-opcodes' } # extend with 6502X opcodes + { include: 'source.cc65-directives' } # include the directives for the cc65 toolchain ] diff --git a/grammars/wdc816-toolchain.cson b/grammars/wdc-816-toolchain.cson similarity index 50% rename from grammars/wdc816-toolchain.cson rename to grammars/wdc-816-toolchain.cson index c997c13..78cf4e5 100644 --- a/grammars/wdc816-toolchain.cson +++ b/grammars/wdc-816-toolchain.cson @@ -1,6 +1,6 @@ # Syntax Highlighting for the Western Design Center toolchain and 65816 support -scopeName: 'source.wdc816-toolchain' +scopeName: 'source.wdc-816-toolchain' name: '65816 Assembly (WDCTools)' # Name shown in Atom Editor grammar selection # File extensions associated with this grammar fileTypes: [ @@ -8,7 +8,7 @@ fileTypes: [ ] # include all opcodes and directives the toolchain supports patterns: [ - { include: 'source.65816-opcodes' } # the 65c02 opcodes, includes the basic 65c02 instruction set - { include: 'source.65816-aliases' } # Opcode aliases for the 65816 - { include: 'source.wdc-directives' } # include the directives of the WDCxAS assemblers + { include: 'source.65816-opcodes' } # the 65c02 opcodes, includes the basic 65c02 instruction set + { include: 'source.65816-aliases' } # Opcode aliases for the 65816 + { include: 'source.wdc-directives' } # include the directives of the WDCxAS assemblers ] diff --git a/grammars/wdc-directives.cson b/grammars/wdc-directives.cson index 9833f96..f51e699 100644 --- a/grammars/wdc-directives.cson +++ b/grammars/wdc-directives.cson @@ -3,17 +3,9 @@ scopeName: 'source.wdc-directives' patterns: [ - { - include: '#comments' - } - # symbols, constants, numbers - { - include: '#symbols' - } - # directives - { - include: '#directives' - } + { include: '#comments' } + { include: '#symbols' } # symbols, constants, numbers + { include: '#directives' } ] # Repository starts here ------------------------------------------------------ diff --git a/grammars/wdc-toolchain.cson b/grammars/wdc-toolchain.cson index ec03df5..4290b7a 100644 --- a/grammars/wdc-toolchain.cson +++ b/grammars/wdc-toolchain.cson @@ -9,6 +9,6 @@ fileTypes: [ ] # include all opcodes and directives the toolchain supports patterns: [ - { include: 'source.65c02-opcodes' } # the 65c02 opcodes, includes the basic 6502 instruction set - { include: 'source.wdc-directives' } # include the directives of the WDCxAS assemblers + { include: 'source.65c02-opcodes' } # the 65c02 opcodes, includes the basic 6502 instruction set + { include: 'source.wdc-directives' } # include the directives of the WDCxAS assemblers ] From c5850644595a6cca9c5d6d96165ec2a958edbde0 Mon Sep 17 00:00:00 2001 From: Georg Ziegler Date: Sun, 3 Jun 2018 04:16:44 +0200 Subject: [PATCH 4/4] Streamline scopes --- grammars/cc65-816-toolchain.cson | 2 +- grammars/cc65-toolchain.cson | 2 +- grammars/dasm.cson | 2 +- grammars/wdc-816-toolchain.cson | 2 +- grammars/wdc-toolchain.cson | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/grammars/cc65-816-toolchain.cson b/grammars/cc65-816-toolchain.cson index 37c32aa..484972a 100644 --- a/grammars/cc65-816-toolchain.cson +++ b/grammars/cc65-816-toolchain.cson @@ -1,6 +1,6 @@ # Syntax Highlighting for the cc65 toolchain and 65816 support -scopeName: 'source.assembly.cc65-816-toolchain' +scopeName: 'source.assembly.65816.cc65-816-toolchain' name: '65816 Assembly (cc65)' # Name shown in Atom Editor grammar selection # File extensions associated with this grammar fileTypes: [ diff --git a/grammars/cc65-toolchain.cson b/grammars/cc65-toolchain.cson index 589d5d4..0146c3d 100644 --- a/grammars/cc65-toolchain.cson +++ b/grammars/cc65-toolchain.cson @@ -1,6 +1,6 @@ # Syntax Highlighting for the cc65 toolchain ans 6502 support -scopeName: 'source.assembly.cc65-toolchain' +scopeName: 'source.assembly.6502.cc65-toolchain' name: '6502 Assembly (cc65)' # Name shown in Atom Editor grammar selection # File extensions associated with this grammar fileTypes: [ diff --git a/grammars/dasm.cson b/grammars/dasm.cson index 80f63ac..41e68b9 100644 --- a/grammars/dasm.cson +++ b/grammars/dasm.cson @@ -2,7 +2,7 @@ # Improvements: absolut addresses/numbers, equ, seg, ds, word # Not working: labels -scopeName: 'source.dasm-6502' # Prevents conflicts with other architectures supported by dasm +scopeName: 'source.assembly.6502.dasm-6502' # Prevents conflicts with other architectures supported by dasm name: '6502 Assembly (DASM)' # Name shown in Atom Editor grammar selection'fileTypes': [] foldingStartMarker: '/\\*\\*|\\{\\s*$' foldingStopMarker: '\\*\\*/|^\\s*\\}' diff --git a/grammars/wdc-816-toolchain.cson b/grammars/wdc-816-toolchain.cson index 78cf4e5..85d049e 100644 --- a/grammars/wdc-816-toolchain.cson +++ b/grammars/wdc-816-toolchain.cson @@ -1,6 +1,6 @@ # Syntax Highlighting for the Western Design Center toolchain and 65816 support -scopeName: 'source.wdc-816-toolchain' +scopeName: 'source.assembly.65816.wdc-816-toolchain' name: '65816 Assembly (WDCTools)' # Name shown in Atom Editor grammar selection # File extensions associated with this grammar fileTypes: [ diff --git a/grammars/wdc-toolchain.cson b/grammars/wdc-toolchain.cson index 4290b7a..9979bff 100644 --- a/grammars/wdc-toolchain.cson +++ b/grammars/wdc-toolchain.cson @@ -1,7 +1,7 @@ # Syntax Highlighting for the Western Design Center toolchain and 6502 support # TODO: extra addressing modes, chip point prefix, * comments -scopeName: 'source.wdc-toolchain' +scopeName: 'source.assembly.6502.wdc-toolchain' name: '6502 Assembly (WDCTools)' # Name shown in Atom Editor grammar selection # File extensions associated with this grammar fileTypes: [