Updated ACME grammar from GoDot

This commit is contained in:
Matthew Callis 2018-06-12 11:38:16 -07:00
parent a32c1f73a2
commit b4a88e0a42
No known key found for this signature in database
GPG Key ID: 57B56B4FEABD74EB
2 changed files with 168 additions and 27 deletions

114
coffeelint.json Normal file
View File

@ -0,0 +1,114 @@
{
"coffeescript_error": {
"level": "error"
},
"arrow_spacing": {
"name": "arrow_spacing",
"level": "warn"
},
"no_tabs": {
"name": "no_tabs",
"level": "error"
},
"no_trailing_whitespace": {
"name": "no_trailing_whitespace",
"level": "error",
"allowed_in_comments": false,
"allowed_in_empty_lines": true
},
"max_line_length": {
"name": "max_line_length",
"value": 128,
"level": "ignore",
"limitComments": true
},
"line_endings": {
"name": "line_endings",
"level": "warn",
"value": "unix"
},
"no_trailing_semicolons": {
"name": "no_trailing_semicolons",
"level": "error"
},
"indentation": {
"name": "indentation",
"value": 2,
"level": "error"
},
"camel_case_classes": {
"name": "camel_case_classes",
"level": "error"
},
"colon_assignment_spacing": {
"name": "colon_assignment_spacing",
"level": "ignore",
"spacing": {
"left": 0,
"right": 0
}
},
"no_implicit_braces": {
"name": "no_implicit_braces",
"level": "ignore",
"strict": false
},
"no_plusplus": {
"name": "no_plusplus",
"level": "ignore"
},
"no_throwing_strings": {
"name": "no_throwing_strings",
"level": "error"
},
"no_backticks": {
"name": "no_backticks",
"level": "error"
},
"no_implicit_parens": {
"name": "no_implicit_parens",
"level": "ignore"
},
"no_empty_param_list": {
"name": "no_empty_param_list",
"level": "warn"
},
"no_stand_alone_at": {
"name": "no_stand_alone_at",
"level": "warn"
},
"space_operators": {
"name": "space_operators",
"level": "warn"
},
"duplicate_key": {
"name": "duplicate_key",
"level": "error"
},
"empty_constructor_needs_parens": {
"name": "empty_constructor_needs_parens",
"level": "warn"
},
"cyclomatic_complexity": {
"name": "cyclomatic_complexity",
"value": 10,
"level": "ignore"
},
"newlines_after_classes": {
"name": "newlines_after_classes",
"value": 3,
"level": "ignore"
},
"no_unnecessary_fat_arrows": {
"name": "no_unnecessary_fat_arrows",
"level": "warn"
},
"missing_fat_arrows": {
"name": "missing_fat_arrows",
"level": "ignore"
},
"non_empty_constructor_needs_parens": {
"name": "non_empty_constructor_needs_parens",
"level": "ignore"
}
}

View File

