1 /* $NetBSD: syntax.c,v 1.3 2012/03/28 20:11:25 christos Exp $ */
4 __RCSID("$NetBSD: syntax.c,v 1.3 2012/03/28 20:11:25 christos Exp $");
12 #error initialisation assumes 'CWORD' is zero
15 #define ndx(ch) (ch + 1 - CHAR_MIN)
16 #define set(ch, val) [ndx(ch)] = val,
17 #define set_range(s, e, val) [ndx(s) ... ndx(e)] = val,
19 /* syntax table used when not in quotes */
20 const char basesyntax
[257] = { CEOF
,
21 set_range(CTL_FIRST
, CTL_LAST
, CCTL
)
40 /* syntax table used when in double quotes */
41 const char dqsyntax
[257] = { CEOF
,
42 set_range(CTL_FIRST
, CTL_LAST
, CCTL
)
49 /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */
61 /* syntax table used when in single quotes */
62 const char sqsyntax
[257] = { CEOF
,
63 set_range(CTL_FIRST
, CTL_LAST
, CCTL
)
66 /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */
78 /* syntax table used when in arithmetic */
79 const char arisyntax
[257] = { CEOF
,
80 set_range(CTL_FIRST
, CTL_LAST
, CCTL
)
92 /* character classification table */
93 const char is_type
[257] = { 0,
94 set_range('0', '9', ISDIGIT
)
95 set_range('a', 'z', ISLOWER
)
96 set_range('A', 'Z', ISUPPER
)