xref: /dragonfly/bin/sh/pregenerated/syntax.h (revision 04277bb2)
1 /*
2  * This file was generated by the mksyntax program.
3  */
4 
5 #include <sys/cdefs.h>
6 #include <limits.h>
7 
8 /* Syntax classes */
9 #define CWORD 0			/* character is nothing special */
10 #define CNL 1			/* newline character */
11 #define CBACK 2			/* a backslash character */
12 #define CSBACK 3		/* a backslash character in single quotes */
13 #define CSQUOTE 4		/* single quote */
14 #define CDQUOTE 5		/* double quote */
15 #define CENDQUOTE 6		/* a terminating quote */
16 #define CBQUOTE 7		/* backwards single quote */
17 #define CVAR 8			/* a dollar sign */
18 #define CENDVAR 9		/* a '}' character */
19 #define CLP 10			/* a left paren in arithmetic */
20 #define CRP 11			/* a right paren in arithmetic */
21 #define CEOF 12			/* end of file */
22 #define CCTL 13			/* like CWORD, except it must be escaped */
23 #define CSPCL 14		/* these terminate a word */
24 #define CIGN 15			/* character should be ignored */
25 
26 /* Syntax classes for is_ functions */
27 #define ISDIGIT 01		/* a digit */
28 #define ISUPPER 02		/* an upper case letter */
29 #define ISLOWER 04		/* a lower case letter */
30 #define ISUNDER 010		/* an underscore */
31 #define ISSPECL 020		/* the name of a special parameter */
32 
33 #define SYNBASE (1 - CHAR_MIN)
34 #define PEOF -SYNBASE
35 
36 
37 #define BASESYNTAX (basesyntax + SYNBASE)
38 #define DQSYNTAX (dqsyntax + SYNBASE)
39 #define SQSYNTAX (sqsyntax + SYNBASE)
40 #define ARISYNTAX (arisyntax + SYNBASE)
41 
42 #define is_digit(c)	((unsigned int)((c) - '0') <= 9)
43 #define is_eof(c)	((c) == PEOF)
44 #define is_alpha(c)	((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))
45 #define is_name(c)	((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))
46 #define is_in_name(c)	((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))
47 #define is_special(c)	((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))
48 #define digit_val(c)	((c) - '0')
49 
50 extern const char basesyntax[];
51 extern const char dqsyntax[];
52 extern const char sqsyntax[];
53 extern const char arisyntax[];
54 extern const char is_type[];
55