summaryrefslogtreecommitdiff
path: root/node.h
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-20 16:22:22 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-20 16:22:22 +0000
commit6d4b5578115c290fe17db213ae17e0fff43a37af (patch)
tree18e8f57bc1c49143710edaf62a0aa2ab87c5df61 /node.h
parent43e320ba1b08c32286f0aa1972528c5f25b4a483 (diff)
Store token first column number on RNode
* node.c (A_NODE_HEADER): Print column number. * node.h (nd_column, nd_set_column): Define getter/setter macros for column number of RNode. * parse.y: Set first column number of tokens. Notes: * Use `@n` to get the location of token in parse.y. * When we use `@n`, arguments of yyerror and yylex are changed. * Initialize column of nodes with -1 to make it easy to detect nodes which we forget to set a column number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'node.h')
-rw-r--r--node.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/node.h b/node.h
index f1c8029257..36d83f0265 100644
--- a/node.h
+++ b/node.h
@@ -284,6 +284,8 @@ typedef struct RNode {
#define nd_line(n) (int)(((SIGNED_VALUE)RNODE(n)->flags)>>NODE_LSHIFT)
#define nd_set_line(n,l) \
RNODE(n)->flags=((RNODE(n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
+#define nd_column(n) (int)(RNODE(n)->nd_reserved)
+#define nd_set_column(n, v) (RNODE(n)->nd_reserved=v)
#define nd_head u1.node
#define nd_alen u2.argc