comparison src/regexp.c @ 27490:fb4c30606b4a v8.2.4273

patch 8.2.4273: the EBCDIC support is outdated Commit: https://github.com/vim/vim/commit/424bcae1fb0f69e0aef5e0cf84fd771cf34a0fb7 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 31 14:59:41 2022 +0000 patch 8.2.4273: the EBCDIC support is outdated Problem: The EBCDIC support is outdated. Solution: Remove the EBCDIC support.
author Bram Moolenaar <Bram@vim.org>
date Mon, 31 Jan 2022 16:00:09 +0100
parents 678ea52c15a0
children c1d1639b52dd
comparison
equal deleted inserted replaced
27489:9f00e1edb43c 27490:fb4c30606b4a
229 class_tab[i] = RI_DIGIT + RI_HEX + RI_OCTAL + RI_WORD; 229 class_tab[i] = RI_DIGIT + RI_HEX + RI_OCTAL + RI_WORD;
230 else if (i >= '8' && i <= '9') 230 else if (i >= '8' && i <= '9')
231 class_tab[i] = RI_DIGIT + RI_HEX + RI_WORD; 231 class_tab[i] = RI_DIGIT + RI_HEX + RI_WORD;
232 else if (i >= 'a' && i <= 'f') 232 else if (i >= 'a' && i <= 'f')
233 class_tab[i] = RI_HEX + RI_WORD + RI_HEAD + RI_ALPHA + RI_LOWER; 233 class_tab[i] = RI_HEX + RI_WORD + RI_HEAD + RI_ALPHA + RI_LOWER;
234 #ifdef EBCDIC
235 else if ((i >= 'g' && i <= 'i') || (i >= 'j' && i <= 'r')
236 || (i >= 's' && i <= 'z'))
237 #else
238 else if (i >= 'g' && i <= 'z') 234 else if (i >= 'g' && i <= 'z')
239 #endif
240 class_tab[i] = RI_WORD + RI_HEAD + RI_ALPHA + RI_LOWER; 235 class_tab[i] = RI_WORD + RI_HEAD + RI_ALPHA + RI_LOWER;
241 else if (i >= 'A' && i <= 'F') 236 else if (i >= 'A' && i <= 'F')
242 class_tab[i] = RI_HEX + RI_WORD + RI_HEAD + RI_ALPHA + RI_UPPER; 237 class_tab[i] = RI_HEX + RI_WORD + RI_HEAD + RI_ALPHA + RI_UPPER;
243 #ifdef EBCDIC
244 else if ((i >= 'G' && i <= 'I') || ( i >= 'J' && i <= 'R')
245 || (i >= 'S' && i <= 'Z'))
246 #else
247 else if (i >= 'G' && i <= 'Z') 238 else if (i >= 'G' && i <= 'Z')
248 #endif
249 class_tab[i] = RI_WORD + RI_HEAD + RI_ALPHA + RI_UPPER; 239 class_tab[i] = RI_WORD + RI_HEAD + RI_ALPHA + RI_UPPER;
250 else if (i == '_') 240 else if (i == '_')
251 class_tab[i] = RI_WORD + RI_HEAD; 241 class_tab[i] = RI_WORD + RI_HEAD;
252 else 242 else
253 class_tab[i] = 0; 243 class_tab[i] = 0;
298 288
299 /* 289 /*
300 * META contains all characters that may be magic, except '^' and '$'. 290 * META contains all characters that may be magic, except '^' and '$'.
301 */ 291 */
302 292
303 #ifdef EBCDIC
304 static char_u META[] = "%&()*+.123456789<=>?@ACDFHIKLMOPSUVWX[_acdfhiklmnopsuvwxz{|~";
305 #else
306 // META[] is used often enough to justify turning it into a table. 293 // META[] is used often enough to justify turning it into a table.
307 static char_u META_flags[] = { 294 static char_u META_flags[] = {
308 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
309 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 296 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
310 // % & ( ) * + . 297 // % & ( ) * + .
318 // a c d f h i k l m n o 305 // a c d f h i k l m n o
319 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 306 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
320 // p s u v w x z { | ~ 307 // p s u v w x z { | ~
321 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1 308 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1
322 }; 309 };
323 #endif
324 310
325 static int curchr; // currently parsed character 311 static int curchr; // currently parsed character
326 // Previous character. Note: prevchr is sometimes -1 when we are not at the 312 // Previous character. Note: prevchr is sometimes -1 when we are not at the
327 // start, eg in /[ ^I]^ the pattern was never found even if it existed, 313 // start, eg in /[ ^I]^ the pattern was never found even if it existed,
328 // because ^ was taken to be magic -- webb 314 // because ^ was taken to be magic -- webb
406 return c; 392 return c;
407 } 393 }
408 } 394 }
409 return 0; 395 return 0;
410 } 396 }
411
412 #ifdef EBCDIC
413 /*
414 * Table for equivalence class "c". (IBM-1047)
415 */
416 static char *EQUIVAL_CLASS_C[16] = {
417 "A\x62\x63\x64\x65\x66\x67",
418 "C\x68",
419 "E\x71\x72\x73\x74",
420 "I\x75\x76\x77\x78",
421 "N\x69",
422 "O\xEB\xEC\xED\xEE\xEF\x80",
423 "U\xFB\xFC\xFD\xFE",
424 "Y\xBA",
425 "a\x42\x43\x44\x45\x46\x47",
426 "c\x48",
427 "e\x51\x52\x53\x54",
428 "i\x55\x56\x57\x58",
429 "n\x49",
430 "o\xCB\xCC\xCD\xCE\xCF\x70",
431 "u\xDB\xDC\xDD\xDE",
432 "y\x8D\xDF",
433 };
434 #endif
435 397
436 /* 398 /*
437 * Check for a collating element "[.a.]". "pp" points to the '['. 399 * Check for a collating element "[.a.]". "pp" points to the '['.
438 * Returns a character. Zero means that no item was recognized. Otherwise 400 * Returns a character. Zero means that no item was recognized. Otherwise
439 * "pp" is advanced to after the item. 401 * "pp" is advanced to after the item.
786 { 748 {
787 int c = regparse[1]; 749 int c = regparse[1];
788 750
789 if (c == NUL) 751 if (c == NUL)
790 curchr = '\\'; // trailing '\' 752 curchr = '\\'; // trailing '\'
791 else if ( 753 else if (c <= '~' && META_flags[c])
792 #ifdef EBCDIC
793 vim_strchr(META, c)
794 #else
795 c <= '~' && META_flags[c]
796 #endif
797 )
798 { 754 {
799 /* 755 /*
800 * META contains everything that may be magic sometimes, 756 * META contains everything that may be magic sometimes,
801 * except ^ and $ ("\^" and "\$" are only magic after 757 * except ^ and $ ("\^" and "\$" are only magic after
802 * "\V"). We now fetch the next character and toggle its 758 * "\V"). We now fetch the next character and toggle its