better number matching

This commit is contained in:
Kelvin Sherlock 2018-09-08 16:11:17 -04:00
parent 835888a663
commit 0692c4a4e8
7 changed files with 49 additions and 30 deletions

View File

@ -114,13 +114,13 @@ contexts:
- include: eol
numbers:
- match: \d+
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01]+
- match: \%[01]+\b
scope: constant.numeric.binary
- match: \@[0-7]+
- match: \@[0-7]+\b
scope: constant.numeric.octal
strings:

View File

@ -21,20 +21,20 @@ contexts:
- match: '^({{ident}}){{ws}}((?i)PROC|PROCNAME|FUNC|INIT)\b'
captures:
1: entity.name.function
2: keyword.directive
2: meta.opcode keyword.directive
push: operand-proc
- match: '^({{ident}}){{ws}}((?i)STACKDP)\b'
captures:
1: entity.name.function
2: keyword.directive
2: meta.operand keyword.directive
push: operand-stackdp
- match: '^({{ident}}){{ws}}((?i)RECORD)\b'
captures:
1: entity.name.record
2: keyword.directive
2: meta.operand keyword.directive
push: operand-record
@ -53,8 +53,11 @@ contexts:
pop: true
opcode:
- meta_content_scope: meta.opcode
- match: '{{ws}}'
set: operand
- include: scope:source.asm.65816#mnemonics-6502
- include: scope:source.asm.65816#mnemonics-65c02
- include: scope:source.asm.65816#mnemonics-65816
@ -62,6 +65,7 @@ contexts:
- include: mnemonics-65816-alt
# toolbox macros
# matches _ for toolbox completion.
- match: \b_[A-Za-z0-9]+\b
scope: support.function.macro.toolbox
@ -249,6 +253,8 @@ contexts:
- include: expect-comment
operand:
- meta_content_scope: meta.operand
- include: macro-parm
- include: numbers
@ -266,13 +272,13 @@ contexts:
numbers:
- match: \d+
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01]+
- match: \%[01]+\b
scope: constant.numeric.binary
- match: \@[0-7]+
- match: \@[0-7]+\b
scope: constant.numeric.octal
strings:

View File

@ -155,16 +155,16 @@ contexts:
pop: true
numbers:
- match: 0[0-7]+
- match: \b0[0-7]+\b
scope: constant.numeric.octal
- match: 0[xX][0-9A-Fa-f]+
- match: \b0[xX][0-9A-Fa-f]+\b
scope: constant.numeric.hexadecimal
- match: 0[qQ][0-3]+
- match: \b0[qQ][0-3]+\b
scope: constant.numeric.quarters
- match: 0[bB][01]+
- match: \b0[bB][01]+\b
scope: constant.numeric
- match: \d+
- match: \b\d+\b
scope: constant.numeric
- match: \'([^'\n]|\\.)\'

View File

@ -233,14 +233,27 @@ contexts:
scope: keyword.mnemonic.65816.alt
numbers:
- match: \d+
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01_]+
- match: \%[01_]+\b
scope: constant.numeric.binary
strings:
# special case for ''' and """
- match: "(')'(')"
captures:
0: string.quoted.single
1: punctuation.definition.string.begin
2: punctuation.definition.string.end
- match: '(")"(")'
captures:
0: string.quoted.double
1: punctuation.definition.string.begin
2: punctuation.definition.string.end
- match: "'"
scope: punctuation.definition.string.begin
push:

View File

@ -122,15 +122,15 @@ contexts:
numbers:
- match: \d+
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01]+
- match: \%[01]+\b
scope: constant.numeric.binary
macro-parm:
- match: '&\d'
- match: '&\d\b'
scope: variable.other
strings:

View File

@ -286,13 +286,13 @@ contexts:
numbers:
- match: \d+
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01]+
- match: \%[01]+\b
scope: constant.numeric.binary
- match: \@[0-7]+
- match: \@[0-7]+\b
scope: constant.numeric.octal
strings:

View File

@ -191,11 +191,11 @@ contexts:
numbers:
- match: \d+
- match: \b\d+\b
scope: constant.numeric
- match: \$[0-9a-fA-F]+
- match: \$[0-9a-fA-F]+\b
scope: constant.numeric.hex
- match: \%[01]+
- match: \%[01]+\b
scope: constant.numeric.binary
strings: