From 859a7a92775a84f118a063e5afba4580c7d6d0df Mon Sep 17 00:00:00 2001 From: knu Date: Mon, 30 Apr 2001 17:54:55 +0000 Subject: Merge from irb 0.7.3. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/irb/input-method.rb | 12 ++++++------ lib/irb/loader.rb | 6 +++--- lib/irb/multi-irb.rb | 27 ++++++++++++--------------- lib/irb/ruby-lex.rb | 24 +++++++++++++++--------- lib/irb/ruby-token.rb | 13 +++++++++---- lib/irb/slex.rb | 19 +++++++++++-------- lib/irb/version.rb | 10 +++++----- 7 files changed, 61 insertions(+), 50 deletions(-) (limited to 'lib') diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index 19df0eb073..ffbc6d9edc 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -1,9 +1,9 @@ # -# input-method.rb - input methods using irb -# $Release Version: 0.6$ +# irb/input-method.rb - input methods using irb +# $Release Version: 0.7.3$ # $Revision$ # $Date$ -# by Keiju ISHITSUKA(Nippon Rational Inc.) +# by Keiju ISHITSUKA(keiju@ishitsuka.com) # # -- # @@ -23,9 +23,9 @@ module IRB def initialize(file = STDIN_FILE_NAME) @file_name = file end - attr :file_name + attr_reader :file_name - attr :prompt, true + attr_accessor :prompt def gets IRB.fail NotImplementError, "gets" @@ -67,7 +67,7 @@ module IRB super @io = open(file) end - attr :file_name + attr_reader :file_name def eof? @io.eof? diff --git a/lib/irb/loader.rb b/lib/irb/loader.rb index 83b10a55a0..6e7a89e454 100644 --- a/lib/irb/loader.rb +++ b/lib/irb/loader.rb @@ -1,9 +1,9 @@ # -# irb-loader.rb - -# $Release Version: 0.6$ +# irb/loader.rb - irb loader +# $Release Version: 0.7.3$ # $Revision$ # $Date$ -# by Keiju ISHITSUKA(Nippon Rational Inc.) +# by Keiju ISHITSUKA(keiju@ishitsuka.com) # # -- # diff --git a/lib/irb/multi-irb.rb b/lib/irb/multi-irb.rb index 39dbcbae3c..af9d773a2a 100644 --- a/lib/irb/multi-irb.rb +++ b/lib/irb/multi-irb.rb @@ -1,9 +1,9 @@ # -# multi-irb.rb - multiple irb module -# $Release Version: 0.6$ +# irb/multi-irb.rb - multiple irb module(JP: 複数irb対応モジュール) +# $Release Version: 0.7.3$ # $Revision$ # $Date$ -# by Keiju ISHITSUKA(Nippon Rational Inc.) +# by Keiju ISHITSUKA(keiju@ishitsuka.com) # # -- # @@ -14,6 +14,7 @@ require "thread" module IRB # job management class + # (JP: job管理クラス) class JobManager @RCS_ID='-$Id$-' @@ -23,7 +24,7 @@ module IRB @current_job = nil end - attr :current_job, true + attr_accessor :current_job def n_jobs @jobs.size @@ -140,20 +141,16 @@ module IRB @JobManager end - # invoke multiple irb + # invoke multi-irb + # (JP: irb起動) def IRB.irb(file = nil, *main) - workspace = IRB.workspace_binding(*main) - if main.empty? - main = eval("self", workspace) - else - main = main[0] - end + workspace = WorkSpace.new(*main) parent_thread = Thread.current Thread.start do begin - irb = Irb.new(main, workspace, file) + irb = Irb.new(workspace, file) rescue - print "Subirb can't start with context(self): ", main.inspect, "\n" + print "Subirb can't start with context(self): ", workspace.main.inspect, "\n" print "return to main irb\n" Thread.pass Thread.main.wakeup @@ -190,7 +187,7 @@ module IRB class Context def _=(value) @_ = value - eval "_ = IRB.JobManager.irb(Thread.current).context._", @bind + @workspace.evaluate "_ = IRB.JobManager.irb(Thread.current).context._" end end @@ -198,7 +195,7 @@ module IRB def irb_context IRB.JobManager.irb(Thread.current).context end - alias conf irb_context +# alias conf irb_context end @CONF[:SINGLE_IRB_MODE] = false diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 24db325214..5b37013361 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -1,9 +1,9 @@ # -# ruby-lex.rb - ruby lexcal analizer -# $Release Version: 0.6$ +# irb/ruby-lex.rb - ruby lexcal analizer +# $Release Version: 0.7.3$ # $Revision$ # $Date$ -# by Keiju ISHITSUKA(Nippon Rational Inc.) +# by Keiju ISHITSUKA(keiju@ishitsuka.com) # # -- # @@ -202,8 +202,8 @@ class RubyLex @space_seen = false @here_header = false - prompt @continue = false + prompt @line = "" @exp_line_no = @line_no @@ -239,8 +239,8 @@ class RubyLex until (((tk = token).kind_of?(TkNL) || tk.kind_of?(TkEND_OF_SCRIPT)) && !@continue or tk.nil?) - # p tk - # p self + #p tk + #p self end line = get_readed # print self.inspect @@ -333,7 +333,7 @@ class RubyLex until peek_equal?("=end") && peek(4) =~ /\s/ until getc == "\n"; end end - getc; getc; getc; getc + gets @ltype = nil Token(TkRD_COMMENT) end @@ -459,6 +459,7 @@ class RubyLex identify_number else # for obj.if + # (JP: obj.if などの対応) @lex_state = EXPR_DOT Token(TkDOT) end @@ -691,7 +692,8 @@ class RubyLex if ch == "!" or ch == "?" token.concat getc end - # fix token + # almost fix token + # (JP: 大体fix token) case token when /^\$/ @@ -707,11 +709,13 @@ class RubyLex token_c, *trans = TkReading2Token[token] if token_c # reserved word? + # (JP: 予約語かどうか?) if (@lex_state != EXPR_BEG && @lex_state != EXPR_FNAME && trans[1]) # modifiers + # (JP: 修飾子) token_c = TkSymbol2Token[trans[1]] @lex_state = trans[0] else @@ -752,6 +756,7 @@ class RubyLex def identify_here_document ch = getc +# if lt = PERCENT_LTYPE[ch] if ch == "-" ch = getc indent = true @@ -954,7 +959,8 @@ class RubyLex read_escape(chrs) end else - # other characters + # other characters + #(JP:その他の文字) end end end diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb index 1532dc78eb..2e5715c9f7 100644 --- a/lib/irb/ruby-token.rb +++ b/lib/irb/ruby-token.rb @@ -1,9 +1,9 @@ # -# ruby-token.rb - ruby tokens -# $Release Version: 0.6$ +# irb/ruby-token.rb - ruby tokens +# $Release Version: 0.7.3$ # $Revision$ # $Date$ -# by Keiju ISHITSUKA(Nippon Rational Inc.) +# by Keiju ISHITSUKA(keiju@ishitsuka.com) # # -- # @@ -17,6 +17,11 @@ module RubyToken EXPR_FNAME = :EXPR_FNAME EXPR_DOT = :EXPR_DOT EXPR_CLASS = :EXPR_CLASS + + # for ruby 1.4X + if !defined?(Symbol) + Symbol = Integer + end class Token def initialize(seek, line_no, char_no) @@ -241,7 +246,7 @@ module RubyToken TkSymbol2Token = {} def RubyToken.def_token(token_n, super_token = Token, reading = nil, *opts) - token_n = token_n.id2name unless token_n.kind_of?(String) + token_n = token_n.id2name if token_n.kind_of?(Symbol) if RubyToken.const_defined?(token_n) IRB.fail AlreadyDefinedToken, token_n end diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb index 85aa92bd73..e283df40fe 100644 --- a/lib/irb/slex.rb +++ b/lib/irb/slex.rb @@ -1,9 +1,9 @@ # -# irb-slex.rb - symple lex analizer -# $Release Version: 0.6$ +# irb/slex.rb - symple lex analizer +# $Release Version: 0.7.3$ # $Revision$ # $Date$ -# by Keiju ISHITSUKA(Nippon Rational Inc.) +# by Keiju ISHITSUKA(keiju@ishituska.com) # # -- # @@ -20,7 +20,7 @@ class SLex def_exception :ErrNodeAlreadyExists, "node already exists" class << self - attr :debug_level, TRUE + attr_accessor :debug_level def debug? debug_level > 0 end @@ -90,14 +90,15 @@ class SLex class Node # if postproc no exist, this node is abstract node. # if postproc isn't nil, this node is real node. + # (JP: postprocがなければ抽象ノード, nilじゃなければ具象ノード) def initialize(preproc = nil, postproc = nil) @Tree = {} @preproc = preproc @postproc = postproc end - attr :preproc, TRUE - attr :postproc, TRUE + attr_accessor :preproc + attr_accessor :postproc def search(chrs, opt = nil) return self if chrs.empty? @@ -158,9 +159,11 @@ class SLex # # chrs: String - # character array + # character array (JP: 一文字づつのArray) # io It must have getc()/ungetc(), and ungetc() can be # called any number of times. + # (JP:だだし, getc/ungetcが備わっていなければならない. + # さらに, ungetcは複数回可能でなくてはならない.) # def match(chrs, op = "") print "match>: ", chrs, "op:", op, "\n" if SLex.debug? @@ -265,7 +268,7 @@ if $0 == __FILE__ print "0: ", tr.inspect, "\n" tr.def_rule("=") {print "=\n"} print "1: ", tr.inspect, "\n" - tr.def_rule("==", proc{FALSE}) {print "==\n"} + tr.def_rule("==", proc{false}) {print "==\n"} print "2: ", tr.inspect, "\n" print "case 1:\n" diff --git a/lib/irb/version.rb b/lib/irb/version.rb index 7179d1c163..b309978d9b 100644 --- a/lib/irb/version.rb +++ b/lib/irb/version.rb @@ -1,9 +1,9 @@ # -# version.rb - irb version definition file -# $Release Version: 0.6.1$ +# irb/version.rb - irb version definition file +# $Release Version: 0.7.3$ # $Revision$ # $Date$ -# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd) +# by Keiju ISHITSUKA(keiju@ishitsuka.com) # # -- # @@ -11,6 +11,6 @@ # module IRB - @RELEASE_VERSION = "0.6.1" - @LAST_UPDATE_DATE = "99/09/16" + @RELEASE_VERSION = "0.7.3" + @LAST_UPDATE_DATE = "01/04/16" end -- cgit v1.2.3