0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

updated for version 7.0109

This commit is contained in:
Bram Moolenaar 2005-07-18 21:47:53 +00:00
parent fe3ca8ddd9
commit bbebc85750
13 changed files with 128 additions and 69 deletions

View File

@ -2498,6 +2498,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:syn-skipempty syntax.txt /*:syn-skipempty*
:syn-skipnl syntax.txt /*:syn-skipnl*
:syn-skipwhite syntax.txt /*:syn-skipwhite*
:syn-spell syntax.txt /*:syn-spell*
:syn-start syntax.txt /*:syn-start*
:syn-sync syntax.txt /*:syn-sync*
:syn-sync-ccomment syntax.txt /*:syn-sync-ccomment*
@ -5150,6 +5151,7 @@ hebrew hebrew.txt /*hebrew*
hebrew.txt hebrew.txt /*hebrew.txt*
help various.txt /*help*
help-context help.txt /*help-context*
help-tags tags 1
help-translated various.txt /*help-translated*
help-xterm-window various.txt /*help-xterm-window*
help.txt help.txt /*help.txt*

80
runtime/syntax/xquery.vim Normal file
View File

@ -0,0 +1,80 @@
" Vim syntax file
" Language: XQuery
" Author: Jean-Marc Vanel <http://jmvanel.free.fr/>
" Last Change: mar jui 12 18:04:05 CEST 2005
" Filenames: *.xq
" URL: http://jmvanel.free.fr/vim/xquery.vim
" $Id$
" REFERENCES:
" [1] http://www.w3.org/TR/xquery/
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
runtime syntax/xml.vim
syn case match
" From XQuery grammar:
syn keyword xqueryStatement ancestor ancestor-or-self and as ascending at attribute base-uri by case cast castable child collation construction declare default descendant descendant-or-self descending div document element else empty encoding eq every except external following following-sibling for function ge greatest gt idiv if import in inherit-namespaces instance intersect is le least let lt mod module namespace ne no of or order ordered ordering parent preceding preceding-sibling preserve return satisfies schema self some stable strip then to treat typeswitch union unordered validate variable version where xmlspace xquery yes
" TODO contains clashes with vim keyword
syn keyword xqueryFunction abs adjust-date-to-timezone adjust-date-to-timezone adjust-dateTime-to-timezone adjust-dateTime-to-timezone adjust-time-to-timezone adjust-time-to-timezone avg base-uri base-uri boolean ceiling codepoint-equal codepoints-to-string collection collection compare concat count current-date current-dateTime current-time data dateTime day-from-date day-from-dateTime days-from-duration deep-equal deep-equal default-collation distinct-values distinct-values doc doc-available document-uri empty ends-with ends-with error error error error escape-uri exactly-one exists false floor hours-from-dateTime hours-from-duration hours-from-time id id idref idref implicit-timezone in-scope-prefixes index-of index-of insert-before lang lang last local-name local-name local-name-from-QName lower-case matches matches max max min min minutes-from-dateTime minutes-from-duration minutes-from-time month-from-date month-from-dateTime months-from-duration name name namespace-uri namespace-uri namespace-uri-for-prefix namespace-uri-from-QName nilled node-name normalize-space normalize-space normalize-unicode normalize-unicode not number number one-or-more position prefix-from-QName QName remove replace replace resolve-QName resolve-uri resolve-uri reverse root root round round-half-to-even round-half-to-even seconds-from-dateTime seconds-from-duration seconds-from-time starts-with starts-with static-base-uri string string string-join string-length string-length string-to-codepoints subsequence subsequence substring substring substring-after substring-after substring-before substring-before sum sum timezone-from-date timezone-from-dateTime timezone-from-time tokenize tokenize trace translate true unordered upper-case year-from-date year-from-dateTime years-from-duration zero-or-one
syn keyword xqueryOperator add-dayTimeDuration-to-date add-dayTimeDuration-to-dateTime add-dayTimeDuration-to-time add-dayTimeDurations add-yearMonthDuration-to-date add-yearMonthDuration-to-dateTime add-yearMonthDurations base64Binary-equal boolean-equal boolean-greater-than boolean-less-than concatenate date-equal date-greater-than date-less-than dateTime-equal dateTime-greater-than dateTime-less-than dayTimeDuration-equal dayTimeDuration-greater-than dayTimeDuration-less-than divide-dayTimeDuration divide-dayTimeDuration-by-dayTimeDuration divide-yearMonthDuration divide-yearMonthDuration-by-yearMonthDuration except gDay-equal gMonth-equal gMonthDay-equal gYear-equal gYearMonth-equal hexBinary-equal intersect is-same-node multiply-dayTimeDuration multiply-yearMonthDuration node-after node-before NOTATION-equal numeric-add numeric-divide numeric-equal numeric-greater-than numeric-integer-divide numeric-less-than numeric-mod numeric-multiply numeric-subtract numeric-unary-minus numeric-unary-plus QName-equal subtract-dates-yielding-dayTimeDuration subtract-dateTimes-yielding-dayTimeDuration subtract-dayTimeDuration-from-date subtract-dayTimeDuration-from-dateTime subtract-dayTimeDuration-from-time subtract-dayTimeDurations subtract-times subtract-yearMonthDuration-from-date subtract-yearMonthDuration-from-dateTime subtract-yearMonthDurations time-equal time-greater-than time-less-than to union yearMonthDuration-equal yearMonthDuration-greater-than yearMonthDuration-less-than
syn match xqueryType "xs:\(\|Datatype\|primitive\|string\|boolean\|float\|double\|decimal\|duration\|dateTime\|time\|date\|gYearMonth\|gYear\|gMonthDay\|gDay\|gMonth\|hexBinary\|base64Binary\|anyURI\|QName\|NOTATION\|\|normalizedString\|token\|language\|IDREFS\|ENTITIES\|NMTOKEN\|NMTOKENS\|Name\|NCName\|ID\|IDREF\|ENTITY\|integer\|nonPositiveInteger\|negativeInteger\|long\|int\|short\|byte\|nonNegativeInteger\|unsignedLong\|unsignedInt\|unsignedShort\|unsignedByte\|positiveInteger\)"
" From XPath grammar:
syn keyword xqueryXPath some every in in satisfies if then else to div idiv mod union intersect except instance of treat castable cast eq ne lt le gt ge is child descendant attribute self descendant-or-self following-sibling following namespace parent ancestor preceding-sibling preceding ancestor-or-self void item node document-node text comment processing-instruction attribute schema-attribute schema-element
" eXist extensions
syn match xqExist "&="
" XQdoc
syn match XQdoc contained "@\(param\|return\|author\)\>"
highlight def link xqueryStatement Statement
highlight def link xqueryFunction Function
highlight def link xqueryOperator Operator
highlight def link xqueryType Type
highlight def link xqueryXPath Operator
highlight def link XQdoc Special
highlight def link xqExist Operator
"floating point number, with dot, optional exponent
syn match cFloat "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
"floating point number, starting with a dot, optional exponent
syn match cFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
"floating point number, without dot, with exponent
syn match cFloat "\d\+e[-+]\=\d\+[fl]\=\>"
syn match cNumber "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
syn match cNumber "\<\d\+\>"
highlight def link cNumber Number
highlight def link cFloat Number
syn region xqComment start='(:' excludenl end=':)' contains=XQdoc
highlight def link xqComment Comment
" syntax match xqVariable "$\w\+"
syntax match xqVariable +$\<[a-zA-Z:_][-.0-9a-zA-Z0-9:_]*\>+
highlight def link xqVariable Identifier
" Redefine the default XML highlighting:
highlight def link xmlTag Structure
highlight def link xmlTagName Structure
highlight def link xmlEndTag Structure
syntax match xqSeparator ",\|;"
highlight link xqSeparator Operator
syn region xqCode transparent contained start='{' excludenl end='}' contains=xmlRegionBis,xqComment,xqueryStatement,xmlString,xqSeparator,cNumber,xqVariable keepend extend
syn region xmlRegionBis start=+<\z([^ /!?<>"']\+\)+ skip=+<!--\_.\{-}-->+ end=+</\z1\_\s\{-}>+ end=+/>+ fold contains=xmlTag,xmlEndTag,xmlCdata,xmlRegionBis,xmlComment,xmlEntity,xmlProcessing,xqCode keepend extend
syn region List transparent start='(' excludenl end=')' contains=xqCode,xmlRegion,xqComment,xqSeparator,xqueryStatement,xqVariable,xqueryType keepend extend

View File

@ -3865,8 +3865,7 @@ gui_mch_init_font(font_name, fontset)
else
{
font = gui_mac_find_font(font_name);
STRNCPY(used_font_name, font_name, sizeof(used_font_name));
used_font_name[sizeof(used_font_name) - 1] = NUL;
vim_strncpy(used_font_name, font_name, sizeof(used_font_name) - 1);
if (font == NOFONT)
return FAIL;
@ -6201,8 +6200,7 @@ gui_mch_dialog(
if (name[0] > IOSIZE)
name[0] = IOSIZE - 1;
#endif
STRNCPY(textfield, &name[1], name[0]);
textfield[name[0]] = NUL;
vim_strncpy(textfield, &name[1], name[0]);
}
/* Restore the original graphical port */
@ -6522,8 +6520,7 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
#endif
/* Start filling fname with file.name */
STRNCPY(filenamePtr, &file.name[1], file.name[0]);
filenamePtr[file.name[0]] = 0; /* NULL terminate the string */
vim_strncpy(filenamePtr, &file.name[1], file.name[0]);
/* Get the info about the file specified in FSSpec */
theCPB.dirInfo.ioFDirIndex = 0;
@ -6625,8 +6622,7 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
/* Put the new directoryName in front of the current fname */
STRCPY(temporaryPtr, filenamePtr);
STRNCPY(filenamePtr, &directoryName[1], directoryName[0]);
filenamePtr[directoryName[0]] = 0; /* NULL terminate the string */
vim_strncpy(filenamePtr, &directoryName[1], directoryName[0]);
STRCAT(filenamePtr, ":");
STRCAT(filenamePtr, temporaryPtr);
}
@ -6660,8 +6656,7 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
{
/* Add the volume name */
STRCPY(temporaryPtr, filenamePtr);
STRNCPY(filenamePtr, &directoryName[1], directoryName[0]);
filenamePtr[directoryName[0]] = 0; /* NULL terminate the string */
vim_strncpy(filenamePtr, &directoryName[1], directoryName[0]);
STRCAT(filenamePtr, ":");
STRCAT(filenamePtr, temporaryPtr);

View File

@ -2620,10 +2620,7 @@ gui_mch_dialog(type, title, message, button_names, dfltbutton, textfield)
if (p == NULL || dialogStatus < 0)
*textfield = NUL;
else
{
STRNCPY(textfield, p, IOSIZE);
textfield[IOSIZE - 1] = NUL;
}
vim_strncpy(textfield, p, IOSIZE - 1);
}
suppress_dialog_mnemonics(dialogform);