@ -11,10 +11,10 @@ patterns: [
{ include: 'source.6502-opcodes' } { include: 'source.6502-opcodes' }
{ include: 'source.6502x-opcodes' } { include: 'source.6502x-opcodes' }
{ include: '#comments' } { include: '#comments' }
# symbols, constants, numbers
{ include: '#symbols' }
# directives # directives
{ include: '#directives' } { include: '#directives' }
# symbols, constants, numbers
{ include: '#symbols' }
] ]
# Repository starts here ------------------------------------------------------ # Repository starts here ------------------------------------------------------
@ -33,72 +33,99 @@ repository:
# symbols # symbols
symbols: symbols:
patterns: [ patterns: [
# Labels (at beginning of a line)
{
match: '^[A-Za-z\\._][A-Za-z0-9_:]*'
name: 'entity.name.function.acme'
}
# this section hilights labels as variables: results in pretty colorful listings, maybe you like it
# Labels inline
# {
# match: '\\b[A-Za-z][A-Za-z0-9_:]*\\b'
# name: 'variable.language'
# }
# Register A (like in ASL A)
{
match: '\\b[aA]\\b'
name: 'variable.language.register.acme'
}
# Registers X and Y (like in LDA $1000,X or LDA ($30),Y )
{
match: '(?<=,)([xXyY])\\b'
name: 'variable.language.register.acme'
}
# strings # strings
{ {
begin: '"' begin: '"'
beginCaptures:
0:
name: 'punctuation.definition.string.begin.acme'
end: '"' end: '"'
endCaptures: endCaptures:
0: 0:
name: 'punctuation.definition.string.end.acme' name: 'punctuation.definition.string.end.acme'
name: 'string.quoted.double.acme' name: 'string.quoted.double.acme'
} }
# absolut addressing/numbering
{ {
match: '\\#(\'.\'|[^\\s\']+)' begin: '\''
end: '\''
name: 'string.quoted.single.assembly.acme'
}
# absolut addressing/numbering (including lo/hibyte by < or >)
{
match: '\\#(\\>?\\<?\\(?\\$?\\w*\\)?|[^\\s]\\h?*)'
name: 'constant.numeric.hex.acme' name: 'constant.numeric.hex.acme'
} }
# hex, prefixed with dollar ($) # hex, prefixed with dollar ($) or 0x
{ {
match: '-?\\$[A-Fa-f0-9]+' match: '\\$\\h+|0x\\h+'
name: 'constant.numeric.hex.acme' name: 'constant.numeric.hex.acme'
} }
# binary prefixed with % # binary prefixed with %
{ {
match: '%[01]+' match: '%[01]+|%[\\#\\.]+|0b[01]+|0b[\\#\\.]+'
name: 'constant.numeric.binary.acme' name: 'constant.numeric.binary.acme'
} }
# decimal # Float
{ {
match: '\\b([0-9]+)\\b' match: '\\d*\\.\\d+\\b'
name: 'constant.numeric.float.acme'
}
# Decimal (but not float)
{
match: '\\b\\d+\\b'
name: 'constant.numeric.decimal.acme' name: 'constant.numeric.decimal.acme'
} }
# Cctal
{
match: '&([0-7]+)\\b'
name: 'constant.numeric.octal.acme'
}
] ]
# assembler directives # assembler directives
directives: directives:
patterns: [ patterns: [
# File and Symbol control # File and Symbol Control (pseudos)
{ {
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' match: '\\!(?i:source|src|pseudopc|zn|zone|to|bin(ary)?|symbollist|sl|initmem)\\b'
name: 'support.function.pseudo.acme' name: 'support.function.pseudo.acme'
} }
# Parsing control # Parsing Control (more pseudos)
{ {
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' match: '\\!(?i:macro|cpu|al|as|rl|rs|8|by|byte|le16|be16|16|wo|word|le24|be24|24|le32|be32|32|hex|h|fill|fi|align|skip|ct|convtab|tx|text|pet|scr|scrxor|raw|address|addr)\\b'
name: 'support.function.pseudo.acme' name: 'support.function.pseudo.acme'
} }
# Macro control # Conditional Control
{ {
match: '(?i:!\\bmacro|\\+[a-zA-Z0-9])\\b' match: '\\!(?i:if|if(n)?def|for|do|set|warn|error|serious|eof|endoffile)\\b'
name: 'support.function.pseudo.acme'
}
# Conditional control
{
match: '!\\b(?i:if|if(n)?def|for|do|while|until)\\b'
name: 'keyword.control.conditional.acme' name: 'keyword.control.conditional.acme'
} }
# Conditional control II
{ {
match: '\\b(?i:else|while|until)\\b' match: '(?i:while|until|else)\\b'
name: 'keyword.control.conditional.acme' name: 'keyword.control.conditional.acme'
} }
# Operators # Operators
{ {
match: '!|\\+|\\-|\\/|\\*|<<|>>|&|\\||\\^|=|<|>|\\:|\\|\\|' match: '\\!|\\+|\\-|\\/|\\*|<<|>>|&|\\||\\^|=|<|>|\\:|\\|\\|'
name: 'keyword.operator.acme' name: 'keyword.operator'
} }
# Operators II # Operators II
{ {