|
Karsten Hopp |
192200 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
192200 |
Subject: Patch 7.2.060
|
|
Karsten Hopp |
192200 |
Fcc: outbox
|
|
Karsten Hopp |
192200 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
192200 |
Mime-Version: 1.0
|
|
Karsten Hopp |
192200 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
192200 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
192200 |
------------
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
Patch 7.2.060
|
|
Karsten Hopp |
192200 |
Problem: When a spell files has many compound rules it may take a very long
|
|
Karsten Hopp |
192200 |
time making the list of suggestions. Displaying also can be slow
|
|
Karsten Hopp |
192200 |
when there are misspelled words.
|
|
Karsten Hopp |
192200 |
Can't parse some Hunspell .aff files.
|
|
Karsten Hopp |
192200 |
Solution: Check if a compounding can possibly work before trying a
|
|
Karsten Hopp |
192200 |
combination, if the compound rules don't contain wildcards.
|
|
Karsten Hopp |
192200 |
Implement using CHECKCOMPOUNDPATTERN.
|
|
Karsten Hopp |
192200 |
Ignore COMPOUNDRULES. Ignore a comment after most items.
|
|
Karsten Hopp |
192200 |
Accept ONLYINCOMPOUND as an alias for NEEDCOMPOUND.
|
|
Karsten Hopp |
192200 |
Accept FORBIDDENWORD as an alias for BAD.
|
|
Karsten Hopp |
192200 |
Files: runtime/doc/spell.txt, src/spell.c
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
*** ../vim-7.2.059/runtime/doc/spell.txt Sat Aug 9 19:36:52 2008
|
|
Karsten Hopp |
192200 |
--- runtime/doc/spell.txt Sun Nov 30 16:30:02 2008
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1,4 ****
|
|
Karsten Hopp |
192200 |
! *spell.txt* For Vim version 7.2. Last change: 2008 Jun 21
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
Karsten Hopp |
192200 |
--- 1,4 ----
|
|
Karsten Hopp |
192200 |
! *spell.txt* For Vim version 7.2. Last change: 2008 Nov 30
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 831,838 ****
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
# comment line ~
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
! With some items it's also possible to put a comment after it, but this isn't
|
|
Karsten Hopp |
192200 |
! supported in general.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
ENCODING *spell-SET*
|
|
Karsten Hopp |
192200 |
--- 831,841 ----
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
# comment line ~
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
! Items with a fixed number of arguments can be followed by a comment. But only
|
|
Karsten Hopp |
192200 |
! if none of the arguments can contain white space. The comment must start with
|
|
Karsten Hopp |
192200 |
! a "#" character. Example:
|
|
Karsten Hopp |
192200 |
!
|
|
Karsten Hopp |
192200 |
! KEEPCASE = # fix case for words with this flag ~
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
ENCODING *spell-SET*
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 965,970 ****
|
|
Karsten Hopp |
192200 |
--- 968,976 ----
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
Note: When using utf-8 only characters up to 65000 may be used for flags.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ Note: even when using "num" or "long" the number of flags available to
|
|
Karsten Hopp |
192200 |
+ compounding and prefixes is limited to about 250.
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
AFFIXES
|
|
Karsten Hopp |
192200 |
*spell-PFX* *spell-SFX*
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1178,1183 ****
|
|
Karsten Hopp |
192200 |
--- 1185,1193 ----
|
|
Karsten Hopp |
192200 |
The flag also applies to the word with affixes, thus this can be used to mark
|
|
Karsten Hopp |
192200 |
a whole bunch of related words as bad.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ *spell-FORBIDDENWORD*
|
|
Karsten Hopp |
192200 |
+ FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
*spell-NEEDAFFIX*
|
|
Karsten Hopp |
192200 |
The NEEDAFFIX flag is used to require that a word is used with an affix. The
|
|
Karsten Hopp |
192200 |
word itself is not a good word (unless there is an empty affix). Example:
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1268,1273 ****
|
|
Karsten Hopp |
192200 |
--- 1278,1287 ----
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
NEEDCOMPOUND & ~
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ *spell-ONLYINCOMPOUND*
|
|
Karsten Hopp |
192200 |
+ The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
|
|
Karsten Hopp |
192200 |
+ compatiblity with Hunspell.
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
*spell-COMPOUNDMIN*
|
|
Karsten Hopp |
192200 |
The minimal character length of a word used for compounding is specified with
|
|
Karsten Hopp |
192200 |
COMPOUNDMIN. Example:
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1328,1333 ****
|
|
Karsten Hopp |
192200 |
--- 1342,1361 ----
|
|
Karsten Hopp |
192200 |
rules. Can also be used for an affix to count the affix as a compounding
|
|
Karsten Hopp |
192200 |
word.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ *spell-CHECKCOMPOUNDPATTERN*
|
|
Karsten Hopp |
192200 |
+ CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
|
|
Karsten Hopp |
192200 |
+ position where two words are compounded together forbids the compound.
|
|
Karsten Hopp |
192200 |
+ For example:
|
|
Karsten Hopp |
192200 |
+ CHECKCOMPOUNDPATTERN o e ~
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ This forbids compounding if the first word ends in "o" and the second word
|
|
Karsten Hopp |
192200 |
+ starts with "e".
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ The arguments must be plain text, no patterns are actually supported, despite
|
|
Karsten Hopp |
192200 |
+ the item name. Case is always ignored.
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ The Hunspell feature to use three arguments and flags is not supported.
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
*spell-SYLLABLE*
|
|
Karsten Hopp |
192200 |
The SYLLABLE item defines characters or character sequences that are used to
|
|
Karsten Hopp |
192200 |
count the number of syllables in a word. Example:
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1496,1501 ****
|
|
Karsten Hopp |
192200 |
--- 1524,1533 ----
|
|
Karsten Hopp |
192200 |
ACCENT (Hunspell) *spell-ACCENT*
|
|
Karsten Hopp |
192200 |
Use MAP instead. |spell-MAP|
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ BREAK (Hunspell) *spell-BREAK*
|
|
Karsten Hopp |
192200 |
+ Define break points. Unclear how it works exactly.
|
|
Karsten Hopp |
192200 |
+ Not supported.
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
|
|
Karsten Hopp |
192200 |
Disallow uppercase letters at compound word boundaries.
|
|
Karsten Hopp |
192200 |
Not supported.
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1512,1520 ****
|
|
Karsten Hopp |
192200 |
Forbid three identical characters when compounding. Not
|
|
Karsten Hopp |
192200 |
supported.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
- CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
|
|
Karsten Hopp |
192200 |
- Forbid compounding when patterns match. Not supported.
|
|
Karsten Hopp |
192200 |
-
|
|
Karsten Hopp |
192200 |
COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
|
|
Karsten Hopp |
192200 |
Enables using two prefixes. Not supported.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
--- 1544,1549 ----
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1536,1548 ****
|
|
Karsten Hopp |
192200 |
COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
|
|
Karsten Hopp |
192200 |
Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
|
|
Karsten Hopp |
192200 |
Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
|
|
Karsten Hopp |
192200 |
|spell-COMPOUNDSYLMAX|
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
! FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
|
|
Karsten Hopp |
192200 |
! Use BAD instead. |spell-BAD|
|
|
Karsten Hopp |
192200 |
!
|
|
Karsten Hopp |
192200 |
LANG (Hunspell) *spell-LANG*
|
|
Karsten Hopp |
192200 |
This specifies language-specific behavior. This actually
|
|
Karsten Hopp |
192200 |
moves part of the language knowledge into the program,
|
|
Karsten Hopp |
192200 |
--- 1565,1582 ----
|
|
Karsten Hopp |
192200 |
COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
|
|
Karsten Hopp |
192200 |
Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
|
|
Karsten Hopp |
192200 |
+ Number of COMPOUNDRULE lines following. Ignored, but the
|
|
Karsten Hopp |
192200 |
+ argument must be a number.
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
|
|
Karsten Hopp |
192200 |
Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
|
|
Karsten Hopp |
192200 |
|spell-COMPOUNDSYLMAX|
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
! KEY (Hunspell) *spell-KEY*
|
|
Karsten Hopp |
192200 |
! Define characters that are close together on the keyboard.
|
|
Karsten Hopp |
192200 |
! Used to give better suggestions. Not supported.
|
|
Karsten Hopp |
192200 |
!
|
|
Karsten Hopp |
192200 |
LANG (Hunspell) *spell-LANG*
|
|
Karsten Hopp |
192200 |
This specifies language-specific behavior. This actually
|
|
Karsten Hopp |
192200 |
moves part of the language knowledge into the program,
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1553,1562 ****
|
|
Karsten Hopp |
192200 |
Only needed for morphological analysis.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
|
|
Karsten Hopp |
192200 |
! Not supported.
|
|
Karsten Hopp |
192200 |
!
|
|
Karsten Hopp |
192200 |
! ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
|
|
Karsten Hopp |
192200 |
! Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
|
|
Karsten Hopp |
192200 |
Use NEEDAFFIX instead. |spell-NEEDAFFIX|
|
|
Karsten Hopp |
192200 |
--- 1587,1593 ----
|
|
Karsten Hopp |
192200 |
Only needed for morphological analysis.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
|
|
Karsten Hopp |
192200 |
! Set number of n-gram suggestions. Not supported.
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
|
|
Karsten Hopp |
192200 |
Use NEEDAFFIX instead. |spell-NEEDAFFIX|
|
|
Karsten Hopp |
192200 |
*** ../vim-7.2.059/src/spell.c Sat Nov 29 20:18:44 2008
|
|
Karsten Hopp |
192200 |
--- src/spell.c Sun Nov 30 20:59:13 2008
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 469,474 ****
|
|
Karsten Hopp |
192200 |
--- 469,475 ----
|
|
Karsten Hopp |
192200 |
garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
|
|
Karsten Hopp |
192200 |
regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
|
|
Karsten Hopp |
192200 |
* (NULL when no compounding) */
|
|
Karsten Hopp |
192200 |
+ char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
|
|
Karsten Hopp |
192200 |
char_u *sl_compstartflags; /* flags for first compound word */
|
|
Karsten Hopp |
192200 |
char_u *sl_compallflags; /* all flags for compound words */
|
|
Karsten Hopp |
192200 |
char_u sl_nobreak; /* When TRUE: no spaces between words */
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 839,845 ****
|
|
Karsten Hopp |
192200 |
--- 840,849 ----
|
|
Karsten Hopp |
192200 |
static void slang_clear __ARGS((slang_T *lp));
|
|
Karsten Hopp |
192200 |
static void slang_clear_sug __ARGS((slang_T *lp));
|
|
Karsten Hopp |
192200 |
static void find_word __ARGS((matchinf_T *mip, int mode));
|
|
Karsten Hopp |
192200 |
+ static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
|
|
Karsten Hopp |
192200 |
static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
|
|
Karsten Hopp |
192200 |
+ static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
|
|
Karsten Hopp |
192200 |
+ static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
|
|
Karsten Hopp |
192200 |
static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
|
|
Karsten Hopp |
192200 |
static void find_prefix __ARGS((matchinf_T *mip, int mode));
|
|
Karsten Hopp |
192200 |
static int fold_more __ARGS((matchinf_T *mip));
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1519,1524 ****
|
|
Karsten Hopp |
192200 |
--- 1523,1533 ----
|
|
Karsten Hopp |
192200 |
((unsigned)flags >> 24)))
|
|
Karsten Hopp |
192200 |
continue;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ /* If there is a match with a CHECKCOMPOUNDPATTERN rule
|
|
Karsten Hopp |
192200 |
+ * discard the compound word. */
|
|
Karsten Hopp |
192200 |
+ if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
|
|
Karsten Hopp |
192200 |
+ continue;
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
if (mode == FIND_COMPOUND)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
int capflags;
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1577,1582 ****
|
|
Karsten Hopp |
192200 |
--- 1586,1596 ----
|
|
Karsten Hopp |
192200 |
if (!can_compound(slang, fword, mip->mi_compflags))
|
|
Karsten Hopp |
192200 |
continue;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
+ else if (slang->sl_comprules != NULL
|
|
Karsten Hopp |
192200 |
+ && !match_compoundrule(slang, mip->mi_compflags))
|
|
Karsten Hopp |
192200 |
+ /* The compound flags collected so far do not match any
|
|
Karsten Hopp |
192200 |
+ * COMPOUNDRULE, discard the compounded word. */
|
|
Karsten Hopp |
192200 |
+ continue;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
/* Check NEEDCOMPOUND: can't use word without compounding. */
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1727,1732 ****
|
|
Karsten Hopp |
192200 |
--- 1741,1779 ----
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
/*
|
|
Karsten Hopp |
192200 |
+ * Return TRUE if there is a match between the word ptr[wlen] and
|
|
Karsten Hopp |
192200 |
+ * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
|
|
Karsten Hopp |
192200 |
+ * word.
|
|
Karsten Hopp |
192200 |
+ * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
|
|
Karsten Hopp |
192200 |
+ * end of ptr[wlen] and the second part matches after it.
|
|
Karsten Hopp |
192200 |
+ */
|
|
Karsten Hopp |
192200 |
+ static int
|
|
Karsten Hopp |
192200 |
+ match_checkcompoundpattern(ptr, wlen, gap)
|
|
Karsten Hopp |
192200 |
+ char_u *ptr;
|
|
Karsten Hopp |
192200 |
+ int wlen;
|
|
Karsten Hopp |
192200 |
+ garray_T *gap; /* &sl_comppat */
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ int i;
|
|
Karsten Hopp |
192200 |
+ char_u *p;
|
|
Karsten Hopp |
192200 |
+ int len;
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ for (i = 0; i + 1 < gap->ga_len; i += 2)
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ p = ((char_u **)gap->ga_data)[i + 1];
|
|
Karsten Hopp |
192200 |
+ if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ /* Second part matches at start of following compound word, now
|
|
Karsten Hopp |
192200 |
+ * check if first part matches at end of previous word. */
|
|
Karsten Hopp |
192200 |
+ p = ((char_u **)gap->ga_data)[i];
|
|
Karsten Hopp |
192200 |
+ len = STRLEN(p);
|
|
Karsten Hopp |
192200 |
+ if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
|
|
Karsten Hopp |
192200 |
+ return TRUE;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+ return FALSE;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /*
|
|
Karsten Hopp |
192200 |
* Return TRUE if "flags" is a valid sequence of compound flags and "word"
|
|
Karsten Hopp |
192200 |
* does not have too many syllables.
|
|
Karsten Hopp |
192200 |
*/
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 1773,1778 ****
|
|
Karsten Hopp |
192200 |
--- 1820,1917 ----
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
/*
|
|
Karsten Hopp |
192200 |
+ * Return TRUE when the sequence of flags in "compflags" plus "flag" can
|
|
Karsten Hopp |
192200 |
+ * possibly form a valid compounded word. This also checks the COMPOUNDRULE
|
|
Karsten Hopp |
192200 |
+ * lines if they don't contain wildcards.
|
|
Karsten Hopp |
192200 |
+ */
|
|
Karsten Hopp |
192200 |
+ static int
|
|
Karsten Hopp |
192200 |
+ can_be_compound(sp, slang, compflags, flag)
|
|
Karsten Hopp |
192200 |
+ trystate_T *sp;
|
|
Karsten Hopp |
192200 |
+ slang_T *slang;
|
|
Karsten Hopp |
192200 |
+ char_u *compflags;
|
|
Karsten Hopp |
192200 |
+ int flag;
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ /* If the flag doesn't appear in sl_compstartflags or sl_compallflags
|
|
Karsten Hopp |
192200 |
+ * then it can't possibly compound. */
|
|
Karsten Hopp |
192200 |
+ if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
|
|
Karsten Hopp |
192200 |
+ ? slang->sl_compstartflags : slang->sl_compallflags, flag))
|
|
Karsten Hopp |
192200 |
+ return FALSE;
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /* If there are no wildcards, we can check if the flags collected so far
|
|
Karsten Hopp |
192200 |
+ * possibly can form a match with COMPOUNDRULE patterns. This only
|
|
Karsten Hopp |
192200 |
+ * makes sense when we have two or more words. */
|
|
Karsten Hopp |
192200 |
+ if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ int v;
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ compflags[sp->ts_complen] = flag;
|
|
Karsten Hopp |
192200 |
+ compflags[sp->ts_complen + 1] = NUL;
|
|
Karsten Hopp |
192200 |
+ v = match_compoundrule(slang, compflags + sp->ts_compsplit);
|
|
Karsten Hopp |
192200 |
+ compflags[sp->ts_complen] = NUL;
|
|
Karsten Hopp |
192200 |
+ return v;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ return TRUE;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /*
|
|
Karsten Hopp |
192200 |
+ * Return TRUE if the compound flags in compflags[] match the start of any
|
|
Karsten Hopp |
192200 |
+ * compound rule. This is used to stop trying a compound if the flags
|
|
Karsten Hopp |
192200 |
+ * collected so far can't possibly match any compound rule.
|
|
Karsten Hopp |
192200 |
+ * Caller must check that slang->sl_comprules is not NULL.
|
|
Karsten Hopp |
192200 |
+ */
|
|
Karsten Hopp |
192200 |
+ static int
|
|
Karsten Hopp |
192200 |
+ match_compoundrule(slang, compflags)
|
|
Karsten Hopp |
192200 |
+ slang_T *slang;
|
|
Karsten Hopp |
192200 |
+ char_u *compflags;
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ char_u *p;
|
|
Karsten Hopp |
192200 |
+ int i;
|
|
Karsten Hopp |
192200 |
+ int c;
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /* loop over all the COMPOUNDRULE entries */
|
|
Karsten Hopp |
192200 |
+ for (p = slang->sl_comprules; *p != NUL; ++p)
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ /* loop over the flags in the compound word we have made, match
|
|
Karsten Hopp |
192200 |
+ * them against the current rule entry */
|
|
Karsten Hopp |
192200 |
+ for (i = 0; ; ++i)
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ c = compflags[i];
|
|
Karsten Hopp |
192200 |
+ if (c == NUL)
|
|
Karsten Hopp |
192200 |
+ /* found a rule that matches for the flags we have so far */
|
|
Karsten Hopp |
192200 |
+ return TRUE;
|
|
Karsten Hopp |
192200 |
+ if (*p == '/' || *p == NUL)
|
|
Karsten Hopp |
192200 |
+ break; /* end of rule, it's too short */
|
|
Karsten Hopp |
192200 |
+ if (*p == '[')
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ int match = FALSE;
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /* compare against all the flags in [] */
|
|
Karsten Hopp |
192200 |
+ ++p;
|
|
Karsten Hopp |
192200 |
+ while (*p != ']' && *p != NUL)
|
|
Karsten Hopp |
192200 |
+ if (*p++ == c)
|
|
Karsten Hopp |
192200 |
+ match = TRUE;
|
|
Karsten Hopp |
192200 |
+ if (!match)
|
|
Karsten Hopp |
192200 |
+ break; /* none matches */
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+ else if (*p != c)
|
|
Karsten Hopp |
192200 |
+ break; /* flag of word doesn't match flag in pattern */
|
|
Karsten Hopp |
192200 |
+ ++p;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /* Skip to the next "/", where the next pattern starts. */
|
|
Karsten Hopp |
192200 |
+ p = vim_strchr(p, '/');
|
|
Karsten Hopp |
192200 |
+ if (p == NULL)
|
|
Karsten Hopp |
192200 |
+ break;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /* Checked all the rules and none of them match the flags, so there
|
|
Karsten Hopp |
192200 |
+ * can't possibly be a compound starting with these flags. */
|
|
Karsten Hopp |
192200 |
+ return FALSE;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /*
|
|
Karsten Hopp |
192200 |
* Return non-zero if the prefix indicated by "arridx" matches with the prefix
|
|
Karsten Hopp |
192200 |
* ID in "flags" for the word "word".
|
|
Karsten Hopp |
192200 |
* The WF_RAREPFX flag is included in the return value for a rare prefix.
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 2513,2521 ****
|
|
Karsten Hopp |
192200 |
--- 2652,2662 ----
|
|
Karsten Hopp |
192200 |
lp->sl_midword = NULL;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
vim_free(lp->sl_compprog);
|
|
Karsten Hopp |
192200 |
+ vim_free(lp->sl_comprules);
|
|
Karsten Hopp |
192200 |
vim_free(lp->sl_compstartflags);
|
|
Karsten Hopp |
192200 |
vim_free(lp->sl_compallflags);
|
|
Karsten Hopp |
192200 |
lp->sl_compprog = NULL;
|
|
Karsten Hopp |
192200 |
+ lp->sl_comprules = NULL;
|
|
Karsten Hopp |
192200 |
lp->sl_compstartflags = NULL;
|
|
Karsten Hopp |
192200 |
lp->sl_compallflags = NULL;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 3460,3465 ****
|
|
Karsten Hopp |
192200 |
--- 3601,3607 ----
|
|
Karsten Hopp |
192200 |
char_u *pp;
|
|
Karsten Hopp |
192200 |
char_u *cp;
|
|
Karsten Hopp |
192200 |
char_u *ap;
|
|
Karsten Hopp |
192200 |
+ char_u *crp;
|
|
Karsten Hopp |
192200 |
int cnt;
|
|
Karsten Hopp |
192200 |
garray_T *gap;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 3545,3550 ****
|
|
Karsten Hopp |
192200 |
--- 3687,3698 ----
|
|
Karsten Hopp |
192200 |
slang->sl_compallflags = ap;
|
|
Karsten Hopp |
192200 |
*ap = NUL;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ /* And a list of all patterns in their original form, for checking whether
|
|
Karsten Hopp |
192200 |
+ * compounding may work in match_compoundrule(). This is freed when we
|
|
Karsten Hopp |
192200 |
+ * encounter a wildcard, the check doesn't work then. */
|
|
Karsten Hopp |
192200 |
+ crp = alloc(todo + 1);
|
|
Karsten Hopp |
192200 |
+ slang->sl_comprules = crp;
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
pp = pat;
|
|
Karsten Hopp |
192200 |
*pp++ = '^';
|
|
Karsten Hopp |
192200 |
*pp++ = '\\';
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 3587,3592 ****
|
|
Karsten Hopp |
192200 |
--- 3735,3754 ----
|
|
Karsten Hopp |
192200 |
atstart = 0;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /* Copy flag to "sl_comprules", unless we run into a wildcard. */
|
|
Karsten Hopp |
192200 |
+ if (crp != NULL)
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ if (c == '+' || c == '*')
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ vim_free(slang->sl_comprules);
|
|
Karsten Hopp |
192200 |
+ slang->sl_comprules = NULL;
|
|
Karsten Hopp |
192200 |
+ crp = NULL;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+ else
|
|
Karsten Hopp |
192200 |
+ *crp++ = c;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
if (c == '/') /* slash separates two items */
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
*pp++ = '\\';
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 3611,3616 ****
|
|
Karsten Hopp |
192200 |
--- 3773,3781 ----
|
|
Karsten Hopp |
192200 |
*pp++ = '$';
|
|
Karsten Hopp |
192200 |
*pp = NUL;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ if (crp != NULL)
|
|
Karsten Hopp |
192200 |
+ *crp = NUL;
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
|
|
Karsten Hopp |
192200 |
vim_free(pat);
|
|
Karsten Hopp |
192200 |
if (slang->sl_compprog == NULL)
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 4915,4920 ****
|
|
Karsten Hopp |
192200 |
--- 5080,5086 ----
|
|
Karsten Hopp |
192200 |
} spellinfo_T;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
|
|
Karsten Hopp |
192200 |
+ static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
|
|
Karsten Hopp |
192200 |
static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
|
|
Karsten Hopp |
192200 |
static int spell_info_item __ARGS((char_u *s));
|
|
Karsten Hopp |
192200 |
static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5223,5230 ****
|
|
Karsten Hopp |
192200 |
/* Handle non-empty lines. */
|
|
Karsten Hopp |
192200 |
if (itemcnt > 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
! if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
! && aff->af_enc == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
192200 |
/* Setup for conversion from "ENC" to 'encoding'. */
|
|
Karsten Hopp |
192200 |
--- 5389,5395 ----
|
|
Karsten Hopp |
192200 |
/* Handle non-empty lines. */
|
|
Karsten Hopp |
192200 |
if (itemcnt > 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
! if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
192200 |
/* Setup for conversion from "ENC" to 'encoding'. */
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5239,5245 ****
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Conversion in %s not supported"), fname);
|
|
Karsten Hopp |
192200 |
#endif
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& aff->af_flagtype == AFT_CHAR)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
if (STRCMP(items[1], "long") == 0)
|
|
Karsten Hopp |
192200 |
--- 5404,5410 ----
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Conversion in %s not supported"), fname);
|
|
Karsten Hopp |
192200 |
#endif
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "FLAG", 2)
|
|
Karsten Hopp |
192200 |
&& aff->af_flagtype == AFT_CHAR)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
if (STRCMP(items[1], "long") == 0)
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5284,5352 ****
|
|
Karsten Hopp |
192200 |
spin->si_info = p;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& midword == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
midword = getroom_save(spin, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* ignored, we look in the tree for what chars may appear */
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
/* TODO: remove "RAR" later */
|
|
Karsten Hopp |
192200 |
! else if ((STRCMP(items[0], "RAR") == 0
|
|
Karsten Hopp |
192200 |
! || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
|
|
Karsten Hopp |
192200 |
! && aff->af_rare == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
/* TODO: remove "KEP" later */
|
|
Karsten Hopp |
192200 |
! else if ((STRCMP(items[0], "KEP") == 0
|
|
Karsten Hopp |
192200 |
! || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& aff->af_keepcase == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
! && aff->af_bad == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& aff->af_needaffix == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& aff->af_circumfix == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& aff->af_nosuggest == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& aff->af_needcomp == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& aff->af_comproot == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
|
|
Karsten Hopp |
192200 |
! && itemcnt == 2 && aff->af_compforbid == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
--- 5449,5519 ----
|
|
Karsten Hopp |
192200 |
spin->si_info = p;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
|
|
Karsten Hopp |
192200 |
&& midword == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
midword = getroom_save(spin, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "TRY", 2))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* ignored, we look in the tree for what chars may appear */
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
/* TODO: remove "RAR" later */
|
|
Karsten Hopp |
192200 |
! else if ((is_aff_rule(items, itemcnt, "RAR", 2)
|
|
Karsten Hopp |
192200 |
! || is_aff_rule(items, itemcnt, "RARE", 2))
|
|
Karsten Hopp |
192200 |
! && aff->af_rare == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
/* TODO: remove "KEP" later */
|
|
Karsten Hopp |
192200 |
! else if ((is_aff_rule(items, itemcnt, "KEP", 2)
|
|
Karsten Hopp |
192200 |
! || is_aff_rule(items, itemcnt, "KEEPCASE", 2))
|
|
Karsten Hopp |
192200 |
&& aff->af_keepcase == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if ((is_aff_rule(items, itemcnt, "BAD", 2)
|
|
Karsten Hopp |
192200 |
! || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
|
|
Karsten Hopp |
192200 |
! && aff->af_bad == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
|
|
Karsten Hopp |
192200 |
&& aff->af_needaffix == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
|
|
Karsten Hopp |
192200 |
&& aff->af_circumfix == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
|
|
Karsten Hopp |
192200 |
&& aff->af_nosuggest == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
|
|
Karsten Hopp |
192200 |
! || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
|
|
Karsten Hopp |
192200 |
&& aff->af_needcomp == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
|
|
Karsten Hopp |
192200 |
&& aff->af_comproot == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
|
|
Karsten Hopp |
192200 |
! && aff->af_compforbid == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5354,5361 ****
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
|
|
Karsten Hopp |
192200 |
! && itemcnt == 2 && aff->af_comppermit == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
--- 5521,5528 ----
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
|
|
Karsten Hopp |
192200 |
! && aff->af_comppermit == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5363,5369 ****
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& compflags == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* Turn flag "c" into COMPOUNDRULE compatible string "c+",
|
|
Karsten Hopp |
192200 |
--- 5530,5536 ----
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
|
|
Karsten Hopp |
192200 |
fname, lnum);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
|
|
Karsten Hopp |
192200 |
&& compflags == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* Turn flag "c" into COMPOUNDRULE compatible string "c+",
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5376,5382 ****
|
|
Karsten Hopp |
192200 |
compflags = p;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* Concatenate this string to previously defined ones, using a
|
|
Karsten Hopp |
192200 |
* slash to separate them. */
|
|
Karsten Hopp |
192200 |
--- 5543,5557 ----
|
|
Karsten Hopp |
192200 |
compflags = p;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
|
|
Karsten Hopp |
192200 |
! {
|
|
Karsten Hopp |
192200 |
! /* We don't use the count, but do check that it's a number and
|
|
Karsten Hopp |
192200 |
! * not COMPOUNDRULE mistyped. */
|
|
Karsten Hopp |
192200 |
! if (atoi((char *)items[1]) == 0)
|
|
Karsten Hopp |
192200 |
! smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
! fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
! }
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* Concatenate this string to previously defined ones, using a
|
|
Karsten Hopp |
192200 |
* slash to separate them. */
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5395,5401 ****
|
|
Karsten Hopp |
192200 |
compflags = p;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& compmax == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compmax = atoi((char *)items[1]);
|
|
Karsten Hopp |
192200 |
--- 5570,5576 ----
|
|
Karsten Hopp |
192200 |
compflags = p;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
|
|
Karsten Hopp |
192200 |
&& compmax == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compmax = atoi((char *)items[1]);
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5403,5409 ****
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& compminlen == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compminlen = atoi((char *)items[1]);
|
|
Karsten Hopp |
192200 |
--- 5578,5584 ----
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
|
|
Karsten Hopp |
192200 |
&& compminlen == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compminlen = atoi((char *)items[1]);
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5411,5417 ****
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& compsylmax == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compsylmax = atoi((char *)items[1]);
|
|
Karsten Hopp |
192200 |
--- 5586,5592 ----
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
|
|
Karsten Hopp |
192200 |
&& compsylmax == 0)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compsylmax = atoi((char *)items[1]);
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5419,5450 ****
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compoptions |= COMP_CHECKDUP;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compoptions |= COMP_CHECKREP;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compoptions |= COMP_CHECKCASE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
|
|
Karsten Hopp |
192200 |
! && itemcnt == 1)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compoptions |= COMP_CHECKTRIPLE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
|
|
Karsten Hopp |
192200 |
! && itemcnt == 2)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
if (atoi((char *)items[1]) == 0)
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
|
|
Karsten Hopp |
192200 |
! && itemcnt == 3)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
garray_T *gap = &spin->si_comppat;
|
|
Karsten Hopp |
192200 |
int i;
|
|
Karsten Hopp |
192200 |
--- 5594,5622 ----
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compoptions |= COMP_CHECKDUP;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compoptions |= COMP_CHECKREP;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compoptions |= COMP_CHECKCASE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
compoptions |= COMP_CHECKTRIPLE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
if (atoi((char *)items[1]) == 0)
|
|
Karsten Hopp |
192200 |
smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
|
|
Karsten Hopp |
192200 |
fname, lnum, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
garray_T *gap = &spin->si_comppat;
|
|
Karsten Hopp |
192200 |
int i;
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5463,5486 ****
|
|
Karsten Hopp |
192200 |
= getroom_save(spin, items[2]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& syllable == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
syllable = getroom_save(spin, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
spin->si_nobreak = TRUE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
spin->si_nosplitsugs = TRUE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
spin->si_nosugfile = TRUE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_pfxpostpone = TRUE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
--- 5635,5658 ----
|
|
Karsten Hopp |
192200 |
= getroom_save(spin, items[2]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
|
|
Karsten Hopp |
192200 |
&& syllable == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
syllable = getroom_save(spin, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
spin->si_nobreak = TRUE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
spin->si_nosplitsugs = TRUE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
spin->si_nosugfile = TRUE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
aff->af_pfxpostpone = TRUE;
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5771,5794 ****
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
! && fol == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
fol = vim_strsave(items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
! && low == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
low = vim_strsave(items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
! && upp == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
upp = vim_strsave(items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if ((STRCMP(items[0], "REP") == 0
|
|
Karsten Hopp |
192200 |
! || STRCMP(items[0], "REPSAL") == 0)
|
|
Karsten Hopp |
192200 |
! && itemcnt == 2)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* Ignore REP/REPSAL count */;
|
|
Karsten Hopp |
192200 |
if (!isdigit(*items[1]))
|
|
Karsten Hopp |
192200 |
--- 5943,5962 ----
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
fol = vim_strsave(items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
low = vim_strsave(items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
upp = vim_strsave(items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "REP", 2)
|
|
Karsten Hopp |
192200 |
! || is_aff_rule(items, itemcnt, "REPSAL", 2))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* Ignore REP/REPSAL count */;
|
|
Karsten Hopp |
192200 |
if (!isdigit(*items[1]))
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5819,5825 ****
|
|
Karsten Hopp |
192200 |
: &spin->si_rep, items[1], items[2]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* MAP item or count */
|
|
Karsten Hopp |
192200 |
if (!found_map)
|
|
Karsten Hopp |
192200 |
--- 5987,5993 ----
|
|
Karsten Hopp |
192200 |
: &spin->si_rep, items[1], items[2]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "MAP", 2))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
/* MAP item or count */
|
|
Karsten Hopp |
192200 |
if (!found_map)
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5856,5864 ****
|
|
Karsten Hopp |
192200 |
ga_append(&spin->si_map, '/');
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! /* Accept "SAL from to" and "SAL from to # comment". */
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "SAL") == 0
|
|
Karsten Hopp |
192200 |
! && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
if (do_sal)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
--- 6024,6031 ----
|
|
Karsten Hopp |
192200 |
ga_append(&spin->si_map, '/');
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! /* Accept "SAL from to" and "SAL from to #comment". */
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "SAL", 3))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
if (do_sal)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 5877,5888 ****
|
|
Karsten Hopp |
192200 |
: items[2]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& sofofrom == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
sofofrom = getroom_save(spin, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
|
|
Karsten Hopp |
192200 |
&& sofoto == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
sofoto = getroom_save(spin, items[1]);
|
|
Karsten Hopp |
192200 |
--- 6044,6055 ----
|
|
Karsten Hopp |
192200 |
: items[2]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
|
|
Karsten Hopp |
192200 |
&& sofofrom == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
sofofrom = getroom_save(spin, items[1]);
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
! else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
|
|
Karsten Hopp |
192200 |
&& sofoto == NULL)
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
sofoto = getroom_save(spin, items[1]);
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 6017,6022 ****
|
|
Karsten Hopp |
192200 |
--- 6184,6205 ----
|
|
Karsten Hopp |
192200 |
}
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
/*
|
|
Karsten Hopp |
192200 |
+ * Return TRUE when items[0] equals "rulename", there are "mincount" items or
|
|
Karsten Hopp |
192200 |
+ * a comment is following after item "mincount".
|
|
Karsten Hopp |
192200 |
+ */
|
|
Karsten Hopp |
192200 |
+ static int
|
|
Karsten Hopp |
192200 |
+ is_aff_rule(items, itemcnt, rulename, mincount)
|
|
Karsten Hopp |
192200 |
+ char_u **items;
|
|
Karsten Hopp |
192200 |
+ int itemcnt;
|
|
Karsten Hopp |
192200 |
+ char *rulename;
|
|
Karsten Hopp |
192200 |
+ int mincount;
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ return (STRCMP(items[0], rulename) == 0
|
|
Karsten Hopp |
192200 |
+ && (itemcnt == mincount
|
|
Karsten Hopp |
192200 |
+ || (itemcnt > mincount && items[mincount][0] == '#')));
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
+ /*
|
|
Karsten Hopp |
192200 |
* For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
|
|
Karsten Hopp |
192200 |
* ae_flags to ae_comppermit and ae_compforbid.
|
|
Karsten Hopp |
192200 |
*/
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 11492,11506 ****
|
|
Karsten Hopp |
192200 |
vim_strncpy(preword + sp->ts_prewordlen,
|
|
Karsten Hopp |
192200 |
tword + sp->ts_splitoff,
|
|
Karsten Hopp |
192200 |
sp->ts_twordlen - sp->ts_splitoff);
|
|
Karsten Hopp |
192200 |
! p = preword;
|
|
Karsten Hopp |
192200 |
! while (*skiptowhite(p) != NUL)
|
|
Karsten Hopp |
192200 |
! p = skipwhite(skiptowhite(p));
|
|
Karsten Hopp |
192200 |
! if (fword_ends && !can_compound(slang, p,
|
|
Karsten Hopp |
192200 |
! compflags + sp->ts_compsplit))
|
|
Karsten Hopp |
192200 |
! /* Compound is not allowed. But it may still be
|
|
Karsten Hopp |
192200 |
! * possible if we add another (short) word. */
|
|
Karsten Hopp |
192200 |
compound_ok = FALSE;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
/* Get pointer to last char of previous word. */
|
|
Karsten Hopp |
192200 |
p = preword + sp->ts_prewordlen;
|
|
Karsten Hopp |
192200 |
mb_ptr_back(preword, p);
|
|
Karsten Hopp |
192200 |
--- 11675,11698 ----
|
|
Karsten Hopp |
192200 |
vim_strncpy(preword + sp->ts_prewordlen,
|
|
Karsten Hopp |
192200 |
tword + sp->ts_splitoff,
|
|
Karsten Hopp |
192200 |
sp->ts_twordlen - sp->ts_splitoff);
|
|
Karsten Hopp |
192200 |
!
|
|
Karsten Hopp |
192200 |
! /* Verify CHECKCOMPOUNDPATTERN rules. */
|
|
Karsten Hopp |
192200 |
! if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
|
|
Karsten Hopp |
192200 |
! &slang->sl_comppat))
|
|
Karsten Hopp |
192200 |
compound_ok = FALSE;
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
+ if (compound_ok)
|
|
Karsten Hopp |
192200 |
+ {
|
|
Karsten Hopp |
192200 |
+ p = preword;
|
|
Karsten Hopp |
192200 |
+ while (*skiptowhite(p) != NUL)
|
|
Karsten Hopp |
192200 |
+ p = skipwhite(skiptowhite(p));
|
|
Karsten Hopp |
192200 |
+ if (fword_ends && !can_compound(slang, p,
|
|
Karsten Hopp |
192200 |
+ compflags + sp->ts_compsplit))
|
|
Karsten Hopp |
192200 |
+ /* Compound is not allowed. But it may still be
|
|
Karsten Hopp |
192200 |
+ * possible if we add another (short) word. */
|
|
Karsten Hopp |
192200 |
+ compound_ok = FALSE;
|
|
Karsten Hopp |
192200 |
+ }
|
|
Karsten Hopp |
192200 |
+
|
|
Karsten Hopp |
192200 |
/* Get pointer to last char of previous word. */
|
|
Karsten Hopp |
192200 |
p = preword + sp->ts_prewordlen;
|
|
Karsten Hopp |
192200 |
mb_ptr_back(preword, p);
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 11697,11706 ****
|
|
Karsten Hopp |
192200 |
&& (slang->sl_compsylmax < MAXWLEN
|
|
Karsten Hopp |
192200 |
|| sp->ts_complen + 1 - sp->ts_compsplit
|
|
Karsten Hopp |
192200 |
< slang->sl_compmax)
|
|
Karsten Hopp |
192200 |
! && (byte_in_str(sp->ts_complen == sp->ts_compsplit
|
|
Karsten Hopp |
192200 |
! ? slang->sl_compstartflags
|
|
Karsten Hopp |
192200 |
! : slang->sl_compallflags,
|
|
Karsten Hopp |
192200 |
! ((unsigned)flags >> 24))))
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
try_compound = TRUE;
|
|
Karsten Hopp |
192200 |
compflags[sp->ts_complen] = ((unsigned)flags >> 24);
|
|
Karsten Hopp |
192200 |
--- 11889,11897 ----
|
|
Karsten Hopp |
192200 |
&& (slang->sl_compsylmax < MAXWLEN
|
|
Karsten Hopp |
192200 |
|| sp->ts_complen + 1 - sp->ts_compsplit
|
|
Karsten Hopp |
192200 |
< slang->sl_compmax)
|
|
Karsten Hopp |
192200 |
! && (can_be_compound(sp, slang,
|
|
Karsten Hopp |
192200 |
! compflags, ((unsigned)flags >> 24))))
|
|
Karsten Hopp |
192200 |
!
|
|
Karsten Hopp |
192200 |
{
|
|
Karsten Hopp |
192200 |
try_compound = TRUE;
|
|
Karsten Hopp |
192200 |
compflags[sp->ts_complen] = ((unsigned)flags >> 24);
|
|
Karsten Hopp |
192200 |
*** ../vim-7.2.059/src/version.c Sun Nov 30 15:15:56 2008
|
|
Karsten Hopp |
192200 |
--- src/version.c Sun Nov 30 21:09:23 2008
|
|
Karsten Hopp |
192200 |
***************
|
|
Karsten Hopp |
192200 |
*** 678,679 ****
|
|
Karsten Hopp |
192200 |
--- 678,681 ----
|
|
Karsten Hopp |
192200 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
192200 |
+ /**/
|
|
Karsten Hopp |
192200 |
+ 60,
|
|
Karsten Hopp |
192200 |
/**/
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
--
|
|
Karsten Hopp |
192200 |
DEAD PERSON: I'm getting better!
|
|
Karsten Hopp |
192200 |
CUSTOMER: No, you're not -- you'll be stone dead in a moment.
|
|
Karsten Hopp |
192200 |
MORTICIAN: Oh, I can't take him like that -- it's against regulations.
|
|
Karsten Hopp |
192200 |
The Quest for the Holy Grail (Monty Python)
|
|
Karsten Hopp |
192200 |
|
|
Karsten Hopp |
192200 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
192200 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
192200 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
192200 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|