rubymotionlisp 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubylisp/tokenizer.rb +13 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0651f5a21b9eef38abe56e63192088deccc8bb45
|
4
|
+
data.tar.gz: 955912fc8020349b60cb610d3787a2b9e524a037
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61f5ebb8c719ef8a253a266533824bb013bf7dcfa470b8bf9783ac287771f23dd0b41231105c1ded889de05323031f633dd157e4cdd3aaead7369b489540e1a3
|
7
|
+
data.tar.gz: 775c7504c2579963d97fe3edf6cba8dc2979293446bcde19d6b9640767b01426e60c2a5e480c17792dbf6658556dcca7642c9c5a916cc1e2ae96771cf4f37a24
|
data/lib/rubylisp/tokenizer.rb
CHANGED
@@ -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,15 @@ module Lisp
|
|
209
210
|
def read_next_token
|
210
211
|
return :EOF, '' if eof?
|
211
212
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
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)
|
219
222
|
@line_number += 1 if @current_ch == "\n"
|
220
223
|
advance
|
221
224
|
return :WHITESPACE, " "
|