Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/bin/sh Pullup rev 1.11 (requested by simonb in ticket #...



details:   https://anonhg.NetBSD.org/src/rev/0d86afba3ac5
branches:  netbsd-1-6
changeset: 531237:0d86afba3ac5
user:      jmc <jmc%NetBSD.org@localhost>
date:      Tue Apr 06 05:40:35 2004 +0000

description:
Pullup rev 1.11 (requested by simonb in ticket #1650)

Recognise octal and hexadecimal constants in expressions.

diffstat:

 bin/sh/arith_lex.l |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 66e380ef8105 -r 0d86afba3ac5 bin/sh/arith_lex.l
--- a/bin/sh/arith_lex.l        Tue Apr 06 05:32:52 2004 +0000
+++ b/bin/sh/arith_lex.l        Tue Apr 06 05:40:35 2004 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: arith_lex.l,v 1.10 1999/02/05 07:52:52 christos Exp $  */
+/*     $NetBSD: arith_lex.l,v 1.10.14.1 2004/04/06 05:40:35 jmc Exp $  */
 
 /*-
  * Copyright (c) 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)arith_lex.l        8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: arith_lex.l,v 1.10 1999/02/05 07:52:52 christos Exp $");
+__RCSID("$NetBSD: arith_lex.l,v 1.10.14.1 2004/04/06 05:40:35 jmc Exp $");
 #endif
 #endif /* not lint */
 
@@ -61,7 +61,9 @@
 
 %%
 [ \t\n]        { ; }
-[0-9]+ { yylval = atol(yytext); return(ARITH_NUM); }
+0x[0-9a-fA-F]+ { yylval = strtol(yytext, 0, 16); return(ARITH_NUM); }
+0[0-7]*                { yylval = strtol(yytext, 0, 8); return(ARITH_NUM); }
+[1-9][0-9]*    { yylval = strtol(yytext, 0, 10); return(ARITH_NUM); }
 "("    { return(ARITH_LPAREN); }
 ")"    { return(ARITH_RPAREN); }
 "||"   { return(ARITH_OR); }



Home | Main Index | Thread Index | Old Index