Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Recognise octal and hexadecimal constants in expressi...



details:   https://anonhg.NetBSD.org/src/rev/b630a356d385
branches:  trunk
changeset: 546758:b630a356d385
user:      dsl <dsl%NetBSD.org@localhost>
date:      Tue May 06 08:10:42 2003 +0000

description:
Recognise octal and hexadecimal constants in expressions.
- as required by SUSv3

diffstat:

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

diffs (30 lines):

diff -r 2e0ddc89c775 -r b630a356d385 bin/sh/arith_lex.l
--- a/bin/sh/arith_lex.l        Tue May 06 08:09:36 2003 +0000
+++ b/bin/sh/arith_lex.l        Tue May 06 08:10:42 2003 +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.11 2003/05/06 08:10:42 dsl 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.11 2003/05/06 08:10:42 dsl 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