From b4a88e0a4274aeb3194e0fc3e910a77ff592c5ce Mon Sep 17 00:00:00 2001 From: Matthew Callis Date: Tue, 12 Jun 2018 11:38:16 -0700 Subject: [PATCH] Updated ACME grammar from GoDot --- coffeelint.json | 114 +++++++++++++++++++++++++++++++++++++++++++++ grammars/acme.cson | 81 +++++++++++++++++++++----------- 2 files changed, 168 insertions(+), 27 deletions(-) create mode 100644 coffeelint.json diff --git a/coffeelint.json b/coffeelint.json new file mode 100644 index 0000000..41fb6c8 --- /dev/null +++ b/coffeelint.json @@ -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" + } +} diff --git a/grammars/acme.cson b/grammars/acme.cson index 8acf08f..034d9f1 100644 --- a/grammars/acme.cson +++ b/grammars/acme.cson @@ -11,10 +11,10 @@ patterns: [ { include: 'source.6502-opcodes' } { include: 'source.6502x-opcodes' } { include: '#comments' } - # symbols, constants, numbers - { include: '#symbols' } # directives { include: '#directives' } + # symbols, constants, numbers + { include: '#symbols' } ] # Repository starts here ------------------------------------------------------ @@ -33,72 +33,99 @@ repository: # symbols symbols: 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 { begin: '"' - beginCaptures: - 0: - name: 'punctuation.definition.string.begin.acme' end: '"' endCaptures: 0: name: 'punctuation.definition.string.end.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: '\\#(\\>?\\>|&|\\||\\^|=|<|>|\\:|\\|\\|' - name: 'keyword.operator.acme' + match: '\\!|\\+|\\-|\\/|\\*|<<|>>|&|\\||\\^|=|<|>|\\:|\\|\\|' + name: 'keyword.operator' } # Operators II {