rubylisp 1.0.7 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubylisp/tokenizer.rb +14 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b93affab132db5c0e9bf534996928f4e6776a30
4
- data.tar.gz: ccbee829606fe1643ab3a1f8ee9a9a994d73c844
3
+ metadata.gz: 19a21b82aeba5d0b46584080bf3625d60fb3b49d
4
+ data.tar.gz: 009daa5e7fef562898b0bbbe8c06816887c12fb6
5
5
  SHA512:
6
- metadata.gz: cc72c561b43fa6af68e15e5b6edae3963adb94ab3a56c2f6529f8eddfd56ae155f12a3bfd564016c40dd8a868ba4efdef73885a63f49930062a36d8c584cce31
7
- data.tar.gz: fbd4d2548fc905bfeef54c46c1bca940dc3e6a4cc95e134627107680105454b5077295aa56cb25a82a9ce3fb61921f0011c9546a7f36fc7f10401c6656b117a4
6
+ metadata.gz: cd899d823e85dd7d9a812aca7e8b75b94550c4ee4abc193e881dc17d80a4a410e22cead3a62ec286c4ff4aee28e84ea5bf6633893b52fd8a3ca30f324e4d9cc9
7
+ data.tar.gz: 821ddee478d4b52f13435e29dbb40705401dfaeb7788ad62fc2fd463a29eb4ad9a2a7db8d9213a523f12175b3e530b0033da9bc622b161edae2cde1946ae928a
@@ -4,15 +4,16 @@ module Lisp
4
4
 
5
5
  attr_reader :line_number
6
6
 
7
- def self.from_string(str)
8
- self.new(StringIO.new(str, "r"))
7
+ def self.from_string(str, absorb_space=true)
8
+ self.new(StringIO.new(str, "r"), absorb_space)
9
9
  end
10
10
 
11
11
  def self.from_file(f)
12
12
  self.new(f)
13
13
  end
14
14
 
15
- def initialize(src)
15
+ def initialize(src, absorb_space=true)
16
+ @absorb_whitespace = absorb_space
16
17
  @source = src
17
18
  @lookahead_token = nil
18
19
  @lookahead_literal = ''
@@ -209,13 +210,16 @@ module Lisp
209
210
  def read_next_token
210
211
  return :EOF, '' if eof?
211
212
 
212
- # while space?(@current_ch)
213
- # @line_number += 1 if @current_ch == "\n"
214
- # advance
215
- # return :EOF, '' if eof?
216
- # end
217
-
218
- if space?(@current_ch)
213
+ if @absorb_whitespace
214
+ while space?(@current_ch)
215
+ @line_number += 1 if @current_ch == "\n"
216
+ advance
217
+ return :EOF, '' if eof?
218
+ end
219
+ end
220
+
221
+ if !@absorb_whitespace && space?(@current_ch)
222
+ @line_number += 1 if @current_ch == "\n"
219
223
  advance
220
224
  return :WHITESPACE, " "
221
225
  elsif number?(@current_ch)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubylisp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Astels