editors

changeset 27:1c1e3ed6872f

* Greatly expanded the Euphoria Vim mode supporting all the new strings,
comments, escape characters and number formats
* Added file open filtering for Win32 vim users
* [[ and ]] now properly go to the prev/next function, procedure or
type
* Highlights TODO, BUG, NOTE, FIXME and XXX found in comments
* If enabled, spell checker now functions in comments and string literals
author Jeremy Cowgar <jeremy@cowgar.com>
date Thu Nov 11 11:52:38 2010 -0500 (2010-11-11)
parents d20abca87f49
children 70eec38602e5
files vim/ftplugin/euphoria.vim vim/syntax/euphoria.vim
line diff
     1.1 --- a/vim/ftplugin/euphoria.vim	Sat Nov 06 19:48:44 2010 +0000
     1.2 +++ b/vim/ftplugin/euphoria.vim	Thu Nov 11 11:52:38 2010 -0500
     1.3 @@ -1,3 +1,11 @@
     1.4 +" Vim file type file
     1.5 +" 
     1.6 +" Language:	    Euphoria
     1.7 +" Language Web: http://openeuphoria.org
     1.8 +" Maintainer:	Jeremy Cowgar <jeremy@cowgar.com>
     1.9 +" Last Change:	Thu Nov 11 11:16:31 EST 2010
    1.10 +"
    1.11 +
    1.12  if exists("b:did_ftplugin")
    1.13  	finish
    1.14  endif
    1.15 @@ -12,6 +20,12 @@
    1.16  
    1.17  setlocal commentstring=--%s
    1.18  
    1.19 -noremap <silent><buffer> [[ m':call search('^\s*\(\(global\|export\|public\|override\)\s*\)*\(function\|procedure\|type\)', "bW")<CR>
    1.20 -noremap <silent><buffer> ]] m':call search('^\s*\(\(global\|export\|public\|override\)\s*\)*\(function\|procedure\|type\)', "W")<CR>
    1.21 +" Win32 can filter files in the browse dialog
    1.22 +if has("gui_win32") && !exists("b:browsefilter")
    1.23 +    let b:browsefilter = "Euphoria Source Files (*.e *.ex *.exw)\t*.e;*.ex;*.exw\n" .
    1.24 +	  \ "All Files (*.*)\t*.*\n"
    1.25 +endif
    1.26  
    1.27 +noremap <buffer><silent> ]] m':call search('^\s*\(\(override\\|global\\|public\\|export\)\s\+\)\=\(function\\|procedure\\|type\)', "W")<CR>
    1.28 +noremap <buffer><silent> [[ m':call search('^\s*\(\(override\\|global\\|public\\|export\)\s\+\)\=\(function\\|procedure\\|type\)', "bW")<CR>
    1.29 +
     2.1 --- a/vim/syntax/euphoria.vim	Sat Nov 06 19:48:44 2010 +0000
     2.2 +++ b/vim/syntax/euphoria.vim	Thu Nov 11 11:52:38 2010 -0500
     2.3 @@ -1,15 +1,16 @@
     2.4  " Vim syntax file
     2.5  " 
     2.6 -" Language:	Euphoria
     2.7 +" Language:	    Euphoria
     2.8 +" Language Web: http://openeuphoria.org
     2.9  " Maintainer:	Jeremy Cowgar <jeremy@cowgar.com>
    2.10 -" Last Change:	2009-08-29
    2.11 +" Last Change:	Thu Nov 11 11:16:31 EST 2010
    2.12  "
    2.13  " Install:
    2.14  "
    2.15  " Add something like the following to your ~/.vim/filetype.vim
    2.16  "
    2.17  " augroup filetypedetect
    2.18 -"   au! BufRead,BufNewFile *.e, *.ex, *.exw, *.eu, *.exu setfiletype euphoria
    2.19 +"   au! BufRead,BufNewFile *.e, *.ex, *.exw, *.exu setfiletype euphoria
    2.20  " augroup END
    2.21  " 
    2.22  " Notes:
    2.23 @@ -22,86 +23,111 @@
    2.24  	finish
    2.25  endif
    2.26  
    2.27 -" Euphoria Pre-processor words
    2.28 -syn keyword euphoriaPre                elsedef elsifdef ifdef include namespace trace with without
    2.29 -
    2.30 -" Euphoria Scope
    2.31 -syn keyword euphoriaScope              export public global override
    2.32 -
    2.33  " Euphoria Keywords
    2.34 -syn keyword euphoriaKeywords	       as and
    2.35 -syn keyword euphoriaKeywords	       break by
    2.36 -syn keyword euphoriaKeywords	       case constant continue
    2.37 -syn keyword euphoriaKeywords	       do
    2.38 -syn keyword euphoriaKeywords	       end else elsif exit entry
    2.39 -syn keyword euphoriaKeywords	       for function
    2.40 -syn keyword euphoriaKeywords	       goto
    2.41 -syn keyword euphoriaKeywords	       if 
    2.42 -syn keyword euphoriaKeywords           label loop
    2.43 -syn keyword euphoriaKeywords	       not
    2.44 -syn keyword euphoriaKeywords	       or
    2.45 -syn keyword euphoriaKeywords	       procedure
    2.46 -syn keyword euphoriaKeywords	       return retry
    2.47 -syn keyword euphoriaKeywords	       switch
    2.48 -syn keyword euphoriaKeywords	       then type to
    2.49 -syn keyword euphoriaKeywords	       until
    2.50 -syn keyword euphoriaKeywords	       while
    2.51 -syn keyword euphoriaKeywords	       xor
    2.52 +syn keyword euphoriaKeywords	   and as
    2.53 +syn keyword euphoriaKeywords	   by
    2.54 +syn keyword euphoriaKeywords	   case constant
    2.55 +syn keyword euphoriaKeywords	   do
    2.56 +syn keyword euphoriaKeywords	   else elsif end enum
    2.57 +syn keyword euphoriaKeywords	   for function
    2.58 +syn keyword euphoriaKeywords	   if
    2.59 +syn keyword euphoriaKeywords	   loop
    2.60 +syn keyword euphoriaKeywords	   not
    2.61 +syn keyword euphoriaKeywords	   or
    2.62 +syn keyword euphoriaKeywords	   procedure
    2.63 +syn keyword euphoriaKeywords	   routine
    2.64 +syn keyword euphoriaKeywords	   switch
    2.65 +syn keyword euphoriaKeywords	   then to type
    2.66 +syn keyword euphoriaKeywords	   until
    2.67 +syn keyword euphoriaKeywords	   while
    2.68 +syn keyword euphoriaKeywords	   xor
    2.69  
    2.70  " Types
    2.71 -syn keyword euphoriaTypes	       object sequence integer atom enum
    2.72 +syn keyword euphoriaTypes	       object sequence integer atom
    2.73  
    2.74 -" Constants
    2.75 -syn match euphoriaConstant "\<[A-Z_][A-Z0-9_]*\>"
    2.76 +" Pre-processor type commands
    2.77 +syn keyword euphoriaPreProc        elsifdef elsedef
    2.78 +syn keyword euphoriaPreProc        ifdef include
    2.79 +syn keyword euphoriaPreProc        namespace
    2.80 +syn keyword euphoriaPreProc        trace
    2.81 +syn keyword euphoriaPreProc        with without
    2.82  
    2.83 -" Various number methods
    2.84 -syn match euphoriaNumber	"\<[_0-9]\+\>"
    2.85 -syn match euphoriaNumber	"\<[_0-9]\+\.[_0-9]*\>"
    2.86 -syn match euphoriaNumber	"\.[_0-9]\+\>"
    2.87 -syn match euphoriaNumber    "\(#\|0x\)[A-Fa-f0-9_]\+\>"
    2.88 -syn match euphoriaNumber    "\<0b[01]\+\>"
    2.89 -syn match euphoriaNumber    "\<0t[0-7]\+\>"
    2.90 -syn match euphoriaNumber    "\<0d[0-9]\+\>"
    2.91 +" Branch Jumps
    2.92 +"
    2.93 +" NOTE: abort and crash are routines but are important in jumping (exiting)
    2.94 +" the application so they are included here
    2.95 +"
    2.96 +syn keyword euphoriaJumps          abort
    2.97 +syn keyword euphoriaJumps          break 
    2.98 +syn keyword euphoriaJumps          continue crash
    2.99 +syn keyword euphoriaJumps          entry exit 
   2.100 +syn keyword euphoriaJumps          fallthru
   2.101 +syn keyword euphoriaJumps          goto 
   2.102 +syn keyword euphoriaJumps          label 
   2.103 +syn keyword euphoriaJumps          return retry
   2.104 +
   2.105 +" Scope Modifiers
   2.106 +syn keyword euphoriaScope          override global public export
   2.107 +
   2.108 +" Namespace use
   2.109 +syn match euphoriaNamespaceUse "\<[A-Za-z0-9_]\+\:"
   2.110 +
   2.111 +" integer, number or floating point number without a dot.
   2.112 +syn match euphoriaNumber "\<[0-9_]\+\>"
   2.113 +" floating point number, with dot
   2.114 +syn match  euphoriaNumber "\<[0-9_]\+\.[\d_]*\>"
   2.115 +" floating point number, starting with a dot
   2.116 +syn match  euphoriaNumber "\<\.[0-9_]\+\>"
   2.117 +" binary number
   2.118 +syn match euphoriaNumber "\<0b[0-1_]\+\>"
   2.119 +" octal number
   2.120 +syn match euphoriaNumber "\<0t[0-7_]\+\>"
   2.121 +" decimal number
   2.122 +syn match euphoriaNumber "\<0d[0-9_]\+\>"
   2.123 +" hex number 1
   2.124 +syn match euphoriaNumber "\<0x[0-9A-Fa-f_]\+\>"
   2.125 +" hex number 2
   2.126 +syn match euphoriaNumber "\#[0-9A-Fa-f_]\+\>"
   2.127  
   2.128  " String and Character constants
   2.129 -syn region euphoriaString matchgroup=Normal start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=@Spell
   2.130 -syn region euphoriaString matchgroup=Normal start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=@Spell
   2.131 -syn region euphoriaString matchgroup=Normal start=+`+ end=+`+ contains=@Spell
   2.132 -syn region euphoriaString matchgroup=Normal start=+"""+ end=+"""+ contains=@Spell
   2.133 +syn region  euphoriaString start=+"+  skip=+\\\\\|\\"+  end=+"+ contains=euphoriaEscape,@Spell
   2.134 +syn region  euphoriaString start=+"""+ end=+"""+ contains=@Spell
   2.135 +syn region  euphoriaString start=+`+ end=+`+ contains=@Spell
   2.136 +syn match   euphoriaCharacter "L\='[^\\]'"
   2.137 +syn match   euphoriaCharacter "L'[^']*'" contains=euphoriaEscape
   2.138 +
   2.139 +syn match   euphoriaEscape +\\[nrt0eE'"\\]+      contained
   2.140 +syn match   euphoriaEscape +\\b[01]\++           contained
   2.141 +syn match   euphoriaEscape +\\x[0-9A-Fa-f]\{2\}+ contained
   2.142 +syn match   euphoriaEscape +\\u[0-9A-Fa-f]\{4\}+ contained
   2.143 +syn match   euphoriaEscape +\\U[0-9A-Fa-f]\{8\}+ contained
   2.144 +
   2.145 +" Operator
   2.146 +syn match   euphoriaOperator   "=\|&\|[!:\[\]\(\)\{\}<>+\*^/\\]"
   2.147  
   2.148  " Todo (only highlighted in comments)
   2.149 -syn keyword euphoriaTodo contained	TODO FIXME XXX
   2.150 +syn keyword euphoriaTodo contained	TODO FIXME XXX BUG NOTE
   2.151  
   2.152 -syn region euphoriaComment oneline contains=euphoriaTodo,@Spell start="--" end="$"
   2.153 -syn region euphoriaComment contains=euphoriaTodo,@Spell start="/\*" end="\*/"
   2.154 -
   2.155 -" Operator
   2.156 -syn match euphoriaOperator   "=\|&\|[!:\[\]\(\)\{\}<>+\*^\\]"
   2.157 +syn region euphoriaComment start="/\*" end="\*/" contains=euphoriaTodo,@Spell
   2.158 +syn region euphoriaComment oneline contains=euphoriaTodo start="--" end="$"
   2.159 +syn sync ccomment euphoriaComment
   2.160  
   2.161  " Define the default highlighting.
   2.162  " For version 5.7 and earlier: only when not done already
   2.163  " For version 5.8 and later: only when an item doesn't have highlighting yet
   2.164  if version >= 508 || !exists("did_euphoria_syntax_inits")
   2.165 -	if version < 508
   2.166 -		let did_euphoria_syntax_inits = 1
   2.167 -		command -nargs=+ HiLink hi link <args>
   2.168 -	else
   2.169 -		command -nargs=+ HiLink hi def link <args>
   2.170 -	endif
   2.171 -	
   2.172 -	HiLink euphoriaPre              PreProc
   2.173 -	HiLink euphoriaScope            Special
   2.174 -	HiLink euphoriaKeywords			Keyword
   2.175 -	HiLink euphoriaNumber			Number
   2.176 -	HiLink euphoriaComment			Comment
   2.177 -	HiLink euphoriaConstant         Constant
   2.178 -	HiLink euphoriaString			String
   2.179 -	HiLink euphoriaOperator			Operator
   2.180 -	HiLink euphoriaTypes			Type
   2.181 -	HiLink euphoriaTodo				ToDo
   2.182 -	HiLink euphoriaDocSection       Constant
   2.183 -	
   2.184 -	delcommand HiLink
   2.185 +	hi def link euphoriaKeywords        Keyword
   2.186 +	hi def link euphoriaTypes           Type
   2.187 +    hi def link euphoriaPreProc         PreProc
   2.188 +    hi def link euphoriaJumps           Label
   2.189 +    hi def link euphoriaScope           StorageClass
   2.190 +    hi def link euphoriaNamespaceUse    StorageClass
   2.191 +	hi def link euphoriaNumber          Number
   2.192 +	hi def link euphoriaComment         Comment
   2.193 +	hi def link euphoriaString          String
   2.194 +	hi def link euphoriaCharacter       Character
   2.195 +	hi def link euphoriaOperator        Operator
   2.196 +	hi def link euphoriaTodo            ToDo
   2.197  endif
   2.198  
   2.199  let b:current_syntax = "euphoria"

SCM Home | OpenEuphoria.org Home