citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

alex.vim (3567B)


      1 " Vim syntax file
      2 " Language:     Alex config language
      3 " Maintainer:   Nickolay Kudasov <false.developer@gmail.com>
      4 " Last Change:  March 16, 2010
      5 "
      6 " Version:      0.2
      7 " Changes:      $ and @ are now part of identifier
      8 "               so auto complete works well
      9 "               haskell directives are now regocnized
     10 "               hightlighting fixmes
     11 "               hightlighting todos and fixmes in haskell comments
     12 
     13 if exists("b:current_syntax")
     14     finish
     15 endif
     16 
     17 " macro definitions start with $ for sets and @ for regexps
     18 " so we add this symbols to isident to make autocompletion work properly
     19 set isident+=$
     20 set isident+=@
     21 
     22 " Haskell code in alex file
     23 syn match haskell_comment  /--.*$/ contained contains=alex_todo,alex_fixme
     24 syn match haskell_char /'[^\\]'\|'\\.'/ contained
     25 
     26 syn region haskell_string           start=/"/ skip=/\\"/ end=/"/        contained
     27 syn region haskell_block_comment    start=/{-/ end=/-}/                 fold contained contains=haskell_block_comment,alex_todo,alex_fixme
     28 syn region haskell_directive        start=/{-#/ end=/#-}/               contained
     29 syn region haskell_code             start=/{/ skip=/'\\\?}'/ end=/}/    fold contains=haskell_comment,haskell_block_comment,haskell_string,haskell_char,haskell_code,haskell_directive
     30 
     31 " Comments in alex file
     32 syn match alex_comment  /--.*$/ contains=alex_todo,alex_fixme
     33 syn match alex_todo     /[tT][oO][dD][oO]/ contained
     34 syn match alex_fixme    /[fF][iI][xX][mM][eE]/ contained
     35 
     36 " String representing ordered set of characters for regexp matching
     37 syn region alex_string  start=/"/ skip=/\\"/ end=/"/
     38 
     39 " Sets of characters
     40 syn match alex_char     /\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)/
     41 syn match alex_anychar  /\./
     42 syn match alex_range    /\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)\(-\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)\)\?/
     43 syn match alex_set      /$[a-zA-Z_][a-zA-Z_\d]*/
     44 syn match alex_setcompl /\~\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)/he=s+1,me=s+1
     45 syn match alex_setcompl /\~\./
     46 syn match alex_setcompl /\~\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)\(-\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)\)\?/he=s+1,me=s+1
     47 syn match alex_setcompl /\~$[a-zA-Z_][a-zA-Z_\d]*/he=s+1,me=s+1
     48 syn match alex_setspec  /[\^.$]/ contained
     49 syn region alex_sets start="\[" skip="\\]" end="]" contains=alex_char,alex_anychar,alex_range,alex_set,alex_setcompl,alex_sets,alex_setspec
     50 
     51 " Regular expressions
     52 syn match alex_regexp   /@[a-zA-Z_][a-zA-Z_\d]*/
     53 syn match alex_rexpspec /[*+?]/
     54 syn match alex_repeat   /{\d\+\(\,\d*\)\?}/
     55 
     56 " Keywords
     57 syn keyword alex_keywords wrapper tokens
     58 
     59 hi def link haskell_comment         Comment
     60 hi def link haskell_block_comment   Comment
     61 hi def link haskell_directive       Special
     62 hi def link haskell_char            Character
     63 hi def link haskell_string          String
     64 
     65 hi def link alex_comment            Comment
     66 hi def link alex_todo               Todo
     67 hi def link alex_fixme              Todo
     68 hi def link alex_string             String
     69 hi def link alex_char               Character
     70 hi def link alex_range              Character
     71 hi def link alex_anychar            Special
     72 hi def link alex_setcompl           Special
     73 hi def link alex_setspec            Special
     74 hi def link alex_rexpspec           Special
     75 hi def link alex_repeat             Special
     76 hi def link alex_set                Identifier
     77 hi def link alex_regexp             Function
     78 hi def link alex_keywords           Keyword
     79 
     80 " Syntax configuration name
     81 let b:current_syntax = "alex"
     82