adding nim linter and syntax

This commit is contained in:
Samantha Marshall
2017-01-26 14:19:07 -05:00
parent f7560c3311
commit 15ab0b2fed
3 changed files with 48 additions and 2 deletions

View File

@@ -29,6 +29,8 @@ function runLinter()
lint("pylint", "pylint", {"--output-format=parseable", "--reports=no", file}, "%f:%l: %m")
elseif ft == "c" then
lint("gcc", "gcc", {"-fsyntax-only", "-Wall", "-Wextra", file}, "%f:%l:%d+:.+: %m")
elseif ft == "swift" then
lint("switfc", "xcrun", {"swiftc", file}, "%f:%l:%d+:.+: %m")
elseif ft == "Objective-C" then
lint("clang", "xcrun", {"clang", "-fsyntax-only", "-Wall", "-Wextra", file}, "%f:%l:%d+:.+: %m")
elseif ft == "d" then
@@ -37,6 +39,8 @@ function runLinter()
lint("javac", "javac", {"-d", temp, file}, "%f:%l: error: %m")
elseif ft == "javascript" then
lint("jshint", "jshint", {file}, "%f: line %l,.+, %m")
elseif ft == "nim" then
lint("nim", "nim", {"check", "--listFullPaths", "--stdout", "--hints:off", file}, "%f\\(%l, %d\\) .+: %m")
end
end
@@ -62,6 +66,7 @@ function onExit(output, linter, errorformat)
-- Trim whitespace
line = line:match("^%s*(.+)%s*$")
if string.find(line, regex) then
print(regex)
local file, line, msg = string.match(line, regex)
if basename(CurView().Buf.Path) == basename(file) then
CurView():GutterMessage(linter, tonumber(line), msg, 2)

18
runtime/syntax/nim.micro Normal file
View File

@@ -0,0 +1,18 @@
syntax "nim" "\.nim$"
color statement "\b(addr|and|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|div|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|in|include|interface|is|isnot|iterator|let|macro|method|mixin|mod|nil|not|notin|object|of|or|out|proc|ptr|raise|ref|return|shl|shr|static|template|try|tuple|type|using|var|when|while|with|without|xor|yield)\b"
color special "\{\.[^}]*\.\}"
color preproc "{\..*\b(deprecated|noSideEffect|constructor|destructor|override|procvar|compileTime|noReturn|acyclic|final|shallow|pure|asmNoStackFrame|error|fatal|warning|hint|line|linearScanEnd|computedGoto|unroll|immediate|checks|boundsChecks|overflowChecks|nilChecks|assertations|warnings|hints|optimization|patterns|callconv|push|pop|global|pragma|experimental|bitsize|volatile|noDecl|header|incompleteStruct|compile|link|passC|passL|emit|importc|importcpp|importobjc|codegenDecl|injectStmt|intdefine|strdefine|varargs|exportc|extern|bycopy|byref|union|packed|unchecked|dynlib|cdecl|thread|gcsafe|threadvar|guard|locks|compileTime)\b.*\.}"
color type "\b(int|cint|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|float32|float64|bool|char|enum|string|cstring|array|openarray|seq|varargs|tuple|object|set|void|auto|cshort|range|nil)\b"
color statement "=" "\+" "-" "\*" "/" "<" ">" "@" "$" "~" "&" "%" "|" "!" "?" "^" "." ":" "\\"
color constant.number "\b[0-9]+\b"
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
color comment "[[:space:]]*#.*$"
color comment start="#[" end="]#"
color todo "TODO:?"