git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-10-17 11:56:11 +00:00
Родитель b025ce4678
Коммит 26b3c7a0f3
3 изменённых файлов: 67 добавлений и 36 удалений

Просмотреть файл

@ -1,14 +1,10 @@
Fri Oct 17 19:46:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (ID_H_TARGET): phony target to update id.h.
* tool/ifchange, win32/ifchange.bat: --timestamp option added.
* tool/generic_erb.rb: --timestamp, --output and --if-change options
added.
* template/id.h.tmpl: moved from id.h.
Fri Oct 17 18:33:12 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* array.c (ary_resize_capa): renamed RESIZE_CAPA.

Просмотреть файл

@ -645,11 +645,9 @@ transdb.h: $(PREP) srcs-enc
$(MINIRUBY) $(srcdir)/enc/trans/make_transdb.rb $@.new $(srcdir)/enc/trans enc/trans
$(IFCHANGE) "$@" "$@.new"
{$(VPATH)}id.h:
$(CPP) $(CPPFLAGS) -DUSE_PARSE_H $@
$(ID_H_TARGET): {$(VPATH)}parse.c $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl
$(BASERUBY) $(srcdir)/tool/generic_erb.rb --if-change --output=$(srcdir)/id.h $(srcdir)/template/id.h.tmpl --vpath=$(VPATH) parse.c
# {$(VPATH)}id.h: {$(VPATH)}parse.h $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl
# $(BASERUBY) $(srcdir)/tool/generic_erb.rb --if-change --output=$@ \
# $(srcdir)/template/id.h.tmpl --vpath=$(VPATH) parse.h
known_errors.inc: $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_errors.def
$(BASERUBY) $(srcdir)/tool/generic_erb.rb $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_errors.def > $@

Просмотреть файл

@ -1,5 +1,3 @@
%# -*- c -*-
/* DO NOT EDIT THIS FILE DIRECTLY */
/**********************************************************************
id.h -
@ -10,28 +8,7 @@
Copyright (C) 2007 Koichi Sasada
**********************************************************************/
<%
require 'optparse'
vpath = ["."]
input = nil
opt = OptionParser.new do |o|
o.on('-v', '--vpath=DIR') {|dirs| vpath.concat dirs.split(File::PATH_SEPARATOR)}
input, = o.order!(ARGV)
end or abort opt.opt_s
tokens = nil
vpath.find do |dir|
begin
if line = File.read(File.join(dir, input))[/^\s*enum\s+yytokentype\s*\{([^{}]*)\s*\};/m, 1]
tokens = line.scan(/\b(t(?:LAST_TOKEN|U(?:PLUS|MINUS)|POW|CMP|EQQ?|[NGL]EQ|(?:AND|OR)OP|N?MATCH|DOT\d|AREF|ASET|[LR]SHFT|LAMBDA)|id\w+)\s*=\s*(\d+),?/m)
end
rescue Errno::ENOENT
nil
else
true
end
end
%>
#ifndef RUBY_ID_H
#define RUBY_ID_H
@ -55,10 +32,70 @@ end
enum ruby_method_ids {
#ifndef tLAST_TOKEN
% tokens.each do |token, value|
<%=token%> = <%=value%>,
% end
#elif <%= tokens.map {|token, value|"#{token} != #{value}"}.join(" || \\\n ") %>
tUPLUS = 321,
tUMINUS = 322,
tPOW = 323,
tCMP = 324,
tEQ = 325,
tEQQ = 326,
tNEQ = 327,
tGEQ = 328,
tLEQ = 329,
tANDOP = 330,
tOROP = 331,
tMATCH = 332,
tNMATCH = 333,
tDOT2 = 334,
tDOT3 = 335,
tAREF = 336,
tASET = 337,
tLSHFT = 338,
tRSHFT = 339,
tLAMBDA = 352,
idNULL = 365,
idRespond_to = 366,
idIFUNC = 367,
idCFUNC = 368,
idThrowState = 369,
id_core_set_method_alias = 370,
id_core_set_variable_alias = 371,
id_core_undef_method = 372,
id_core_define_method = 373,
id_core_define_singleton_method = 374,
id_core_set_postexe = 375,
tLAST_TOKEN = 376,
#elif tUPLUS != 321 || \
tUMINUS != 322 || \
tPOW != 323 || \
tCMP != 324 || \
tEQ != 325 || \
tEQQ != 326 || \
tNEQ != 327 || \
tGEQ != 328 || \
tLEQ != 329 || \
tANDOP != 330 || \
tOROP != 331 || \
tMATCH != 332 || \
tNMATCH != 333 || \
tDOT2 != 334 || \
tDOT3 != 335 || \
tAREF != 336 || \
tASET != 337 || \
tLSHFT != 338 || \
tRSHFT != 339 || \
tLAMBDA != 352 || \
idNULL != 365 || \
idRespond_to != 366 || \
idIFUNC != 367 || \
idCFUNC != 368 || \
idThrowState != 369 || \
id_core_set_method_alias != 370 || \
id_core_set_variable_alias != 371 || \
id_core_undef_method != 372 || \
id_core_define_method != 373 || \
id_core_define_singleton_method != 374 || \
id_core_set_postexe != 375 || \
tLAST_TOKEN != 376
#error id.h is out of date.
#endif
idPLUS = '+',