View File

@ -701,6 +701,7 @@ codepage_invalid:
* where mblen() returns 0 for invalid character.
* Therefore, following condition includes 0.
*/
(void)mblen(NULL, 0); /* First reset the state. */
if (mblen(buf, (size_t)1) <= 0)
n = 2;
else

View File

@ -1372,7 +1372,7 @@ del_trailing_spaces(ptr)
vim_strncpy(to, from, len)
char_u *to;
char_u *from;
int len;
size_t len;
{
STRNCPY(to, from, len);
to[len] = NUL;
@ -2957,8 +2957,7 @@ vim_chdirfile(fname)
{
char_u dir[MAXPATHL];
STRNCPY(dir, fname, MAXPATHL);
dir[MAXPATHL - 1] = NUL;
vim_strncpy(dir, fname, MAXPATHL - 1);
*gettail_sep(dir) = NUL;
return mch_chdir((char *)dir) == 0 ? OK : FAIL;
}
@ -3907,8 +3906,7 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, need_dir,
if (!vim_isAbsName(rel_fname) && len + 1 < MAXPATHL)
{
/* Make the start dir an absolute path name. */
STRNCPY(ff_expand_buffer, rel_fname, len);
ff_expand_buffer[len] = NUL;
vim_strncpy(ff_expand_buffer, rel_fname, len);
ff_search_ctx->ffsc_start_dir = FullName_save(ff_expand_buffer,
FALSE);
}
@ -4810,7 +4808,7 @@ ff_check_visited(visited_list, fname
* device/inode (unix) or the full path name (not Unix). */
if (path_with_url(fname))
{
STRNCPY(ff_expand_buffer, fname, MAXPATHL);
vim_strncpy(ff_expand_buffer, fname, MAXPATHL - 1);
#ifdef UNIX
url = TRUE;
#endif
@ -5393,9 +5391,10 @@ vim_chdir(new_dir)
}
/*
* Get user name from machine-specific function and cache it.
* Get user name from machine-specific function.
* Returns the user name in "buf[len]".
* Some systems are quite slow in obtaining the user name (Windows NT).
* Some systems are quite slow in obtaining the user name (Windows NT), thus
* cache the result.
* Returns OK or FAIL.
*/
int
@ -5410,7 +5409,7 @@ get_user_name(buf, len)
username = vim_strsave(buf);
}
else
STRNCPY(buf, username, len);
vim_strncpy(buf, username, len - 1);
return OK;
}

