]> granicus.if.org Git - vim/commitdiff
Fix completion of file names with '%' and '*'.
authorBram Moolenaar <Bram@vim.org>
Tue, 1 Jun 2010 19:57:09 +0000 (21:57 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 1 Jun 2010 19:57:09 +0000 (21:57 +0200)
runtime/filetype.vim
runtime/syntax/fan.vim [new file with mode: 0644]
src/Make_mvc.mak
src/ex_getln.c
src/fileio.c

index 1e62d8561feb7f5e4beedb54f669f61183e04276..92dfda2468c13f1934999de770a42ec642b2f119 100644 (file)
@@ -674,6 +674,9 @@ au BufNewFile,BufRead *.exp                 setf expect
 " Exports
 au BufNewFile,BufRead exports                  setf exports
 
+" Fantom
+au BufNewFile,BufRead *.fan,*.fwt              setf fan
+
 " Factor
 au BufNewFile,BufRead *.factor                 setf factor
 
diff --git a/runtime/syntax/fan.vim b/runtime/syntax/fan.vim
new file mode 100644 (file)
index 0000000..fc193af
--- /dev/null
@@ -0,0 +1,132 @@
+" Vim syntax file
+" Language:     Fantom
+" Maintainer:   Kamil Toman <kamil.toman@gmail.com>
+" Last Change:  2010 May 27
+" Based on Java syntax file by Claudio Fleiner <claudio@fleiner.com>
+
+" Quit when a syntax file was already loaded
+if exists("b:current_syntax")
+  finish
+endif
+
+" keyword definitions
+syn keyword fanExternal                using native
+syn keyword fanError           goto void serializable volatile
+syn keyword fanConditional     if else switch
+syn keyword fanRepeat          do while for foreach each
+syn keyword fanBoolean         true false
+syn keyword fanConstant        null
+syn keyword fanTypedef         this super
+syn keyword fanOperator                new is isnot as
+syn keyword fanLongOperator     plus minus mult div mod get set slice lshift rshift and or xor inverse negate increment decrement equals compare
+syn keyword fanType            Void Bool Int Float Decimal Str Duration Uri Type Range List Map Obj
+syn keyword fanStatement       return
+syn keyword fanStorageClass    static const final
+syn keyword fanSlot            virtual override once
+syn keyword fanField           readonly
+syn keyword fanExceptions      throw try catch finally
+syn keyword fanAssert          assert
+syn keyword fanTypedef         class enum mixin
+syn match   fanFacet            "@[_a-zA-Z][_a-zA-Z0-9_]*\>"
+syn keyword fanBranch          break continue
+syn keyword fanScopeDecl       public internal protected private abstract
+
+if exists("fan_space_errors")
+  if !exists("fan_no_trail_space_error")
+    syn match   fanSpaceError  "\s\+$"
+  endif
+  if !exists("fan_no_tab_space_error")
+    syn match   fanSpaceError  " \+\t"me=e-1
+  endif
+endif
+
+syn region  fanLabelRegion     transparent matchgroup=fanLabel start="\<case\>" matchgroup=NONE end=":" contains=fanNumber,fanCharacter
+syn keyword fanLabel           default
+syn keyword fanLabel           case
+
+" The following cluster contains all fan groups except the contained ones
+syn cluster fanTop add=fanExternal,fanError,fanConditional,fanRepeat,fanBoolean,fanConstant,fanTypedef,fanOperator,fanLongOperator,fanType,fanType,fanStatement,fanStorageClass,fanSlot,fanField,fanExceptions,fanAssert,fanClassDecl,fanTypedef,fanFacet,fanBranch,fanScopeDecl,fanLabelRegion,fanLabel
+
+" Comments
+syn keyword fanTodo             contained TODO FIXME XXX
+syn region  fanComment          start="/\*"  end="\*/" contains=@fanCommentSpecial,fanTodo,fanComment,@Spell
+syn match   fanCommentStar      contained "^\s*\*[^/]"me=e-1
+syn match   fanCommentStar      contained "^\s*\*$"
+syn match   fanLineComment      "//.*" contains=@fanCommentSpecial2,fanTodo,@Spell
+syn match   fanDocComment       "\*\*.*" contains=@fanCommentSpecial2,fanTodo,@Spell
+hi def link fanCommentString fanString
+hi def link fanComment2String fanString
+hi def link fanCommentCharacter fanCharacter
+
+syn cluster fanTop add=fanComment,fanLineComment,fanDocComment
+
+" match the special comment /**/
+syn match   fanComment          "/\*\*/"
+
+" Strings and constants
+syn match   fanSpecialError                    contained "\\."
+syn match   fanSpecialCharError        contained "[^']"
+syn match   fanSpecialChar             contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\|\$\)"
+syn match   fanStringSubst             contained "\$[A-Za-z][A-Za-z_.]*"
+syn match   fanStringSubst             contained "\${[^}]*}"
+syn region  fanString          start=+"+ end=+"+ contains=fanSpecialChar,fanSpecialError,fanStringSubst,@Spell
+syn region  fanTripleString    start=+"""+ end=+"""+ contains=fanSpecialChar,fanSpecialError,fanStringSubst,@Spell
+syn region  fanDSL             start=+<|+ end=+|>+ 
+syn match   fanUri              "`[^`]*`"
+syn match   fanCharacter        "'[^']*'" contains=fanSpecialChar,fanSpecialCharError
+syn match   fanCharacter        "'\\''" contains=fanSpecialChar
+syn match   fanCharacter        "'[^\\]'"
+syn match   fanNumber           "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
+syn match   fanNumber           "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
+syn match   fanNumber           "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
+syn match   fanNumber           "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
+
+syn cluster fanTop add=fanString,fanCharacter,fanNumber,fanSpecial,fanStringError
+
+" The default highlighting.
+hi def link fanBranch                  Conditional
+hi def link fanLabel                   Label
+hi def link fanUserLabel               Label
+hi def link fanConditional             Conditional
+hi def link fanRepeat                  Repeat
+hi def link fanExceptions              Exception
+hi def link fanAssert                  Statement
+hi def link fanStorageClass            StorageClass
+hi def link fanSlot                    StorageClass
+hi def link fanField                   StorageClass
+hi def link fanScopeDecl               StorageClass
+hi def link fanBoolean         Boolean
+hi def link fanSpecial         Special
+hi def link fanSpecialError            Error
+hi def link fanSpecialCharError        Error
+hi def link fanTripleString            String
+hi def link fanString                  String
+hi def link fanDSL                     String
+hi def link fanCharacter               String
+hi def link fanStringSubst             Identifier
+hi def link fanUri                     SpecialChar
+hi def link fanSpecialChar             SpecialChar
+hi def link fanNumber                  Number
+hi def link fanError                   Error
+hi def link fanStringError             Error
+hi def link fanStatement               Statement
+hi def link fanOperator                Operator
+hi def link fanLongOperator            Operator
+hi def link fanComment         Comment
+hi def link fanDocComment              Comment
+hi def link fanLineComment             Comment
+hi def link fanConstant                Constant
+hi def link fanTypedef         Typedef
+hi def link fanTodo                    Todo
+hi def link fanFacet                  PreProc
+
+hi def link fanCommentTitle            SpecialComment
+hi def link fanCommentStar             SpecialComment
+hi def link fanType                    Identifier
+hi def link fanExternal                Include
+
+hi def link fanSpaceError              Error
+
+let b:current_syntax = "fan"
+
+" vim: ts=8
index 5a123a8d9a76f3b24a609f062c29477037fb41f9..14c46ed52d4471529805be0c8f76c50db1028dbb 100644 (file)
@@ -208,7 +208,7 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes
 
 !include <Win32.mak>
 
