changing code for the new reader and compiler
This commit is contained in:
parent
ad4c8e35d4
commit
9752533d12
@ -333,7 +333,6 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
runstatedir = @runstatedir@
|
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
@ -344,7 +344,6 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
runstatedir = @runstatedir@
|
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
14
configure
vendored
14
configure
vendored
@ -759,7 +759,6 @@ infodir
|
|||||||
docdir
|
docdir
|
||||||
oldincludedir
|
oldincludedir
|
||||||
includedir
|
includedir
|
||||||
runstatedir
|
|
||||||
localstatedir
|
localstatedir
|
||||||
sharedstatedir
|
sharedstatedir
|
||||||
sysconfdir
|
sysconfdir
|
||||||
@ -851,7 +850,6 @@ datadir='${datarootdir}'
|
|||||||
sysconfdir='${prefix}/etc'
|
sysconfdir='${prefix}/etc'
|
||||||
sharedstatedir='${prefix}/com'
|
sharedstatedir='${prefix}/com'
|
||||||
localstatedir='${prefix}/var'
|
localstatedir='${prefix}/var'
|
||||||
runstatedir='${localstatedir}/run'
|
|
||||||
includedir='${prefix}/include'
|
includedir='${prefix}/include'
|
||||||
oldincludedir='/usr/include'
|
oldincludedir='/usr/include'
|
||||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||||
@ -1104,15 +1102,6 @@ do
|
|||||||
| -silent | --silent | --silen | --sile | --sil)
|
| -silent | --silent | --silen | --sile | --sil)
|
||||||
silent=yes ;;
|
silent=yes ;;
|
||||||
|
|
||||||
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
|
||||||
| --runstate | --runstat | --runsta | --runst | --runs \
|
|
||||||
| --run | --ru | --r)
|
|
||||||
ac_prev=runstatedir ;;
|
|
||||||
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
|
||||||
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
|
||||||
| --run=* | --ru=* | --r=*)
|
|
||||||
runstatedir=$ac_optarg ;;
|
|
||||||
|
|
||||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||||
ac_prev=sbindir ;;
|
ac_prev=sbindir ;;
|
||||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||||
@ -1250,7 +1239,7 @@ fi
|
|||||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||||
libdir localedir mandir runstatedir
|
libdir localedir mandir
|
||||||
do
|
do
|
||||||
eval ac_val=\$$ac_var
|
eval ac_val=\$$ac_var
|
||||||
# Remove trailing slashes.
|
# Remove trailing slashes.
|
||||||
@ -1403,7 +1392,6 @@ Fine tuning of the installation directories:
|
|||||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||||
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
|
||||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||||
--includedir=DIR C header files [PREFIX/include]
|
--includedir=DIR C header files [PREFIX/include]
|
||||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||||
|
@ -392,7 +392,6 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
runstatedir = @runstatedir@
|
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
51
lib/cnode.c
51
lib/cnode.c
@ -30,7 +30,7 @@ static hcl_cnode_t* make_cnode (hcl_t* hcl, hcl_cnode_type_t type, const hcl_iol
|
|||||||
{
|
{
|
||||||
hcl_cnode_t* cnode;
|
hcl_cnode_t* cnode;
|
||||||
|
|
||||||
cnode = hcl_allocmem(hcl, HCL_SIZEOF(*cnode) + extra_space);
|
cnode = hcl_callocmem(hcl, HCL_SIZEOF(*cnode) + extra_space);
|
||||||
if (HCL_UNLIKELY(!cnode)) return HCL_NULL;
|
if (HCL_UNLIKELY(!cnode)) return HCL_NULL;
|
||||||
|
|
||||||
cnode->type = type;
|
cnode->type = type;
|
||||||
@ -40,14 +40,7 @@ static hcl_cnode_t* make_cnode (hcl_t* hcl, hcl_cnode_type_t type, const hcl_iol
|
|||||||
|
|
||||||
hcl_cnode_t* hcl_makecnodersn (hcl_t* hcl, const hcl_ioloc_t* loc)
|
hcl_cnode_t* hcl_makecnodersn (hcl_t* hcl, const hcl_ioloc_t* loc)
|
||||||
{
|
{
|
||||||
hcl_cnode_t* cnode;
|
return make_cnode(hcl, HCL_CNODE_RSN, loc, 0);
|
||||||
cnode = make_cnode(hcl, loc);
|
|
||||||
if (HCL_UNLIKELY(!cnode)) return HCL_NULL;
|
|
||||||
cnode->u.rsn.head = HCL_NULL;
|
|
||||||
cnode->u.rsn.tail = HCL_NULL;
|
|
||||||
cnode->u.rsn.flags = 0;
|
|
||||||
cnode->u.rsn.rsn_par = HCL_NULL;
|
|
||||||
return cnode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc)
|
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc)
|
||||||
@ -73,11 +66,32 @@ hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len)
|
||||||
|
{
|
||||||
|
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_SYMBOL, loc, HCL_SIZEOF(*ptr) * (len + 1));
|
||||||
|
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
||||||
|
c->u.symbol.ptr = (hcl_ooch_t*)(c + 1);
|
||||||
|
c->u.symbol.len = len;
|
||||||
|
hcl_copy_oochars (c->u.symbol.ptr, ptr, len);
|
||||||
|
c->u.symbol.ptr[len] = '\0';
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len)
|
||||||
|
{
|
||||||
|
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_STRLIT, loc, HCL_SIZEOF(*ptr) * (len + 1));
|
||||||
|
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
||||||
|
c->u.strlit.ptr = (hcl_ooch_t*)(c + 1);
|
||||||
|
c->u.strlit.len = len;
|
||||||
|
hcl_copy_oochars (c->u.strlit.ptr, ptr, len);
|
||||||
|
c->u.strlit.ptr[len] = '\0';
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len)
|
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len)
|
||||||
{
|
{
|
||||||
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_NUMLIT, loc, HCL_SIZEOF(*ptr) * (len + 1));
|
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_NUMLIT, loc, HCL_SIZEOF(*ptr) * (len + 1));
|
||||||
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
||||||
|
|
||||||
c->u.numlit.ptr = (hcl_ooch_t*)(c + 1);
|
c->u.numlit.ptr = (hcl_ooch_t*)(c + 1);
|
||||||
c->u.numlit.len = len;
|
c->u.numlit.len = len;
|
||||||
hcl_copy_oochars (c->u.numlit.ptr, ptr, len);
|
hcl_copy_oochars (c->u.numlit.ptr, ptr, len);
|
||||||
@ -108,20 +122,9 @@ hcl_cnode_t* hcl_makecnodefpdeclit (hcl_t* hcl, const hcl_ioloc_t* loc, const hc
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len)
|
|
||||||
{
|
|
||||||
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_STRLIT, loc, HCL_SIZEOF(*ptr) * (len + 1));
|
|
||||||
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
|
||||||
c->u.strlit.ptr = (hcl_ooch_t*)(c + 1);
|
|
||||||
c->u.strlit.len = len;
|
|
||||||
hcl_copy_oochars (c->u.strlit.ptr, ptr, len);
|
|
||||||
c->u.strlit.ptr[len] = '\0';
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_oow_t v)
|
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_oow_t v)
|
||||||
{
|
{
|
||||||
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_ERRLIT, loc, 0);
|
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_SMPTRLIT, loc, 0);
|
||||||
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
||||||
c->u.smptrlit.v = v;
|
c->u.smptrlit.v = v;
|
||||||
return c;
|
return c;
|
||||||
@ -137,9 +140,9 @@ hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_ooi_t
|
|||||||
|
|
||||||
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t* car, hcl_cnode_t* cdr)
|
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t* car, hcl_cnode_t* cdr)
|
||||||
{
|
{
|
||||||
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_ERRLIT, loc, 0);
|
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_CONS, loc, 0);
|
||||||
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
if (HCL_UNLIKELY(!c)) return HCL_NULL;
|
||||||
c->u.cons.car = car;
|
c->u.cons.car = car;
|
||||||
c->u.cons.cdr = cdr;
|
c->u.cons.cdr = cdr;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
#ifndef _HCL_PRV_H_
|
#ifndef _HCL_PRV_H_
|
||||||
#define _HCL_PRV_H_
|
#define _HCL_PRV_H_
|
||||||
|
|
||||||
#include "hcl.h"
|
#include <hcl.h>
|
||||||
#include "hcl-fmt.h"
|
#include <hcl-fmt.h>
|
||||||
#include "hcl-utl.h"
|
#include <hcl-utl.h>
|
||||||
|
|
||||||
/* you can define this to either 1 or 2 */
|
/* you can define this to either 1 or 2 */
|
||||||
#define HCL_HCL_CODE_LONG_PARAM_SIZE 2
|
#define HCL_HCL_CODE_LONG_PARAM_SIZE 2
|
||||||
@ -186,6 +186,7 @@ enum hcl_cnode_type_t
|
|||||||
HCL_CNODE_RSN, /* internally used */
|
HCL_CNODE_RSN, /* internally used */
|
||||||
|
|
||||||
HCL_CNODE_CHARLIT,
|
HCL_CNODE_CHARLIT,
|
||||||
|
HCL_CNODE_SYMBOL,
|
||||||
HCL_CNODE_STRLIT,
|
HCL_CNODE_STRLIT,
|
||||||
HCL_CNODE_NUMLIT,
|
HCL_CNODE_NUMLIT,
|
||||||
HCL_CNODE_RADNUMLIT,
|
HCL_CNODE_RADNUMLIT,
|
||||||
@ -196,7 +197,7 @@ enum hcl_cnode_type_t
|
|||||||
HCL_CNODE_TRUE,
|
HCL_CNODE_TRUE,
|
||||||
HCL_CNODE_FALSE,
|
HCL_CNODE_FALSE,
|
||||||
|
|
||||||
HCL_CNODE_AND = 1,
|
HCL_CNODE_AND,
|
||||||
HCL_CNODE_BREAK,
|
HCL_CNODE_BREAK,
|
||||||
HCL_CNODE_DEFUN,
|
HCL_CNODE_DEFUN,
|
||||||
HCL_CNODE_DO,
|
HCL_CNODE_DO,
|
||||||
@ -211,11 +212,13 @@ enum hcl_cnode_type_t
|
|||||||
HCL_CNODE_UNTIL,
|
HCL_CNODE_UNTIL,
|
||||||
HCL_CNODE_WHILE,
|
HCL_CNODE_WHILE,
|
||||||
|
|
||||||
HCL_CNODE_XLIST = 0, /* () - executable list */
|
|
||||||
HCL_CNODE_ARRAY, /* [] */
|
HCL_CNODE_CONS, /* generic member cons. the beginning of a list may have the following */
|
||||||
HCL_CNODE_BYTEARRAY, /* #[] */
|
HCL_CNODE_CONS_XLIST, /* () - executable list */
|
||||||
HCL_CNODE_DIC, /* {} */
|
HCL_CNODE_CONS_ARRAY, /* [] */
|
||||||
HCL_CNODE_QLIST /* #() - data list */
|
HCL_CNODE_CONS_BYTEARRAY, /* #[] */
|
||||||
|
HCL_CNODE_CONS_DIC, /* {} */
|
||||||
|
HCL_CNODE_CONS_QLIST /* #() - data list */
|
||||||
};
|
};
|
||||||
typedef enum hcl_cnode_type_t hcl_cnode_type_t;
|
typedef enum hcl_cnode_type_t hcl_cnode_type_t;
|
||||||
|
|
||||||
@ -232,14 +235,20 @@ struct hcl_cnode_t
|
|||||||
{
|
{
|
||||||
hcl_cnode_t* head;
|
hcl_cnode_t* head;
|
||||||
hcl_cnode_t* tail;
|
hcl_cnode_t* tail;
|
||||||
hcl_oow_t count;
|
int flagv;
|
||||||
hcl_cnode_t* rsn_par; /* parent item in the stack */
|
unsigned int count;
|
||||||
|
hcl_cnode_t* rsn_par; /* parent item in the stack. must point to hcl_cnode_t* of the HCL_CNODE_RSN type. */
|
||||||
} rsn; /* reader stack node */
|
} rsn; /* reader stack node */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
hcl_ooch_t v;
|
hcl_ooch_t v;
|
||||||
} charlit;
|
} charlit;
|
||||||
struct
|
struct
|
||||||
|
{
|
||||||
|
hcl_ooch_t* ptr;
|
||||||
|
hcl_oow_t len;
|
||||||
|
} symbol;
|
||||||
|
struct
|
||||||
{
|
{
|
||||||
hcl_ooch_t* ptr;
|
hcl_ooch_t* ptr;
|
||||||
hcl_oow_t len;
|
hcl_oow_t len;
|
||||||
@ -366,6 +375,9 @@ struct hcl_compiler_t
|
|||||||
hcl_oop_t s; /* stack for reading */
|
hcl_oop_t s; /* stack for reading */
|
||||||
hcl_oop_t e; /* last object read */
|
hcl_oop_t e; /* last object read */
|
||||||
|
|
||||||
|
hcl_cnode_t* st; /* stack for reading with cnode */
|
||||||
|
hcl_cnode_t* ecn; /* last object cnode read */
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
hcl_oob_t* ptr;
|
hcl_oob_t* ptr;
|
||||||
@ -1251,12 +1263,14 @@ hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc);
|
|||||||
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_ioloc_t* loc);
|
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_ioloc_t* loc);
|
||||||
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_ioloc_t* loc);
|
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_ioloc_t* loc);
|
||||||
hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t ch);
|
hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t ch);
|
||||||
|
hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
||||||
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
||||||
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
||||||
hcl_cnode_t* hcl_makecnoderadnumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
hcl_cnode_t* hcl_makecnoderadnumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
||||||
hcl_cnode_t* hcl_makecnodefpdeclit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
hcl_cnode_t* hcl_makecnodefpdeclit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_ooch_t* ptr, hcl_oow_t len);
|
||||||
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_oow_t v);
|
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_oow_t v);
|
||||||
hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_ooi_t v);
|
hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_ooi_t v);
|
||||||
|
|
||||||
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t* car, hcl_cnode_t* cdr);
|
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t* car, hcl_cnode_t* cdr);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
242
lib/read2.c
242
lib/read2.c
@ -1405,7 +1405,7 @@ static int end_include (hcl_t* hcl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static HCL_INLINE hcl_cnode_t* enter_list (hcl_t* hcl, int flagv)
|
static HCL_INLINE hcl_cnode_t* enter_list (hcl_t* hcl, const hcl_ioloc_t* loc, int flagv)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
hcl_oop_oop_t rsa;
|
hcl_oop_oop_t rsa;
|
||||||
@ -1429,17 +1429,19 @@ static HCL_INLINE hcl_cnode_t* enter_list (hcl_t* hcl, int flagv)
|
|||||||
return hcl->c->r.s;
|
return hcl->c->r.s;
|
||||||
#else
|
#else
|
||||||
hcl_cnode_t* rsn;
|
hcl_cnode_t* rsn;
|
||||||
rsn = hcl_makecnodersn(hcl, loc)
|
rsn = hcl_makecnodersn(hcl, loc);
|
||||||
if (HCL_UNLIKELY(!rsn)) return HCL_NULL
|
if (HCL_UNLIKELY(!rsn)) return HCL_NULL;
|
||||||
rsn->flags = flagv;
|
rsn->u.rsn.flagv = flagv;
|
||||||
rsn->rsn_par = hcl->c->r.st; /* push */
|
rsn->u.rsn.count = 0;
|
||||||
hcl->c.r.st = rsn;
|
rsn->u.rsn.rsn_par = hcl->c->r.st; /* push */
|
||||||
|
hcl->c->r.st = rsn;
|
||||||
return rsn; /* returns the stack top */
|
return rsn; /* returns the stack top */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static HCL_INLINE hcl_oop_t leave_list (hcl_t* hcl, int* flagv, int* oldflagv)
|
static HCL_INLINE hcl_oop_t leave_list (hcl_t* hcl, int* flagv, int* oldflagv)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
hcl_oop_oop_t rsa;
|
hcl_oop_oop_t rsa;
|
||||||
hcl_oop_t head;
|
hcl_oop_t head;
|
||||||
int fv, concode;
|
int fv, concode;
|
||||||
@ -1543,6 +1545,114 @@ done:
|
|||||||
|
|
||||||
if (HCL_IS_CONS(hcl,head)) HCL_OBJ_SET_FLAGS_SYNCODE(head, concode);
|
if (HCL_IS_CONS(hcl,head)) HCL_OBJ_SET_FLAGS_SYNCODE(head, concode);
|
||||||
return head;
|
return head;
|
||||||
|
#else
|
||||||
|
hcl_cnode_t* stt;
|
||||||
|
hcl_cnode_t* head;
|
||||||
|
int fv, concode;
|
||||||
|
|
||||||
|
/* the stack must not be empty - cannot leave a list without entering it */
|
||||||
|
HCL_ASSERT (hcl, !HCL_IS_NIL(hcl,hcl->c->r.s));
|
||||||
|
|
||||||
|
stt = hcl->c->r.st;
|
||||||
|
HCL_ASSERT (hcl, stt->type == HCL_CNODE_RSN);
|
||||||
|
|
||||||
|
|
||||||
|
head = stt->u.rsn.head;
|
||||||
|
fv = stt->u.rsn.flagv;
|
||||||
|
concode = LIST_FLAG_GET_CONCODE(fv);
|
||||||
|
|
||||||
|
hcl->c->r.st = stt->u.rsn.rsn_par; /* pop off */
|
||||||
|
stt->u.rsn.rsn_par = HCL_NULL;
|
||||||
|
|
||||||
|
if (fv & (COMMAED | COLONED))
|
||||||
|
{
|
||||||
|
hcl_setsynerr (hcl, ((fv & COMMAED)? HCL_SYNERR_COMMANOVALUE: HCL_SYNERR_COLONNOVALUE), TOKEN_LOC(hcl), HCL_NULL);
|
||||||
|
return HCL_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* TODO: literalize the list if all the elements are all literals */
|
||||||
|
if (concode == HCL_CONCODE_ARRAY || concode == HCL_CONCODE_BYTEARRAY /*|| concode == HCL_CONCODE_DIC*/)
|
||||||
|
{
|
||||||
|
/* convert a list to an array */
|
||||||
|
hcl_oop_oop_t arr;
|
||||||
|
hcl_oop_t ptr;
|
||||||
|
hcl_oow_t count;
|
||||||
|
|
||||||
|
ptr = head;
|
||||||
|
count = 0;
|
||||||
|
while (ptr != hcl->_nil)
|
||||||
|
{
|
||||||
|
hcl_oop_t car;
|
||||||
|
HCL_ASSERT (hcl, HCL_OBJ_GET_FLAGS_BRAND(ptr) == HCL_BRAND_CONS);
|
||||||
|
car = HCL_CONS_CAR(ptr);
|
||||||
|
|
||||||
|
if (!HCL_OOP_IS_NUMERIC(car)) goto done; /* TODO: check if the element is a literal properly here */
|
||||||
|
|
||||||
|
ptr = HCL_CONS_CDR(ptr);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
hcl_pushvolat (hcl, &head);
|
||||||
|
arr = (hcl_oop_oop_t)hcl_makearray(hcl, count, 0);
|
||||||
|
hcl_popvolat (hcl);
|
||||||
|
if (!arr) return HCL_NULL;
|
||||||
|
|
||||||
|
ptr = head;
|
||||||
|
count = 0;
|
||||||
|
while (ptr != hcl->_nil)
|
||||||
|
{
|
||||||
|
arr->slot[count++] = HCL_CONS_CAR(ptr);
|
||||||
|
ptr = HCL_CONS_CDR(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
head = (hcl_oop_t)arr;
|
||||||
|
}
|
||||||
|
done:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
*oldflagv = fv;
|
||||||
|
if (!hcl->c->r.st)
|
||||||
|
{
|
||||||
|
/* the stack is empty after popping.
|
||||||
|
* it is back to the top level.
|
||||||
|
* the top level can never be quoted. */
|
||||||
|
*flagv = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* restore the flag for the outer returning level */
|
||||||
|
stt = hcl->c->r.st;
|
||||||
|
HCL_ASSERT (hcl, stt->type == HCL_CNODE_RSN);
|
||||||
|
*flagv = stt->u.rsn.flagv;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* return the head of the list being left */
|
||||||
|
if (!head)
|
||||||
|
{
|
||||||
|
/* the list is empty. literalize the empty list according to
|
||||||
|
* the list opener. for a list, it is same as #nil. */
|
||||||
|
switch (concode)
|
||||||
|
{
|
||||||
|
case HCL_CONCODE_ARRAY:
|
||||||
|
return (hcl_oop_t)hcl_makearray(hcl, 0, 0);
|
||||||
|
case HCL_CONCODE_BYTEARRAY:
|
||||||
|
return (hcl_oop_t)hcl_makebytearray(hcl, HCL_NULL, 0);
|
||||||
|
case HCL_CONCODE_DIC:
|
||||||
|
return (hcl_oop_t)hcl_makedic(hcl, 100); /* TODO: default dictionary size for empty definition? */
|
||||||
|
|
||||||
|
/* NOTE: empty xlist will get translated to #nil.
|
||||||
|
* this is useful when used in the lambda expression to express an empty argument. also in defun.
|
||||||
|
* (lambda () ...) is equivalent to (lambda #nil ...)
|
||||||
|
* (defun x() ...) */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (head->type == HCL_CNODE_CONS) head->type = HCL_CNODE_CONS + concode;
|
||||||
|
return head;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static HCL_INLINE int can_dot_list (hcl_t* hcl)
|
static HCL_INLINE int can_dot_list (hcl_t* hcl)
|
||||||
@ -1645,15 +1755,15 @@ static HCL_INLINE void clear_comma_colon_flag (hcl_t* hcl)
|
|||||||
rsa->slot[2] = HCL_SMOOI_TO_OOP(flagv);
|
rsa->slot[2] = HCL_SMOOI_TO_OOP(flagv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static hcl_oop_t chain_to_list (hcl_t* hcl, hcl_cnode_t* obj)
|
static hcl_cnode_t* chain_to_list (hcl_t* hcl, hcl_cnode_t* obj)
|
||||||
{
|
{
|
||||||
hcl_oop_oop_t rsa;
|
hcl_cnode_t* stt;
|
||||||
int flagv;
|
int flagv;
|
||||||
|
|
||||||
HCL_ASSERT (hcl, !HCL_IS_NIL(hcl,hcl->c->r.s));
|
stt = hcl->c->r.st;
|
||||||
rsa = (hcl_oop_oop_t)hcl->c->r.s;
|
HCL_ASSERT (hcl, stt != HCL_NULL);
|
||||||
HCL_ASSERT (hcl, HCL_OOP_IS_SMOOI(rsa->slot[2]));
|
HCL_ASSERT (hcl, stt->type == HCL_CNODE_RSN);
|
||||||
flagv = (int)HCL_OOP_TO_SMOOI(rsa->slot[2]);
|
flagv = stt->u.rsn.flagv;
|
||||||
|
|
||||||
if (flagv & CLOSED)
|
if (flagv & CLOSED)
|
||||||
{
|
{
|
||||||
@ -1668,30 +1778,29 @@ static hcl_oop_t chain_to_list (hcl_t* hcl, hcl_cnode_t* obj)
|
|||||||
}
|
}
|
||||||
else if (flagv & DOTTED)
|
else if (flagv & DOTTED)
|
||||||
{
|
{
|
||||||
hcl_ooi_t count;
|
hcl_cnode_t* tail;
|
||||||
|
|
||||||
/* the list must not be empty to have reached the dotted state */
|
/* the list must not be empty to have reached the dotted state */
|
||||||
HCL_ASSERT (hcl, !HCL_IS_NIL(hcl,rsa->slot[1]));
|
HCL_ASSERT (hcl, stt->u.rsn.head != HCL_NULL);
|
||||||
|
HCL_ASSERT (hcl, stt->u.rsn.tail != HCL_NULL);
|
||||||
|
HCL_ASSERT (hcl, stt->u.rsn.count > 0);
|
||||||
|
|
||||||
/* chain the object via 'cdr' of the tail cell */
|
/* chain the object via 'cdr' of the tail cell */
|
||||||
HCL_CONS_CDR(rsa->slot[1]) = obj;
|
tail = stt->u.rsn.tail;
|
||||||
|
HCL_ASSERT (hcl, tail->type >= HCL_CNODE_CONS && tail->type <= HCL_CNODE_CONS_QLIST);
|
||||||
|
tail->u.cons.cdr = obj;
|
||||||
|
|
||||||
/* update the flag to CLOSED so that you can have more than
|
/* update the flag to CLOSED so that you can have more than
|
||||||
* one item after the dot. */
|
* one item after the dot. */
|
||||||
flagv |= CLOSED;
|
flagv |= CLOSED;
|
||||||
rsa->slot[2] = HCL_SMOOI_TO_OOP(flagv);
|
stt->u.rsn.flagv = flagv;
|
||||||
|
/* TODO: check overflow on count??? */
|
||||||
count = HCL_OOP_TO_SMOOI(rsa->slot[4]) + 1;
|
stt->u.rsn.count++;
|
||||||
rsa->slot[4] = HCL_SMOOI_TO_OOP(count);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hcl_oop_t cons;
|
hcl_cnode_t* cons, * tail;
|
||||||
hcl_ooi_t count;
|
|
||||||
|
|
||||||
count = HCL_OOP_TO_SMOOI(rsa->slot[4]);
|
if ((flagv & JSON) && stt->u.rsn.count > 0 && !(flagv & (COMMAED | COLONED)))
|
||||||
|
|
||||||
if ((flagv & JSON) && count > 0 && !(flagv & (COMMAED | COLONED)))
|
|
||||||
{
|
{
|
||||||
/* there is no separator between array/dictionary elements
|
/* there is no separator between array/dictionary elements
|
||||||
* for instance, [1 2] { 10 20 } */
|
* for instance, [1 2] { 10 20 } */
|
||||||
@ -1699,48 +1808,37 @@ static hcl_oop_t chain_to_list (hcl_t* hcl, hcl_cnode_t* obj)
|
|||||||
return HCL_NULL;
|
return HCL_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcl_pushvolat (hcl, (hcl_oop_t*)&rsa);
|
|
||||||
cons = hcl_makecnodecons(hcl, &obj->loc, obj, HCL_NULL);
|
cons = hcl_makecnodecons(hcl, &obj->loc, obj, HCL_NULL);
|
||||||
hcl_popvolat (hcl);
|
|
||||||
if (HCL_UNLIKELY(!cons)) return HCL_NULL;
|
if (HCL_UNLIKELY(!cons)) return HCL_NULL;
|
||||||
|
|
||||||
if (HCL_IS_NIL(hcl, rsa->slot[0]))
|
if (!stt->u.rsn.head)
|
||||||
{
|
{
|
||||||
/* the list head is not set yet. it is the first
|
/* the list head is not set yet. it is the first
|
||||||
* element added to the list. let both head and tail
|
* element added to the list. let both head and tail
|
||||||
* point to the new cons cell */
|
* point to the new cons cell */
|
||||||
HCL_ASSERT (hcl, HCL_IS_NIL(hcl, rsa->slot[1]));
|
HCL_ASSERT (hcl, stt->u.rsn.tail == HCL_NULL);
|
||||||
rsa->slot[0] = cons;
|
HCL_ASSERT (hcl, stt->u.rsn.count == 0);
|
||||||
rsa->slot[1] = cons;
|
|
||||||
|
stt->u.rsn.head = cons;
|
||||||
|
stt->u.rsn.tail = cons;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* the new cons cell is not the first element.
|
/* the new cons cell is not the first element.
|
||||||
* append it to the list */
|
* append it to the list */
|
||||||
HCL_CONS_CDR(rsa->slot[1]) = cons;
|
tail = stt->u.rsn.tail;
|
||||||
rsa->slot[1] = cons;
|
HCL_ASSERT (hcl, tail->type >= HCL_CNODE_CONS && tail->type <= HCL_CNODE_CONS_QLIST);
|
||||||
|
tail->u.cons.cdr = obj;
|
||||||
|
stt->u.rsn.tail = cons;
|
||||||
}
|
}
|
||||||
|
|
||||||
count++;
|
/* TODO: check overflow on count??? */
|
||||||
rsa->slot[4] = HCL_SMOOI_TO_OOP(count);
|
stt->u.rsn.count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static HCL_INLINE int is_list_empty (hcl_t* hcl)
|
|
||||||
{
|
|
||||||
hcl_oop_oop_t rsa;
|
|
||||||
/* the stack must not be empty */
|
|
||||||
HCL_ASSERT (hcl, !HCL_IS_NIL(hcl,hcl->c->r.s));
|
|
||||||
rsa = (hcl_oop_oop_t)hcl->c->r.s;
|
|
||||||
/* if the tail pointer is pointing to nil, the list is empty */
|
|
||||||
return HCL_IS_NIL(hcl, rsa->slot[1]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int add_to_symbol_array_literal_buffer (hcl_t* hcl, hcl_oop_t b)
|
static int add_to_symbol_array_literal_buffer (hcl_t* hcl, hcl_oop_t b)
|
||||||
{
|
{
|
||||||
if (hcl->c->r.salit.size >= hcl->c->r.salit.capa)
|
if (hcl->c->r.salit.size >= hcl->c->r.salit.capa)
|
||||||
@ -1820,8 +1918,7 @@ static int read_object (hcl_t* hcl)
|
|||||||
* by manipulating its own stack. */
|
* by manipulating its own stack. */
|
||||||
|
|
||||||
int level = 0, array_level = 0, flagv = 0;
|
int level = 0, array_level = 0, flagv = 0;
|
||||||
hcl_oop_t obj;
|
hcl_cnode_t* obj;
|
||||||
hcl_cnode_t* cnode;
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -1850,17 +1947,17 @@ static int read_object (hcl_t* hcl)
|
|||||||
|
|
||||||
case HCL_IOTOK_LBRACK: /* [] */
|
case HCL_IOTOK_LBRACK: /* [] */
|
||||||
flagv = 0;
|
flagv = 0;
|
||||||
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_ARRAY);
|
LIST_FLAG_SET_CONCODE (flagv, HCL_CNODE_CONS_ARRAY - HCL_CNODE_CONS);
|
||||||
goto start_list;
|
goto start_list;
|
||||||
|
|
||||||
case HCL_IOTOK_BAPAREN: /* #[] */
|
case HCL_IOTOK_BAPAREN: /* #[] */
|
||||||
flagv = 0;
|
flagv = 0;
|
||||||
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_BYTEARRAY);
|
LIST_FLAG_SET_CONCODE (flagv, HCL_CNODE_CONS_BYTEARRAY - HCL_CNODE_CONS);
|
||||||
goto start_list;
|
goto start_list;
|
||||||
|
|
||||||
case HCL_IOTOK_LBRACE: /* {} */
|
case HCL_IOTOK_LBRACE: /* {} */
|
||||||
flagv = 0;
|
flagv = 0;
|
||||||
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_DIC);
|
LIST_FLAG_SET_CONCODE (flagv, HCL_CNODE_CONS_DIC - HCL_CNODE_CONS);
|
||||||
goto start_list;
|
goto start_list;
|
||||||
|
|
||||||
case HCL_IOTOK_QLPAREN: /* #() */
|
case HCL_IOTOK_QLPAREN: /* #() */
|
||||||
@ -1869,13 +1966,13 @@ static int read_object (hcl_t* hcl)
|
|||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
flagv = 0;
|
flagv = 0;
|
||||||
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_QLIST);
|
LIST_FLAG_SET_CONCODE (flagv, HCL_CNODE_CONS_QLIST - HCL_CNODE_CONS);
|
||||||
goto start_list;
|
goto start_list;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case HCL_IOTOK_LPAREN: /* () */
|
case HCL_IOTOK_LPAREN: /* () */
|
||||||
flagv = 0;
|
flagv = 0;
|
||||||
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_XLIST);
|
LIST_FLAG_SET_CONCODE (flagv, HCL_CNODE_CONS_XLIST - HCL_CNODE_CONS);
|
||||||
start_list:
|
start_list:
|
||||||
if (level >= HCL_TYPE_MAX(int))
|
if (level >= HCL_TYPE_MAX(int))
|
||||||
{
|
{
|
||||||
@ -1886,7 +1983,7 @@ static int read_object (hcl_t* hcl)
|
|||||||
|
|
||||||
/* push some data to simulate recursion into
|
/* push some data to simulate recursion into
|
||||||
* a list literal or an array literal */
|
* a list literal or an array literal */
|
||||||
if (enter_list(hcl, flagv) == HCL_NULL) return -1;
|
if (enter_list(hcl, TOKEN_LOC(hcl), flagv) == HCL_NULL) return -1;
|
||||||
level++;
|
level++;
|
||||||
if (LIST_FLAG_GET_CONCODE(flagv) == HCL_CONCODE_ARRAY) array_level++;
|
if (LIST_FLAG_GET_CONCODE(flagv) == HCL_CONCODE_ARRAY) array_level++;
|
||||||
|
|
||||||
@ -1989,7 +2086,7 @@ static int read_object (hcl_t* hcl)
|
|||||||
obj = leave_list(hcl, &flagv, &oldflagv);
|
obj = leave_list(hcl, &flagv, &oldflagv);
|
||||||
|
|
||||||
level--;
|
level--;
|
||||||
if (LIST_FLAG_GET_CONCODE(oldflagv) == HCL_CONCODE_ARRAY) array_level--;
|
if (LIST_FLAG_GET_CONCODE(oldflagv) == (HCL_CNODE_CONS_ARRAY - HCL_CNODE_CONS)) array_level--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2001,22 +2098,19 @@ static int read_object (hcl_t* hcl)
|
|||||||
hcl_setsynerr (hcl, HCL_SYNERR_VBARBANNED, TOKEN_LOC(hcl), TOKEN_NAME(hcl));
|
hcl_setsynerr (hcl, HCL_SYNERR_VBARBANNED, TOKEN_LOC(hcl), TOKEN_NAME(hcl));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (get_symbol_array_literal(hcl, &obj) <= -1) return -1;
|
if (get_symbol_array_literal(hcl, &obj) <= -1) return -1; // TOOD: more consistenc errir handling...
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_NIL:
|
case HCL_IOTOK_NIL:
|
||||||
cnode = hcl_makecnodenil(hcl, TOKEN_LOC(hcl));
|
obj = hcl_makecnodenil(hcl, TOKEN_LOC(hcl));
|
||||||
if (HCL_UNLIKELY(!cnode)) return -1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_TRUE:
|
case HCL_IOTOK_TRUE:
|
||||||
cnode = hcl_makecnodetrue(hcl, TOKEN_LOC(hcl));
|
obj = hcl_makecnodetrue(hcl, TOKEN_LOC(hcl));
|
||||||
if (HCL_UNLIKELY(!cnode)) return -1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_FALSE:
|
case HCL_IOTOK_FALSE:
|
||||||
cnode = hcl_makecnodefalse(hcl, TOKEN_LOC(hcl));
|
obj = hcl_makecnodefalse(hcl, TOKEN_LOC(hcl));
|
||||||
if (HCL_UNLIKELY(!cnode)) return -1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_SMPTRLIT:
|
case HCL_IOTOK_SMPTRLIT:
|
||||||
@ -2037,7 +2131,7 @@ static int read_object (hcl_t* hcl)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cnode = hcl_makecnodesmptrlit(hcl, TOKEN_LOC(hcl), v);
|
obj = hcl_makecnodesmptrlit(hcl, TOKEN_LOC(hcl), v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2059,24 +2153,24 @@ static int read_object (hcl_t* hcl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cnode = hcl_makecnodeerrlit(hcl, TOKEN_LOC(hcl), v);
|
obj = hcl_makecnodeerrlit(hcl, TOKEN_LOC(hcl), v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case HCL_IOTOK_CHARLIT:
|
case HCL_IOTOK_CHARLIT:
|
||||||
cnode = hcl_makecnodecharlit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_CHAR(hcl, 0));
|
obj = hcl_makecnodecharlit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_CHAR(hcl, 0));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_NUMLIT:
|
case HCL_IOTOK_NUMLIT:
|
||||||
cnode = hcl_makecnodenumlit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
obj = hcl_makecnodenumlit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_RADNUMLIT:
|
case HCL_IOTOK_RADNUMLIT:
|
||||||
cnode = hcl_makecnoderadnumlit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
obj = hcl_makecnoderadnumlit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_FPDECLIT:
|
case HCL_IOTOK_FPDECLIT:
|
||||||
cnode = hcl_makecnodefpdeclit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
obj = hcl_makecnodefpdeclit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2086,11 +2180,11 @@ static int read_object (hcl_t* hcl)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
case HCL_IOTOK_STRLIT:
|
case HCL_IOTOK_STRLIT:
|
||||||
cnode = hcl_makecnodestrlit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
obj = hcl_makecnodestrlit(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_IDENT:
|
case HCL_IOTOK_IDENT:
|
||||||
obj = hcl_makesymbol(hcl, TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
obj = hcl_makecnodesymbol(hcl, TOKEN_LOC(hcl), TOKEN_NAME_PTR(hcl), TOKEN_NAME_LEN(hcl));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCL_IOTOK_IDENT_DOTTED:
|
case HCL_IOTOK_IDENT_DOTTED:
|
||||||
@ -2172,7 +2266,7 @@ static int read_object (hcl_t* hcl)
|
|||||||
/* one level up toward the top */
|
/* one level up toward the top */
|
||||||
level--;
|
level--;
|
||||||
|
|
||||||
if (LIST_FLAG_GET_CONCODE(oldflagv) == HCL_CONCODE_ARRAY) array_level--;
|
if (LIST_FLAG_GET_CONCODE(oldflagv) == (HCL_CNODE_CONS_ARRAY - HCL_CNODE_CONS)) array_level--;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2192,7 +2286,7 @@ static int read_object (hcl_t* hcl)
|
|||||||
HCL_ASSERT (hcl, level == 0);
|
HCL_ASSERT (hcl, level == 0);
|
||||||
HCL_ASSERT (hcl, array_level == 0);
|
HCL_ASSERT (hcl, array_level == 0);
|
||||||
|
|
||||||
hcl->c->r.e = obj;
|
hcl->c->r.ecn = obj;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +364,6 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
runstatedir = @runstatedir@
|
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
Loading…
Reference in New Issue
Block a user