dgd-tools 0.1.9 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -1
- data/README.md +16 -4
- data/dgd-tools.gemspec +1 -0
- data/exe/dgd-manifest +2 -2
- data/lib/dgd-tools/dgd-doc.rb +56 -0
- data/lib/dgd-tools/dgd_grammar.tt +373 -0
- data/lib/dgd-tools/dgd_grammar_support.rb +36 -0
- data/lib/dgd-tools/manifest.rb +24 -6
- data/lib/dgd-tools/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4e4925b8d684b03724d08b7442db5571bc7e0f375423db6ecd64851b52067bd
|
4
|
+
data.tar.gz: ac11a322be7176383128f4c2bac7608e6508f6a22c36bcf52a7472490535d844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abc36f014f7e5d6afa179b52ced8d117a113f8244874495cab98bf92f9dfdc3bbe5d571505e5deac56fb4553435546fc42d49f65c5988975e5edf226f8c2f749
|
7
|
+
data.tar.gz: 94ef526fdb34b337b6529fbe5c7bde566fffc952087cc011477b231d1dba7400a27d44ca2a57954c1ff61bf80976e8dee755c29780511ef58562768cf3c38e11
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dgd-tools (0.1.
|
4
|
+
dgd-tools (0.1.11)
|
5
5
|
nokogiri (~> 1.10.5)
|
6
6
|
optimist (~> 3.0.1)
|
7
|
+
treetop
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
@@ -13,7 +14,10 @@ GEM
|
|
13
14
|
nokogiri (1.10.10)
|
14
15
|
mini_portile2 (~> 2.4.0)
|
15
16
|
optimist (3.0.1)
|
17
|
+
polyglot (0.3.5)
|
16
18
|
rake (12.3.3)
|
19
|
+
treetop (1.6.11)
|
20
|
+
polyglot (~> 0.3)
|
17
21
|
|
18
22
|
PLATFORMS
|
19
23
|
ruby
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ You can find example "goods" (library) files under the "goods" subdirectory of t
|
|
20
20
|
|
21
21
|
## WOE Objects and skotos-xml-diff
|
22
22
|
|
23
|
-
SkotOS-based games use an XML format for in-game objects
|
23
|
+
SkotOS-based games use an XML format for in-game objects ("/base/obj/thing"), which is [documented in SkotOS-Doc](https://ChatTheatre.github.io/SkotOS-Doc). The skotos-xml-diff utility will diff between Things or directories of Things.
|
24
24
|
|
25
25
|
See SkotOS-Doc for more detail about how this can be used with a SkotOS game.
|
26
26
|
|
@@ -30,15 +30,21 @@ Run "skotos-xml-diff --help" for a list of options. You can tell it to ignore wh
|
|
30
30
|
|
31
31
|
You would normally install DGDTools directly: `gem install dgd-tools`.
|
32
32
|
|
33
|
-
|
33
|
+
If you have a Ruby Gemfile or gems.rb that uses it, you can "bundle install" as normal.
|
34
34
|
|
35
35
|
## Usage
|
36
36
|
|
37
|
-
If you have a DGD application that uses DGD Manifest, run `dgd-manifest install` to download its dependencies and create a fully-assembled DGD directory for it. You can also `dgd-manifest test` to make sure its dependencies are downloaded and satisfied without building an application directory.
|
37
|
+
If you have a DGD application that uses DGD Manifest, run `dgd-manifest install` to download its dependencies and create a clean, fully-assembled DGD directory for it. You can also `dgd-manifest test` to make sure its dependencies are downloaded and satisfied without building an application directory. After the initial install, "dgd-manifest update" will avoid deleting any files you may have added.
|
38
|
+
|
39
|
+
NOTE: "dgd-manifest install" will delete any extra files you may have created in the DGD root. "dgd-manifest update" will not. Neither of these is always the right answer.
|
38
40
|
|
39
41
|
That fully-assembled DGD directory is named ".root". To run your dgd server, type "dgd-manifest server".
|
40
42
|
|
41
|
-
|
43
|
+
## Creating a New DGD Manifest App
|
44
|
+
|
45
|
+
You can type "dgd-manifest new my_app_name" to create a new application using the appropriate DGD manifest structure. This is an easy way to set up an appropriate .gitignore file and similar.
|
46
|
+
|
47
|
+
You can, of course, do the same without the command if you like.
|
42
48
|
|
43
49
|
## Using DGD Manifest with your DGD Application
|
44
50
|
|
@@ -94,6 +100,12 @@ Here's what those look like:
|
|
94
100
|
}
|
95
101
|
```
|
96
102
|
|
103
|
+
Fields in the Goods file are the same as fields in unbundled_goods.
|
104
|
+
|
105
|
+
## Implementation Limits
|
106
|
+
|
107
|
+
Right now it's not possible to use the same repo multiple times with different branches. So for instance, you can't use one branch of ChatTheatre/SkotOS for your main library while using a different branch of it for some other library. For this reason, it's recommended that you extract smaller libraries into their own repositories rather than keeping multiple libraries in the same repo.
|
108
|
+
|
97
109
|
## Development
|
98
110
|
|
99
111
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
|
data/dgd-tools.gemspec
CHANGED
data/exe/dgd-manifest
CHANGED
@@ -37,7 +37,7 @@ cmd_opts = case cmd
|
|
37
37
|
puts "Running dgd.manifest installer..."
|
38
38
|
repo = DGD::Manifest::Repo.new
|
39
39
|
repo.manifest_file("dgd.manifest")
|
40
|
-
repo.precheck(".", verbose: verbose)
|
40
|
+
repo.precheck(".", verbose: OPTS[:verbose])
|
41
41
|
puts "Verified Manifest packages: this looks likely correct."
|
42
42
|
|
43
43
|
when "install"
|
@@ -48,7 +48,7 @@ cmd_opts = case cmd
|
|
48
48
|
repo = DGD::Manifest::Repo.new
|
49
49
|
repo.manifest_file("dgd.manifest")
|
50
50
|
current_dir = File.expand_path(".")
|
51
|
-
repo.precheck(current_dir, verbose: verbose)
|
51
|
+
repo.precheck(current_dir, verbose: OPTS[:verbose])
|
52
52
|
repo.assemble_app(current_dir, verbose: OPTS[:verbose])
|
53
53
|
puts "Assembled DGD application into #{current_dir}"
|
54
54
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "dgd-tools/version"
|
2
|
+
|
3
|
+
require "treetop"
|
4
|
+
|
5
|
+
require_relative "dgd_grammar_support"
|
6
|
+
Treetop.load "#{__dir__}/dgd_grammar.tt"
|
7
|
+
|
8
|
+
# Preprocessor incantation: cpp -C -I. -D__DGD__ name_of_file.c
|
9
|
+
|
10
|
+
module DGD; end
|
11
|
+
|
12
|
+
module DGD::Doc
|
13
|
+
|
14
|
+
class SourceFile
|
15
|
+
attr_reader :parser
|
16
|
+
|
17
|
+
def initialize(path, dgd_root:)
|
18
|
+
unless File.exist?(path)
|
19
|
+
raise "No such source file for DGD::Doc::Sourcefile: #{path.inspect}"
|
20
|
+
end
|
21
|
+
|
22
|
+
@parser = DGDGrammarParser.new
|
23
|
+
@path = path
|
24
|
+
@dgd_root = dgd_root
|
25
|
+
|
26
|
+
parse_contents
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def parse_contents
|
32
|
+
preproc_output = `cpp -C -I#{@dgd_root}/include -D__DGD__ #{@path}`
|
33
|
+
preproc_output.gsub!(/\n+/, "\n") # The preprocessor often winds up leaving a lot of newlines from various sources
|
34
|
+
preproc_output.gsub!(/^# \d+ ".*"\w*\d*$/, "")
|
35
|
+
data = @parser.parse(preproc_output)
|
36
|
+
if data
|
37
|
+
clean_tree(data)
|
38
|
+
#puts data.inspect
|
39
|
+
else
|
40
|
+
puts @parser.failure_reason
|
41
|
+
puts @parser.failure_line
|
42
|
+
puts @parser.failure_column
|
43
|
+
|
44
|
+
#puts "Preproc output was:#{preproc_output}\n\n\n"
|
45
|
+
raise "Parse error!"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def clean_tree(root_node)
|
50
|
+
return if(root_node.elements.nil?)
|
51
|
+
root_node.elements.each {|node| self.clean_tree(node) }
|
52
|
+
root_node.elements.delete_if {|node| node.class.name == "Treetop::Runtime::SyntaxNode" && node.text_value.size < 20 }
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,373 @@
|
|
1
|
+
grammar DGDGrammar
|
2
|
+
rule source_file
|
3
|
+
ws (inherit ws)* (top_level_decl ws)*
|
4
|
+
end
|
5
|
+
|
6
|
+
rule inherit
|
7
|
+
("private" WS)? "inherit" WS (ident WS)? ('object' WS)? string_exp ws ';' <Inherit>
|
8
|
+
end
|
9
|
+
|
10
|
+
rule top_level_decl
|
11
|
+
data_decl / func_decl
|
12
|
+
end
|
13
|
+
|
14
|
+
rule ident
|
15
|
+
[a-zA-Z_] [a-zA-Z_0-9]* <Identifier>
|
16
|
+
end
|
17
|
+
|
18
|
+
rule c_comment
|
19
|
+
'/*'
|
20
|
+
(
|
21
|
+
!'*/'
|
22
|
+
(. / "\n")
|
23
|
+
)*
|
24
|
+
'*/'
|
25
|
+
end
|
26
|
+
|
27
|
+
rule preproc_hash_line
|
28
|
+
"\n"? "# " decimal " "+ simple_string (" "+ decimal)? "\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
rule simple_string
|
32
|
+
'"' (
|
33
|
+
!["\n\\]
|
34
|
+
.
|
35
|
+
)*
|
36
|
+
'"' <StringLiteral>
|
37
|
+
end
|
38
|
+
|
39
|
+
rule complex_string
|
40
|
+
'"' ( ((!["\n\\] ) .) / . )+ '"' <StringLiteral>
|
41
|
+
end
|
42
|
+
|
43
|
+
rule simple_char
|
44
|
+
"'" ((!['\n\\]) .)+ "'" <CharLiteral>
|
45
|
+
end
|
46
|
+
|
47
|
+
rule complex_char
|
48
|
+
"'" (((!['\n\\]) .) / ("\\" .))+ "'" <CharLiteral>
|
49
|
+
end
|
50
|
+
|
51
|
+
rule decimal
|
52
|
+
[1-9] [0-9]* <DecimalLiteral>
|
53
|
+
end
|
54
|
+
|
55
|
+
rule octal
|
56
|
+
'0' [0-7]* <OctalLiteral>
|
57
|
+
end
|
58
|
+
|
59
|
+
rule hexadecimal
|
60
|
+
'0' [xX] [a-fA-F0-9]+ <HexadecimalLiteral>
|
61
|
+
end
|
62
|
+
|
63
|
+
rule float
|
64
|
+
([0-9]+ "." [0-9]+ ([eE] [-+]? [0-9]+)?) <FloatLiteral> /
|
65
|
+
("." [0-9]+ ([eE] [-+]? [0-9]+)?) <FloatLiteral> /
|
66
|
+
([0-9]+ [eE] [-+]? [0-9]+) <FloatLiteral>
|
67
|
+
end
|
68
|
+
|
69
|
+
rule single_WS
|
70
|
+
[ \t\v\f\r\n] / c_comment / preproc_hash_line
|
71
|
+
end
|
72
|
+
|
73
|
+
rule ws
|
74
|
+
single_WS*
|
75
|
+
end
|
76
|
+
|
77
|
+
rule WS
|
78
|
+
single_WS+
|
79
|
+
end
|
80
|
+
|
81
|
+
rule string
|
82
|
+
simple_string /
|
83
|
+
complex_string
|
84
|
+
end
|
85
|
+
|
86
|
+
rule string_exp
|
87
|
+
string /
|
88
|
+
'(' ws composite_string ws ')'
|
89
|
+
end
|
90
|
+
|
91
|
+
rule composite_string
|
92
|
+
string_exp / string_exp '+' composite_string
|
93
|
+
end
|
94
|
+
|
95
|
+
rule klass
|
96
|
+
(class_spec WS)* class_spec
|
97
|
+
end
|
98
|
+
|
99
|
+
rule class_spec
|
100
|
+
'private' / 'static' / 'atomic' / 'nomask' / 'varargs'
|
101
|
+
end
|
102
|
+
|
103
|
+
rule type_spec
|
104
|
+
'int' / 'float' / 'string' / 'object' / 'mapping' / 'mixed' / 'void'
|
105
|
+
end
|
106
|
+
|
107
|
+
rule stars
|
108
|
+
('*' ws)*
|
109
|
+
end
|
110
|
+
|
111
|
+
rule formals
|
112
|
+
# If you put these in a different order with '' and 'void' first, parses start failing. That seems bad.
|
113
|
+
formal_list (ws '...')? / '' / 'void'
|
114
|
+
end
|
115
|
+
|
116
|
+
rule formal_list
|
117
|
+
formal (ws ',' ws formal)*
|
118
|
+
end
|
119
|
+
|
120
|
+
rule formal
|
121
|
+
class_type data_declarator /
|
122
|
+
ident
|
123
|
+
end
|
124
|
+
|
125
|
+
rule data_decl
|
126
|
+
class_type WS declarators ws ';' <DataDecl>
|
127
|
+
end
|
128
|
+
|
129
|
+
rule func_decl
|
130
|
+
class_type WS function_declarator ws compound_statement <FuncDecl> /
|
131
|
+
klass WS function_name ws '(' ws formals ws ')' ws compound_statement <FuncDecl>
|
132
|
+
end
|
133
|
+
|
134
|
+
rule class_type
|
135
|
+
(class_spec WS)* type_spec /
|
136
|
+
(class_spec WS)* 'object' list_exp
|
137
|
+
end
|
138
|
+
|
139
|
+
rule data_declarator
|
140
|
+
stars ws ident
|
141
|
+
end
|
142
|
+
|
143
|
+
rule function_name
|
144
|
+
ident /
|
145
|
+
'operator' ws '+' /
|
146
|
+
'operator' ws '-' /
|
147
|
+
'operator' ws '*' /
|
148
|
+
'operator' ws '/' /
|
149
|
+
'operator' ws '%' /
|
150
|
+
'operator' ws '&' /
|
151
|
+
'operator' ws '^' /
|
152
|
+
'operator' ws '|' /
|
153
|
+
'operator' ws '<' /
|
154
|
+
'operator' ws '>' /
|
155
|
+
'operator' ws '>=' /
|
156
|
+
'operator' ws '<=' /
|
157
|
+
'operator' ws '<<' /
|
158
|
+
'operator' ws '>>' /
|
159
|
+
'operator' ws '~' /
|
160
|
+
'operator' ws '++' /
|
161
|
+
'operator' ws '--' /
|
162
|
+
'operator' ws '[' ws ']' /
|
163
|
+
'operator' ws '[' ws ']' ws '=' /
|
164
|
+
'operator' ws '[' ws '..' ws ']'
|
165
|
+
end
|
166
|
+
|
167
|
+
rule function_declarator
|
168
|
+
stars ws function_name ws '(' ws formals ws ')'
|
169
|
+
end
|
170
|
+
|
171
|
+
rule declarator
|
172
|
+
function_declarator / data_declarator
|
173
|
+
end
|
174
|
+
|
175
|
+
rule declarators
|
176
|
+
declarator (ws ',' ws declarator)*
|
177
|
+
end
|
178
|
+
|
179
|
+
rule locals
|
180
|
+
(ws data_decl ws)*
|
181
|
+
end
|
182
|
+
|
183
|
+
rule statements
|
184
|
+
(ws statement ws)*
|
185
|
+
end
|
186
|
+
|
187
|
+
rule statement
|
188
|
+
'if' ws '(' ws list_exp ws ')' ws statement (WS 'else' statement)? /
|
189
|
+
'do' WS statement WS 'while' ws '(' ws list_exp ws ')' ws ';' /
|
190
|
+
'while' ws '(' ws list_exp ws ')' ws statement /
|
191
|
+
'for' ws '(' ws list_exp? ws ';' ws list_exp? ws ';' ws list_exp? ws ')' ws statement /
|
192
|
+
'rlimits' ws '(' ws list_exp ws ';' ws list_exp ws ')' ws compound_statement /
|
193
|
+
'catch' ws compound_statement ws ':' statement /
|
194
|
+
'catch' ws compound_statement /
|
195
|
+
'switch' ws '(' ws list_exp ws ')' ws compound_statement /
|
196
|
+
'case' WS exp ws ':' ws statement /
|
197
|
+
'case' WS exp ws '..' ws exp ws ':' statement /
|
198
|
+
'default' ws ':' ws statement /
|
199
|
+
'goto' WS ident ws ';' /
|
200
|
+
'break' ws ';' /
|
201
|
+
'continue' ws ';' /
|
202
|
+
'return' WS list_exp WS ';' /
|
203
|
+
'return' ws ';' /
|
204
|
+
ident ws ':' ws statement / # label statement
|
205
|
+
list_exp /
|
206
|
+
compound_statement /
|
207
|
+
';'
|
208
|
+
end
|
209
|
+
|
210
|
+
rule compound_statement
|
211
|
+
'{' ws locals ws statements ws '}'
|
212
|
+
end
|
213
|
+
|
214
|
+
rule function_call
|
215
|
+
('::' ws function_name) /
|
216
|
+
(ident ws '::' ws function_name) /
|
217
|
+
function_name
|
218
|
+
end
|
219
|
+
|
220
|
+
rule list_exp
|
221
|
+
exp ws ',' ws list_exp /
|
222
|
+
exp
|
223
|
+
end
|
224
|
+
|
225
|
+
rule exp
|
226
|
+
cond_exp ws '=' ws exp /
|
227
|
+
cond_exp ws '+=' ws exp /
|
228
|
+
cond_exp ws '-=' ws exp /
|
229
|
+
cond_exp ws '*=' ws exp /
|
230
|
+
cond_exp ws '/=' ws exp /
|
231
|
+
cond_exp ws '%=' ws exp /
|
232
|
+
cond_exp ws '<<=' ws exp /
|
233
|
+
cond_exp ws '>>=' ws exp /
|
234
|
+
cond_exp ws '&=' ws exp /
|
235
|
+
cond_exp ws '^=' ws exp /
|
236
|
+
cond_exp ws '|=' ws exp /
|
237
|
+
cond_exp
|
238
|
+
end
|
239
|
+
|
240
|
+
rule cond_exp
|
241
|
+
or_exp ws '?' ws list_exp ws ':' ws cond_exp / or_exp
|
242
|
+
end
|
243
|
+
|
244
|
+
rule or_exp
|
245
|
+
and_exp ws '||' ws or_exp / and_exp
|
246
|
+
end
|
247
|
+
|
248
|
+
rule and_exp
|
249
|
+
bitor_exp ws '&&' ws and_exp / bitor_exp
|
250
|
+
end
|
251
|
+
|
252
|
+
rule bitor_exp
|
253
|
+
bitxor_exp ws '|' ws bitor_exp / bitxor_exp
|
254
|
+
end
|
255
|
+
|
256
|
+
rule bitxor_exp
|
257
|
+
bitand_exp ws '^' ws bitxor_exp / bitand_exp
|
258
|
+
end
|
259
|
+
|
260
|
+
rule bitand_exp
|
261
|
+
equ_exp ws '&' bitand_exp / equ_exp
|
262
|
+
end
|
263
|
+
|
264
|
+
rule equ_exp
|
265
|
+
rel_exp ws '==' ws equ_exp /
|
266
|
+
rel_exp ws '!=' ws equ_exp /
|
267
|
+
rel_exp
|
268
|
+
end
|
269
|
+
|
270
|
+
rule rel_exp
|
271
|
+
shift_exp ws '<' ws rel_exp /
|
272
|
+
shift_exp ws '>' ws rel_exp /
|
273
|
+
shift_exp ws '<=' ws rel_exp /
|
274
|
+
shift_exp ws '>=' ws rel_exp /
|
275
|
+
shift_exp
|
276
|
+
end
|
277
|
+
|
278
|
+
rule shift_exp
|
279
|
+
add_exp ws '<<' ws shift_exp /
|
280
|
+
add_exp ws '>>' ws shift_exp /
|
281
|
+
add_exp
|
282
|
+
end
|
283
|
+
|
284
|
+
rule add_exp
|
285
|
+
mult_exp ws '+' ws add_exp /
|
286
|
+
mult_exp ws '-' ws add_exp /
|
287
|
+
mult_exp
|
288
|
+
end
|
289
|
+
|
290
|
+
rule mult_exp
|
291
|
+
cast_exp ws '*' ws mult_exp /
|
292
|
+
cast_exp ws '/' ws mult_exp /
|
293
|
+
cast_exp ws '%' ws mult_exp /
|
294
|
+
cast_exp
|
295
|
+
end
|
296
|
+
|
297
|
+
rule cast_exp
|
298
|
+
'(' ws class_type ws stars ws ')' ws cast_exp /
|
299
|
+
prefix_exp
|
300
|
+
end
|
301
|
+
|
302
|
+
rule prefix_exp
|
303
|
+
'++' ws cast_exp /
|
304
|
+
'--' ws cast_exp /
|
305
|
+
'+' ws cast_exp /
|
306
|
+
'-' ws cast_exp /
|
307
|
+
'!' ws cast_exp /
|
308
|
+
'~' ws cast_exp /
|
309
|
+
postfix_exp
|
310
|
+
end
|
311
|
+
|
312
|
+
rule postfix_exp
|
313
|
+
exp2 (ws ('++' / '--'))?
|
314
|
+
end
|
315
|
+
|
316
|
+
rule exp2
|
317
|
+
exp1 ws '->' ws ident ws '(' ws opt_arg_list ws ')' /
|
318
|
+
exp1 ws '<-' ws string_exp /
|
319
|
+
exp1 ((ws '[' ws list_exp ws ']') / (ws '[' ws (list_exp ws)? '..' ws (list_exp ws)? ']'))*
|
320
|
+
end
|
321
|
+
|
322
|
+
rule exp1
|
323
|
+
# This works (for now) with function_call up front, but not when it was lower down...
|
324
|
+
# There's some kind of bad stuff going on with precedence that's causing parse failures.
|
325
|
+
# That's weird, since I assume it should try all combinations/precedences before giving up...
|
326
|
+
function_call ws '(' ws opt_arg_list ws ')' /
|
327
|
+
'catch' ws '(' list_exp ws ')' /
|
328
|
+
'new' (WS 'object')? ws string_exp (ws '(' ws opt_arg_list ws ')')? /
|
329
|
+
'nil' /
|
330
|
+
'(' ws '{' ws opt_arg_list_comma ws '}' ws ')' /
|
331
|
+
'(' ws '[' ws opt_assoc_list_comma ws ']' ws ')' /
|
332
|
+
'::' ws ident /
|
333
|
+
decimal /
|
334
|
+
octal /
|
335
|
+
hexadecimal /
|
336
|
+
simple_char /
|
337
|
+
complex_char /
|
338
|
+
float /
|
339
|
+
string /
|
340
|
+
ident /
|
341
|
+
'(' ws list_exp ws ')'
|
342
|
+
end
|
343
|
+
|
344
|
+
rule arg_list
|
345
|
+
exp ws ',' ws arg_list /
|
346
|
+
exp
|
347
|
+
end
|
348
|
+
|
349
|
+
rule opt_arg_list
|
350
|
+
arg_list ws '...' /
|
351
|
+
arg_list?
|
352
|
+
end
|
353
|
+
|
354
|
+
rule opt_arg_list_comma
|
355
|
+
arg_list ws ',' /
|
356
|
+
arg_list?
|
357
|
+
end
|
358
|
+
|
359
|
+
rule assoc_list
|
360
|
+
assoc_pair ws ',' ws assoc_list /
|
361
|
+
assoc_pair
|
362
|
+
end
|
363
|
+
|
364
|
+
rule assoc_pair
|
365
|
+
exp ws ':' ws exp
|
366
|
+
end
|
367
|
+
|
368
|
+
rule opt_assoc_list_comma
|
369
|
+
assoc_list ws ',' /
|
370
|
+
assoc_list?
|
371
|
+
end
|
372
|
+
|
373
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#class StringLiteral < Treetop::Runtime::SyntaxNode
|
2
|
+
# def some_name
|
3
|
+
# # This is a pretty crude way of handling character escaping, etc.
|
4
|
+
# return eval self.text_value
|
5
|
+
# end
|
6
|
+
#end
|
7
|
+
|
8
|
+
class DataDecl < Treetop::Runtime::SyntaxNode
|
9
|
+
end
|
10
|
+
|
11
|
+
class FuncDecl < Treetop::Runtime::SyntaxNode
|
12
|
+
end
|
13
|
+
|
14
|
+
class Inherit < Treetop::Runtime::SyntaxNode
|
15
|
+
end
|
16
|
+
|
17
|
+
class Identifier < Treetop::Runtime::SyntaxNode
|
18
|
+
end
|
19
|
+
|
20
|
+
class DecimalLiteral < Treetop::Runtime::SyntaxNode
|
21
|
+
end
|
22
|
+
|
23
|
+
class OctalLiteral < Treetop::Runtime::SyntaxNode
|
24
|
+
end
|
25
|
+
|
26
|
+
class HexadecimalLiteral < Treetop::Runtime::SyntaxNode
|
27
|
+
end
|
28
|
+
|
29
|
+
class FloatLiteral < Treetop::Runtime::SyntaxNode
|
30
|
+
end
|
31
|
+
|
32
|
+
class StringLiteral < Treetop::Runtime::SyntaxNode
|
33
|
+
end
|
34
|
+
|
35
|
+
class CharLiteral < Treetop::Runtime::SyntaxNode
|
36
|
+
end
|
data/lib/dgd-tools/manifest.rb
CHANGED
@@ -128,11 +128,13 @@ module DGD::Manifest
|
|
128
128
|
|
129
129
|
def assemble_app(location, verbose:)
|
130
130
|
Dir[File.join(dgd_root(location), "*")].each { |dir| FileUtils.rm_rf dir }
|
131
|
+
Dir[File.join(dgd_root(location), "state", "*")].each { |dir| FileUtils.rm_rf dir }
|
131
132
|
|
132
133
|
write_app_files(location, verbose: verbose)
|
133
134
|
end
|
134
135
|
|
135
136
|
def update_app(location, verbose:)
|
137
|
+
Dir[File.join(dgd_root(location), ".repos", "*")].each { |dir| FileUtils.rm_f dir }
|
136
138
|
write_app_files(location, verbose: verbose)
|
137
139
|
end
|
138
140
|
|
@@ -142,6 +144,13 @@ module DGD::Manifest
|
|
142
144
|
Dir.chdir(location) do
|
143
145
|
write_config_file("#{location}/dgd.config")
|
144
146
|
FileUtils.mkdir_p("#{location}/state") # Statedir for statedumps, editor files, etc.
|
147
|
+
repos_dir = "#{location}/.repos"
|
148
|
+
FileUtils.mkdir_p(repos_dir) # Links to repos in manifest
|
149
|
+
|
150
|
+
@manifest_file.ordered_specs.each do |spec|
|
151
|
+
# force:true prevents getting an exception if the file exists
|
152
|
+
FileUtils.ln_s(spec.source.local_dir, File.join(".repos", spec.name), force: true)
|
153
|
+
end
|
145
154
|
|
146
155
|
assembly_operations(location, verbose: verbose).each do |sd_hash|
|
147
156
|
to_path = "#{dgd_root(location)}/#{sd_hash[:to]}"
|
@@ -429,6 +438,13 @@ module DGD::Manifest
|
|
429
438
|
.root
|
430
439
|
dgd.config
|
431
440
|
state/*
|
441
|
+
wafer
|
442
|
+
websocket-to-tcp-tunnel
|
443
|
+
dgd
|
444
|
+
log/*
|
445
|
+
skotos.database
|
446
|
+
skotos.database.old
|
447
|
+
.repos/**
|
432
448
|
FILE_CONTENTS
|
433
449
|
end
|
434
450
|
|
@@ -562,15 +578,17 @@ FILE_CONTENTS
|
|
562
578
|
|
563
579
|
def config_to_ports(data)
|
564
580
|
if data.is_a?(Hash)
|
565
|
-
|
566
|
-
return data
|
581
|
+
return data.map { |ip, port| [ip, Integer(port) ] }
|
567
582
|
elsif data.is_a?(Array)
|
568
|
-
|
569
|
-
|
570
|
-
|
583
|
+
if data[0].is_a?(Array)
|
584
|
+
ports = data.map { |ip, port| [ip, Integer(port) ] }
|
585
|
+
return ports
|
586
|
+
end
|
587
|
+
|
588
|
+
ports = data.map { |p| [ "*", Integer(p) ] }
|
571
589
|
return ports
|
572
590
|
elsif data.is_a?(Integer)
|
573
|
-
return
|
591
|
+
return [ [ "*", data ] ]
|
574
592
|
else
|
575
593
|
raise "dgd-manifest: not sure how to get port data from a #{data.class.name} -- #{data.inspect}!"
|
576
594
|
end
|
data/lib/dgd-tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dgd-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Gibbs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: treetop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: dgd-tools supplies DGD Manifest and eventually perhaps other tools. DGD
|
42
56
|
Manifest is an experimental DGD library and packaging system.
|
43
57
|
email:
|
@@ -69,6 +83,9 @@ files:
|
|
69
83
|
- exe/skotos-xml-diff
|
70
84
|
- goods/chattheatre_kernellib.goods
|
71
85
|
- goods/skotos_httpd.goods
|
86
|
+
- lib/dgd-tools/dgd-doc.rb
|
87
|
+
- lib/dgd-tools/dgd_grammar.tt
|
88
|
+
- lib/dgd-tools/dgd_grammar_support.rb
|
72
89
|
- lib/dgd-tools/manifest.rb
|
73
90
|
- lib/dgd-tools/skotos_xml_obj.rb
|
74
91
|
- lib/dgd-tools/version.rb
|