Skip to content

Commit

Permalink
Add default keyword to editor plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
tsandall committed Feb 3, 2017
1 parent 1e19847 commit fb9e41f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 3 additions & 1 deletion misc/syntax/atom/language-rego/grammars/rego.cson
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ repository:
}
]
head:
begin: "^([[:alpha:]_][[:alnum:]_]*)"
begin: "^(default\s+)?([[:alpha:]_][[:alnum:]_]*)"
beginCaptures:
"1":
name: "keyword.control.import.$1.rego"
"2":
name: "storage.type.function.rego"
end: "(=|:-)"
name: "meta.function.rego"
Expand Down
7 changes: 6 additions & 1 deletion misc/syntax/textmate/Rego.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,15 @@
<key>head</key>
<dict>
<key>begin</key>
<string>^([[:alpha:]_][[:alnum:]_]*)</string>
<string>^(default\s+)?([[:alpha:]_][[:alnum:]_]*)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.import.$1.rego</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>storage.type.function.rego</string>
Expand Down
6 changes: 4 additions & 2 deletions misc/syntax/vim/syntax/rego.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif
syn case match

" language keywords
syn keyword regoKeyword package import as not with
syn keyword regoKeyword package import as not with default

" comments
syn match regoComment "#.*$" contains=regoTodo,@Spell
Expand All @@ -29,7 +29,9 @@ syn match regoStringEscape "\\u[0-9a-fA-F]\{4}" contained
syn match regoStringEscape "\\[nrfvb\\\"]" contained

" rule head
syn match regoRuleName "^\w\+" nextgroup=regoRuleKey,regoRuleValue skipwhite
" TODO: how to match 'default' here but highlight as keyword (and still
" highlight rule name as function)?
syn match regoRuleName "^\s*\(\w\+\)" nextgroup=regoRuleKey,regoRuleValue skipwhite
syn region regoRuleKey start="\[" end="\]" contained skipwhite
syn match regoRuleValue "=\w\+" nextgroup=regoIfThen skipwhite

Expand Down
7 changes: 6 additions & 1 deletion misc/syntax/visualstudio/rego/syntaxes/Rego.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,15 @@
<key>head</key>
<dict>
<key>begin</key>
<string>^([[:alpha:]_][[:alnum:]_]*)</string>
<string>^(default\s+)?([[:alpha:]_][[:alnum:]_]*)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.import.$1.rego</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>storage.type.function.rego</string>
Expand Down

0 comments on commit fb9e41f

Please sign in to comment.