Revert (kind of) the change in 1.12 of the ancient mksyntax.sh script
(undoing the effect of that commit on syntax.h when it was being dynamically generated) from 1996. This means that the shell parser is now locale independent, so scripts that work anywhere will work consistently everywhere. Inspired by a similar change in FreeBSD's sh (from 2010) - the original change in the other direction came from FreeBSD as well.... Note that this does not in any way add any kind of support for locales to sh (which is a whole different problem.) (from kre)
This commit is contained in:
parent
8c844a2ebd
commit
5f0a664efb
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: syntax.h,v 1.2 2004/01/17 17:38:12 dsl Exp $ */
|
||||
/* $NetBSD: syntax.h,v 1.3 2016/03/16 15:45:40 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -59,8 +59,6 @@
|
|||
|
||||
#define PEOF (CHAR_MIN - 1)
|
||||
#define SYNBASE (-PEOF)
|
||||
/* XXX UPEOF is CHAR_MAX, so is a valid 'char' value... */
|
||||
#define UPEOF ((char)PEOF)
|
||||
|
||||
|
||||
#define BASESYNTAX (basesyntax + SYNBASE)
|
||||
|
@ -68,11 +66,11 @@
|
|||
#define SQSYNTAX (sqsyntax + SYNBASE)
|
||||
#define ARISYNTAX (arisyntax + SYNBASE)
|
||||
|
||||
/* These defines assume that the digits are contiguous */
|
||||
#define is_digit(c) ((unsigned)((c) - '0') <= 9)
|
||||
#define is_alpha(c) (((char)(c)) != UPEOF && ((c) < CTL_FIRST || (c) > CTL_LAST) && isalpha((unsigned char)(c)))
|
||||
#define is_name(c) (((char)(c)) != UPEOF && ((c) < CTL_FIRST || (c) > CTL_LAST) && ((c) == '_' || isalpha((unsigned char)(c))))
|
||||
#define is_in_name(c) (((char)(c)) != UPEOF && ((c) < CTL_FIRST || (c) > CTL_LAST) && ((c) == '_' || isalnum((unsigned char)(c))))
|
||||
/* These defines assume that the digits are contiguous (which is guaranteed) */
|
||||
#define is_digit(c) ((unsigned)((c) - '0') <= 9)
|
||||
#define is_alpha(c) ((is_type+SYNBASE)[c] & (ISUPPER|ISLOWER))
|
||||
#define is_name(c) ((is_type+SYNBASE)[c] & (ISUPPER|ISLOWER|ISUNDER))
|
||||
#define is_in_name(c) ((is_type+SYNBASE)[c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))
|
||||
#define is_special(c) ((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT))
|
||||
#define digit_val(c) ((c) - '0')
|
||||
|
||||
|
|
Loading…
Reference in New Issue