comparison src/spellfile.c @ 18548:4fbfecbb968c v8.1.2268

patch 8.1.2268: spell file flag zero is not recognized Commit: https://github.com/vim/vim/commit/3d2a47c7823b934e1a85d773b68758c87c3ddc90 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 7 20:48:42 2019 +0100 patch 8.1.2268: spell file flag zero is not recognized Problem: Spell file flag zero is not recognized. Solution: Use -1 as an error value, so that zero can be used as a valid flag number.
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 Nov 2019 21:00:05 +0100
parents 3dbff5d37520
children 7e7ec935e7c8
comparison
equal deleted inserted replaced
18547:2602ebaedfda 18548:4fbfecbb968c
258 * postponed prefix: <pflags> follows */ 258 * postponed prefix: <pflags> follows */
259 #define BY_FLAGS2 3 /* end of word, <flags> and <flags2> bytes 259 #define BY_FLAGS2 3 /* end of word, <flags> and <flags2> bytes
260 * follow; never used in prefix tree */ 260 * follow; never used in prefix tree */
261 #define BY_SPECIAL BY_FLAGS2 /* highest special byte value */ 261 #define BY_SPECIAL BY_FLAGS2 /* highest special byte value */
262 262
263 #define ZERO_FLAG 65009 // used when flag is zero: "0"
264
263 /* Flags used in .spl file for soundsalike flags. */ 265 /* Flags used in .spl file for soundsalike flags. */
264 #define SAL_F0LLOWUP 1 266 #define SAL_F0LLOWUP 1
265 #define SAL_COLLAPSE 2 267 #define SAL_COLLAPSE 2
266 #define SAL_REM_ACCENTS 4 268 #define SAL_REM_ACCENTS 4
267 269
3180 return res; 3182 return res;
3181 } 3183 }
3182 3184
3183 /* 3185 /*
3184 * Get one affix name from "*pp" and advance the pointer. 3186 * Get one affix name from "*pp" and advance the pointer.
3187 * Returns ZERO_FLAG for "0".
3185 * Returns zero for an error, still advances the pointer then. 3188 * Returns zero for an error, still advances the pointer then.
3186 */ 3189 */
3187 static unsigned 3190 static unsigned
3188 get_affitem(int flagtype, char_u **pp) 3191 get_affitem(int flagtype, char_u **pp)
3189 { 3192 {
3195 { 3198 {
3196 ++*pp; /* always advance, avoid getting stuck */ 3199 ++*pp; /* always advance, avoid getting stuck */
3197 return 0; 3200 return 0;
3198 } 3201 }
3199 res = getdigits(pp); 3202 res = getdigits(pp);
3203 if (res == 0)
3204 res = ZERO_FLAG;
3200 } 3205 }
3201 else 3206 else
3202 { 3207 {
3203 res = mb_ptr2char_adv(pp); 3208 res = mb_ptr2char_adv(pp);
3204 if (flagtype == AFT_LONG || (flagtype == AFT_CAPLONG 3209 if (flagtype == AFT_LONG || (flagtype == AFT_CAPLONG
3341 3346
3342 case AFT_NUM: 3347 case AFT_NUM:
3343 for (p = afflist; *p != NUL; ) 3348 for (p = afflist; *p != NUL; )
3344 { 3349 {
3345 n = getdigits(&p); 3350 n = getdigits(&p);
3351 if (n == 0)
3352 n = ZERO_FLAG;
3346 if (n == flag) 3353 if (n == flag)
3347 return TRUE; 3354 return TRUE;
3348 if (*p != NUL) /* skip over comma */ 3355 if (*p != NUL) /* skip over comma */
3349 ++p; 3356 ++p;
3350 } 3357 }