alphalang 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nodes/scopemanager.rb +2 -2
- data/lib/rdparse.rb +16 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9264317b60fae6805130ff9692189ba73bf08530c025d8a732c0c520b19a466
|
4
|
+
data.tar.gz: e7bff4ae6de5fbade8cbc6b0a779ddd06259fad639b3650239fbb5f39d0adff9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c8f5078f5f91b224847c2c43134e84fb053d3ba6b5eb456104ae7a4f0f267009ee78077fc8e338e1bb5002616d16627491469df240492f045546b20d4a18c5a
|
7
|
+
data.tar.gz: daf389f2da9e82cd86a921639b5d8843ef4c45b33ef294d2c93a3281d64dfb0d6674c36f16aac04e76ef2f75c160865554e8325e57bb3c5864462a4739fc9f4f
|
data/lib/nodes/scopemanager.rb
CHANGED
@@ -37,7 +37,7 @@ class ScopeManager
|
|
37
37
|
return @@scopes[temp_scope_lvl][name]
|
38
38
|
end
|
39
39
|
end
|
40
|
-
raise
|
40
|
+
raise SyntaxError, "Variable '#{name}' is not defined" unless @value
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.increment_scope_level
|
@@ -51,7 +51,7 @@ class ScopeManager
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def self.lookup_func(name)
|
54
|
-
raise
|
54
|
+
raise SyntaxError, "Function '#{name}' is not defined" if @@scopes[0][name].is_a?(NilClass)
|
55
55
|
return @@scopes[0][name]
|
56
56
|
end
|
57
57
|
|
data/lib/rdparse.rb
CHANGED
@@ -188,6 +188,9 @@ class Parser
|
|
188
188
|
end
|
189
189
|
|
190
190
|
def find_faulty_expression_within_block(block_start_line, block_end_line, problematic_token)
|
191
|
+
if block_start_line == nil || block_end_line == nil
|
192
|
+
raise ParseError, "Error with <#{problematic_token}> somewhere around line #{block_end_line}#{block_start_line}"
|
193
|
+
end
|
191
194
|
index = 0
|
192
195
|
result = []
|
193
196
|
@file_string.each_line do |line|
|
@@ -212,28 +215,33 @@ class Parser
|
|
212
215
|
end
|
213
216
|
|
214
217
|
def find_faulty_line
|
218
|
+
if @tokens[@max_pos-0].is_a?(NilClass)
|
219
|
+
if @max_pos >= 3
|
220
|
+
puts "Problem is in the end of the file after:\n #{@tokens[@max_pos - 3]}#{@tokens[@max_pos - 2]}#{@tokens[@max_pos - 1]}"
|
221
|
+
else
|
222
|
+
puts "Problem is right in the beginning of the file."
|
223
|
+
end
|
224
|
+
raise ParseError
|
225
|
+
end
|
226
|
+
|
215
227
|
problematic_token = "#{@tokens[@max_pos - 1].downcase}"
|
216
228
|
before_problem = "#{@tokens[@max_pos - 2].downcase}"
|
217
229
|
after_problem = "#{@tokens[@max_pos - 0].downcase}"
|
218
230
|
|
219
|
-
|
220
|
-
|
221
|
-
return
|
222
|
-
elsif @max_pos + 5 < @max_pos
|
223
|
-
puts 'problem in the end of file, figure it out'
|
224
|
-
return
|
225
|
-
end
|
231
|
+
after_problem = "[" + after_problem + "]" if !after_problem.match?(/[a-z]/)
|
232
|
+
before_problem = "[" + before_problem + "]" if !before_problem.match?(/[a-z]/)
|
226
233
|
|
227
234
|
translated_problematic_token = @token_list[problematic_token]
|
228
235
|
|
229
236
|
if translated_problematic_token.is_a?(NilClass)
|
230
|
-
raise ParseError, "Faulty expression likely between two '#{@token_list['
|
237
|
+
raise ParseError, "Faulty expression likely between two '#{@token_list['end']}' tokens."
|
231
238
|
end
|
232
239
|
|
233
240
|
index = 0
|
234
241
|
problem_match_hash = {}
|
235
242
|
found_end = false
|
236
243
|
@file_string.each_line do |line|
|
244
|
+
|
237
245
|
if line.match?(before_problem) && found_end == false
|
238
246
|
problem_match_hash[before_problem] = index
|
239
247
|
end
|