zsh-workers
 help / color / mirror / code / Atom feed
From: hzoli@cs.elte.hu (Zoltan Hidvegi)
To: zsh-workers@math.gatech.edu (zsh-workers)
Subject: Octal and hex numbers in zsh
Date: Fri, 9 Jun 1995 18:55:18 +0100 (MET DST)	[thread overview]
Message-ID: <9506091655.AA05115@turan.elte.hu> (raw)

The following simple patch removes the feature when a leading zero denotes
octal number. But leading 0x still can be uset for hex numbers. The 0xff
syntax also sets lastbase (ie. it sets the base to 16 if an integer is first
assigned this way). To remove this feature, replace `lastbase = 16' with `16'
below. This patch does not depend on the strtol feature to interpret 0xff as a
hex number if called with base 0.

Zoltan

rcsdiff -qc -kk -r1.7 -r1.8 math.c
*** math.c
--- math.c	1995/06/02 23:56:54
***************
*** 327,336 ****
  	case '\t':
  	case '\n':
  	    break;
  	default:
  	    if (idigit(*--ptr)) {
  		unary = 0;
! 		yyval = strtol(ptr, &ptr, 0);
  
  		if (*ptr == '#') {
  		    ptr++;
--- 327,343 ----
  	case '\t':
  	case '\n':
  	    break;
+ 	case '0':
+ 	    if (*ptr == 'x' || *ptr == 'X') {
+ 		/* Should we set lastbase here? */
+ 		yyval = strtol(++ptr, &ptr, lastbase = 16);
+ 		return NUM;
+ 	    }
+ 	/* Fall through! */
  	default:
  	    if (idigit(*--ptr)) {
  		unary = 0;
! 		yyval = strtol(ptr, &ptr, 10);
  
  		if (*ptr == '#') {
  		    ptr++;


                 reply	other threads:[~1995-06-09 16:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9506091655.AA05115@turan.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).