199512ac4SPeter Avalos /*- 299512ac4SPeter Avalos * Copyright (c) 1993 399512ac4SPeter Avalos * The Regents of the University of California. All rights reserved. 499512ac4SPeter Avalos * Copyright (c) 2007 599512ac4SPeter Avalos * Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved. 699512ac4SPeter Avalos * 799512ac4SPeter Avalos * This code is derived from software contributed to Berkeley by 899512ac4SPeter Avalos * Kenneth Almquist. 999512ac4SPeter Avalos * 1099512ac4SPeter Avalos * Redistribution and use in source and binary forms, with or without 1199512ac4SPeter Avalos * modification, are permitted provided that the following conditions 1299512ac4SPeter Avalos * are met: 1399512ac4SPeter Avalos * 1. Redistributions of source code must retain the above copyright 1499512ac4SPeter Avalos * notice, this list of conditions and the following disclaimer. 1599512ac4SPeter Avalos * 2. Redistributions in binary form must reproduce the above copyright 1699512ac4SPeter Avalos * notice, this list of conditions and the following disclaimer in the 1799512ac4SPeter Avalos * documentation and/or other materials provided with the distribution. 1899512ac4SPeter Avalos * 3. Neither the name of the University nor the names of its contributors 1999512ac4SPeter Avalos * may be used to endorse or promote products derived from this software 2099512ac4SPeter Avalos * without specific prior written permission. 2199512ac4SPeter Avalos * 2299512ac4SPeter Avalos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2399512ac4SPeter Avalos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2499512ac4SPeter Avalos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2599512ac4SPeter Avalos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2699512ac4SPeter Avalos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2799512ac4SPeter Avalos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2899512ac4SPeter Avalos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2999512ac4SPeter Avalos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3099512ac4SPeter Avalos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3199512ac4SPeter Avalos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3299512ac4SPeter Avalos * SUCH DAMAGE. 3399512ac4SPeter Avalos * 34*3e3895bfSKrzysztof Piecuch * $FreeBSD: head/bin/sh/arith_yacc.h 343981 2019-02-10 22:23:05Z jilles $ 3599512ac4SPeter Avalos */ 3699512ac4SPeter Avalos 3799512ac4SPeter Avalos #define ARITH_ASS 1 3899512ac4SPeter Avalos 3999512ac4SPeter Avalos #define ARITH_OR 2 4099512ac4SPeter Avalos #define ARITH_AND 3 4199512ac4SPeter Avalos #define ARITH_BAD 4 4299512ac4SPeter Avalos #define ARITH_NUM 5 4399512ac4SPeter Avalos #define ARITH_VAR 6 4499512ac4SPeter Avalos #define ARITH_NOT 7 4599512ac4SPeter Avalos 4699512ac4SPeter Avalos #define ARITH_BINOP_MIN 8 4799512ac4SPeter Avalos #define ARITH_LE 8 4899512ac4SPeter Avalos #define ARITH_GE 9 4999512ac4SPeter Avalos #define ARITH_LT 10 5099512ac4SPeter Avalos #define ARITH_GT 11 5199512ac4SPeter Avalos #define ARITH_EQ 12 5299512ac4SPeter Avalos #define ARITH_REM 13 5399512ac4SPeter Avalos #define ARITH_BAND 14 5499512ac4SPeter Avalos #define ARITH_LSHIFT 15 5599512ac4SPeter Avalos #define ARITH_RSHIFT 16 5699512ac4SPeter Avalos #define ARITH_MUL 17 5799512ac4SPeter Avalos #define ARITH_ADD 18 5899512ac4SPeter Avalos #define ARITH_BOR 19 5999512ac4SPeter Avalos #define ARITH_SUB 20 6099512ac4SPeter Avalos #define ARITH_BXOR 21 6199512ac4SPeter Avalos #define ARITH_DIV 22 6299512ac4SPeter Avalos #define ARITH_NE 23 6399512ac4SPeter Avalos #define ARITH_BINOP_MAX 24 6499512ac4SPeter Avalos 6599512ac4SPeter Avalos #define ARITH_ASS_MIN 24 6699512ac4SPeter Avalos #define ARITH_REMASS 24 6799512ac4SPeter Avalos #define ARITH_BANDASS 25 6899512ac4SPeter Avalos #define ARITH_LSHIFTASS 26 6999512ac4SPeter Avalos #define ARITH_RSHIFTASS 27 7099512ac4SPeter Avalos #define ARITH_MULASS 28 7199512ac4SPeter Avalos #define ARITH_ADDASS 29 7299512ac4SPeter Avalos #define ARITH_BORASS 30 7399512ac4SPeter Avalos #define ARITH_SUBASS 31 7499512ac4SPeter Avalos #define ARITH_BXORASS 32 7599512ac4SPeter Avalos #define ARITH_DIVASS 33 7699512ac4SPeter Avalos #define ARITH_ASS_MAX 34 7799512ac4SPeter Avalos 7899512ac4SPeter Avalos #define ARITH_LPAREN 34 7999512ac4SPeter Avalos #define ARITH_RPAREN 35 8099512ac4SPeter Avalos #define ARITH_BNOT 36 8199512ac4SPeter Avalos #define ARITH_QMARK 37 8299512ac4SPeter Avalos #define ARITH_COLON 38 8399512ac4SPeter Avalos 8402d0b1ceSMatthew Dillon extern const char *arith_buf; 8502d0b1ceSMatthew Dillon 8699512ac4SPeter Avalos union yystype { 8799512ac4SPeter Avalos arith_t val; 8899512ac4SPeter Avalos char *name; 8999512ac4SPeter Avalos }; 9099512ac4SPeter Avalos 9199512ac4SPeter Avalos extern union yystype yylval; 9299512ac4SPeter Avalos 93*3e3895bfSKrzysztof Piecuch arith_t strtoarith_t(const char *restrict nptr, char **restrict endptr); 9499512ac4SPeter Avalos int yylex(void); 95