1999-04-16 03:35:26 +02:00
|
|
|
/* Scheme/Guile language support routines for GDB, the GNU debugger.
|
2003-09-15 00:35:33 +02:00
|
|
|
|
2005-02-06 Andrew Cagney <cagney@gnu.org>
* value.c (value_contents, value_contents_writeable): New
functions.
* value.h (VALUE_CONTENTS): Delete macro.
(value_contents, value_contents_writeable): Declare.
* xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
* stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
* sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
* rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
* ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
* m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
* jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
* hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
* c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
* cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
* arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
* ada-valprint.c, ada-lang.c: Update.
2005-02-07 01:09:56 +01:00
|
|
|
Copyright 1995, 1996, 2000, 2003, 2005 Free Software Foundation,
|
|
|
|
Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "symtab.h"
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
#include "expression.h"
|
|
|
|
#include "parser-defs.h"
|
|
|
|
#include "language.h"
|
|
|
|
#include "value.h"
|
|
|
|
#include "c-lang.h"
|
|
|
|
#include "scm-lang.h"
|
|
|
|
#include "scm-tags.h"
|
|
|
|
|
|
|
|
#define USE_EXPRSTRING 0
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
static void scm_lreadparen (int);
|
|
|
|
static int scm_skip_ws (void);
|
|
|
|
static void scm_read_token (int, int);
|
|
|
|
static LONGEST scm_istring2number (char *, int, int);
|
|
|
|
static LONGEST scm_istr2int (char *, int, int);
|
|
|
|
static void scm_lreadr (int);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
static LONGEST
|
2000-07-30 03:48:28 +02:00
|
|
|
scm_istr2int (char *str, int len, int radix)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
LONGEST inum = 0;
|
|
|
|
int c;
|
|
|
|
int sign = 0;
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
if (0 >= len)
|
|
|
|
return SCM_BOOL_F; /* zero scm_length */
|
1999-04-16 03:35:26 +02:00
|
|
|
switch (str[0])
|
1999-07-07 22:19:36 +02:00
|
|
|
{ /* leading sign */
|
1999-04-16 03:35:26 +02:00
|
|
|
case '-':
|
|
|
|
case '+':
|
|
|
|
sign = str[0];
|
1999-07-07 22:19:36 +02:00
|
|
|
if (++i == len)
|
|
|
|
return SCM_BOOL_F; /* bad if lone `+' or `-' */
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
1999-07-07 22:19:36 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
switch (c = str[i++])
|
|
|
|
{
|
|
|
|
case '0':
|
|
|
|
case '1':
|
|
|
|
case '2':
|
|
|
|
case '3':
|
|
|
|
case '4':
|
|
|
|
case '5':
|
|
|
|
case '6':
|
|
|
|
case '7':
|
|
|
|
case '8':
|
|
|
|
case '9':
|
|
|
|
c = c - '0';
|
|
|
|
goto accumulate;
|
|
|
|
case 'A':
|
|
|
|
case 'B':
|
|
|
|
case 'C':
|
|
|
|
case 'D':
|
|
|
|
case 'E':
|
|
|
|
case 'F':
|
|
|
|
c = c - 'A' + 10;
|
|
|
|
goto accumulate;
|
|
|
|
case 'a':
|
|
|
|
case 'b':
|
|
|
|
case 'c':
|
|
|
|
case 'd':
|
|
|
|
case 'e':
|
|
|
|
case 'f':
|
|
|
|
c = c - 'a' + 10;
|
|
|
|
accumulate:
|
|
|
|
if (c >= radix)
|
|
|
|
return SCM_BOOL_F; /* bad digit for radix */
|
|
|
|
inum *= radix;
|
|
|
|
inum += c;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return SCM_BOOL_F; /* not a digit */
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
1999-07-07 22:19:36 +02:00
|
|
|
while (i < len);
|
1999-04-16 03:35:26 +02:00
|
|
|
if (sign == '-')
|
|
|
|
inum = -inum;
|
|
|
|
return SCM_MAKINUM (inum);
|
|
|
|
}
|
|
|
|
|
|
|
|
static LONGEST
|
2000-07-30 03:48:28 +02:00
|
|
|
scm_istring2number (char *str, int len, int radix)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
char ex = 0;
|
|
|
|
char ex_p = 0, rx_p = 0; /* Only allow 1 exactness and 1 radix prefix */
|
|
|
|
#if 0
|
|
|
|
SCM res;
|
|
|
|
#endif
|
1999-07-07 22:19:36 +02:00
|
|
|
if (len == 1)
|
|
|
|
if (*str == '+' || *str == '-') /* Catches lone `+' and `-' for speed */
|
1999-04-16 03:35:26 +02:00
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
while ((len - i) >= 2 && str[i] == '#' && ++i)
|
|
|
|
switch (str[i++])
|
|
|
|
{
|
|
|
|
case 'b':
|
|
|
|
case 'B':
|
|
|
|
if (rx_p++)
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
radix = 2;
|
|
|
|
break;
|
|
|
|
case 'o':
|
|
|
|
case 'O':
|
|
|
|
if (rx_p++)
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
radix = 8;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
case 'D':
|
|
|
|
if (rx_p++)
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
radix = 10;
|
|
|
|
break;
|
|
|
|
case 'x':
|
|
|
|
case 'X':
|
|
|
|
if (rx_p++)
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
radix = 16;
|
|
|
|
break;
|
|
|
|
case 'i':
|
|
|
|
case 'I':
|
|
|
|
if (ex_p++)
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
ex = 2;
|
|
|
|
break;
|
|
|
|
case 'e':
|
|
|
|
case 'E':
|
|
|
|
if (ex_p++)
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
ex = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
switch (ex)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
return scm_istr2int (&str[i], len - i, radix);
|
|
|
|
case 0:
|
|
|
|
return scm_istr2int (&str[i], len - i, radix);
|
1999-04-16 03:35:26 +02:00
|
|
|
#if 0
|
1999-07-07 22:19:36 +02:00
|
|
|
if NFALSEP
|
|
|
|
(res) return res;
|
1999-04-16 03:35:26 +02:00
|
|
|
#ifdef FLOATS
|
1999-07-07 22:19:36 +02:00
|
|
|
case 2:
|
|
|
|
return scm_istr2flo (&str[i], len - i, radix);
|
1999-04-16 03:35:26 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
1999-07-07 22:19:36 +02:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
return SCM_BOOL_F;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-30 03:48:28 +02:00
|
|
|
scm_read_token (int c, int weird)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
c = *lexptr++;
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case '[':
|
|
|
|
case ']':
|
|
|
|
case '(':
|
|
|
|
case ')':
|
|
|
|
case '\"':
|
|
|
|
case ';':
|
1999-07-07 22:19:36 +02:00
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\r':
|
|
|
|
case '\f':
|
1999-04-16 03:35:26 +02:00
|
|
|
case '\n':
|
|
|
|
if (weird)
|
|
|
|
goto default_case;
|
1999-07-07 22:19:36 +02:00
|
|
|
case '\0': /* End of line */
|
1999-04-16 03:35:26 +02:00
|
|
|
eof_case:
|
|
|
|
--lexptr;
|
|
|
|
return;
|
|
|
|
case '\\':
|
|
|
|
if (!weird)
|
|
|
|
goto default_case;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
c = *lexptr++;
|
|
|
|
if (c == '\0')
|
|
|
|
goto eof_case;
|
|
|
|
else
|
|
|
|
goto default_case;
|
|
|
|
}
|
|
|
|
case '}':
|
|
|
|
if (!weird)
|
|
|
|
goto default_case;
|
|
|
|
|
|
|
|
c = *lexptr++;
|
|
|
|
if (c == '#')
|
|
|
|
return;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
--lexptr;
|
|
|
|
c = '}';
|
|
|
|
goto default_case;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
default_case:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
static int
|
2000-07-30 03:48:28 +02:00
|
|
|
scm_skip_ws (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2003-09-14 Andrew Cagney <cagney@redhat.com>
* alpha-nat.c: Remove some occurances of "register".
* alpha-tdep.c, arm-tdep.c, blockframe.c, breakpoint.c: Ditto.
* buildsym.c, c-typeprint.c, c-valprint.c, coffread.c: Ditto.
* corefile.c, cp-support.c, cp-valprint.c, cris-tdep.c: Ditto.
* dbxread.c, dcache.c, dwarf2read.c, elfread.c: Ditto.
* environ.c, eval.c, event-top.c, f-typeprint.c: Ditto.
* f-valprint.c, findvar.c, frame.c, gdbtypes.c: Ditto.
* h8300-tdep.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c: Ditto.
* hppam3-nat.c, hpread.c, ia64-aix-nat.c, ia64-linux-nat.c: Ditto.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Ditto.
* infttrace.c, irix5-nat.c, jv-typeprint.c: Ditto.
* jv-valprint.c, m68k-tdep.c, m68klinux-nat.c, main.c: Ditto.
* mdebugread.c, minsyms.c, mips-linux-tdep.c: Ditto.
* mips-nat.c, mips-tdep.c, mipsread.c, mipsv4-nat.c: Ditto.
* ns32k-tdep.c, objfiles.c, p-typeprint.c: Ditto.
* p-valprint.c, ppc-linux-nat.c, printcmd.c: Ditto.
* remote-mips.c, remote-vx.c, rs6000-nat.c: Ditto.
* rs6000-tdep.c, scm-exp.c, sh-tdep.c, sh64-tdep.c: Ditto.
* solib.c, somread.c, source.c, sparc-tdep.c: Ditto.
* stabsread.c, stack.c, standalone.c, symfile.c: Ditto.
* symmisc.c, symtab.c, top.c, tracepoint.c: Ditto.
* typeprint.c, utils.c, valarith.c, valops.c: Ditto.
* values.c, vax-tdep.c, xcoffread.c: Ditto.
2003-09-14 18:32:14 +02:00
|
|
|
int c;
|
1999-04-16 03:35:26 +02:00
|
|
|
while (1)
|
|
|
|
switch ((c = *lexptr++))
|
|
|
|
{
|
|
|
|
case '\0':
|
|
|
|
goteof:
|
|
|
|
return c;
|
|
|
|
case ';':
|
|
|
|
lp:
|
|
|
|
switch ((c = *lexptr++))
|
|
|
|
{
|
|
|
|
case '\0':
|
|
|
|
goto goteof;
|
|
|
|
default:
|
|
|
|
goto lp;
|
|
|
|
case '\n':
|
|
|
|
break;
|
|
|
|
}
|
1999-07-07 22:19:36 +02:00
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\r':
|
|
|
|
case '\f':
|
|
|
|
case '\n':
|
1999-04-16 03:35:26 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-30 03:48:28 +02:00
|
|
|
scm_lreadparen (int skipping)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
int c = scm_skip_ws ();
|
|
|
|
if (')' == c || ']' == c)
|
|
|
|
return;
|
|
|
|
--lexptr;
|
|
|
|
if (c == '\0')
|
|
|
|
error ("missing close paren");
|
|
|
|
scm_lreadr (skipping);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-30 03:48:28 +02:00
|
|
|
scm_lreadr (int skipping)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int c, j;
|
|
|
|
struct stoken str;
|
|
|
|
LONGEST svalue = 0;
|
1999-07-07 22:19:36 +02:00
|
|
|
tryagain:
|
1999-04-16 03:35:26 +02:00
|
|
|
c = *lexptr++;
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case '\0':
|
|
|
|
lexptr--;
|
|
|
|
return;
|
|
|
|
case '[':
|
|
|
|
case '(':
|
|
|
|
scm_lreadparen (skipping);
|
|
|
|
return;
|
|
|
|
case ']':
|
|
|
|
case ')':
|
|
|
|
error ("unexpected #\\%c", c);
|
|
|
|
goto tryagain;
|
|
|
|
case '\'':
|
|
|
|
case '`':
|
|
|
|
str.ptr = lexptr - 1;
|
|
|
|
scm_lreadr (skipping);
|
|
|
|
if (!skipping)
|
|
|
|
{
|
2001-11-10 21:44:38 +01:00
|
|
|
struct value *val = scm_evaluate_string (str.ptr, lexptr - str.ptr);
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-12 22:45:08 +01:00
|
|
|
if (!is_scmvalue_type (value_type (val)))
|
1999-04-16 03:35:26 +02:00
|
|
|
error ("quoted scm form yields non-SCM value");
|
2005-02-06 Andrew Cagney <cagney@gnu.org>
* value.c (value_contents, value_contents_writeable): New
functions.
* value.h (VALUE_CONTENTS): Delete macro.
(value_contents, value_contents_writeable): Declare.
* xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
* stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
* sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
* rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
* ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
* m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
* jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
* hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
* c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
* cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
* arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
* ada-valprint.c, ada-lang.c: Update.
2005-02-07 01:09:56 +01:00
|
|
|
svalue = extract_signed_integer (value_contents (val),
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-12 22:45:08 +01:00
|
|
|
TYPE_LENGTH (value_type (val)));
|
1999-04-16 03:35:26 +02:00
|
|
|
goto handle_immediate;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case ',':
|
|
|
|
c = *lexptr++;
|
|
|
|
if ('@' != c)
|
|
|
|
lexptr--;
|
|
|
|
scm_lreadr (skipping);
|
|
|
|
return;
|
|
|
|
case '#':
|
|
|
|
c = *lexptr++;
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case '[':
|
|
|
|
case '(':
|
|
|
|
scm_lreadparen (skipping);
|
|
|
|
return;
|
1999-07-07 22:19:36 +02:00
|
|
|
case 't':
|
|
|
|
case 'T':
|
1999-04-16 03:35:26 +02:00
|
|
|
svalue = SCM_BOOL_T;
|
|
|
|
goto handle_immediate;
|
1999-07-07 22:19:36 +02:00
|
|
|
case 'f':
|
|
|
|
case 'F':
|
1999-04-16 03:35:26 +02:00
|
|
|
svalue = SCM_BOOL_F;
|
|
|
|
goto handle_immediate;
|
1999-07-07 22:19:36 +02:00
|
|
|
case 'b':
|
|
|
|
case 'B':
|
|
|
|
case 'o':
|
|
|
|
case 'O':
|
|
|
|
case 'd':
|
|
|
|
case 'D':
|
|
|
|
case 'x':
|
|
|
|
case 'X':
|
|
|
|
case 'i':
|
|
|
|
case 'I':
|
|
|
|
case 'e':
|
|
|
|
case 'E':
|
1999-04-16 03:35:26 +02:00
|
|
|
lexptr--;
|
|
|
|
c = '#';
|
|
|
|
goto num;
|
1999-07-07 22:19:36 +02:00
|
|
|
case '*': /* bitvector */
|
1999-04-16 03:35:26 +02:00
|
|
|
scm_read_token (c, 0);
|
|
|
|
return;
|
|
|
|
case '{':
|
|
|
|
scm_read_token (c, 1);
|
|
|
|
return;
|
1999-07-07 22:19:36 +02:00
|
|
|
case '\\': /* character */
|
1999-04-16 03:35:26 +02:00
|
|
|
c = *lexptr++;
|
|
|
|
scm_read_token (c, 0);
|
|
|
|
return;
|
|
|
|
case '|':
|
|
|
|
j = 1; /* here j is the comment nesting depth */
|
|
|
|
lp:
|
|
|
|
c = *lexptr++;
|
|
|
|
lpc:
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case '\0':
|
|
|
|
error ("unbalanced comment");
|
|
|
|
default:
|
|
|
|
goto lp;
|
|
|
|
case '|':
|
|
|
|
if ('#' != (c = *lexptr++))
|
|
|
|
goto lpc;
|
|
|
|
if (--j)
|
|
|
|
goto lp;
|
|
|
|
break;
|
|
|
|
case '#':
|
|
|
|
if ('|' != (c = *lexptr++))
|
|
|
|
goto lpc;
|
|
|
|
++j;
|
|
|
|
goto lp;
|
|
|
|
}
|
|
|
|
goto tryagain;
|
|
|
|
case '.':
|
|
|
|
default:
|
|
|
|
#if 0
|
|
|
|
callshrp:
|
|
|
|
#endif
|
|
|
|
scm_lreadr (skipping);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case '\"':
|
|
|
|
while ('\"' != (c = *lexptr++))
|
|
|
|
{
|
|
|
|
if (c == '\\')
|
|
|
|
switch (c = *lexptr++)
|
|
|
|
{
|
|
|
|
case '\0':
|
|
|
|
error ("non-terminated string literal");
|
|
|
|
case '\n':
|
|
|
|
continue;
|
|
|
|
case '0':
|
|
|
|
case 'f':
|
|
|
|
case 'n':
|
|
|
|
case 'r':
|
|
|
|
case 't':
|
|
|
|
case 'a':
|
|
|
|
case 'v':
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
1999-07-07 22:19:36 +02:00
|
|
|
case '0':
|
|
|
|
case '1':
|
|
|
|
case '2':
|
|
|
|
case '3':
|
|
|
|
case '4':
|
|
|
|
case '5':
|
|
|
|
case '6':
|
|
|
|
case '7':
|
|
|
|
case '8':
|
|
|
|
case '9':
|
1999-04-16 03:35:26 +02:00
|
|
|
case '.':
|
|
|
|
case '-':
|
|
|
|
case '+':
|
|
|
|
num:
|
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
str.ptr = lexptr - 1;
|
1999-04-16 03:35:26 +02:00
|
|
|
scm_read_token (c, 0);
|
|
|
|
if (!skipping)
|
|
|
|
{
|
|
|
|
svalue = scm_istring2number (str.ptr, lexptr - str.ptr, 10);
|
|
|
|
if (svalue != SCM_BOOL_F)
|
|
|
|
goto handle_immediate;
|
|
|
|
goto tok;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case ':':
|
|
|
|
scm_read_token ('-', 0);
|
|
|
|
return;
|
|
|
|
#if 0
|
|
|
|
do_symbol:
|
|
|
|
#endif
|
|
|
|
default:
|
1999-07-07 22:19:36 +02:00
|
|
|
str.ptr = lexptr - 1;
|
1999-04-16 03:35:26 +02:00
|
|
|
scm_read_token (c, 0);
|
|
|
|
tok:
|
|
|
|
if (!skipping)
|
|
|
|
{
|
|
|
|
str.length = lexptr - str.ptr;
|
|
|
|
if (str.ptr[0] == '$')
|
|
|
|
{
|
|
|
|
write_dollar_variable (str);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
write_exp_elt_opcode (OP_NAME);
|
|
|
|
write_exp_string (str);
|
|
|
|
write_exp_elt_opcode (OP_NAME);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
1999-07-07 22:19:36 +02:00
|
|
|
handle_immediate:
|
1999-04-16 03:35:26 +02:00
|
|
|
if (!skipping)
|
|
|
|
{
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
write_exp_elt_type (builtin_type_scm);
|
|
|
|
write_exp_elt_longcst (svalue);
|
|
|
|
write_exp_elt_opcode (OP_LONG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
scm_parse (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
char *start;
|
1999-04-16 03:35:26 +02:00
|
|
|
while (*lexptr == ' ')
|
|
|
|
lexptr++;
|
|
|
|
start = lexptr;
|
|
|
|
scm_lreadr (USE_EXPRSTRING);
|
|
|
|
#if USE_EXPRSTRING
|
|
|
|
str.length = lexptr - start;
|
|
|
|
str.ptr = start;
|
|
|
|
write_exp_elt_opcode (OP_EXPRSTRING);
|
|
|
|
write_exp_string (str);
|
|
|
|
write_exp_elt_opcode (OP_EXPRSTRING);
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|