gloo 0.6.1 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gloo/app/args.rb +48 -6
- data/lib/gloo/app/engine.rb +58 -39
- data/lib/gloo/app/help.rb +126 -25
- data/lib/gloo/app/info.rb +3 -1
- data/lib/gloo/app/log.rb +23 -0
- data/lib/gloo/app/mode.rb +2 -0
- data/lib/gloo/app/settings.rb +75 -68
- data/lib/gloo/convert/converter.rb +35 -0
- data/lib/gloo/convert/string_to_datetime.rb +1 -1
- data/lib/gloo/convert/string_to_decimal.rb +1 -1
- data/lib/gloo/convert/string_to_integer.rb +1 -1
- data/lib/gloo/core/dictionary.rb +99 -22
- data/lib/gloo/core/error.rb +19 -8
- data/lib/gloo/core/event_manager.rb +4 -0
- data/lib/gloo/core/factory.rb +11 -0
- data/lib/gloo/core/gloo_system.rb +1 -1
- data/lib/gloo/core/heap.rb +11 -3
- data/lib/gloo/core/it.rb +6 -0
- data/lib/gloo/core/literal.rb +5 -0
- data/lib/gloo/core/obj.rb +14 -0
- data/lib/gloo/core/op.rb +7 -0
- data/lib/gloo/core/parser.rb +6 -0
- data/lib/gloo/core/pn.rb +36 -0
- data/lib/gloo/core/tokens.rb +66 -22
- data/lib/gloo/core/verb.rb +4 -0
- data/lib/gloo/exec/exec_env.rb +13 -1
- data/lib/gloo/expr/expression.rb +26 -4
- data/lib/gloo/expr/l_boolean.rb +6 -0
- data/lib/gloo/expr/l_decimal.rb +5 -0
- data/lib/gloo/expr/l_integer.rb +7 -0
- data/lib/gloo/expr/l_string.rb +7 -0
- data/lib/gloo/expr/op_div.rb +2 -0
- data/lib/gloo/expr/op_minus.rb +2 -0
- data/lib/gloo/expr/op_mult.rb +2 -0
- data/lib/gloo/expr/op_plus.rb +2 -0
- data/lib/gloo/help/app/application.txt +22 -0
- data/lib/gloo/help/app/configuration.txt +7 -0
- data/lib/gloo/help/app/default_help.txt +14 -0
- data/lib/gloo/help/app/logging.txt +16 -0
- data/lib/gloo/help/core/color.txt +31 -0
- data/lib/gloo/help/core/error.txt +33 -0
- data/lib/gloo/help/core/events.txt +21 -0
- data/lib/gloo/help/core/gloo_system.txt +54 -0
- data/lib/gloo/help/core/here.txt +30 -0
- data/lib/gloo/help/core/it.txt +23 -0
- data/lib/gloo/help/core/ops.txt +16 -0
- data/lib/gloo/help/core/pathname.txt +29 -0
- data/lib/gloo/help/objs/basic/alias.txt +36 -0
- data/lib/gloo/help/objs/basic/boolean.txt +28 -0
- data/lib/gloo/help/objs/basic/container.txt +33 -0
- data/lib/gloo/help/objs/basic/decimal.txt +28 -0
- data/lib/gloo/help/objs/basic/integer.txt +27 -0
- data/lib/gloo/help/objs/basic/script.txt +29 -0
- data/lib/gloo/help/objs/basic/string.txt +28 -0
- data/lib/gloo/help/objs/basic/text.txt +27 -0
- data/lib/gloo/help/objs/basic/untyped.txt +22 -0
- data/lib/gloo/help/objs/cli/banner.txt +49 -0
- data/lib/gloo/help/objs/cli/bar.txt +34 -0
- data/lib/gloo/help/objs/cli/colorize.txt +33 -0
- data/lib/gloo/help/objs/cli/confirm.txt +26 -0
- data/lib/gloo/help/objs/cli/menu.txt +44 -0
- data/lib/gloo/help/objs/cli/menu_item.txt +26 -0
- data/lib/gloo/help/objs/cli/pastel.txt +43 -0
- data/lib/gloo/help/objs/cli/prompt.txt +27 -0
- data/lib/gloo/help/objs/cli/select.txt +34 -0
- data/lib/gloo/help/objs/ctrl/each.txt +48 -0
- data/lib/gloo/help/objs/ctrl/repeat.txt +38 -0
- data/lib/gloo/help/objs/data/markdown.txt +25 -0
- data/lib/gloo/help/objs/data/table.txt +46 -0
- data/lib/gloo/help/objs/dev/git_repo.txt +35 -0
- data/lib/gloo/help/objs/dt/date.txt +23 -0
- data/lib/gloo/help/objs/dt/datetime.txt +24 -0
- data/lib/gloo/help/objs/dt/time.txt +23 -0
- data/lib/gloo/help/objs/ror/erb.txt +37 -0
- data/lib/gloo/help/objs/ror/eval.txt +24 -0
- data/lib/gloo/help/objs/snd/play.txt +23 -0
- data/lib/gloo/help/objs/snd/say.txt +28 -0
- data/lib/gloo/help/objs/system/file.txt +48 -0
- data/lib/gloo/help/objs/system/system.txt +32 -0
- data/lib/gloo/help/objs/web/http_get.txt +35 -0
- data/lib/gloo/help/objs/web/http_post.txt +32 -0
- data/lib/gloo/help/objs/web/json.txt +34 -0
- data/lib/gloo/help/objs/web/slack.txt +33 -0
- data/lib/gloo/help/objs/web/teams.txt +30 -0
- data/lib/gloo/help/objs/web/uri.txt +37 -0
- data/lib/gloo/help/verbs/alert.txt +33 -0
- data/lib/gloo/help/verbs/beep.txt +25 -0
- data/lib/gloo/help/verbs/cls.txt +24 -0
- data/lib/gloo/help/verbs/context.txt +43 -0
- data/lib/gloo/help/verbs/create.txt +33 -0
- data/lib/gloo/help/verbs/execute.txt +27 -0
- data/lib/gloo/help/verbs/help.txt +34 -0
- data/lib/gloo/help/verbs/if.txt +37 -0
- data/lib/gloo/help/verbs/list.txt +34 -0
- data/lib/gloo/help/verbs/load.txt +38 -0
- data/lib/gloo/help/verbs/move.txt +42 -0
- data/lib/gloo/help/verbs/put.txt +38 -0
- data/lib/gloo/help/verbs/quit.txt +25 -0
- data/lib/gloo/help/verbs/run.txt +41 -0
- data/lib/gloo/help/verbs/save.txt +26 -0
- data/lib/gloo/help/verbs/show.txt +30 -0
- data/lib/gloo/help/verbs/tell.txt +34 -0
- data/lib/gloo/help/verbs/unless.txt +38 -0
- data/lib/gloo/help/verbs/version.txt +32 -0
- data/lib/gloo/help/verbs/wait.txt +29 -0
- data/lib/gloo/objs/basic/alias.rb +0 -33
- data/lib/gloo/objs/basic/boolean.rb +6 -27
- data/lib/gloo/objs/basic/container.rb +0 -33
- data/lib/gloo/objs/basic/decimal.rb +8 -28
- data/lib/gloo/objs/basic/integer.rb +5 -26
- data/lib/gloo/objs/basic/script.rb +0 -26
- data/lib/gloo/objs/basic/string.rb +6 -26
- data/lib/gloo/objs/basic/text.rb +0 -25
- data/lib/gloo/objs/basic/untyped.rb +0 -26
- data/lib/gloo/objs/cli/banner.rb +0 -29
- data/lib/gloo/objs/cli/bar.rb +0 -29
- data/lib/gloo/objs/cli/colorize.rb +4 -34
- data/lib/gloo/objs/cli/confirm.rb +6 -36
- data/lib/gloo/objs/cli/menu.rb +4 -34
- data/lib/gloo/objs/cli/menu_item.rb +0 -33
- data/lib/gloo/objs/cli/pastel.rb +4 -27
- data/lib/gloo/objs/cli/prompt.rb +4 -28
- data/lib/gloo/objs/cli/select.rb +4 -31
- data/lib/gloo/objs/ctrl/each.rb +33 -33
- data/lib/gloo/objs/ctrl/repeat.rb +8 -29
- data/lib/gloo/objs/data/markdown.rb +0 -25
- data/lib/gloo/objs/data/table.rb +4 -32
- data/lib/gloo/objs/dev/git.rb +12 -30
- data/lib/gloo/objs/dt/date.rb +3 -25
- data/lib/gloo/objs/dt/datetime.rb +4 -26
- data/lib/gloo/objs/dt/time.rb +3 -25
- data/lib/gloo/objs/ror/erb.rb +11 -45
- data/lib/gloo/objs/ror/eval.rb +11 -38
- data/lib/gloo/objs/snd/play.rb +2 -25
- data/lib/gloo/objs/snd/say.rb +9 -31
- data/lib/gloo/objs/system/file_handle.rb +7 -36
- data/lib/gloo/objs/system/system.rb +16 -46
- data/lib/gloo/objs/web/http_get.rb +57 -83
- data/lib/gloo/objs/web/http_post.rb +8 -31
- data/lib/gloo/objs/web/json.rb +11 -31
- data/lib/gloo/objs/web/slack.rb +7 -34
- data/lib/gloo/objs/web/teams.rb +13 -48
- data/lib/gloo/objs/web/uri.rb +0 -29
- data/lib/gloo/persist/file_loader.rb +8 -0
- data/lib/gloo/persist/file_saver.rb +6 -0
- data/lib/gloo/persist/file_storage.rb +2 -0
- data/lib/gloo/persist/line_splitter.rb +2 -0
- data/lib/gloo/persist/persist_man.rb +6 -0
- data/lib/gloo/verbs/alert.rb +30 -44
- data/lib/gloo/verbs/beep.rb +0 -30
- data/lib/gloo/verbs/cls.rb +0 -30
- data/lib/gloo/verbs/context.rb +9 -39
- data/lib/gloo/verbs/create.rb +17 -32
- data/lib/gloo/verbs/execute.rb +56 -0
- data/lib/gloo/verbs/help.rb +151 -115
- data/lib/gloo/verbs/if.rb +46 -44
- data/lib/gloo/verbs/list.rb +36 -54
- data/lib/gloo/verbs/load.rb +8 -37
- data/lib/gloo/verbs/move.rb +12 -51
- data/lib/gloo/verbs/put.rb +28 -52
- data/lib/gloo/verbs/quit.rb +0 -31
- data/lib/gloo/verbs/run.rb +23 -39
- data/lib/gloo/verbs/save.rb +0 -33
- data/lib/gloo/verbs/show.rb +6 -31
- data/lib/gloo/verbs/tell.rb +31 -31
- data/lib/gloo/verbs/unless.rb +47 -46
- data/lib/gloo/verbs/version.rb +0 -30
- data/lib/gloo/verbs/wait.rb +0 -31
- metadata +74 -3
- data/lib/gloo/help/help.md +0 -16
data/lib/gloo/core/tokens.rb
CHANGED
@@ -11,78 +11,85 @@ module Gloo
|
|
11
11
|
|
12
12
|
attr_reader :cmd, :tokens
|
13
13
|
|
14
|
+
# ---------------------------------------------------------------------
|
15
|
+
# Constructor
|
16
|
+
# ---------------------------------------------------------------------
|
17
|
+
|
18
|
+
#
|
14
19
|
# Set up the tokens.
|
20
|
+
# The command string is parsed into tokens during creation.
|
21
|
+
#
|
15
22
|
def initialize( cmd_string )
|
16
23
|
@cmd = cmd_string
|
17
24
|
@tokens = []
|
18
25
|
tokenize @cmd
|
19
26
|
end
|
20
27
|
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
i = str.index( '"' )
|
25
|
-
j = str.index( '"', i + 1 )
|
26
|
-
j ||= str.length
|
27
|
-
|
28
|
-
tokenize( str[ 0..i - 1 ] ) if i > 1
|
29
|
-
@tokens << str[ i..j ]
|
30
|
-
tokenize( str[ j + 1..-1 ] ) if j + 1 < str.length
|
31
|
-
elsif str.index( "'" )
|
32
|
-
i = str.index( "'" )
|
33
|
-
j = str.index( "'", i + 1 )
|
34
|
-
j ||= str.length
|
35
|
-
|
36
|
-
tokenize( str[ 0..i - 1 ] ) if i > 1
|
37
|
-
@tokens << str[ i..j ]
|
38
|
-
tokenize( str[ j + 1..-1 ] ) if j + 1 < str.length
|
39
|
-
else
|
40
|
-
str.strip.split( ' ' ).each { |t| @tokens << t }
|
41
|
-
end
|
42
|
-
end
|
28
|
+
# ---------------------------------------------------------------------
|
29
|
+
# Public functions
|
30
|
+
# ---------------------------------------------------------------------
|
43
31
|
|
32
|
+
#
|
44
33
|
# Get the number of tokens
|
34
|
+
#
|
45
35
|
def token_count
|
46
36
|
return @tokens.size
|
47
37
|
end
|
48
38
|
|
39
|
+
#
|
49
40
|
# Get the verb (the first word)
|
41
|
+
#
|
50
42
|
def verb
|
51
43
|
return first
|
52
44
|
end
|
53
45
|
|
46
|
+
#
|
54
47
|
# Get all tokens except the first.
|
48
|
+
#
|
55
49
|
def params
|
56
50
|
return @tokens[ 1..-1 ]
|
57
51
|
end
|
58
52
|
|
53
|
+
#
|
59
54
|
# Get the first token.
|
55
|
+
#
|
60
56
|
def first
|
61
57
|
return @tokens.first if @tokens
|
62
58
|
end
|
63
59
|
|
60
|
+
#
|
64
61
|
# Get the last token.
|
62
|
+
#
|
65
63
|
def last
|
66
64
|
return @tokens.last if @tokens
|
67
65
|
end
|
68
66
|
|
67
|
+
#
|
69
68
|
# Get the second token.
|
69
|
+
#
|
70
70
|
def second
|
71
71
|
return @tokens[ 1 ] if @tokens&.size&.positive?
|
72
72
|
end
|
73
73
|
|
74
|
+
#
|
75
|
+
# Get the token at the the requested index.
|
76
|
+
#
|
74
77
|
def at( index )
|
75
78
|
return @tokens[ index ] if @tokens && @tokens.size >= index
|
76
79
|
end
|
77
80
|
|
81
|
+
#
|
78
82
|
# Get the index of the given token.
|
83
|
+
#
|
79
84
|
def index_of( token )
|
80
85
|
return nil unless @tokens
|
81
86
|
|
82
87
|
return @tokens.find_index { |o| o.casecmp( token ).zero? }
|
83
88
|
end
|
84
89
|
|
90
|
+
#
|
85
91
|
# Get the list of tokens after the given token
|
92
|
+
#
|
86
93
|
def tokens_after( token )
|
87
94
|
i = index_of token
|
88
95
|
return @tokens[ i + 1..-1 ] if i && @tokens && @tokens.size > ( i + 1 )
|
@@ -90,7 +97,9 @@ module Gloo
|
|
90
97
|
return nil
|
91
98
|
end
|
92
99
|
|
100
|
+
#
|
93
101
|
# Get the expression after the given token
|
102
|
+
#
|
94
103
|
def expr_after( token )
|
95
104
|
str = ''
|
96
105
|
tokens_after( token ).each do |t|
|
@@ -100,7 +109,9 @@ module Gloo
|
|
100
109
|
return str
|
101
110
|
end
|
102
111
|
|
112
|
+
#
|
103
113
|
# Get the item after a given token.
|
114
|
+
#
|
104
115
|
def after_token( token )
|
105
116
|
i = index_of token
|
106
117
|
return @tokens[ i + 1 ] if i && @tokens && @tokens.size > ( i + 1 )
|
@@ -108,7 +119,9 @@ module Gloo
|
|
108
119
|
return nil
|
109
120
|
end
|
110
121
|
|
122
|
+
#
|
111
123
|
# Get the item after a given token.
|
124
|
+
#
|
112
125
|
def before_token( token )
|
113
126
|
i = index_of token
|
114
127
|
return @tokens[ 0..i - 1 ] if i && @tokens && @tokens.size >= i
|
@@ -116,6 +129,37 @@ module Gloo
|
|
116
129
|
return nil
|
117
130
|
end
|
118
131
|
|
132
|
+
# ---------------------------------------------------------------------
|
133
|
+
# Private functions
|
134
|
+
# ---------------------------------------------------------------------
|
135
|
+
|
136
|
+
private
|
137
|
+
|
138
|
+
#
|
139
|
+
# Create a list of token from the given string.
|
140
|
+
#
|
141
|
+
def tokenize( str )
|
142
|
+
if str.index( '"' )
|
143
|
+
i = str.index( '"' )
|
144
|
+
j = str.index( '"', i + 1 )
|
145
|
+
j ||= str.length
|
146
|
+
|
147
|
+
tokenize( str[ 0..i - 1 ] ) if i > 1
|
148
|
+
@tokens << str[ i..j ]
|
149
|
+
tokenize( str[ j + 1..-1 ] ) if j + 1 < str.length
|
150
|
+
elsif str.index( "'" )
|
151
|
+
i = str.index( "'" )
|
152
|
+
j = str.index( "'", i + 1 )
|
153
|
+
j ||= str.length
|
154
|
+
|
155
|
+
tokenize( str[ 0..i - 1 ] ) if i > 1
|
156
|
+
@tokens << str[ i..j ]
|
157
|
+
tokenize( str[ j + 1..-1 ] ) if j + 1 < str.length
|
158
|
+
else
|
159
|
+
str.strip.split( ' ' ).each { |t| @tokens << t }
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
119
163
|
end
|
120
164
|
end
|
121
165
|
end
|
data/lib/gloo/core/verb.rb
CHANGED
@@ -13,13 +13,17 @@ module Gloo
|
|
13
13
|
|
14
14
|
attr_reader :tokens, :params
|
15
15
|
|
16
|
+
#
|
16
17
|
# Set up the verb.
|
18
|
+
#
|
17
19
|
def initialize( tokens, params = [] )
|
18
20
|
@tokens = tokens
|
19
21
|
@params = params
|
20
22
|
end
|
21
23
|
|
24
|
+
#
|
22
25
|
# Register verbs when they are loaded.
|
26
|
+
#
|
23
27
|
def self.inherited( subclass )
|
24
28
|
Dictionary.instance.register_verb( subclass )
|
25
29
|
end
|
data/lib/gloo/exec/exec_env.rb
CHANGED
@@ -17,7 +17,7 @@ module Gloo
|
|
17
17
|
HERE_STACK = 'here'.freeze
|
18
18
|
|
19
19
|
#
|
20
|
-
# Set up the
|
20
|
+
# Set up the execution environment.
|
21
21
|
#
|
22
22
|
def initialize
|
23
23
|
$log.debug 'exec env intialized...'
|
@@ -37,21 +37,33 @@ module Gloo
|
|
37
37
|
return @here.stack.last
|
38
38
|
end
|
39
39
|
|
40
|
+
#
|
41
|
+
# Push a script onto the stack.
|
42
|
+
#
|
40
43
|
def push_script( script )
|
41
44
|
@scripts.push script
|
42
45
|
@here.push script.obj
|
43
46
|
end
|
44
47
|
|
48
|
+
#
|
49
|
+
# Pop a script off the stack.
|
50
|
+
#
|
45
51
|
def pop_script
|
46
52
|
@scripts.pop
|
47
53
|
@here.pop
|
48
54
|
end
|
49
55
|
|
56
|
+
#
|
57
|
+
# Push an action onto the stack.
|
58
|
+
#
|
50
59
|
def push_action( action )
|
51
60
|
@actions.push action
|
52
61
|
# @here.push action.to
|
53
62
|
end
|
54
63
|
|
64
|
+
#
|
65
|
+
# Pop an action off the stack.
|
66
|
+
#
|
55
67
|
def pop_action
|
56
68
|
@actions.pop
|
57
69
|
# @here.pop
|
data/lib/gloo/expr/expression.rb
CHANGED
@@ -8,7 +8,13 @@ module Gloo
|
|
8
8
|
module Expr
|
9
9
|
class Expression
|
10
10
|
|
11
|
+
# ---------------------------------------------------------------------
|
12
|
+
# Constructor
|
13
|
+
# ---------------------------------------------------------------------
|
14
|
+
|
15
|
+
#
|
11
16
|
# Create the expression from a list of tokens.
|
17
|
+
#
|
12
18
|
def initialize( tokens )
|
13
19
|
@tokens = tokens
|
14
20
|
@symbols = []
|
@@ -17,7 +23,13 @@ module Gloo
|
|
17
23
|
@op = nil
|
18
24
|
end
|
19
25
|
|
26
|
+
# ---------------------------------------------------------------------
|
27
|
+
# Evaluate Expression
|
28
|
+
# ---------------------------------------------------------------------
|
29
|
+
|
30
|
+
#
|
20
31
|
# Evaluate the expression and return the value.
|
32
|
+
#
|
21
33
|
def evaluate
|
22
34
|
identify_tokens
|
23
35
|
|
@@ -39,7 +51,15 @@ module Gloo
|
|
39
51
|
return @left
|
40
52
|
end
|
41
53
|
|
54
|
+
# ---------------------------------------------------------------------
|
55
|
+
# Private functions
|
56
|
+
# ---------------------------------------------------------------------
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
#
|
42
61
|
# Perform the operation.
|
62
|
+
#
|
43
63
|
def perform_op
|
44
64
|
@op ||= Gloo::Core::Op.default_op
|
45
65
|
l = evaluate_sym @left
|
@@ -49,7 +69,9 @@ module Gloo
|
|
49
69
|
@op = nil
|
50
70
|
end
|
51
71
|
|
72
|
+
#
|
52
73
|
# Evaluate the symbol and get a simple value.
|
74
|
+
#
|
53
75
|
def evaluate_sym( sym )
|
54
76
|
return sym.value if sym.is_a? Gloo::Core::Literal
|
55
77
|
return resolve_ref sym if sym.is_a? Gloo::Core::Pn
|
@@ -57,7 +79,9 @@ module Gloo
|
|
57
79
|
return sym
|
58
80
|
end
|
59
81
|
|
82
|
+
#
|
60
83
|
# resolve an object reference and get the value.
|
84
|
+
#
|
61
85
|
def resolve_ref( ref )
|
62
86
|
return ref.src if ref.named_color?
|
63
87
|
|
@@ -65,15 +89,13 @@ module Gloo
|
|
65
89
|
return ob.value if ob
|
66
90
|
end
|
67
91
|
|
92
|
+
#
|
68
93
|
# Identify each token in the list.
|
94
|
+
#
|
69
95
|
def identify_tokens
|
70
96
|
@tokens.each do |o|
|
71
97
|
@symbols << identify_token( o )
|
72
98
|
end
|
73
|
-
|
74
|
-
# @symbols.each do |o|
|
75
|
-
# puts o.class.name
|
76
|
-
# end
|
77
99
|
end
|
78
100
|
|
79
101
|
#
|
data/lib/gloo/expr/l_boolean.rb
CHANGED
@@ -8,17 +8,23 @@ module Gloo
|
|
8
8
|
module Expr
|
9
9
|
class LBoolean < Gloo::Core::Literal
|
10
10
|
|
11
|
+
#
|
11
12
|
# Is the given token a boolean?
|
13
|
+
#
|
12
14
|
def self.boolean?( token )
|
13
15
|
return Gloo::Objs::Boolean.boolean? token
|
14
16
|
end
|
15
17
|
|
18
|
+
#
|
16
19
|
# Set the value, converting to an boolean.
|
20
|
+
#
|
17
21
|
def set_value( value )
|
18
22
|
@value = Gloo::Objs::Boolean.coerse_to_bool value
|
19
23
|
end
|
20
24
|
|
25
|
+
#
|
21
26
|
# Get string representation
|
27
|
+
#
|
22
28
|
def to_s
|
23
29
|
return 'false' unless @value
|
24
30
|
|
data/lib/gloo/expr/l_decimal.rb
CHANGED
@@ -18,13 +18,18 @@ module Gloo
|
|
18
18
|
return s.to_f.to_s == s
|
19
19
|
end
|
20
20
|
|
21
|
+
#
|
21
22
|
# Set the value, converting to an integer.
|
23
|
+
#
|
22
24
|
def set_value( value )
|
23
25
|
value = value.to_s if value.is_a? Numeric
|
24
26
|
|
25
27
|
@value = value.to_f
|
26
28
|
end
|
27
29
|
|
30
|
+
#
|
31
|
+
# Get string representation
|
32
|
+
#
|
28
33
|
def to_s
|
29
34
|
return self.value.to_s
|
30
35
|
end
|
data/lib/gloo/expr/l_integer.rb
CHANGED
@@ -8,7 +8,9 @@ module Gloo
|
|
8
8
|
module Expr
|
9
9
|
class LInteger < Gloo::Core::Literal
|
10
10
|
|
11
|
+
#
|
11
12
|
# Is the given token an integer?
|
13
|
+
#
|
12
14
|
def self.integer?( token )
|
13
15
|
return true if token.is_a? Integer
|
14
16
|
|
@@ -16,11 +18,16 @@ module Gloo
|
|
16
18
|
return s.to_i.to_s == s
|
17
19
|
end
|
18
20
|
|
21
|
+
#
|
19
22
|
# Set the value, converting to an integer.
|
23
|
+
#
|
20
24
|
def set_value( value )
|
21
25
|
@value = value.to_i
|
22
26
|
end
|
23
27
|
|
28
|
+
#
|
29
|
+
# Get string representation
|
30
|
+
#
|
24
31
|
def to_s
|
25
32
|
return self.value.to_s
|
26
33
|
end
|
data/lib/gloo/expr/l_string.rb
CHANGED
@@ -8,8 +8,10 @@ module Gloo
|
|
8
8
|
module Expr
|
9
9
|
class LString < Gloo::Core::Literal
|
10
10
|
|
11
|
+
#
|
11
12
|
# Set the value, triming opening and closing
|
12
13
|
# quotations if necessary.
|
14
|
+
#
|
13
15
|
def set_value( value )
|
14
16
|
@value = value
|
15
17
|
return unless value
|
@@ -17,7 +19,9 @@ module Gloo
|
|
17
19
|
@value = LString.strip_quotes( @value )
|
18
20
|
end
|
19
21
|
|
22
|
+
#
|
20
23
|
# Is the given token a string?
|
24
|
+
#
|
21
25
|
def self.string?( token )
|
22
26
|
return false unless token.is_a? String
|
23
27
|
return true if token.start_with?( '"' )
|
@@ -42,6 +46,9 @@ module Gloo
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
49
|
+
#
|
50
|
+
# Get string representation
|
51
|
+
#
|
45
52
|
def to_s
|
46
53
|
return self.value
|
47
54
|
end
|
data/lib/gloo/expr/op_div.rb
CHANGED
data/lib/gloo/expr/op_minus.rb
CHANGED