-# May turn on Win64 compatibility warnings for VC7.x and VC8.
+# Flag to turn on Win64 compatibility warnings for VC7.x and VC8.
 WP64CHECK = /Wp64
 
 #>>>>> path of the compiler and linker; name of include and lib directories
index 6e74a23f1a738abf05d288d1e90dd42d472dab5e..e8b6f7c4d1ce69e57758d7d72d9a3c8a282f741d 100644 (file)
@@ -4091,6 +4091,7 @@ addstar(fname, len, context)
     int                i, j;
     int                new_len;
     char_u     *tail;
+    int                ends_in_star;
 
     if (context != EXPAND_FILES
            && context != EXPAND_SHELLCMD
@@ -4181,8 +4182,17 @@ addstar(fname, len, context)
             * When the name ends in '$' don't add a star, remove the '$'.
             */
            tail = gettail(retval);
+           ends_in_star = (len > 0 && retval[len - 1] == '*');
+#ifndef BACKSLASH_IN_FILENAME
+           for (i = len - 2; i >= 0; --i)
+           {
+               if (retval[i] != '\\')
+                   break;
+               ends_in_star = !ends_in_star;
+           }
+#endif
            if ((*retval != '~' || tail != retval)
-                   && (len == 0 || retval[len - 1] != '*')
+                   && !ends_in_star
                    && vim_strchr(tail, '$') == NULL
                    && vim_strchr(retval, '`') == NULL)
                retval[len++] = '*';
index 2685101170af80aead55fa4710e01b7746745ad7..4a9a7f10e1f92a0216835266f5f8d1d3ef83dad7 100644 (file)
@@ -10189,6 +10189,13 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash)
                    }
                }
 #endif
+               /* Undo escaping from ExpandEscape():
+                * foo\?bar -> foo?bar
+                * foo\%bar -> foo%bar
+                * foo\,bar -> foo,bar
+                * foo\ bar -> foo bar
+                * Don't unescape \, * and others that are also special in a
+                * regexp. */
                if (*++p == '?'
 #ifdef BACKSLASH_IN_FILENAME
                        && no_bslash
@@ -10196,8 +10203,8 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash)
                        )
                    reg_pat[i++] = '?';
                else
-                   if (*p == ',')
-                       reg_pat[i++] = ',';
+                   if (*p == ',' || *p == '%' || *p == '#' || *p == ' ')
+                       reg_pat[i++] = *p;
                    else
                    {
                        if (allow_dirs != NULL && vim_ispathsep(*p)