View File

@ -1515,8 +1515,7 @@ mch_FullName(
{
if (!force && mch_isFullName(fname)) /* already expanded */
{
STRNCPY(buf, fname, len);
buf[len - 1] = NUL;
vim_strncpy(buf, fname, len - 1);
slash_adjust(buf);
return OK;
}
@ -1533,8 +1532,7 @@ mch_FullName(
if (!_truename(fname, fullpath))
return FAIL;
slash_adjust(fullpath); /* Only needed when 'shellslash' set */
STRNCPY(buf, fullpath, len);
buf[len - 1] = NUL;
vim_strncpy(buf, fullpath, len - 1);
return OK;
# else /* Old code, to be deleted... */
@ -3074,9 +3072,8 @@ mch_get_host_name(
int len)
{
#ifdef DJGPP
STRNCPY(s, "PC (32 bits Vim)", len);
vim_strncpy(s, "PC (32 bits Vim)", len - 1);
#else
STRNCPY(s, "PC (16 bits Vim)", len);
vim_strncpy(s, "PC (16 bits Vim)", len - 1);
#endif
s[len - 1] = NUL; /* make sure it's terminated */
}

View File

@ -2072,7 +2072,7 @@ mch_get_user_name(s, len)
int len;
{
#ifdef VMS
STRNCPY((char *)s, cuserid(NULL), len);
vim_strncpy((char *)s, cuserid(NULL), len - 1);
return OK;
#else
return mch_get_uname(getuid(), s, len);
@ -2095,8 +2095,7 @@ mch_get_uname(uid, s, len)
if ((pw = getpwuid(uid)) != NULL
&& pw->pw_name != NULL && *(pw->pw_name) != NUL)
{
STRNCPY(s, pw->pw_name, len);
s[len - 1] = NUL;
vim_strncpy(s, (char_u *)pw->pw_name, len - 1);
return OK;
}
#endif
@ -2119,8 +2118,7 @@ mch_get_host_name(s, len)
if (uname(&vutsname) < 0)
*s = NUL;
else
STRNCPY(s, vutsname.nodename, len);
s[len - 1] = NUL; /* make sure it's terminated */
vim_strncpy(s, (char_u *)vutsname.nodename, len - 1);
}
#else /* HAVE_SYS_UTSNAME_H */
@ -2300,8 +2298,7 @@ mch_FullName(fname, buf, len, force)
retval = FAIL;
else
{
STRNCPY(buf, fname, p - fname);
buf[p - fname] = NUL;
vim_strncpy(buf, fname, p - fname);
if (mch_chdir((char *)buf))
retval = FAIL;
else
@ -2630,8 +2627,7 @@ mch_can_exe(name)
STRCPY(buf, "./");
else
{
STRNCPY(buf, p, e - p);
buf[e - p] = NUL;
vim_strncpy(buf, p, e - p);
add_pathsep(buf);
}
STRCAT(buf, name);

View File

@ -443,7 +443,8 @@ qf_init_ext(efile, buf, errorformat, newlist, lnumfirst, lnumlast)
{
if (buflnum > lnumlast)
break;
STRNCPY(IObuff, ml_get_buf(buf, buflnum++, FALSE), CMDBUFFSIZE - 2);
vim_strncpy(IObuff, ml_get_buf(buf, buflnum++, FALSE),
CMDBUFFSIZE - 2);
}
else if (fgets((char *)IObuff, CMDBUFFSIZE - 2, fd) == NULL)
break;
@ -516,8 +517,7 @@ restofline:
else if ((i = (int)fmt_ptr->addr[5]) > 0) /* %m */
{
len = (int)(regmatch.endp[i] - regmatch.startp[i]);
STRNCPY(errmsg, regmatch.startp[i], len);
errmsg[len] = NUL;
vim_strncpy(errmsg, regmatch.startp[i], len);
}
if ((i = (int)fmt_ptr->addr[6]) > 0) /* %r */
tail = regmatch.startp[i];

View File

@ -3047,7 +3047,7 @@ static int ireg_icombine;
* Copy of "rmm_maxcol": maximum column to search for a match. Zero when
* there is no maximum.
*/
static int ireg_maxcol;
static colnr_T ireg_maxcol;
/*
* Sometimes need to save a copy of a line. Since alloc()/free() is very
@ -6866,10 +6866,7 @@ reg_submatch(no)
len = submatch_mmatch->endpos[no].col
- submatch_mmatch->startpos[no].col;
if (round == 2)
{
STRNCPY(retval, s, len);
retval[len] = NUL;
}
vim_strncpy(retval, s, len);
++len;
}
else

View File

@ -64,7 +64,7 @@ typedef struct
lpos_T startpos[NSUBEXP];
lpos_T endpos[NSUBEXP];
int rmm_ic;
int rmm_maxcol; /* when not zero: maximum column */
colnr_T rmm_maxcol; /* when not zero: maximum column */
} regmmatch_T;
/*

View File

@ -1558,8 +1558,8 @@ line_read_in:
{
if (STRLEN(fullpath_ebuf) > LSIZE)
EMSG2(_("E430: Tag file path truncated for %s\n"), ebuf);
STRNCPY(tag_fname, fullpath_ebuf, LSIZE);
tag_fname[LSIZE] = NUL;
vim_strncpy(tag_fname, fullpath_ebuf,
MAXPATHL);
++incstack_idx;
is_etag = 0; /* we can include anything */
}
@ -2090,8 +2090,7 @@ line_read_in:
{
mfp->len = len + 1; /* include the NUL */
p = mfp->match;
STRNCPY(p, tagp.command + 2, len);
p[len] = NUL;
vim_strncpy(p, tagp.command + 2, len);
}
}
else
@ -2107,8 +2106,7 @@ line_read_in:
{
mfp->len = len + 1; /* include the NUL */
p = mfp->match;
STRNCPY(p, tagp.tagname, len);
p[len] = NUL;
vim_strncpy(p, tagp.tagname, len);
}
/* if wanted, re-read line to get long form too */
@ -2436,10 +2434,8 @@ get_tagfname(first, buf)
STRCPY(gettail(buf), "tags");
}
else
{
STRNCPY(buf, ((char_u **)(tag_fnames.ga_data))[hf_idx++], MAXPATHL);
buf[MAXPATHL - 1] = NUL;
}
vim_strncpy(buf, ((char_u **)(tag_fnames.ga_data))[hf_idx++],
MAXPATHL - 1);
}
else
{
@ -3186,8 +3182,8 @@ expand_tag_fname(fname, tag_fname, expand)
if (retval != NULL)
{
STRCPY(retval, tag_fname);
STRNCPY(retval + (p - tag_fname), fname,
MAXPATHL - (p - tag_fname));
vim_strncpy(retval + (p - tag_fname), fname,
MAXPATHL - (p - tag_fname) - 1);
/*
* Translate names like "src/a/../b/file.c" into "src/b/file.c".
*/
@ -3586,7 +3582,7 @@ add_tag_field(dict, field_name, start, end)
len = end - start;
if (len > sizeof(buf) - 1)
len = sizeof(buf) - 1;
STRNCPY(buf, start, len);
vim_strncpy(buf, start, len);
}
buf[len] = NUL;
return dict_add_nr_str(dict, field_name, 0L, buf);

View File

@ -10,10 +10,10 @@ STARTTEST
:e!
:set fenc=
:" First generate a .spl file from a .dic and a .aff file.
gg:/^affstart1/+1,/^affend1/-1w Xtest.aff
gg:/^dicstart/+1,/^dicend/-1w Xtest.dic
gg:/^affstart1/+1,/^affend1/-1w! Xtest.aff
gg:/^dicstart/+1,/^dicend/-1w! Xtest.dic
:set enc=utf-8
:mkspell Xtest Xtest
:mkspell! Xtest Xtest
:"
:" use that spell file
:set spl=Xtest.utf-8.spl
@ -75,30 +75,29 @@ gg:/^affstart2/+1,/^affend2/-1w! Xtest.aff
:" also use an addition file
gg:/^addstart/+1,/^addend/-1w! Xtest.utf-8.add
:mkspell! Xtest.utf-8.add.spl Xtest.utf-8.add
:set spl=en
:set spellfile=Xtest.utf-8.add
/^test2:
]s:let str = spellbadword()
:$put =str
:set spl=en_us
:set spl=Xtest_us.utf-8.spl
/^test2:
]smm:let str = spellbadword()
:$put =str
`m]s:let str = spellbadword()
:$put =str
:set spl=en_gb
:set spl=Xtest_gb.utf-8.spl
/^test2:
]smm:let str = spellbadword()
:$put =str
`m]s:let str = spellbadword()
:$put =str
:set spl=en_nz
:set spl=Xtest_nz.utf-8.spl
/^test2:
]smm:let str = spellbadword()
:$put =str
`m]s:let str = spellbadword()
:$put =str
:set spl=en_ca
:set spl=Xtest_ca.utf-8.spl
/^test2:
]smm:let str = spellbadword()
:$put =str