alphalang 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nodes/basenodes.rb +4 -0
- data/lib/nodes/scopemanager.rb +2 -2
- data/lib/rdparse.rb +17 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aa1abd7f6b12ba6f941ca7e7baeca95c13b5c962304e903fe997d905f2b8378
|
4
|
+
data.tar.gz: 1a5a6287eb251f45c3185d617bf0b9d25a5490b85bd0e982e7486bead31aeeea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9463287f66570dd95d2d9b22268c420611c51d969c45d4cd6ac079e03968cdd1bdab473fd6b56a455d780d8e2d2475e6534b97f1ff9fd3ad8c683241be7ff9f1
|
7
|
+
data.tar.gz: 066ec1444b64853a07bce2f2a6b0acc296c8555e48c86589f8fe8de3d52da0e93869fb689c23e1394a7e10a6e2e08c432c2e5649f22ea451219a48edd2fb3cfe
|
data/lib/nodes/basenodes.rb
CHANGED
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,34 @@ 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
|
-
|
237
|
+
puts "The problem is #{before_problem}#{problematic_token}#{after_problem}"
|
238
|
+
raise ParseError, "Faulty expression, this is not completely implemented."
|
231
239
|
end
|
232
240
|
|
233
241
|
index = 0
|
234
242
|
problem_match_hash = {}
|
235
243
|
found_end = false
|
236
244
|
@file_string.each_line do |line|
|
245
|
+
|
237
246
|
if line.match?(before_problem) && found_end == false
|
238
247
|
problem_match_hash[before_problem] = index
|
239
248
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alphalang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mattias, victor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logger
|
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements:
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: 3.0.2
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - ">="
|