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