gloo-lang 0.9.7 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -1
- data/gloo-lang.gemspec +1 -1
- data/lib/VERSION +1 -1
- data/lib/gloo_lang/app/args.rb +3 -2
- data/lib/gloo_lang/app/engine.rb +25 -26
- data/lib/gloo_lang/app/engine_context.rb +25 -0
- data/lib/gloo_lang/app/help.rb +10 -9
- data/lib/gloo_lang/app/log.rb +5 -3
- data/lib/gloo_lang/app/settings.rb +30 -37
- data/lib/gloo_lang/convert/converter.rb +9 -2
- data/lib/gloo_lang/core/baseo.rb +2 -1
- data/lib/gloo_lang/core/dictionary.rb +16 -6
- data/lib/gloo_lang/core/event_manager.rb +9 -8
- data/lib/gloo_lang/core/factory.rb +11 -10
- data/lib/gloo_lang/core/gloo_system.rb +9 -8
- data/lib/gloo_lang/core/heap.rb +5 -4
- data/lib/gloo_lang/core/here.rb +2 -2
- data/lib/gloo_lang/core/obj.rb +9 -8
- data/lib/gloo_lang/core/obj_finder.rb +3 -3
- data/lib/gloo_lang/core/parser.rb +6 -5
- data/lib/gloo_lang/core/pn.rb +20 -16
- data/lib/gloo_lang/core/verb.rb +2 -1
- data/lib/gloo_lang/exec/dispatch.rb +8 -8
- data/lib/gloo_lang/exec/exec_env.rb +7 -6
- data/lib/gloo_lang/exec/runner.rb +10 -10
- data/lib/gloo_lang/exec/script.rb +6 -5
- data/lib/gloo_lang/exec/stack.rb +8 -7
- data/lib/gloo_lang/expr/expression.rb +3 -2
- data/lib/gloo_lang/objs/basic/alias.rb +4 -4
- data/lib/gloo_lang/objs/basic/boolean.rb +3 -3
- data/lib/gloo_lang/objs/basic/container.rb +2 -2
- data/lib/gloo_lang/objs/basic/decimal.rb +3 -3
- data/lib/gloo_lang/objs/basic/integer.rb +3 -3
- data/lib/gloo_lang/objs/basic/script.rb +1 -1
- data/lib/gloo_lang/objs/basic/string.rb +3 -3
- data/lib/gloo_lang/objs/basic/text.rb +2 -2
- data/lib/gloo_lang/objs/ctrl/each.rb +3 -3
- data/lib/gloo_lang/objs/ctrl/repeat.rb +2 -2
- data/lib/gloo_lang/objs/data/markdown.rb +2 -2
- data/lib/gloo_lang/objs/data/query.rb +4 -4
- data/lib/gloo_lang/objs/data/table.rb +3 -3
- data/lib/gloo_lang/objs/dt/date.rb +1 -1
- data/lib/gloo_lang/objs/dt/datetime.rb +2 -2
- data/lib/gloo_lang/objs/dt/time.rb +1 -1
- data/lib/gloo_lang/objs/ror/erb.rb +2 -2
- data/lib/gloo_lang/objs/ror/eval.rb +3 -3
- data/lib/gloo_lang/objs/web/http_get.rb +3 -3
- data/lib/gloo_lang/objs/web/http_post.rb +8 -8
- data/lib/gloo_lang/objs/web/json.rb +5 -5
- data/lib/gloo_lang/objs/web/slack.rb +1 -1
- data/lib/gloo_lang/objs/web/teams.rb +1 -1
- data/lib/gloo_lang/objs/web/uri.rb +6 -6
- data/lib/gloo_lang/persist/file_loader.rb +6 -5
- data/lib/gloo_lang/persist/file_saver.rb +2 -1
- data/lib/gloo_lang/persist/file_storage.rb +6 -5
- data/lib/gloo_lang/persist/persist_man.rb +9 -8
- data/lib/gloo_lang/utils/stats.rb +5 -4
- data/lib/gloo_lang/verbs/context.rb +4 -4
- data/lib/gloo_lang/verbs/create.rb +3 -3
- data/lib/gloo_lang/verbs/execute.rb +4 -4
- data/lib/gloo_lang/verbs/help.rb +23 -23
- data/lib/gloo_lang/verbs/if.rb +3 -3
- data/lib/gloo_lang/verbs/list.rb +7 -7
- data/lib/gloo_lang/verbs/load.rb +3 -3
- data/lib/gloo_lang/verbs/move.rb +6 -6
- data/lib/gloo_lang/verbs/put.rb +6 -6
- data/lib/gloo_lang/verbs/quit.rb +1 -1
- data/lib/gloo_lang/verbs/run.rb +5 -5
- data/lib/gloo_lang/verbs/save.rb +1 -1
- data/lib/gloo_lang/verbs/show.rb +5 -5
- data/lib/gloo_lang/verbs/tell.rb +5 -4
- data/lib/gloo_lang/verbs/unless.rb +3 -3
- data/lib/gloo_lang/verbs/version.rb +1 -1
- data/lib/gloo_lang/verbs/wait.rb +1 -1
- metadata +23 -2
@@ -18,7 +18,8 @@ module GlooLang
|
|
18
18
|
attr_reader :pn
|
19
19
|
|
20
20
|
# Set up the object.
|
21
|
-
def initialize( pn )
|
21
|
+
def initialize( engine, pn )
|
22
|
+
@engine = engine
|
22
23
|
@pn = pn
|
23
24
|
end
|
24
25
|
|
@@ -137,7 +138,7 @@ module GlooLang
|
|
137
138
|
o = "msg_#{msg}"
|
138
139
|
return self.public_send( o ) if self.respond_to? o
|
139
140
|
|
140
|
-
|
141
|
+
@engine.log.error "Message #{msg} not implemented"
|
141
142
|
return false
|
142
143
|
end
|
143
144
|
|
@@ -163,22 +164,22 @@ module GlooLang
|
|
163
164
|
|
164
165
|
# Get the Gloo home directory
|
165
166
|
def msg_gloo_home
|
166
|
-
return
|
167
|
+
return @engine.settings.user_root
|
167
168
|
end
|
168
169
|
|
169
170
|
# Get the Gloo configuration directory
|
170
171
|
def msg_gloo_config
|
171
|
-
return
|
172
|
+
return @engine.settings.config_path
|
172
173
|
end
|
173
174
|
|
174
175
|
# Get the Gloo projects directory
|
175
176
|
def msg_gloo_projects
|
176
|
-
return
|
177
|
+
return @engine.settings.project_path
|
177
178
|
end
|
178
179
|
|
179
180
|
# Get the Gloo log directory
|
180
181
|
def msg_gloo_log
|
181
|
-
return
|
182
|
+
return @engine.settings.log_path
|
182
183
|
end
|
183
184
|
|
184
185
|
# ---------------------------------------------------------------------
|
@@ -196,12 +197,12 @@ module GlooLang
|
|
196
197
|
|
197
198
|
# Get the number of lines on screen.
|
198
199
|
def msg_screen_lines
|
199
|
-
return GlooLang::App::Settings.lines
|
200
|
+
return GlooLang::App::Settings.lines( @engine )
|
200
201
|
end
|
201
202
|
|
202
203
|
# Get the number of columns on screen.
|
203
204
|
def msg_screen_cols
|
204
|
-
return GlooLang::App::Settings.cols
|
205
|
+
return GlooLang::App::Settings.cols( @engine )
|
205
206
|
end
|
206
207
|
|
207
208
|
# ---------------------------------------------------------------------
|
data/lib/gloo_lang/core/heap.rb
CHANGED
@@ -19,13 +19,14 @@ module GlooLang
|
|
19
19
|
#
|
20
20
|
# Set up the object heap.
|
21
21
|
#
|
22
|
-
def initialize
|
23
|
-
|
22
|
+
def initialize( engine )
|
23
|
+
@engine = engine
|
24
|
+
@engine.log.debug 'object heap intialized...'
|
24
25
|
|
25
|
-
@root = GlooLang::Objs::Container.new
|
26
|
+
@root = GlooLang::Objs::Container.new( @engine)
|
26
27
|
@root.name = 'root'
|
27
28
|
|
28
|
-
@context = Pn.root
|
29
|
+
@context = Pn.root engine
|
29
30
|
@it = It.new
|
30
31
|
@error = Error.new
|
31
32
|
end
|
data/lib/gloo_lang/core/here.rb
CHANGED
@@ -21,8 +21,8 @@ module GlooLang
|
|
21
21
|
#
|
22
22
|
# Expand here reference if present.
|
23
23
|
#
|
24
|
-
def self.expand_here( pn )
|
25
|
-
target =
|
24
|
+
def self.expand_here( engine, pn )
|
25
|
+
target = engine.exec_env.here_obj
|
26
26
|
|
27
27
|
here = pn.elements.first
|
28
28
|
remainder = pn.elements[ 1..-1 ].join( '.' )
|
data/lib/gloo_lang/core/obj.rb
CHANGED
@@ -15,7 +15,8 @@ module GlooLang
|
|
15
15
|
#
|
16
16
|
# Set up the object.
|
17
17
|
#
|
18
|
-
def initialize
|
18
|
+
def initialize( engine )
|
19
|
+
@engine = engine
|
19
20
|
@value = ''
|
20
21
|
@children = []
|
21
22
|
@parent = nil
|
@@ -152,7 +153,7 @@ module GlooLang
|
|
152
153
|
:type => type,
|
153
154
|
:value => nil,
|
154
155
|
:parent => self }
|
155
|
-
return
|
156
|
+
return @engine.factory.create params
|
156
157
|
end
|
157
158
|
|
158
159
|
#
|
@@ -193,7 +194,7 @@ module GlooLang
|
|
193
194
|
end
|
194
195
|
|
195
196
|
if self.type_display == GlooLang::Objs::Alias.typename
|
196
|
-
ln = GlooLang::Core::Pn.new( self.value )
|
197
|
+
ln = GlooLang::Core::Pn.new( @engine, self.value )
|
197
198
|
redirect = ln.resolve
|
198
199
|
return redirect.find_child( name )
|
199
200
|
end
|
@@ -256,7 +257,7 @@ module GlooLang
|
|
256
257
|
@params = params
|
257
258
|
return self.dispatch msg if self.can_receive_message? msg
|
258
259
|
|
259
|
-
|
260
|
+
@engine.log.error "Object #{self.name} cannot receive message #{msg}"
|
260
261
|
return false
|
261
262
|
end
|
262
263
|
|
@@ -269,7 +270,7 @@ module GlooLang
|
|
269
270
|
self.public_send( o )
|
270
271
|
return true
|
271
272
|
else
|
272
|
-
|
273
|
+
@engine.log.error "Message #{msg} not implemented"
|
273
274
|
return false
|
274
275
|
end
|
275
276
|
end
|
@@ -279,12 +280,12 @@ module GlooLang
|
|
279
280
|
#
|
280
281
|
def msg_unload
|
281
282
|
if self.root?
|
282
|
-
|
283
|
+
@engine.log.error 'Cannot unload the root object.'
|
283
284
|
return
|
284
285
|
end
|
285
286
|
|
286
|
-
|
287
|
-
|
287
|
+
@engine.event_manager.on_unload self
|
288
|
+
@engine.heap.unload self
|
288
289
|
end
|
289
290
|
|
290
291
|
# ---------------------------------------------------------------------
|
@@ -13,13 +13,13 @@ module GlooLang
|
|
13
13
|
# the given name.
|
14
14
|
# If the container isn't provided, root will be used.
|
15
15
|
#
|
16
|
-
def self.by_name( name, container = nil )
|
17
|
-
container =
|
16
|
+
def self.by_name( engine, name, container = nil )
|
17
|
+
container = engine.heap.root if container.nil?
|
18
18
|
arr = []
|
19
19
|
|
20
20
|
container.children.each do |o|
|
21
21
|
arr << o if o.name == name
|
22
|
-
arr += by_name( name, o ) if o.child_count.positive?
|
22
|
+
arr += by_name( engine, name, o ) if o.child_count.positive?
|
23
23
|
end
|
24
24
|
|
25
25
|
return arr
|
@@ -12,8 +12,9 @@ module GlooLang
|
|
12
12
|
#
|
13
13
|
# Set up the parser.
|
14
14
|
#
|
15
|
-
def initialize
|
16
|
-
|
15
|
+
def initialize( engine )
|
16
|
+
@engine = engine
|
17
|
+
@engine.log.debug 'parser intialized...'
|
17
18
|
end
|
18
19
|
|
19
20
|
#
|
@@ -25,9 +26,9 @@ module GlooLang
|
|
25
26
|
tokens = GlooLang::Core::Tokens.new( cmd )
|
26
27
|
dic = GlooLang::Core::Dictionary.instance
|
27
28
|
verb = dic.find_verb( tokens.verb )
|
28
|
-
return verb.new( tokens, params ) if verb
|
29
|
+
return verb.new( @engine, tokens, params ) if verb
|
29
30
|
|
30
|
-
|
31
|
+
@engine.log.error "Verb '#{tokens.verb}' was not found."
|
31
32
|
return nil
|
32
33
|
end
|
33
34
|
|
@@ -51,7 +52,7 @@ module GlooLang
|
|
51
52
|
#
|
52
53
|
def run( cmd )
|
53
54
|
v = parse_immediate( cmd )
|
54
|
-
GlooLang::Exec::Runner.go( v ) if v
|
55
|
+
GlooLang::Exec::Runner.go( @engine, v ) if v
|
55
56
|
end
|
56
57
|
|
57
58
|
end
|
data/lib/gloo_lang/core/pn.rb
CHANGED
@@ -19,29 +19,30 @@ module GlooLang
|
|
19
19
|
# Set up the object given a source string,
|
20
20
|
# ie: the full path and name.
|
21
21
|
#
|
22
|
-
def initialize( src )
|
22
|
+
def initialize( engine, src )
|
23
|
+
@engine = engine
|
23
24
|
set_to src
|
24
25
|
end
|
25
26
|
|
26
27
|
#
|
27
28
|
# Reference to the root object path.
|
28
29
|
#
|
29
|
-
def self.root
|
30
|
-
return Pn.new( ROOT )
|
30
|
+
def self.root( engine )
|
31
|
+
return Pn.new( engine, ROOT )
|
31
32
|
end
|
32
33
|
|
33
34
|
#
|
34
35
|
# Reference to it.
|
35
36
|
#
|
36
|
-
def self.it
|
37
|
-
return Pn.new( IT )
|
37
|
+
def self.it( engine )
|
38
|
+
return Pn.new( engine, IT )
|
38
39
|
end
|
39
40
|
|
40
41
|
#
|
41
42
|
# Reference to the error message.
|
42
43
|
#
|
43
|
-
def self.error
|
44
|
-
return Pn.new( ERROR )
|
44
|
+
def self.error( engine )
|
45
|
+
return Pn.new( engine, ERROR )
|
45
46
|
end
|
46
47
|
|
47
48
|
#
|
@@ -127,13 +128,13 @@ module GlooLang
|
|
127
128
|
# Get the parent that contains the object referenced.
|
128
129
|
#
|
129
130
|
def get_parent
|
130
|
-
o =
|
131
|
+
o = @engine.heap.root
|
131
132
|
|
132
133
|
if self.includes_path?
|
133
134
|
@elements[ 0..-2 ].each do |e|
|
134
135
|
o = o.find_child( e )
|
135
136
|
if o.nil?
|
136
|
-
|
137
|
+
@engine.log.error "Object '#{e}' was not found."
|
137
138
|
return nil
|
138
139
|
end
|
139
140
|
end
|
@@ -169,18 +170,21 @@ module GlooLang
|
|
169
170
|
# Find the object referenced or return nil if it is not found.
|
170
171
|
#
|
171
172
|
def resolve
|
172
|
-
return
|
173
|
-
return
|
174
|
-
return
|
175
|
-
return GlooLang::Core::GlooSystem.new(
|
176
|
-
|
177
|
-
|
173
|
+
return @engine.heap.root if self.root?
|
174
|
+
return @engine.heap.it if self.it?
|
175
|
+
return @engine.heap.error if self.error?
|
176
|
+
return GlooLang::Core::GlooSystem.new(
|
177
|
+
@engine, self ) if self.gloo_sys?
|
178
|
+
|
179
|
+
if Here.includes_here_ref?( @elements )
|
180
|
+
Here.expand_here( @engine, self )
|
181
|
+
end
|
178
182
|
|
179
183
|
parent = self.get_parent
|
180
184
|
return nil unless parent
|
181
185
|
|
182
186
|
obj = parent.find_child( self.name )
|
183
|
-
return GlooLang::Objs::Alias.resolve_alias( obj, self.src )
|
187
|
+
return GlooLang::Objs::Alias.resolve_alias( @engine, obj, self.src )
|
184
188
|
end
|
185
189
|
|
186
190
|
end
|
data/lib/gloo_lang/core/verb.rb
CHANGED
@@ -15,24 +15,24 @@ module GlooLang
|
|
15
15
|
#
|
16
16
|
# Dispatch the given message to the given object.
|
17
17
|
#
|
18
|
-
def self.message( msg, to_obj, params = nil )
|
19
|
-
|
18
|
+
def self.message( engine, msg, to_obj, params = nil )
|
19
|
+
engine.log.debug "Dispatch message #{msg} to #{to_obj.name}"
|
20
20
|
a = GlooLang::Exec::Action.new msg, to_obj, params
|
21
|
-
GlooLang::Exec::Dispatch.action a
|
21
|
+
GlooLang::Exec::Dispatch.action( engine, a )
|
22
22
|
end
|
23
23
|
|
24
24
|
#
|
25
25
|
# Dispatch an action.
|
26
26
|
#
|
27
|
-
def self.action( action )
|
27
|
+
def self.action( engine, action )
|
28
28
|
unless action.valid?
|
29
|
-
|
29
|
+
engine.log.warn "Object #{action.to.name} does not respond to #{action.msg}"
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
engine.exec_env.push_action action
|
33
|
+
engine.log.debug "Sending message #{action.msg} to #{action.to.name}"
|
34
34
|
action.dispatch
|
35
|
-
|
35
|
+
engine.exec_env.pop_action
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -19,13 +19,14 @@ module GlooLang
|
|
19
19
|
#
|
20
20
|
# Set up the execution environment.
|
21
21
|
#
|
22
|
-
def initialize
|
23
|
-
|
22
|
+
def initialize( engine )
|
23
|
+
@engine = engine
|
24
|
+
@engine.log.debug 'exec env intialized...'
|
24
25
|
|
25
|
-
@verbs = GlooLang::Exec::Stack.new VERB_STACK
|
26
|
-
@actions = GlooLang::Exec::Stack.new ACTION_STACK
|
27
|
-
@scripts = GlooLang::Exec::Stack.new SCRIPT_STACK
|
28
|
-
@here = GlooLang::Exec::Stack.new HERE_STACK
|
26
|
+
@verbs = GlooLang::Exec::Stack.new( @engine, VERB_STACK )
|
27
|
+
@actions = GlooLang::Exec::Stack.new( @engine, ACTION_STACK )
|
28
|
+
@scripts = GlooLang::Exec::Stack.new( @engine, SCRIPT_STACK )
|
29
|
+
@here = GlooLang::Exec::Stack.new( @engine, HERE_STACK )
|
29
30
|
end
|
30
31
|
|
31
32
|
#
|
@@ -15,28 +15,28 @@ module GlooLang
|
|
15
15
|
# that need to be done before or after a verb
|
16
16
|
# is done running.
|
17
17
|
#
|
18
|
-
def self.go( verb )
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
def self.go( engine, verb )
|
19
|
+
engine.log.debug "running verb #{verb.type_display}"
|
20
|
+
engine.heap.error.start_tracking
|
21
|
+
engine.exec_env.verbs.push verb
|
22
22
|
verb&.run
|
23
|
-
|
24
|
-
|
23
|
+
engine.exec_env.verbs.pop
|
24
|
+
engine.heap.error.clear_if_no_errors
|
25
25
|
end
|
26
26
|
|
27
27
|
#
|
28
28
|
# Send 'run' message to the object.
|
29
29
|
# Resolve the path_name and then send the run message.
|
30
30
|
#
|
31
|
-
def self.run( path_name )
|
32
|
-
|
33
|
-
pn = GlooLang::Core::Pn.new path_name
|
31
|
+
def self.run( engine, path_name )
|
32
|
+
engine.log.debug "running script at #{path_name}"
|
33
|
+
pn = GlooLang::Core::Pn.new( engine, path_name )
|
34
34
|
o = pn.resolve
|
35
35
|
|
36
36
|
if o
|
37
37
|
o.send_message 'run'
|
38
38
|
else
|
39
|
-
|
39
|
+
engine.log.error "Could not send message to object. Bad path: #{path_name}"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -13,7 +13,8 @@ module GlooLang
|
|
13
13
|
#
|
14
14
|
# Set up the script.
|
15
15
|
#
|
16
|
-
def initialize( obj )
|
16
|
+
def initialize( engine, obj )
|
17
|
+
@engine = engine
|
17
18
|
@obj = obj
|
18
19
|
end
|
19
20
|
|
@@ -23,17 +24,17 @@ module GlooLang
|
|
23
24
|
# of lines.
|
24
25
|
#
|
25
26
|
def run
|
26
|
-
|
27
|
+
@engine.exec_env.push_script self
|
27
28
|
|
28
29
|
if @obj.value.is_a? String
|
29
|
-
|
30
|
+
@engine.parser.run @obj.value
|
30
31
|
elsif @obj.value.is_a? Array
|
31
32
|
@obj.value.each do |line|
|
32
|
-
|
33
|
+
@engine.parser.run line
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
|
37
|
+
@engine.exec_env.pop_script
|
37
38
|
end
|
38
39
|
|
39
40
|
#
|
data/lib/gloo_lang/exec/stack.rb
CHANGED
@@ -13,19 +13,20 @@ module GlooLang
|
|
13
13
|
#
|
14
14
|
# Set up the stack.
|
15
15
|
#
|
16
|
-
def initialize( name )
|
16
|
+
def initialize( engine, name )
|
17
|
+
@engine = engine
|
17
18
|
@name = name
|
18
19
|
clear_stack
|
19
|
-
|
20
|
+
@engine.log.debug "#{name} stack intialized..."
|
20
21
|
end
|
21
22
|
|
22
23
|
#
|
23
24
|
# Push an item onto the stack.
|
24
25
|
#
|
25
26
|
def push( obj )
|
26
|
-
|
27
|
+
@engine.log.debug "#{@name}:push #{obj.display_value}"
|
27
28
|
@stack.push obj
|
28
|
-
self.update_out_file if
|
29
|
+
self.update_out_file if @engine.settings.debug
|
29
30
|
end
|
30
31
|
|
31
32
|
#
|
@@ -33,8 +34,8 @@ module GlooLang
|
|
33
34
|
#
|
34
35
|
def pop
|
35
36
|
o = @stack.pop
|
36
|
-
|
37
|
-
self.update_out_file if
|
37
|
+
@engine.log.debug "#{@name}:pop #{o.display_value}"
|
38
|
+
self.update_out_file if @engine.settings.debug
|
38
39
|
end
|
39
40
|
|
40
41
|
#
|
@@ -55,7 +56,7 @@ module GlooLang
|
|
55
56
|
# Get the file we'll write debug information for the stack.
|
56
57
|
#
|
57
58
|
def out_file
|
58
|
-
return File.join(
|
59
|
+
return File.join( @engine.settings.debug_path, @name )
|
59
60
|
end
|
60
61
|
|
61
62
|
#
|
@@ -15,7 +15,8 @@ module GlooLang
|
|
15
15
|
#
|
16
16
|
# Create the expression from a list of tokens.
|
17
17
|
#
|
18
|
-
def initialize( tokens )
|
18
|
+
def initialize( engine, tokens )
|
19
|
+
@engine = engine
|
19
20
|
@tokens = tokens
|
20
21
|
@symbols = []
|
21
22
|
@left = nil
|
@@ -110,7 +111,7 @@ module GlooLang
|
|
110
111
|
return LDecimal.new( token ) if LDecimal.decimal?( token )
|
111
112
|
|
112
113
|
# last chance: an Object reference
|
113
|
-
return GlooLang::Core::Pn.new( token )
|
114
|
+
return GlooLang::Core::Pn.new( @engine, token )
|
114
115
|
end
|
115
116
|
|
116
117
|
end
|
@@ -48,9 +48,9 @@ module GlooLang
|
|
48
48
|
# Check to see if the referenced object exists.
|
49
49
|
#
|
50
50
|
def msg_resolve
|
51
|
-
pn = GlooLang::Core::Pn.new( self.value )
|
51
|
+
pn = GlooLang::Core::Pn.new( @engine, self.value )
|
52
52
|
s = pn.exists?
|
53
|
-
|
53
|
+
@engine.heap.it.set_to s
|
54
54
|
return s
|
55
55
|
end
|
56
56
|
|
@@ -64,12 +64,12 @@ module GlooLang
|
|
64
64
|
# If it ends with the * then we won't resolve the alias since
|
65
65
|
# we are trying to refer to the alias itself.
|
66
66
|
#
|
67
|
-
def self.resolve_alias( obj, ref_name = nil )
|
67
|
+
def self.resolve_alias( engine, obj, ref_name = nil )
|
68
68
|
return nil unless obj
|
69
69
|
return obj unless obj.type_display == GlooLang::Objs::Alias.typename
|
70
70
|
return obj if ref_name&.end_with?( ALIAS_REFERENCE )
|
71
71
|
|
72
|
-
ln = GlooLang::Core::Pn.new( obj.value )
|
72
|
+
ln = GlooLang::Core::Pn.new( engine, obj.value )
|
73
73
|
return ln.resolve
|
74
74
|
end
|
75
75
|
|
@@ -93,7 +93,7 @@ module GlooLang
|
|
93
93
|
def msg_not
|
94
94
|
v = !value
|
95
95
|
set_value v
|
96
|
-
|
96
|
+
@engine.heap.it.set_to v
|
97
97
|
return v
|
98
98
|
end
|
99
99
|
|
@@ -102,7 +102,7 @@ module GlooLang
|
|
102
102
|
#
|
103
103
|
def msg_true
|
104
104
|
set_value true
|
105
|
-
|
105
|
+
@engine.heap.it.set_to true
|
106
106
|
return true
|
107
107
|
end
|
108
108
|
|
@@ -111,7 +111,7 @@ module GlooLang
|
|
111
111
|
#
|
112
112
|
def msg_false
|
113
113
|
set_value false
|
114
|
-
|
114
|
+
@engine.heap.it.set_to false
|
115
115
|
return false
|
116
116
|
end
|
117
117
|
|
@@ -41,7 +41,7 @@ module GlooLang
|
|
41
41
|
#
|
42
42
|
def msg_count
|
43
43
|
i = child_count
|
44
|
-
|
44
|
+
@engine.heap.it.set_to i
|
45
45
|
return i
|
46
46
|
end
|
47
47
|
|
@@ -57,7 +57,7 @@ module GlooLang
|
|
57
57
|
#
|
58
58
|
def msg_show_key_value_table
|
59
59
|
data = self.children.map { |o| [ o.name, o.value ] }
|
60
|
-
|
60
|
+
@engine.platform.show_table nil, data, title
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
@@ -35,7 +35,7 @@ module GlooLang
|
|
35
35
|
end
|
36
36
|
|
37
37
|
unless new_value.is_a? Numeric
|
38
|
-
self.value =
|
38
|
+
self.value = @engine.converter.convert( new_value, 'Decimal', 0.0 )
|
39
39
|
return
|
40
40
|
end
|
41
41
|
|
@@ -61,13 +61,13 @@ module GlooLang
|
|
61
61
|
def msg_round
|
62
62
|
data = 0
|
63
63
|
if @params&.token_count&.positive?
|
64
|
-
expr = GlooLang::Expr::Expression.new( @params.tokens )
|
64
|
+
expr = GlooLang::Expr::Expression.new( @engine, @params.tokens )
|
65
65
|
data = expr.evaluate.to_i
|
66
66
|
end
|
67
67
|
|
68
68
|
i = self.value.round( data )
|
69
69
|
set_value i
|
70
|
-
|
70
|
+
@engine.heap.it.set_to i
|
71
71
|
return i
|
72
72
|
end
|
73
73
|
|
@@ -30,7 +30,7 @@ module GlooLang
|
|
30
30
|
#
|
31
31
|
def set_value( new_value )
|
32
32
|
unless new_value.is_a? Numeric
|
33
|
-
self.value =
|
33
|
+
self.value = @engine.converter.convert( new_value, 'Integer', 0 )
|
34
34
|
return
|
35
35
|
end
|
36
36
|
|
@@ -54,7 +54,7 @@ module GlooLang
|
|
54
54
|
def msg_inc
|
55
55
|
i = value + 1
|
56
56
|
set_value i
|
57
|
-
|
57
|
+
@engine.heap.it.set_to i
|
58
58
|
return i
|
59
59
|
end
|
60
60
|
|
@@ -64,7 +64,7 @@ module GlooLang
|
|
64
64
|
def msg_dec
|
65
65
|
i = value - 1
|
66
66
|
set_value i
|
67
|
-
|
67
|
+
@engine.heap.it.set_to i
|
68
68
|
return i
|
69
69
|
end
|
70
70
|
|
@@ -48,7 +48,7 @@ module GlooLang
|
|
48
48
|
#
|
49
49
|
def msg_size
|
50
50
|
s = value.size
|
51
|
-
|
51
|
+
@engine.heap.it.set_to s
|
52
52
|
return s
|
53
53
|
end
|
54
54
|
|
@@ -58,7 +58,7 @@ module GlooLang
|
|
58
58
|
def msg_up
|
59
59
|
s = value.upcase
|
60
60
|
set_value s
|
61
|
-
|
61
|
+
@engine.heap.it.set_to s
|
62
62
|
return s
|
63
63
|
end
|
64
64
|
|
@@ -68,7 +68,7 @@ module GlooLang
|
|
68
68
|
def msg_down
|
69
69
|
s = value.downcase
|
70
70
|
set_value s
|
71
|
-
|
71
|
+
@engine.heap.it.set_to s
|
72
72
|
return s
|
73
73
|
end
|
74
74
|
|
@@ -64,14 +64,14 @@ module GlooLang
|
|
64
64
|
def msg_page
|
65
65
|
return unless value
|
66
66
|
|
67
|
-
|
67
|
+
@engine.platform.show( value, false, true )
|
68
68
|
end
|
69
69
|
|
70
70
|
#
|
71
71
|
# Edit the text in the default editor.
|
72
72
|
#
|
73
73
|
def msg_edit
|
74
|
-
self.value =
|
74
|
+
self.value = @engine.platform.edit( self.value )
|
75
75
|
end
|
76
76
|
|
77
77
|
end
|