aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/arith_lex.l
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1996-09-01 10:22:36 +0000
committerPeter Wemm <peter@FreeBSD.org>1996-09-01 10:22:36 +0000
commitaa9caaf65748ace0f3cd08c2deaf3ef3048d6e4d (patch)
treee47ab3981b495c675a987dd1e943d1f4c823f314 /bin/sh/arith_lex.l
parenteaed89032e2fd68793cbfe677ce15e06b46b11dd (diff)
downloadsrc-aa9caaf65748ace0f3cd08c2deaf3ef3048d6e4d.tar.gz
src-aa9caaf65748ace0f3cd08c2deaf3ef3048d6e4d.zip
Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-] There are some changes to the build that are my fault... mkinit.c was trying (poorly) to duplicate some of the work that make(1) is designed to do. The Makefile hackery is my fault too, the depend list was incomplete because of some explicit OBJS+= entries, so mkdep wasn't picking up their source file #includes. This closes a pile of /bin/sh PR's, but not all of them.. Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
Notes
Notes: svn path=/head/; revision=17987
Diffstat (limited to 'bin/sh/arith_lex.l')
-rw-r--r--bin/sh/arith_lex.l58
1 files changed, 28 insertions, 30 deletions
diff --git a/bin/sh/arith_lex.l b/bin/sh/arith_lex.l
index 9c3b851c4dff..61f21daa9857 100644
--- a/bin/sh/arith_lex.l
+++ b/bin/sh/arith_lex.l
@@ -34,18 +34,19 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: arith_lex.l,v 1.2 1994/09/24 02:57:22 davidg Exp $
+ * $Id: arith_lex.l,v 1.4 1996/06/02 17:06:40 phk Exp $
*/
#ifndef lint
-static char sccsid[] = "@(#)arith_lex.l 8.1 (Berkeley) 5/31/93";
+static char sccsid[] = "@(#)arith_lex.l 8.3 (Berkeley) 5/4/95";
#endif /* not lint */
+#include <unistd.h>
#include "y.tab.h"
+#include "error.h"
extern yylval;
extern char *arith_buf, *arith_startbuf;
-int arith_wasoper;
#undef YY_INPUT
#define YY_INPUT(buf,result,max) \
result = (*buf = *arith_buf++) ? 1 : YY_NULL;
@@ -53,36 +54,33 @@ int arith_wasoper;
%%
[ \t\n] { ; }
-[0-9]+ { arith_wasoper = 0; yylval = atol(yytext); return(ARITH_NUM); }
-"(" { arith_wasoper = 1; return(ARITH_LPAREN); }
-")" { arith_wasoper = 0; return(ARITH_RPAREN); }
-"||" { arith_wasoper = 1; return(ARITH_OR); }
-"&&" { arith_wasoper = 1; return(ARITH_AND); }
-"==" { arith_wasoper = 1; return(ARITH_EQ); }
-">" { arith_wasoper = 1; return(ARITH_GT); }
-">=" { arith_wasoper = 1; return(ARITH_GEQ); }
-"<" { arith_wasoper = 1; return(ARITH_LT); }
-"<=" { arith_wasoper = 1; return(ARITH_LEQ); }
-"!=" { arith_wasoper = 1; return(ARITH_NEQ); }
-"*" { arith_wasoper = 1; return(ARITH_MULT); }
-"/" { arith_wasoper = 1; return(ARITH_DIV); }
-"%" { arith_wasoper = 1; return(ARITH_REM); }
-"+" { if (!arith_wasoper) { /* ignore unary plus */
- arith_wasoper = 1;
- return(ARITH_ADD);
- }
- }
-"-" { if (arith_wasoper) {
- return(ARITH_UNARYMINUS);
- } else {
- arith_wasoper = 1;
- return(ARITH_SUBT);
- }
- }
-"!" { arith_wasoper = 1; return(ARITH_NOT); }
+[0-9]+ { yylval = atol(yytext); return(ARITH_NUM); }
+"(" { return(ARITH_LPAREN); }
+")" { return(ARITH_RPAREN); }
+"||" { return(ARITH_OR); }
+"&&" { return(ARITH_AND); }
+"|" { return(ARITH_BOR); }
+"^" { return(ARITH_BXOR); }
+"&" { return(ARITH_BAND); }
+"==" { return(ARITH_EQ); }
+"!=" { return(ARITH_NE); }
+">" { return(ARITH_GT); }
+">=" { return(ARITH_GE); }
+"<" { return(ARITH_LT); }
+"<=" { return(ARITH_LE); }
+"<<" { return(ARITH_LSHIFT); }
+">>" { return(ARITH_RSHIFT); }
+"*" { return(ARITH_MUL); }
+"/" { return(ARITH_DIV); }
+"%" { return(ARITH_REM); }
+"+" { return(ARITH_ADD); }
+"-" { return(ARITH_SUB); }
+"~" { return(ARITH_BNOT); }
+"!" { return(ARITH_NOT); }
. { error("arith: syntax error: \"%s\"\n", arith_startbuf); }
%%
+void
arith_lex_reset() {
YY_NEW_FILE;
}