~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to lib/irb/ruby-lex.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2006-05-08 22:23:12 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060508222312-w2wqeaz030ifi59j
Tags: 1.9.0+20060423-3ubuntu1
* Resynchronized with Debian.
* Only change from Debian is the addition of
  debian/patches/903_sparc_fix_define.patch to fix illegal instructions
  at runtime on sparc. (change from 1.9.0+20050921-1ubuntu1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
#   irb/ruby-lex.rb - ruby lexcal analizer
3
3
#       $Release Version: 0.9.5$
4
 
#       $Revision: 1.28 $
5
 
#       $Date: 2005/06/30 10:07:29 $
 
4
#       $Revision: 1.29 $
 
5
#       $Date: 2006/02/28 13:47:48 $
6
6
#       by Keiju ISHITSUKA(keiju@ruby-lang.org)
7
7
#
8
8
# --
15
15
require "irb/ruby-token"
16
16
 
17
17
class RubyLex
18
 
  @RCS_ID='-$Id: ruby-lex.rb,v 1.28 2005/06/30 10:07:29 keiju Exp $-'
 
18
  @RCS_ID='-$Id: ruby-lex.rb,v 1.29 2006/02/28 13:47:48 keiju Exp $-'
19
19
 
20
20
  extend Exception2MessageMapper
21
21
  def_exception(:AlreadyDefinedToken, "Already defined token(%s)")
309
309
    "q" => "\'",
310
310
    "Q" => "\"",
311
311
    "x" => "\`",
312
 
    "r" => "\/",
 
312
    "r" => "/",
313
313
    "w" => "]",
314
314
    "W" => "]",
315
315
    "s" => ":"
326
326
    "\'" => TkSTRING,
327
327
    "\"" => TkSTRING,
328
328
    "\`" => TkXSTRING,
329
 
    "\/" => TkREGEXP,
 
329
    "/" => TkREGEXP,
330
330
    "]" => TkDSTRING,
331
331
    ":" => TkSYMBOL
332
332
  }
333
333
  DLtype2Token = {
334
334
    "\"" => TkDSTRING,
335
335
    "\`" => TkDXSTRING,
336
 
    "\/" => TkDREGEXP,
 
336
    "/" => TkDREGEXP,
337
337
  }
338
338
 
339
339
  def lex_init()
1087
1087
  def read_escape
1088
1088
    case ch = getc
1089
1089
    when "\n", "\r", "\f"
1090
 
    when "\\", "n", "t", "r", "f", "v", "a", "e", "b" #"
 
1090
    when "\\", "n", "t", "r", "f", "v", "a", "e", "b", "s" #"
1091
1091
    when /[0-7]/
1092
1092
      ungetc ch
1093
1093
      3.times do
1122
1122
        end
1123
1123
      end
1124
1124
 
1125
 
    when "C", "c", "^"
 
1125
    when "C", "c" #, "^"
1126
1126
      if ch == "C" and (ch = getc) != "-"
1127
1127
        ungetc
1128
1128
      elsif (ch = getc) == "\\" #"