aboutsummaryrefslogtreecommitdiffstats
path: root/template/id.c.tmpl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-05 04:04:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-05 04:04:00 +0000
commit258552e6e5e6340baeb94d84826708038fc336c2 (patch)
tree618b9df3d58a48193bba18ccbc56819b41c900b4 /template/id.c.tmpl
parent20d94b47b9591069ad8d12319bffa594b9b8d5b7 (diff)
downloadruby-258552e6e5e6340baeb94d84826708038fc336c2.tar.gz
id.def: token_ops
* defs/id.def (token_ops): gather associations between IDs, operators, and parser tokens. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template/id.c.tmpl')
-rw-r--r--template/id.c.tmpl16
1 files changed, 16 insertions, 0 deletions
diff --git a/template/id.c.tmpl b/template/id.c.tmpl
index cac213a8fb..477a76bc26 100644
--- a/template/id.c.tmpl
+++ b/template/id.c.tmpl
@@ -13,7 +13,23 @@
<%
defs = File.join(File.dirname(File.dirname(erb.filename)), "defs/id.def")
ids = eval(File.read(defs), binding, defs)
+ops = ids[:token_op].uniq {|id, op, token| token && op}
%>
+% ops.each do |_id, _op, token|
+% next unless token
+#define t<%=token%> RUBY_TOKEN(<%=token%>)
+% end
+
+static const struct {
+ unsigned short token;
+ const char name[3], term;
+} op_tbl[] = {
+% ops.each do |_id, op, token|
+% next unless token
+ {t<%=token%>, "<%=op%>"},
+% end
+};
+
static void
Init_id(void)
{