summaryrefslogtreecommitdiffstats
path: root/dimension/common.prologue
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-04-04 19:25:54 -0400
committerTavian Barnes <tavianator@gmail.com>2011-04-06 15:01:06 -0400
commit629cad2c7578aea62761ba2e1810356138b57480 (patch)
tree56e89b6efc240c4c90b38997e0ceea844df005b3 /dimension/common.prologue
parent5a535f9fac3f4b82f0b154b4c81fd1e2a8d62802 (diff)
downloaddimension-629cad2c7578aea62761ba2e1810356138b57480.tar.xz
Don't make empty child arrays when parsing.
Diffstat (limited to 'dimension/common.prologue')
-rw-r--r--dimension/common.prologue16
1 files changed, 16 insertions, 0 deletions
diff --git a/dimension/common.prologue b/dimension/common.prologue
index 2830094..649f184 100644
--- a/dimension/common.prologue
+++ b/dimension/common.prologue
@@ -47,6 +47,22 @@
/* Create a new astnode, populating filename, line, and col */
static dmnsn_astnode
+dmnsn_new_astleaf(dmnsn_astnode_type type, YYLTYPE lloc)
+{
+ dmnsn_astnode astnode = {
+ .type = type,
+ .children = NULL,
+ .ptr = NULL,
+ .free_fn = NULL,
+ .refcount = dmnsn_malloc(sizeof(unsigned int)),
+ .location = lloc
+ };
+
+ *astnode.refcount = 1;
+ return astnode;
+}
+
+static dmnsn_astnode
dmnsn_new_astnode(dmnsn_astnode_type type, YYLTYPE lloc)
{
dmnsn_astnode astnode = {