xref: /titanic_41/usr/src/lib/libshell/common/data/strdata.c (revision 7a286c471efbab8562f7655a82931904703fffe0)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2008 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                  David Korn <dgk@research.att.com>                   *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 /*
22  * data for string evaluator library
23  */
24 
25 #include	<ast_standards.h>
26 #include	"FEATURE/options"
27 #include	"streval.h"
28 
29 const unsigned char strval_precedence[35] =
30 	/* opcode	precedence,assignment  */
31 {
32 	/* DEFAULT */		MAXPREC|NOASSIGN,
33 	/* DONE */		0|NOASSIGN|RASSOC,
34 	/* NEQ */		10|NOASSIGN,
35 	/* NOT */		MAXPREC|NOASSIGN,
36 	/* MOD */		14,
37 	/* ANDAND */		6|NOASSIGN|SEQPOINT,
38 	/* AND */		9|NOFLOAT,
39 	/* LPAREN */		MAXPREC|NOASSIGN|SEQPOINT,
40 	/* RPAREN */		1|NOASSIGN|RASSOC|SEQPOINT,
41 	/* POW */		14|NOASSIGN|RASSOC,
42 	/* TIMES */		14,
43 	/* PLUSPLUS */		15|NOASSIGN|NOFLOAT|SEQPOINT,
44 	/* PLUS */		13,
45 	/* COMMA */		1|NOASSIGN|SEQPOINT,
46 	/* MINUSMINUS */	15|NOASSIGN|NOFLOAT|SEQPOINT,
47 	/* MINUS */		13,
48 	/* DIV */		14,
49 	/* LSHIFT */		12|NOFLOAT,
50 	/* LE */		11|NOASSIGN,
51 	/* LT */		11|NOASSIGN,
52 	/* EQ */		10|NOASSIGN,
53 	/* ASSIGNMENT */	2|RASSOC,
54 	/* COLON */		0|NOASSIGN,
55 	/* RSHIFT */		12|NOFLOAT,
56 	/* GE */		11|NOASSIGN,
57 	/* GT */		11|NOASSIGN,
58 	/* QCOLON */		3|NOASSIGN|SEQPOINT,
59 	/* QUEST */		3|NOASSIGN|SEQPOINT|RASSOC,
60 	/* XOR */		8|NOFLOAT,
61 	/* OROR */		5|NOASSIGN|SEQPOINT,
62 	/* OR */		7|NOFLOAT,
63 	/* DEFAULT */		MAXPREC|NOASSIGN,
64 	/* DEFAULT */		MAXPREC|NOASSIGN,
65 	/* DEFAULT */		MAXPREC|NOASSIGN,
66 	/* DEFAULT */		MAXPREC|NOASSIGN
67 };
68 
69 /*
70  * This is for arithmetic expressions
71  */
72 const char strval_states[64] =
73 {
74 	A_EOF,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,
75 	A_REG,	0,	0,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,
76 	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,
77 	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,	A_REG,
78 
79 	0,	A_NOT,	0,	A_REG,	A_REG,	A_MOD,	A_AND,	A_LIT,
80 	A_LPAR,	A_RPAR,	A_TIMES,A_PLUS,	A_COMMA,A_MINUS,A_DOT,	A_DIV,
81 	A_DIG,	A_DIG,	A_DIG,	A_DIG,	A_DIG,	A_DIG,	A_DIG,	A_DIG,
82 	A_DIG,	A_DIG,	A_COLON,A_REG,	A_LT,	A_ASSIGN,A_GT,	A_QUEST
83 
84 };
85 
86 
87 const char e_argcount[]		= "%s: function has wrong number of arguments";
88 const char e_badnum[]		= "%s: bad number";
89 const char e_moretokens[]	= "%s: more tokens expected";
90 const char e_paren[]		= "%s: unbalanced parenthesis";
91 const char e_badcolon[]		= "%s: invalid use of :";
92 const char e_divzero[]		= "%s: divide by zero";
93 const char e_synbad[]		= "%s: arithmetic syntax error";
94 const char e_notlvalue[]	= "%s: assignment requires lvalue";
95 const char e_recursive[]	= "%s: recursion too deep";
96 const char e_questcolon[]	= "%s: ':' expected for '?' operator";
97 const char e_function[]		= "%s: unknown function";
98 const char e_incompatible[]	= "%s: invalid floating point operation";
99 const char e_overflow[]		= "%s: overflow exception";
100 const char e_domain[]		= "%s: domain exception";
101 const char e_singularity[]	= "%s: singularity exception";
102 const char e_charconst[]	= "%s: invalid character constant";
103 
104 #include	"FEATURE/math"
105