diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-09 01:36:49 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-09 01:36:49 +0000 |
commit | 8e5af8b628b2a52d203e43ad5a8b18375f801cde (patch) | |
tree | 457d72a0f7ac4ea97949ec5b317b359a7d776089 /lib/irb/ruby-lex.rb | |
parent | 45592f4b4c7e835881538e52172932c3e20d0c4d (diff) | |
download | ruby-8e5af8b628b2a52d203e43ad5a8b18375f801cde.tar.gz |
* lib/cmath.rb: fixed indent.
* lib/drb/ssl.rb: ditto.
* lib/irb/**/*.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/ruby-lex.rb')
-rw-r--r-- | lib/irb/ruby-lex.rb | 658 |
1 files changed, 329 insertions, 329 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index bf1009cf30..8bb7edbbaf 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -22,7 +22,7 @@ class RubyLex def_exception(:TkReading2TokenNoKey, "key nothing(key='%s')") def_exception(:TkSymbol2TokenNoKey, "key nothing(key='%s')") def_exception(:TkReading2TokenDuplicateError, - "key duplicate(token_n='%s', key='%s')") + "key duplicate(token_n='%s', key='%s')") def_exception(:SyntaxError, "%s") def_exception(:TerminateLineInput, "Terminate Line Input") @@ -154,9 +154,9 @@ class RubyLex if c == "\n" @line_no -= 1 if idx = @readed.rindex("\n") - @char_no = idx + 1 + @char_no = idx + 1 else - @char_no = @base_char_no + @readed.size + @char_no = @base_char_no + @readed.size end else @char_no -= 1 @@ -231,41 +231,41 @@ class RubyLex initialize_input catch(:TERM_INPUT) do loop do - begin - @continue = false - prompt - unless l = lex - throw :TERM_INPUT if @line == '' - else - @line.concat l - if @ltype or @continue or @indent > 0 - next - end - end - if @line != "\n" + begin + @continue = false + prompt + unless l = lex + throw :TERM_INPUT if @line == '' + else + @line.concat l + if @ltype or @continue or @indent > 0 + next + end + end + if @line != "\n" @line.force_encoding(@io.encoding) - yield @line, @exp_line_no - end - break unless l - @line = '' - @exp_line_no = @line_no - - @indent = 0 - @indent_stack = [] - prompt - rescue TerminateLineInput - initialize_input - prompt - get_readed - end + yield @line, @exp_line_no + end + break unless l + @line = '' + @exp_line_no = @line_no + + @indent = 0 + @indent_stack = [] + prompt + rescue TerminateLineInput + initialize_input + prompt + get_readed + end end end end def lex until (((tk = token).kind_of?(TkNL) || tk.kind_of?(TkEND_OF_SCRIPT)) && - !@continue or - tk.nil?) + !@continue or + tk.nil?) #p tk #p @lex_state #p self @@ -287,13 +287,13 @@ class RubyLex @prev_char_no = @char_no begin begin - tk = @OP.match(self) - @space_seen = tk.kind_of?(TkSPACE) - @lex_state = EXPR_END if @post_symbeg && tk.kind_of?(TkOp) - @post_symbeg = tk.kind_of?(TkSYMBEG) + tk = @OP.match(self) + @space_seen = tk.kind_of?(TkSPACE) + @lex_state = EXPR_END if @post_symbeg && tk.kind_of?(TkOp) + @post_symbeg = tk.kind_of?(TkSYMBEG) rescue SyntaxError - raise if @exception_on_syntax_error - tk = TkError.new(@seek, @line_no, @char_no) + raise if @exception_on_syntax_error + tk = TkError.new(@seek, @line_no, @char_no) end end while @skip_space and tk.kind_of?(TkSPACE) if @readed_auto_clean_up @@ -361,12 +361,12 @@ class RubyLex end @OP.def_rule("=begin", - proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do + proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do |op, io| @ltype = "=" until getc == "\n"; end until peek_equal?("=end") && peek(4) =~ /\s/ - until getc == "\n"; end + until getc == "\n"; end end gets @ltype = nil @@ -377,15 +377,15 @@ class RubyLex print "\\n\n" if RubyLex.debug? case @lex_state when EXPR_BEG, EXPR_FNAME, EXPR_DOT - @continue = true + @continue = true else - @continue = false - @lex_state = EXPR_BEG - until (@indent_stack.empty? || - [TkLPAREN, TkLBRACK, TkLBRACE, - TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last)) - @indent_stack.pop - end + @continue = false + @lex_state = EXPR_BEG + until (@indent_stack.empty? || + [TkLPAREN, TkLBRACK, TkLBRACE, + TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last)) + @indent_stack.pop + end end @here_header = false @here_readed = [] @@ -393,17 +393,17 @@ class RubyLex end @OP.def_rules("*", "**", - "=", "==", "===", - "=~", "<=>", - "<", "<=", - ">", ">=", ">>", - "!", "!=", "!~") do + "=", "==", "===", + "=~", "<=>", + "<", "<=", + ">", ">=", ">>", + "!", "!=", "!~") do |op, io| case @lex_state when EXPR_FNAME, EXPR_DOT - @lex_state = EXPR_ARG + @lex_state = EXPR_ARG else - @lex_state = EXPR_BEG + @lex_state = EXPR_BEG end Token(op) end @@ -412,20 +412,20 @@ class RubyLex |op, io| tk = nil if @lex_state != EXPR_END && @lex_state != EXPR_CLASS && - (@lex_state != EXPR_ARG || @space_seen) - c = peek(0) - if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-") - tk = identify_here_document - end + (@lex_state != EXPR_ARG || @space_seen) + c = peek(0) + if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-") + tk = identify_here_document + end end unless tk - tk = Token(op) - case @lex_state - when EXPR_FNAME, EXPR_DOT - @lex_state = EXPR_ARG - else - @lex_state = EXPR_BEG - end + tk = Token(op) + case @lex_state + when EXPR_FNAME, EXPR_DOT + @lex_state = EXPR_ARG + else + @lex_state = EXPR_BEG + end end tk end @@ -438,31 +438,31 @@ class RubyLex @OP.def_rules("`") do |op, io| if @lex_state == EXPR_FNAME - @lex_state = EXPR_END - Token(op) + @lex_state = EXPR_END + Token(op) else - identify_string(op) + identify_string(op) end end @OP.def_rules('?') do |op, io| if @lex_state == EXPR_END - @lex_state = EXPR_BEG - Token(TkQUESTION) + @lex_state = EXPR_BEG + Token(TkQUESTION) else - ch = getc - if @lex_state == EXPR_ARG && ch =~ /\s/ - ungetc - @lex_state = EXPR_BEG; - Token(TkQUESTION) - else - if (ch == '\\') - read_escape - end - @lex_state = EXPR_END - Token(TkINTEGER) - end + ch = getc + if @lex_state == EXPR_ARG && ch =~ /\s/ + ungetc + @lex_state = EXPR_BEG; + Token(TkQUESTION) + else + if (ch == '\\') + read_escape + end + @lex_state = EXPR_END + Token(TkINTEGER) + end end end @@ -473,7 +473,7 @@ class RubyLex end @OP.def_rules("+=", "-=", "*=", "**=", - "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do + "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do |op, io| @lex_state = EXPR_BEG op =~ /^(.*)=$/ @@ -495,18 +495,18 @@ class RubyLex @OP.def_rules("+", "-") do |op, io| catch(:RET) do - if @lex_state == EXPR_ARG - if @space_seen and peek(0) =~ /[0-9]/ - throw :RET, identify_number - else - @lex_state = EXPR_BEG - end - elsif @lex_state != EXPR_END and peek(0) =~ /[0-9]/ - throw :RET, identify_number - else - @lex_state = EXPR_BEG - end - Token(op) + if @lex_state == EXPR_ARG + if @space_seen and peek(0) =~ /[0-9]/ + throw :RET, identify_number + else + @lex_state = EXPR_BEG + end + elsif @lex_state != EXPR_END and peek(0) =~ /[0-9]/ + throw :RET, identify_number + else + @lex_state = EXPR_BEG + end + Token(op) end end @@ -514,12 +514,12 @@ class RubyLex |op, io| @lex_state = EXPR_BEG if peek(0) =~ /[0-9]/ - ungetc - identify_number + ungetc + identify_number else - # for "obj.if" etc. - @lex_state = EXPR_DOT - Token(TkDOT) + # for "obj.if" etc. + @lex_state = EXPR_DOT + Token(TkDOT) end end @@ -544,11 +544,11 @@ class RubyLex @OP.def_rule(":") do |op, io| if @lex_state == EXPR_END || peek(0) =~ /\s/ - @lex_state = EXPR_BEG - Token(TkCOLON) + @lex_state = EXPR_BEG + Token(TkCOLON) else - @lex_state = EXPR_FNAME - Token(TkSYMBEG) + @lex_state = EXPR_FNAME + Token(TkSYMBEG) end end @@ -556,27 +556,27 @@ class RubyLex |op, io| # p @lex_state.id2name, @space_seen if @lex_state == EXPR_BEG or @lex_state == EXPR_ARG && @space_seen - @lex_state = EXPR_BEG - Token(TkCOLON3) + @lex_state = EXPR_BEG + Token(TkCOLON3) else - @lex_state = EXPR_DOT - Token(TkCOLON2) + @lex_state = EXPR_DOT + Token(TkCOLON2) end end @OP.def_rule("/") do |op, io| if @lex_state == EXPR_BEG || @lex_state == EXPR_MID - identify_string(op) + identify_string(op) elsif peek(0) == '=' - getc - @lex_state = EXPR_BEG - Token(TkOPASGN, "/") #/) + getc + @lex_state = EXPR_BEG + Token(TkOPASGN, "/") #/) elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/ - identify_string(op) + identify_string(op) else - @lex_state = EXPR_BEG - Token("/") #/) + @lex_state = EXPR_BEG + Token("/") #/) end end @@ -601,9 +601,9 @@ class RubyLex |op, io| @lex_state = EXPR_BEG until (@indent_stack.empty? || - [TkLPAREN, TkLBRACK, TkLBRACE, - TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last)) - @indent_stack.pop + [TkLPAREN, TkLBRACK, TkLBRACE, + TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last)) + @indent_stack.pop end Token(op) end @@ -624,11 +624,11 @@ class RubyLex |op, io| @indent += 1 if @lex_state == EXPR_BEG || @lex_state == EXPR_MID - @lex_state = EXPR_BEG - tk_c = TkfLPAREN + @lex_state = EXPR_BEG + tk_c = TkfLPAREN else - @lex_state = EXPR_BEG - tk_c = TkLPAREN + @lex_state = EXPR_BEG + tk_c = TkLPAREN end @indent_stack.push tk_c Token(tk_c) @@ -650,16 +650,16 @@ class RubyLex |op, io| @indent += 1 if @lex_state == EXPR_FNAME - tk_c = TkfLBRACK + tk_c = TkfLBRACK else - if @lex_state == EXPR_BEG || @lex_state == EXPR_MID - tk_c = TkLBRACK - elsif @lex_state == EXPR_ARG && @space_seen - tk_c = TkLBRACK - else - tk_c = TkfLBRACK - end - @lex_state = EXPR_BEG + if @lex_state == EXPR_BEG || @lex_state == EXPR_MID + tk_c = TkLBRACK + elsif @lex_state == EXPR_ARG && @space_seen + tk_c = TkLBRACK + else + tk_c = TkfLBRACK + end + @lex_state = EXPR_BEG end @indent_stack.push tk_c Token(tk_c) @@ -669,9 +669,9 @@ class RubyLex |op, io| @indent += 1 if @lex_state != EXPR_END && @lex_state != EXPR_ARG - tk_c = TkLBRACE + tk_c = TkLBRACE else - tk_c = TkfLBRACE + tk_c = TkfLBRACE end @lex_state = EXPR_BEG @indent_stack.push tk_c @@ -681,27 +681,27 @@ class RubyLex @OP.def_rule('\\') do |op, io| if getc == "\n" - @space_seen = true - @continue = true - Token(TkSPACE) + @space_seen = true + @continue = true + Token(TkSPACE) else - read_escape - Token("\\") + read_escape + Token("\\") end end @OP.def_rule('%') do |op, io| if @lex_state == EXPR_BEG || @lex_state == EXPR_MID - identify_quotation + identify_quotation elsif peek(0) == '=' - getc - Token(TkOPASGN, :%) + getc + Token(TkOPASGN, :%) elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/ - identify_quotation + identify_quotation else - @lex_state = EXPR_BEG - Token("%") #)) + @lex_state = EXPR_BEG + Token("%") #)) end end @@ -713,10 +713,10 @@ class RubyLex @OP.def_rule('@') do |op, io| if peek(0) =~ /[\w@]/ - ungetc - identify_identifier + ungetc + identify_identifier else - Token("@") + Token("@") end end @@ -734,9 +734,9 @@ class RubyLex |op, io| printf "MATCH: start %s: %s\n", op, io.inspect if RubyLex.debug? if peek(0) =~ /[0-9]/ - t = identify_number + t = identify_number elsif peek(0) =~ /[^\x00-\/:-@\[-^`{-\x7F]/ - t = identify_identifier + t = identify_identifier end printf "MATCH: end %s: %s\n", op, io.inspect if RubyLex.debug? t @@ -774,7 +774,7 @@ class RubyLex if peek(0) =~ /[$@]/ token.concat(c = getc) if c == "@" and peek(0) == "@" - token.concat getc + token.concat getc end end @@ -807,61 +807,61 @@ class RubyLex token_c, *trans = TkReading2Token[token] if token_c - # reserved word? - - if (@lex_state != EXPR_BEG && - @lex_state != EXPR_FNAME && - trans[1]) - # modifiers - token_c = TkSymbol2Token[trans[1]] - @lex_state = trans[0] - else - if @lex_state != EXPR_FNAME - if ENINDENT_CLAUSE.include?(token) - # check for ``class = val'' etc. - valid = true - case token - when "class" - valid = false unless peek_match?(/^\s*(<<|\w|::)/) - when "def" - valid = false if peek_match?(/^\s*(([+\-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/) - when "do" - valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&)/) - when *ENINDENT_CLAUSE - valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&|\|)/) - else - # no nothing - end - if valid - if token == "do" - if ![TkFOR, TkWHILE, TkUNTIL].include?(@indent_stack.last) - @indent += 1 - @indent_stack.push token_c - end - else - @indent += 1 - @indent_stack.push token_c - end -# p @indent_stack - end - - elsif DEINDENT_CLAUSE.include?(token) - @indent -= 1 - @indent_stack.pop - end - @lex_state = trans[0] - else - @lex_state = EXPR_END - end - end - return Token(token_c, token) + # reserved word? + + if (@lex_state != EXPR_BEG && + @lex_state != EXPR_FNAME && + trans[1]) + # modifiers + token_c = TkSymbol2Token[trans[1]] + @lex_state = trans[0] + else + if @lex_state != EXPR_FNAME + if ENINDENT_CLAUSE.include?(token) + # check for ``class = val'' etc. + valid = true + case token + when "class" + valid = false unless peek_match?(/^\s*(<<|\w|::)/) + when "def" + valid = false if peek_match?(/^\s*(([+\-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/) + when "do" + valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&)/) + when *ENINDENT_CLAUSE + valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&|\|)/) + else + # no nothing + end + if valid + if token == "do" + if ![TkFOR, TkWHILE, TkUNTIL].include?(@indent_stack.last) + @indent += 1 + @indent_stack.push token_c + end + else + @indent += 1 + @indent_stack.push token_c + end + # p @indent_stack + end + + elsif DEINDENT_CLAUSE.include?(token) + @indent -= 1 + @indent_stack.pop + end + @lex_state = trans[0] + else + @lex_state = EXPR_END + end + end + return Token(token_c, token) end end if @lex_state == EXPR_FNAME @lex_state = EXPR_END if peek(0) == '=' - token.concat getc + token.concat getc end elsif @lex_state == EXPR_BEG || @lex_state == EXPR_DOT @lex_state = EXPR_ARG @@ -889,13 +889,13 @@ class RubyLex lt = ch quoted = "" while (c = getc) && c != lt - quoted.concat c + quoted.concat c end else lt = '"' quoted = ch.dup while (c = getc) && c =~ /\w/ - quoted.concat c + quoted.concat c end ungetc end @@ -905,9 +905,9 @@ class RubyLex while ch = getc reserve.push ch if ch == "\\" - reserve.push ch = getc + reserve.push ch = getc elsif ch == "\n" - break + break end end @@ -922,15 +922,15 @@ class RubyLex line = "" while ch = getc if ch == "\n" - if line == quoted - break - end - line = "" + if line == quoted + break + end + line = "" else - line.concat ch unless indent && line == "" && /\s/ =~ ch - if @ltype != "'" && ch == "#" && peek(0) == "{" - identify_string_dvar - end + line.concat ch unless indent && line == "" && /\s/ =~ ch + if @ltype != "'" && ch == "#" && peek(0) == "{" + identify_string_dvar + end end end @@ -970,49 +970,49 @@ class RubyLex getc case peek(0) when /[xX]/ - ch = getc - match = /[0-9a-fA-F_]/ + ch = getc + match = /[0-9a-fA-F_]/ when /[bB]/ - ch = getc - match = /[01_]/ + ch = getc + match = /[01_]/ when /[oO]/ - ch = getc - match = /[0-7_]/ + ch = getc + match = /[0-7_]/ when /[dD]/ - ch = getc - match = /[0-9_]/ + ch = getc + match = /[0-9_]/ when /[0-7]/ - match = /[0-7_]/ + match = /[0-7_]/ when /[89]/ - RubyLex.fail SyntaxError, "Invalid octal digit" + RubyLex.fail SyntaxError, "Invalid octal digit" else - return Token(TkINTEGER) + return Token(TkINTEGER) end len0 = true non_digit = false while ch = getc - if match =~ ch - if ch == "_" - if non_digit - RubyLex.fail SyntaxError, "trailing `#{ch}' in number" - else - non_digit = ch - end - else - non_digit = false - len0 = false - end - else - ungetc - if len0 - RubyLex.fail SyntaxError, "numeric literal without digits" - end - if non_digit - RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number" - end - break - end + if match =~ ch + if ch == "_" + if non_digit + RubyLex.fail SyntaxError, "trailing `#{ch}' in number" + else + non_digit = ch + end + else + non_digit = false + len0 = false + end + else + ungetc + if len0 + RubyLex.fail SyntaxError, "numeric literal without digits" + end + if non_digit + RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number" + end + break + end end return Token(TkINTEGER) end @@ -1024,37 +1024,37 @@ class RubyLex while ch = getc case ch when /[0-9]/ - non_digit = false + non_digit = false when "_" - non_digit = ch + non_digit = ch when allow_point && "." - if non_digit - RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number" - end - type = TkFLOAT - if peek(0) !~ /[0-9]/ - type = TkINTEGER - ungetc - break - end - allow_point = false + if non_digit + RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number" + end + type = TkFLOAT + if peek(0) !~ /[0-9]/ + type = TkINTEGER + ungetc + break + end + allow_point = false when allow_e && "e", allow_e && "E" - if non_digit - RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number" - end - type = TkFLOAT - if peek(0) =~ /[+-]/ - getc - end - allow_e = false - allow_point = false - non_digit = ch + if non_digit + RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number" + end + type = TkFLOAT + if peek(0) =~ /[+-]/ + getc + end + allow_e = false + allow_point = false + non_digit = ch else - if non_digit - RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number" - end - ungetc - break + if non_digit + RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number" + end + ungetc + break end end Token(type) @@ -1067,38 +1067,38 @@ class RubyLex begin nest = 0 while ch = getc - if @quoted == ch and nest == 0 - break - elsif @ltype != "'" && ch == "#" && peek(0) == "{" - identify_string_dvar - elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#" - subtype = true - elsif ch == '\\' and @ltype == "'" #' - case ch = getc - when "\\", "\n", "'" - else - ungetc - end - elsif ch == '\\' #' - read_escape - end - if PERCENT_PAREN.values.include?(@quoted) - if PERCENT_PAREN[ch] == @quoted - nest += 1 - elsif ch == @quoted - nest -= 1 - end - end + if @quoted == ch and nest == 0 + break + elsif @ltype != "'" && ch == "#" && peek(0) == "{" + identify_string_dvar + elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#" + subtype = true + elsif ch == '\\' and @ltype == "'" #' + case ch = getc + when "\\", "\n", "'" + else + ungetc + end + elsif ch == '\\' #' + read_escape + end + if PERCENT_PAREN.values.include?(@quoted) + if PERCENT_PAREN[ch] == @quoted + nest += 1 + elsif ch == @quoted + nest -= 1 + end + end end if @ltype == "/" while /[imxoesun]/ =~ peek(0) - getc - end + getc + end end if subtype - Token(DLtype2Token[ltype]) + Token(DLtype2Token[ltype]) else - Token(Ltype2Token[ltype]) + Token(Ltype2Token[ltype]) end ensure @ltype = nil @@ -1125,13 +1125,13 @@ class RubyLex @lex_state = EXPR_BEG loop do - @continue = false - prompt - tk = token - if @ltype or @continue or @indent >= 0 - next - end - break if tk.kind_of?(TkRBRACE) + @continue = false + prompt + tk = token + if @ltype or @continue or @indent >= 0 + next + end + break if tk.kind_of?(TkRBRACE) end ensure @continue = reserve_continue @@ -1151,9 +1151,9 @@ class RubyLex # read_escape # end if ch == "\n" - @ltype = nil - ungetc - break + @ltype = nil + ungetc + break end end return Token(TkCOMMENT) @@ -1166,42 +1166,42 @@ class RubyLex when /[0-7]/ ungetc ch 3.times do - case ch = getc - when /[0-7]/ - when nil - break - else - ungetc - break - end + case ch = getc + when /[0-7]/ + when nil + break + else + ungetc + break + end end when "x" 2.times do - case ch = getc - when /[0-9a-fA-F]/ - when nil - break - else - ungetc - break - end + case ch = getc + when /[0-9a-fA-F]/ + when nil + break + else + ungetc + break + end end when "M" if (ch = getc) != '-' - ungetc + ungetc else - if (ch = getc) == "\\" #" - read_escape - end + if (ch = getc) == "\\" #" + read_escape + end end when "C", "c" #, "^" if ch == "C" and (ch = getc) != "-" - ungetc + ungetc elsif (ch = getc) == "\\" #" - read_escape + read_escape end else # other characters |