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