Deleted Added
full compact
lex.c (125505) lex.c (146299)
1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this

--- 120 unchanged lines hidden (view full) ---

129 else {
130 *bp = 0;
131 unput(c);
132 break;
133 }
134 }
135 *bp = 0;
136 retc = 'a'; /* alphanumeric */
1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this

--- 120 unchanged lines hidden (view full) ---

129 else {
130 *bp = 0;
131 unput(c);
132 break;
133 }
134 }
135 *bp = 0;
136 retc = 'a'; /* alphanumeric */
137 } else { /* it's a number */
137 } else { /* maybe it's a number, but could be . */
138 char *rem;
139 /* read input until can't be a number */
140 for ( ; (c = input()) != 0; ) {
141 if (bp-buf >= sz)
142 if (!adjbuf(&buf, &sz, bp-buf+2, 100, &bp, 0))
143 FATAL( "out of space for number %.10s...", buf );
144 if (isdigit(c) || c == 'e' || c == 'E'
145 || c == '.' || c == '+' || c == '-')
146 *bp++ = c;
147 else {
148 unput(c);
149 break;
150 }
151 }
152 *bp = 0;
153 strtod(buf, &rem); /* parse the number */
138 char *rem;
139 /* read input until can't be a number */
140 for ( ; (c = input()) != 0; ) {
141 if (bp-buf >= sz)
142 if (!adjbuf(&buf, &sz, bp-buf+2, 100, &bp, 0))
143 FATAL( "out of space for number %.10s...", buf );
144 if (isdigit(c) || c == 'e' || c == 'E'
145 || c == '.' || c == '+' || c == '-')
146 *bp++ = c;
147 else {
148 unput(c);
149 break;
150 }
151 }
152 *bp = 0;
153 strtod(buf, &rem); /* parse the number */
154 unputstr(rem); /* put rest back for later */
155 if (rem == buf) { /* it wasn't a valid number at all */
154 if (rem == buf) { /* it wasn't a valid number at all */
156 buf[1] = 0; /* so return one character as token */
155 buf[1] = 0; /* return one character as token */
157 retc = buf[0]; /* character is its own type */
156 retc = buf[0]; /* character is its own type */
157 unputstr(rem+1); /* put rest back for later */
158 } else { /* some prefix was a number */
158 } else { /* some prefix was a number */
159 rem[0] = 0; /* so truncate where failure started */
160 retc = '0'; /* number */
159 unputstr(rem); /* put rest back for later */
160 rem[0] = 0; /* truncate buf after number part */
161 retc = '0'; /* type is number */
161 }
162 }
163 *pbuf = buf;
164 *psz = sz;
165 return retc;
166}
167
168int word(char *);

--- 13 unchanged lines hidden (view full) ---

182 if (sc) {
183 sc = 0;
184 RET('}');
185 }
186 if (reg) {
187 reg = 0;
188 return regexpr();
189 }
162 }
163 }
164 *pbuf = buf;
165 *psz = sz;
166 return retc;
167}
168
169int word(char *);

--- 13 unchanged lines hidden (view full) ---

183 if (sc) {
184 sc = 0;
185 RET('}');
186 }
187 if (reg) {
188 reg = 0;
189 return regexpr();
190 }
191/* printf("top\n"); */
190 for (;;) {
191 c = gettok(&buf, &bufsize);
192 for (;;) {
193 c = gettok(&buf, &bufsize);
194/* printf("gettok [%s]\n", buf); */
192 if (c == 0)
193 return 0;
194 if (isalpha(c) || c == '_')
195 return word(buf);
196 if (isdigit(c)) {
197 yylval.cp = setsymtab(buf, tostring(buf), atof(buf), CON|NUM, symtab);
198 /* should this also have STR set? */
199 RET(NUMBER);

--- 386 unchanged lines hidden ---
195 if (c == 0)
196 return 0;
197 if (isalpha(c) || c == '_')
198 return word(buf);
199 if (isdigit(c)) {
200 yylval.cp = setsymtab(buf, tostring(buf), atof(buf), CON|NUM, symtab);
201 /* should this also have STR set? */
202 RET(NUMBER);

--- 386 unchanged lines hidden ---