Skip to content

Commit

Permalink
misc: update highlighters and indenters
Browse files Browse the repository at this point in the history
Signed-off-by: Jean Privat <[email protected]>
  • Loading branch information
privat committed Apr 26, 2017
1 parent 040af72 commit 020bb11
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions misc/gtksourceview/nit.lang
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<context id="keywords" style-ref="keyword">
<keyword>do</keyword>
<keyword>end</keyword>
<keyword>catch</keyword>
<keyword>intrude</keyword>
<keyword>private</keyword>
<keyword>if</keyword>
Expand Down
2 changes: 1 addition & 1 deletion misc/highlight/nit.lang
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Digits=[[ (?:0x|0X|0b)[0-9a-fA-F]+|\d*[\.\_]?\d+(?:[eE][\-\+]\d+)? ]]

Keywords={
{ Id=1,
List={"abort", "abstract", "as", "assert", "break", "continue", "do", "else", "end", "enum", "extern", "for", "if", "import", "in", "interface", "intern", "intrude", "is", "isa", "isset", "new", "label", "loop", "private", "protected", "readable", "return", "super", "then", "while", "false", "null", "nullable", "redef", "self", "true", "and", "not", "or", "fun", "var", "type", "init", "class", "package", "module", "special", "universal", "writable"},
List={"abort", "abstract", "as", "assert", "break", "continue", "do", "else", "end", "catch", "enum", "extern", "for", "if", "import", "in", "interface", "intern", "intrude", "is", "isa", "isset", "new", "label", "loop", "private", "protected", "readable", "return", "super", "then", "while", "false", "null", "nullable", "redef", "self", "true", "and", "not", "or", "fun", "var", "type", "init", "class", "package", "module", "special", "universal", "writable"},
},
{ Id=2,
Regex=[[[A-Z][\/\w]+]],
Expand Down
2 changes: 1 addition & 1 deletion misc/source-highlight/nit.lang
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ environment string delim '(\"{3})' '(\"{3})' escape "\\" multiline begin
specialchar = '\\.'
end

keyword = "abort|abstract|as|assert|break|continue|do|else|end|enum|extern|for|if|import|in|interface|intern|intrude|is|isa|isset|new|label|loop|private|protected|readable|return|super|then|while|false|null|nullable|redef|self|true|and|not|or|fun|var|type|init|class|package|module|special|universal|writable"
keyword = "abort|abstract|as|assert|break|continue|do|else|end|catch|enum|extern|for|if|import|in|interface|intern|intrude|is|isa|isset|new|label|loop|private|protected|readable|return|super|then|while|false|null|nullable|redef|self|true|and|not|or|fun|var|type|init|class|package|module|special|universal|writable"

type = '[[:upper:]]([[:word:]]*)'

Expand Down
2 changes: 1 addition & 1 deletion misc/syntaxhighlighter/shBrushNit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

function Brush()
{
var keywords = 'abort abstract and as assert break class continue do else end enum extern false for fun' +
var keywords = 'abort abstract and as assert break class continue do else end catch enum extern false for fun' +
'if import in init interface intrude is isa isset label loop module new null nullable not' +
'once or protected private redef return self super then type true universal var' +
'when while writable';
Expand Down
6 changes: 3 additions & 3 deletions misc/vim/indent/nit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ setlocal nosmartindent
setlocal nocindent
setlocal autoindent
setlocal comments=:#
setlocal indentkeys+==end,=else,=do,=var,0!,=then,=loop,=special,=class,=interface,=universal
setlocal indentkeys+==end,=else,=catch,=do,=var,0!,=then,=loop,=special,=class,=interface,=universal

" Only define the function once.
if exists("*GetNITIndent")
finish
endif

" Indent after
let s:relative_indent = '\<\(do\|loop\|then\|else\|if\)\s*\(#\|$\)\|^\s*\(\<\(redef\|private\)\>\s*\)\?\(\<abstract\>\s*\)\?\<\(class\|interface\|universal\|special\)\>'
let s:relative_indent = '\<\(do\|loop\|then\|else\|catch\|if\)\s*\(#\|$\)\|^\s*\(\<\(redef\|private\)\>\s*\)\?\(\<abstract\>\s*\)\?\<\(class\|interface\|universal\|special\)\>'
" Unindent on them
let s:outdent = '^\s*\(else\|then\|end\)\>'
let s:outdent = '^\s*\(catch\|else\|then\|end\)\>'
" At 0
let s:no_indent = '^\s*\(class\|import\|special\)\>'

Expand Down
2 changes: 1 addition & 1 deletion misc/vim/syntax/nit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ syn match NITClosure "!\h\w*"

" Fallback highlight keywords
syn match NITNull "\<\(null\)\>"
syn match NITControl "\<\(init\|end\|not null\|not\|var\|do\|then\|else\|loop\|is\)\>"
syn match NITControl "\<\(init\|end\|not null\|not\|var\|do\|then\|catch\|else\|loop\|is\)\>"
syn match NITKeyword "\<\(super\)\>"
" Unmatchning error
syn match Error "\<end\>"
Expand Down

0 comments on commit 020bb11

Please sign in to comment.