~tim/scheme-vm

ref: c5110102ce2df2d78a0c87f293edf20f5a3984e7 scheme-vm/vm/atom.rb -rw-r--r-- 466 bytes
c5110102Tim Morgan Add more char functions 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class VM
  class Atom < String
    attr_reader :filename, :offset, :line, :column

    def initialize(name, filename = nil, line = nil, column = nil)
      super(name.to_s)
      @filename = filename
      @line = line
      @column = column
    end

    def raw
      self
    end

    alias eq? ==

    def to_ruby
      to_s
    end

    def mangle(version)
      name = "##{self}.v#{version}"
      self.class.new(name, filename, line, column)
    end
  end
end