limit fstBC to 30bp in Python3 ver.
[GalaxyCodeBases.git] / c_cpp / etc / calc / token.h
blob89c2c57da8cfcf912c112a987c64cdb9d187d0f4
1 /*
2 * token - token defines
4 * Copyright (C) 1999-2007 David I. Bell
6 * Calc is open software; you can redistribute it and/or modify it under
7 * the terms of the version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
10 * Calc is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
13 * Public License for more details.
15 * A copy of version 2.1 of the GNU Lesser General Public License is
16 * distributed with calc under the filename COPYING-LGPL. You should have
17 * received a copy with calc; if not, write to Free Software Foundation, Inc.
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * @(#) $Revision: 30.3 $
21 * @(#) $Id: token.h,v 30.3 2013/08/11 08:41:38 chongo Exp $
22 * @(#) $Source: /usr/local/src/bin/calc/RCS/token.h,v $
24 * Under source code control: 1990/02/15 01:48:37
25 * File existed as early as: before 1990
27 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
31 #if !defined(__TOKEN_H__)
32 #define __TOKEN_H__
35 #if defined(CALC_SRC) /* if we are building from the calc source tree */
36 # include "zmath.h"
37 #else
38 # include <calc/zmath.h>
39 #endif
43 * Token types
45 #define T_NULL 0 /* null token */
46 #define T_LEFTPAREN 1 /* left parenthesis "(" */
47 #define T_RIGHTPAREN 2 /* right parenthesis ")" */
48 #define T_LEFTBRACE 3 /* left brace "{" */
49 #define T_RIGHTBRACE 4 /* right brace "}" */
50 #define T_SEMICOLON 5 /* end of statement ";" */
51 #define T_EOF 6 /* end of file */
52 #define T_COLON 7 /* label character ":" */
53 #define T_ASSIGN 8 /* assignment "=" */
54 #define T_PLUS 9 /* plus sign "+" */
55 #define T_MINUS 10 /* minus sign "-" */
56 #define T_MULT 11 /* multiply sign "*" */
57 #define T_DIV 12 /* divide sign "/" */
58 #define T_MOD 13 /* modulo sign "%" */
59 #define T_POWER 14 /* power sign "^" or "**" */
60 #define T_EQ 15 /* equality "==" */
61 #define T_NE 16 /* notequal "!=" */
62 #define T_LT 17 /* less than "<" */
63 #define T_GT 18 /* greater than ">" */
64 #define T_LE 19 /* less than or equals "<=" */
65 #define T_GE 20 /* greater than or equals ">=" */
66 #define T_LEFTBRACKET 21 /* left bracket "[" */
67 #define T_RIGHTBRACKET 22 /* right bracket "]" */
68 #define T_SYMBOL 23 /* symbol name */
69 #define T_STRING 24 /* string value (double quotes) */
70 #define T_NUMBER 25 /* numeric real constant */
71 #define T_PLUSEQUALS 26 /* plus equals "+=" */
72 #define T_MINUSEQUALS 27 /* minus equals "-=" */
73 #define T_MULTEQUALS 28 /* multiply equals "*=" */
74 #define T_DIVEQUALS 29 /* divide equals "/=" */
75 #define T_MODEQUALS 30 /* modulo equals "%=" */
76 #define T_PLUSPLUS 31 /* plusplus "++" */
77 #define T_MINUSMINUS 32 /* minusminus "--" */
78 #define T_COMMA 33 /* comma "," */
79 #define T_ANDAND 34 /* logical and "&&" */
80 #define T_OROR 35 /* logical or "||" */
81 #define T_OLDVALUE 36 /* old value from prev calculation */
82 #define T_SLASHSLASH 37 /* integer divide "//" */
83 #define T_NEWLINE 38 /* newline character */
84 #define T_SLASHSLASHEQUALS 39 /* integer divide equals "//=" */
85 #define T_AND 40 /* arithmetic and "&" */
86 #define T_OR 41 /* arithmetic or "|" */
87 #define T_NOT 42 /* logical not "!" */
88 #define T_LEFTSHIFT 43 /* left shift "<<" */
89 #define T_RIGHTSHIFT 44 /* right shift ">>" */
90 #define T_ANDEQUALS 45 /* and equals "&=" */
91 #define T_OREQUALS 46 /* or equals "|= */
92 #define T_LSHIFTEQUALS 47 /* left shift equals "<<=" */
93 #define T_RSHIFTEQUALS 48 /* right shift equals ">>= */
94 #define T_POWEREQUALS 49 /* power equals "^=" or "**=" */
95 #define T_PERIOD 50 /* period "." */
96 #define T_IMAGINARY 51 /* numeric imaginary constant */
97 #define T_AMPERSAND 52 /* ampersand "&" */
98 #define T_QUESTIONMARK 53 /* question mark "?" */
99 #define T_AT 54 /* at sign "@" */
100 #define T_DOLLAR 55 /* dollar sign "$" */
101 #define T_HASH 56 /* hash or pound sign "#" */
102 #define T_HASHEQUALS 57 /* hash equals "#=" */
103 #define T_BACKQUOTE 58 /* backquote sign "`" */
104 #define T_ARROW 59 /* arrow "->" */
105 #define T_TILDE 60 /* tilde "~" */
106 #define T_TILDEEQUALS 61 /* tilde equals "~=" */
107 #define T_BACKSLASH 62 /* backslash or setminus "\" */
108 #define T_BACKSLASHEQUALS 63 /* backslash equals "\=" */
109 #define T_POUNDBANG 64 /* #!/usr/local/bin/calc comment */
110 #define T_POUNDCOMMENT 65 /* #[whitespace] comment */
114 * Keyword tokens
116 #define T_IF 101 /* if keyword */
117 #define T_ELSE 102 /* else keyword */
118 #define T_WHILE 103 /* while keyword */
119 #define T_CONTINUE 104 /* continue keyword */
120 #define T_BREAK 105 /* break keyword */
121 #define T_GOTO 106 /* goto keyword */
122 #define T_RETURN 107 /* return keyword */
123 #define T_LOCAL 108 /* local keyword */
124 #define T_GLOBAL 109 /* global keyword */
125 #define T_STATIC 110 /* static keyword */
126 #define T_DO 111 /* do keyword */
127 #define T_FOR 112 /* for keyword */
128 #define T_SWITCH 113 /* switch keyword */
129 #define T_CASE 114 /* case keyword */
130 #define T_DEFAULT 115 /* default keyword */
131 #define T_QUIT 116 /* quit keyword */
132 #define T_DEFINE 117 /* define keyword */
133 #define T_READ 118 /* read keyword */
134 #define T_SHOW 119 /* show keyword */
135 #define T_HELP 120 /* help keyword */
136 #define T_WRITE 121 /* write keyword */
137 #define T_MAT 122 /* mat keyword */
138 #define T_OBJ 123 /* obj keyword */
139 #define T_PRINT 124 /* print keyword */
140 #define T_CD 125 /* change directory keyword */
141 #define T_UNDEFINE 126 /* undefine keyword */
142 #define T_ABORT 127 /* abort operation */
145 #define iskeyword(n) ((n) > 100) /* TRUE if token is a keyword */
149 * Flags returned describing results of expression parsing.
151 #define EXPR_RVALUE 0x0001 /* result is an rvalue */
152 #define EXPR_CONST 0x0002 /* result is constant */
153 #define EXPR_ASSIGN 0x0004 /* result is an assignment */
155 /* TRUE if expression is rvalue */
156 #define isrvalue(n) ((n) & EXPR_RVALUE)
157 /* TRUE if expr is lvalue */
158 #define islvalue(n) (((n) & EXPR_RVALUE) == 0)
159 /* TRUE if expr is constant */
160 #define isconst(n) ((n) & EXPR_CONST)
161 /* TRUE if expr is an assignment */
162 #define isassign(n) ((n) & EXPR_ASSIGN)
166 * Flags for modes for tokenizing.
168 #define TM_DEFAULT 0x0 /* normal mode */
169 #define TM_NEWLINES 0x1 /* treat any newline as a token */
170 #define TM_ALLSYMS 0x2 /* treat almost everything as a symbol */
173 EXTERN long errorcount; /* number of errors found */
175 E_FUNC long tokenstring(void);
176 E_FUNC long tokennumber(void);
177 E_FUNC char *tokensymbol(void);
178 E_FUNC void inittokens(void);
179 E_FUNC int tokenmode(int flag);
180 E_FUNC int gettoken(void);
181 E_FUNC void rescantoken(void);
182 E_FUNC void scanerror(int, char *, ...) PRINTF_FORMAT(2, 3);
183 E_FUNC void warning(char *, ...) PRINTF_FORMAT(1, 2);
186 #endif /* !__TOKEN_H__ */