Skip to content

Commit

Permalink
Merge pull request NixOS#3 from aszlig/namespaced-builtins-fix
Browse files Browse the repository at this point in the history
syntax: Merge non-namespaced+namespaced builtins.
  • Loading branch information
LnL7 committed Dec 8, 2015
2 parents 6e67e27 + b93ae52 commit 49f1bc1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
17 changes: 9 additions & 8 deletions syntax/nix.vim
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,16 @@ syn keyword nixSimpleBuiltin
\ abort baseNameOf derivation dirOf fetchTarball import map removeAttrs
\ throw toString
" Namespaced Nix builtins as of version 1.10:
" Namespaced and non-namespaced Nix builtins as of version 1.10:
syn keyword nixNamespacedBuiltin contained
\ add all any attrNames attrValues compareVersions concatLists
\ currentSystem deepSeq div elem elemAt fetchurl filter filterSource
\ foldl' fromJSON genList getAttr getEnv hasAttr hashString head
\ intersectAttrs isAttrs isBool isFunction isInt isList isString length
\ lessThan listToAttrs mul parseDrvName pathExists readDir readFile
\ replaceStrings seq sort stringLength sub substring tail toFile toJSON
\ toPath toXML trace typeOf
\ abort add all any attrNames attrValues baseNameOf compareVersions
\ concatLists currentSystem deepSeq derivation dirOf div elem elemAt
\ fetchTarball fetchurl filter filterSource foldl' fromJSON genList
\ getAttr getEnv hasAttr hashString head import intersectAttrs isAttrs
\ isBool isFunction isInt isList isString length lessThan listToAttrs map
\ mul parseDrvName pathExists readDir readFile removeAttrs replaceStrings
\ seq sort stringLength sub substring tail throw toFile toJSON toPath
\ toString toXML trace typeOf
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin

Expand Down
5 changes: 4 additions & 1 deletion test/nix.vader
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,13 @@ Execute (syntax):
AssertEqual SyntaxOf('&&'), 'nixOperator'

Given nix (builtins):
builtins.doesntexist (hashString (builtins.fetchurl (toString "abort")))
builtins.doesntexist (builtins.map id [
hashString (builtins.fetchurl (toString "abort"))
])

Execute (syntax):
AssertNotEqual SyntaxOf('doesntexist'), 'nixBuiltin'
AssertEqual SyntaxOf('map'), 'nixNamespacedBuiltin'
AssertNotEqual SyntaxOf('hashString'), 'nixBuiltin'
AssertNotEqual SyntaxOf('hashString'), 'nixNamespacedBuiltin'
AssertEqual SyntaxOf('builtins'), 'nixBuiltin'
Expand Down

0 comments on commit 49f1bc1

Please sign in to comment.