"Fossies" - the Fresh Open Source Software Archive

Member "ragel-6.10/ragel.vim" (24 Mar 2017, 5897 Bytes) of package /linux/misc/ragel-6.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) vimscript source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 " Vim syntax file
    2 "
    3 " Language: Ragel
    4 " Author: Adrian Thurston
    5 
    6 syntax clear
    7 
    8 "
    9 " Outside code
   10 "
   11 
   12 " Comments
   13 syntax region ocComment start="\/\*" end="\*\/"
   14 syntax match ocComment "\/\/.*$"
   15 
   16 " Anything preprocessor
   17 syntax match ocPreproc "#\(.\|\\\n\)*$"
   18 syntax region ocPreproc start="#" end="[^\\]$"
   19 
   20 " Strings
   21 syntax match ocLiteral "'\(\\.\|[^'\\]\)*'"
   22 syntax match ocLiteral "\"\(\\.\|[^\"\\]\)*\""
   23 
   24 " C/C++ Keywords
   25 syntax keyword ocType unsigned signed void char short int long float double bool
   26 syntax keyword ocType inline static extern register const volatile auto
   27 syntax keyword ocType union enum struct class typedef
   28 syntax keyword ocType namespace template typename mutable
   29 syntax keyword ocKeyword break continue default do else for
   30 syntax keyword ocKeyword goto if return switch while
   31 syntax keyword ocKeyword new delete this using friend public private protected sizeof
   32 syntax keyword ocKeyword throw try catch operator typeid
   33 syntax keyword ocKeyword and bitor xor compl bitand and_eq or_eq xor_eq not not_eq
   34 syntax keyword ocKeyword static_cast dynamic_cast
   35 
   36 " Numbers
   37 syntax match ocNumber "[0-9][0-9]*[Ll]\?[Ll]\?"
   38 syntax match ocNumber "0x[0-9a-fA-F][0-9a-fA-F]*"
   39 
   40 " Booleans
   41 syntax keyword ocBoolean true false
   42 
   43 " Identifiers
   44 syntax match anyId "[a-zA-Z_][a-zA-Z_0-9]*"
   45 
   46 " Inline code only
   47 syntax keyword fsmType fpc fc fcurs fbuf fblen ftargs fstack
   48 syntax keyword fsmKeyword fhold fgoto fcall fret fentry fnext fexec fbreak
   49 
   50 syntax cluster rlItems contains=rlComment,rlLiteral,rlAugmentOps,rlOtherOps,rlKeywords,rlWrite,rlCodeCurly,rlCodeSemi,rlNumber,anyId,rlLabelColon,rlExprKeywords,rlBuiltIns
   51 
   52 syntax region machineSpec1 matchgroup=beginRL start="%%{" end="}%%" contains=@rlItems
   53 syntax region machineSpec2 matchgroup=beginRL start="%%[^{]"rs=e-1 end="$" keepend contains=@rlItems
   54 syntax region machineSpec2 matchgroup=beginRL start="%%$" end="$" keepend contains=@rlItems
   55 
   56 " Comments
   57 syntax match rlComment "#.*$" contained
   58 
   59 " Literals
   60 syntax match rlLiteral "'\(\\.\|[^'\\]\)*'[i]*" contained
   61 syntax match rlLiteral "\"\(\\.\|[^\"\\]\)*\"[i]*" contained
   62 syntax match rlLiteral /\/\(\\.\|[^\/\\]\)*\/[i]*/ contained
   63 syntax match rlLiteral "\[\(\\.\|[^\]\\]\)*\]" contained
   64 
   65 " Numbers
   66 syntax match rlNumber "[0-9][0-9]*" contained
   67 syntax match rlNumber "0x[0-9a-fA-F][0-9a-fA-F]*" contained
   68 
   69 " Operators
   70 syntax match rlAugmentOps "[>$%@]" contained
   71 syntax match rlAugmentOps "<>\|<" contained
   72 syntax match rlAugmentOps "[>\<$%@][!\^/*~]" contained
   73 syntax match rlAugmentOps "[>$%]?" contained
   74 syntax match rlAugmentOps "<>[!\^/*~]" contained
   75 syntax match rlAugmentOps "=>" contained
   76 syntax match rlOtherOps "->" contained
   77 
   78 syntax match rlOtherOps ":>" contained
   79 syntax match rlOtherOps ":>>" contained
   80 syntax match rlOtherOps "<:" contained
   81 
   82 " Keywords
   83 " FIXME: Enable the range keyword post 5.17.
   84 " syntax keyword rlKeywords machine action context include range contained
   85 syntax keyword rlKeywords machine action context include import export prepush postpop contained
   86 syntax keyword rlExprKeywords when inwhen outwhen err lerr eof from to contained
   87 
   88 " Built-in rules
   89 syntax keyword rlBuiltIns any ascii extend alpha digit alnum lower upper xdigit cntrl graph print punct space zlen empty contained
   90 
   91 " Case Labels
   92 syntax keyword caseLabelKeyword case contained
   93 syntax cluster caseLabelItems contains=ocComment,ocPreproc,ocLiteral,ocType,ocKeyword,caseLabelKeyword,ocNumber,ocBoolean,anyId,fsmType,fsmKeyword
   94 syntax match caseLabelColon "case" contains=@caseLabelItems
   95 syntax match caseLabelColon "case[\t ]\+.*:$" contains=@caseLabelItems
   96 syntax match caseLabelColon "case[\t ]\+.*:[^=:]"me=e-1 contains=@caseLabelItems
   97 
   98 " Labels
   99 syntax match ocLabelColon "^[\t ]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:$" contains=anyLabel
  100 syntax match ocLabelColon "^[\t ]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:[^=:]"me=e-1 contains=anyLabel
  101 
  102 syntax match rlLabelColon "[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:$" contained contains=anyLabel
  103 syntax match rlLabelColon "[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:[^=:>]"me=e-1 contained contains=anyLabel
  104 syntax match anyLabel "[a-zA-Z_][a-zA-Z_0-9]*" contained
  105 
  106 " All items that can go in a code block.
  107 
  108 syntax cluster inlineItems contains=rlCodeCurly,ocComment,ocPreproc,ocLiteral,ocType,ocKeyword,ocNumber,ocBoolean,ocLabelColon,anyId,fsmType,fsmKeyword,caseLabelColon
  109 
  110 " Blocks of code. rlCodeCurly is recursive.
  111 syntax region rlCodeCurly matchgroup=NONE start="{" end="}" contained contains=@inlineItems
  112 syntax region rlCodeSemi matchgroup=Type start="\<alphtype\>" start="\<getkey\>" start="\<access\>" start="\<variable\>" matchgroup=NONE end=";" contained contains=@inlineItems
  113 
  114 syntax region rlWrite matchgroup=Type start="\<write\>" matchgroup=NONE end="[;)]" contained contains=rlWriteKeywords,rlWriteOptions
  115 
  116 syntax keyword rlWriteKeywords init data exec exports start error first_final contained
  117 syntax keyword rlWriteOptions noerror nofinal noentry noprefix noend nocs contained
  118 
  119 "
  120 " Sync at the start of machine specs.
  121 "
  122 " Match The ragel delimiters only if there quotes no ahead on the same line.
  123 " On the open marker, use & to consume the leader.
  124 syntax sync match ragelSyncPat grouphere NONE "^[^\'\"%]*%%{&^[^\'\"%]*"
  125 syntax sync match ragelSyncPat grouphere NONE "^[^\'\"%]*%%[^{]&^[^\'\"%]*"
  126 syntax sync match ragelSyncPat grouphere NONE "^[^\'\"]*}%%"
  127 
  128 "
  129 " Specifying Groups
  130 "
  131 hi link ocComment Comment
  132 hi link ocPreproc Macro
  133 hi link ocLiteral String
  134 hi link ocType Type
  135 hi link ocKeyword Keyword
  136 hi link ocNumber Number
  137 hi link ocBoolean Boolean
  138 hi link rlComment Comment
  139 hi link rlNumber Number
  140 hi link rlLiteral String
  141 hi link rlAugmentOps Keyword
  142 hi link rlExprKeywords Keyword
  143 hi link rlWriteKeywords Keyword
  144 hi link rlWriteOptions Keyword
  145 hi link rlKeywords Type
  146 hi link fsmType Type
  147 hi link fsmKeyword Keyword
  148 hi link anyLabel Label
  149 hi link caseLabelKeyword Keyword
  150 hi link beginRL Type
  151 hi link rlBuiltIns Constant
  152  
  153 let b:current_syntax = "ragel"