Skip to content

Commit

Permalink
Add entity name and storage scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanar committed Nov 6, 2016
1 parent c72c0b4 commit f7015dc
Showing 1 changed file with 58 additions and 8 deletions.
66 changes: 58 additions & 8 deletions atg-c#.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,52 @@ file_extensions:
scope: source.atg
contexts:
main:
- include: lang
- include: strings
- include: section_compiler
- include: section_comments_ignore
- include: section_end
- include: comments
- include: keywords
- include: sections
- include: rule

rule:
- match: '\b[[:alpha:]][\w]+\b'
scope: entity.name.rule.atg
push:
- include: lang
- include: keywords
- include: strings
- meta_scope: meta.rule.body.atg
- match: '(?<!\.)\.(?!\.)'
pop: true

section_compiler:
- match: '(\bCOMPILER\b)\s*(\b[[:alpha:]][\w]+\b)'
captures:
1: storage.modifier.atg
2: entity.name.rule.atg
push: Packages/C#/C#.sublime-syntax
with_prototype:
- match: '\b(IGNORECASE|CHARACTERS|TOKENS|COMMENTS|IGNORE|PRAGMAS|PRODUCTIONS)\b'
scope: storage.modifier.atg
pop: true

section_comments_ignore:
- match: '\b(COMMENTS|IGNORE)\b'
scope: storage.modifier.atg
push:
- include: keywords
- include: comments
- include: strings
- match: '\b(PRAGMAS|PRODUCTIONS)\b'
scope: storage.modifier.atg
pop: true
- include: sections

section_end:
- match: '(\b(END)\b)\s*(\b[[:alpha:]][\w]+\b)'
captures:
1: storage.modifier.atg


lang:
- match: '\(\.'
Expand Down Expand Up @@ -62,13 +104,21 @@ contexts:
pop: true

keywords:
- match: '\b(using|ANY|CONTEXT|IGNORE|PRAGMAS|TOKENS|CHARACTERS|END|IGNORECASE|PRODUCTIONS|WEAK|COMMENTS|FROM|NESTED|SYNC|COMPILER|IF|out|TO|)\b'
- match: '\b(using|ANY|CONTEXT|END|WEAK|FROM|NESTED|SYNC|IF|out|TO|)\b'
scope: keyword.control.atg
- match: '='
scope: keyword.operator.assignment.atg
- match: '\+|-'
scope: keyword.operator.set.atg
- match: '\.\.'
scope: keyword.operator.range.atg
- match: '[\{\}\(\)\|\.\[\]]'
scope: keyword.operator.atg
- match: '[\{\}\(\)\|\[\]]'
scope: keyword.operator.atg

punctuations:
- match: '='
scope: punctuation.separator.atg
- match: '\.'
scope: punctuation.terminator.atg

sections:
- match: '\b(IGNORE|COMMENTS|PRAGMAS|TOKENS|CHARACTERS|PRODUCTIONS|IGNORECASE|COMPILER)\b'
scope: storage.modifier.atg

0 comments on commit f7015dc

Please sign in to comment.