gdstruct 0.8.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +344 -29
- data/MIT-LICENSE +18 -18
- data/README.md +207 -82
- data/lib/gdstruct.rb +66 -25
- data/lib/gdstruct/lng_gds.rb +44 -0
- data/lib/gdstruct/version.rb +1 -1
- metadata +4 -4
- data/lib/gdstruct/gds_013.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 56fe726a627b002f160a1488d9eed35ca89a34a882131ca98efdf499b0ff3936
|
4
|
+
data.tar.gz: 29c8189b56c2405b54971b2bbf019abcb1596898a65de08ba1d532c4de017fa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1894ff6484f8791c1070051445a121483b4a86117702f691ad5e1655f8fce34f49c4d5c8f6a3cfbf5c129ffe74bc1b5575f3adaee3fd25798b188aaeacaf7017
|
7
|
+
data.tar.gz: 65e3f8940dc33ac34e7185b05c064789d05e73e537e7d241ca84552ceb07a0e0e49b0890d2a3251c871b8a4c45c50ae1a0f3247cd37daeb667093968ed3b31bd
|
data/CHANGELOG.md
CHANGED
@@ -1,62 +1,377 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### 0.9.2 - (2020-07-31)
|
4
|
+
|
5
|
+
* __change__
|
6
|
+
the keyword literal for true is changed to @true; the old literal !true is still working, but is deprecated
|
7
|
+
the segil __@__ is more consistent with the overall GDS syntax and the leading __!__
|
8
|
+
could be confusing because in many programming languages it is used as a logical negation operator
|
9
|
+
the keyword literal for false is changed to @false; the old literal !false is still working, but is deprecated
|
10
|
+
the keyword literal for nil is changed to @nil; the old literal !nil is still working, but is deprecated
|
11
|
+
|
12
|
+
* __internal changes__
|
13
|
+
different handling of global variables and context (binding) for embedded Ruby
|
14
|
+
|
15
|
+
### 0.9.1 - (2019-08-16)
|
16
|
+
|
17
|
+
* __feature__
|
18
|
+
new syntax style: an array element can be defined as a hash with a key and an array as a value for the key and one or more values for that array on the same line
|
19
|
+
multiple values for the array has to be separated by a vertical bar symbol (|)
|
20
|
+
that means a colon (:) a key and a comma (,) and one or more values on the same line
|
21
|
+
~~~
|
22
|
+
valuespecs ,
|
23
|
+
: valuelist , 1 | 2 | 3
|
24
|
+
|
25
|
+
# => { valuespecs: [ { valuelist: [ 1, 2, 3 ] } ] }
|
26
|
+
~~~
|
27
|
+
~~~
|
28
|
+
valuespecs ,
|
29
|
+
: valuelist , 1 | 2 | 3
|
30
|
+
4
|
31
|
+
5
|
32
|
+
|
33
|
+
# => { valuespecs: [ { valuelist: [ 1, 2, 3, 4, 5 ] } ] }
|
34
|
+
~~~
|
35
|
+
|
36
|
+
* __feature__
|
37
|
+
on a nested level: after a comma (,) a colon (:) can follow on the same line
|
38
|
+
that means you can create an array and as the first element of this array a hash, everything on the same line
|
39
|
+
~~~
|
40
|
+
,
|
41
|
+
, :
|
42
|
+
|
43
|
+
# => [ [ {} ] ]
|
44
|
+
~~~
|
45
|
+
~~~
|
46
|
+
,
|
47
|
+
, :
|
48
|
+
k1
|
49
|
+
k11 v11
|
50
|
+
b
|
51
|
+
a
|
52
|
+
|
53
|
+
# => [ [ { k1: { k11: "v11" } }, "b" ], "a" ]
|
54
|
+
~~~
|
55
|
+
additionally a key for the first key-value pair of the hash can also be on this line
|
56
|
+
~~~
|
57
|
+
,
|
58
|
+
, : k
|
59
|
+
|
60
|
+
# => [ [ { k: {} } ] ]
|
61
|
+
~~~
|
62
|
+
~~~
|
63
|
+
,
|
64
|
+
, : k1
|
65
|
+
k11 v11
|
66
|
+
k12 v12
|
67
|
+
k2
|
68
|
+
k21 v21
|
69
|
+
a1
|
70
|
+
|
71
|
+
# => [ [ { k1: { k11: "v11", k12: "v12" }, k2: { k21: "v21" } } ], "a1" ]
|
72
|
+
~~~
|
73
|
+
a first key-value pair of the hash can be on this line
|
74
|
+
~~~
|
75
|
+
,
|
76
|
+
, : k v
|
77
|
+
|
78
|
+
# => [ [ { k: "v" } ] ]
|
79
|
+
~~~
|
80
|
+
multiple key-value pairs separated by the vertical bar symbol
|
81
|
+
~~~
|
82
|
+
,
|
83
|
+
, : k1 v1 | k2 v2
|
84
|
+
|
85
|
+
# => [ [ { k1: "v1", k2: "v2" } ] ]
|
86
|
+
~~~
|
87
|
+
|
88
|
+
* __feature__
|
89
|
+
new syntax style: an array element can be defined as a hash with a key and an array as a value for the key on the same line
|
90
|
+
that means a colon (:) a key and a comma (,) on the same line
|
91
|
+
~~~
|
92
|
+
allvalues ,
|
93
|
+
: valueset1 ,
|
94
|
+
100
|
95
|
+
|
96
|
+
# => { allvalues: [ { valueset1: [ 100 ] } ] }
|
97
|
+
~~~
|
98
|
+
~~~
|
99
|
+
k ,
|
100
|
+
: k1 ,
|
101
|
+
100
|
102
|
+
200 | 300
|
103
|
+
: k2
|
104
|
+
|
105
|
+
# => { k: [ { k1: [ 100, 200, 300 ] }, { k2: {} } ] }
|
106
|
+
~~~
|
107
|
+
|
108
|
+
* __feature__
|
109
|
+
on top level: after a comma (,) a colon (:) can follow on the same line
|
110
|
+
that means you can create an array and as the first element of this array a hash, everything on the same line
|
111
|
+
~~~
|
112
|
+
, :
|
113
|
+
|
114
|
+
# => [ {} ]
|
115
|
+
~~~
|
116
|
+
~~~
|
117
|
+
, :
|
118
|
+
k1
|
119
|
+
k11 v11
|
120
|
+
a1
|
121
|
+
|
122
|
+
# => [ { k1: { k11: "v11" } }, "a1" ]
|
123
|
+
~~~
|
124
|
+
additionally a key for the first key-value pair of the hash can also be on this line
|
125
|
+
~~~
|
126
|
+
, : k
|
127
|
+
|
128
|
+
# => [ { k: {} } ]
|
129
|
+
~~~
|
130
|
+
~~~
|
131
|
+
, : k1
|
132
|
+
k11 v11
|
133
|
+
k12 v12
|
134
|
+
k2
|
135
|
+
k21 v21
|
136
|
+
a1
|
137
|
+
|
138
|
+
# => [ { k1: { k11: "v11", k12: "v12" }, k2: { k21: "v21" } }, "a1" ]
|
139
|
+
~~~
|
140
|
+
a first key-value pair of the hash can be on this line
|
141
|
+
~~~
|
142
|
+
, : k v
|
143
|
+
|
144
|
+
# => [ { k: "v" } ]
|
145
|
+
~~~
|
146
|
+
multiple key-value pairs separated by the vertical bar symbol
|
147
|
+
~~~
|
148
|
+
, : k1 v1 | k2 v2
|
149
|
+
|
150
|
+
# => [ { k1: "v1", k2: "v2" } ]
|
151
|
+
~~~
|
152
|
+
|
153
|
+
* __bugfix__
|
154
|
+
definition of ruby symbols has been changed, rectified and improved
|
155
|
+
single quotes and double quotes have to be balanced or escaped with a backslash character
|
156
|
+
the following definitions are no longer valid
|
157
|
+
~~~
|
158
|
+
:'
|
159
|
+
:"
|
160
|
+
:'"
|
161
|
+
:"'
|
162
|
+
:'''
|
163
|
+
:"""
|
164
|
+
~~~
|
165
|
+
the following definitions are valid
|
166
|
+
~~~
|
167
|
+
:'\''
|
168
|
+
:"\""
|
169
|
+
:'"'
|
170
|
+
:"'"
|
171
|
+
~~~
|
172
|
+
it is now possible to define an empty symbol by
|
173
|
+
~~~
|
174
|
+
:''
|
175
|
+
~~~
|
176
|
+
or
|
177
|
+
~~~
|
178
|
+
:""
|
179
|
+
~~~
|
180
|
+
|
181
|
+
### 0.9.0 - (2019-07-15)
|
182
|
+
|
183
|
+
* __feature__
|
184
|
+
class GDstruct::Creator
|
185
|
+
for the creation of a Ruby Hash/Array structure out of possibly several separated GDS definition strings
|
186
|
+
arbitrary combination of #include and #include_file method calls
|
187
|
+
final call of #create method
|
188
|
+
~~~
|
189
|
+
# file: data.gdstruct
|
190
|
+
&persons persons, @schema person /*
|
191
|
+
firstname lastname yearOfBirth */
|
192
|
+
: John | McArthur | 1987
|
193
|
+
: Berry | Miller | 1976
|
194
|
+
~~~
|
195
|
+
~~~
|
196
|
+
# file: example.rb
|
197
|
+
require 'gdstruct'
|
198
|
+
|
199
|
+
creator = GDstruct::Creator.new
|
200
|
+
|
201
|
+
creator.include( <<-EOS )
|
202
|
+
@schema person( firstname, lastname, yearOfBirth )
|
203
|
+
EOS
|
204
|
+
|
205
|
+
creator.include_file( 'data.gdstruct' )
|
206
|
+
|
207
|
+
creator.include( <<-EOS )
|
208
|
+
all
|
209
|
+
mypersons *persons
|
210
|
+
EOS
|
211
|
+
|
212
|
+
res = creator.create
|
213
|
+
|
214
|
+
# => res = {:persons=>[{:firstname=>"John", :lastname=>"McArthur", :yearOfBirth=>1987}, {:firstname=>"Berry", :lastname=>"Miller", :yearOfBirth=>1976}],
|
215
|
+
# :all=>{:mypersons=>{:persons=>[{:firstname=>"John", :lastname=>"McArthur", :yearOfBirth=>1987}, {:firstname=>"Berry", :lastname=>"Miller", :yearOfBirth=>1976}]}}}
|
216
|
+
~~~
|
217
|
+
|
218
|
+
* __feature__
|
219
|
+
on top level: a single key, for the definition of a subhash can now follow a colon (:) on the same line; before you had to put it on a new line
|
220
|
+
the following syntax is allowed now
|
221
|
+
~~~
|
222
|
+
: k
|
223
|
+
~~~
|
224
|
+
~~~
|
225
|
+
: k1
|
226
|
+
k11 v11
|
227
|
+
~~~
|
228
|
+
~~~
|
229
|
+
: k1
|
230
|
+
k11 v11
|
231
|
+
k2
|
232
|
+
~~~
|
233
|
+
~~~
|
234
|
+
: k1
|
235
|
+
k2
|
236
|
+
~~~
|
237
|
+
|
238
|
+
### 0.8.2 - (2019-03-18)
|
239
|
+
|
240
|
+
* __feature__
|
241
|
+
modification for classic Ruby syntax
|
242
|
+
inside an array definition: after the last element a comma (,) is allowed
|
243
|
+
this conforms to the Ruby syntax: a trailing comma is ignored
|
244
|
+
~~~
|
245
|
+
[ 1, 2, ]
|
246
|
+
~~~
|
247
|
+
|
248
|
+
* __feature__
|
249
|
+
modification for classic Ruby syntax
|
250
|
+
inside a hash definition: after the last key-value pair a comma (,) is allowed
|
251
|
+
this conforms to the Ruby syntax
|
252
|
+
~~~
|
253
|
+
{ k1: 'v1', k2: 'v2', }
|
254
|
+
~~~
|
255
|
+
|
256
|
+
* __feature__
|
257
|
+
after an array definition: a single key, for the definition of a subhash can now follow a colon (:) on the same line; before you had to put it on a new line
|
258
|
+
the following syntax is allowed now
|
259
|
+
~~~
|
260
|
+
,
|
261
|
+
: k
|
262
|
+
~~~
|
263
|
+
~~~
|
264
|
+
,
|
265
|
+
: k1
|
266
|
+
k11 v11
|
267
|
+
~~~
|
268
|
+
~~~
|
269
|
+
,
|
270
|
+
: k1
|
271
|
+
k11 v11
|
272
|
+
k2
|
273
|
+
~~~
|
274
|
+
~~~
|
275
|
+
,
|
276
|
+
: k1
|
277
|
+
k2
|
278
|
+
~~~
|
279
|
+
|
280
|
+
* __feature__
|
281
|
+
@merge can now follow a colon (:) on the same line, before you had to put it on a new line
|
282
|
+
the following syntax is allowed now
|
283
|
+
~~~
|
284
|
+
init &init
|
285
|
+
prio 10
|
286
|
+
all,
|
287
|
+
: @merge *init
|
288
|
+
~~~
|
289
|
+
|
290
|
+
### 0.8.1 - (2019-02-08)
|
291
|
+
|
292
|
+
* __feature__
|
293
|
+
improving the consistency of block comments; they can appear now at the beginning of every line and every construct
|
294
|
+
now they even can appear before a colon (:) for the definition of a hash, and before a comma (,) for the definition of an array
|
295
|
+
you just need to pay attention for the proper indentation
|
296
|
+
the following syntax is allowed now
|
297
|
+
~~~
|
298
|
+
,
|
299
|
+
/* !!! this block comment is allowed now !!! */ ,
|
300
|
+
1
|
301
|
+
2
|
302
|
+
~~~
|
303
|
+
~~~
|
304
|
+
,
|
305
|
+
/* !!! this block comment is allowed now */ :
|
306
|
+
k1 v1
|
307
|
+
~~~
|
308
|
+
|
309
|
+
* __change__
|
310
|
+
internal change: improving the grammar for the GDS language - reducing the number of rule alternatives
|
311
|
+
|
3
312
|
### 0.8.0 - (2018-12-14)
|
4
313
|
|
5
314
|
* __feature__
|
6
315
|
string interpolation
|
7
316
|
the values of variables are substituted into string literals
|
8
|
-
string interpolation works for double-quoted strings and default strings
|
9
|
-
example:
|
10
|
-
|
11
|
-
|
12
|
-
|
317
|
+
string interpolation works for double-quoted strings and default strings
|
318
|
+
example:
|
319
|
+
~~~
|
320
|
+
$object = house
|
321
|
+
setup "This is a $(object)."
|
322
|
+
# => { setup: "This is a house." }
|
323
|
+
~~~
|
13
324
|
|
14
325
|
* __feature__
|
15
326
|
schema definition:
|
16
|
-
if there are more values listed than keys for the schema specifier are defined, then an exception is raised
|
17
|
-
if there are less values listed than keys for the schema specifier are defined, then only the keys for the available values will be set
|
327
|
+
if there are more values listed than keys for the schema specifier are defined, then an exception is raised
|
328
|
+
if there are less values listed than keys for the schema specifier are defined, then only the keys for the available values will be set
|
18
329
|
|
19
330
|
* __breaking change__, __bugfix__
|
20
331
|
in array definition with schema specifier
|
21
|
-
syntax change: now after colon (:) for defining a hash, there needs to be at least one space character between the colon
|
332
|
+
syntax change: now after colon (:) for defining a hash, there needs to be at least one space character between the colon
|
22
333
|
and the next expression on the same line
|
23
334
|
|
24
335
|
* __feature__
|
25
336
|
schema specifiers can now also be defined at the time of use
|
26
337
|
example:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
338
|
+
~~~
|
339
|
+
persons1 , @schema person(firstname,lastname,age)
|
340
|
+
: Harry | Langemann | 44
|
341
|
+
: Susi | Heimstett | 32
|
342
|
+
persons2 , @schema person
|
343
|
+
: Ludwig | Reinemann | 33
|
344
|
+
~~~
|
32
345
|
|
33
346
|
* __feature__
|
34
347
|
anonymous schema specifiers
|
35
348
|
defined when used, defined without a name, for one-time use
|
36
349
|
example:
|
37
|
-
|
38
|
-
|
350
|
+
~~~
|
351
|
+
persons , @schema(firstname,lastname,age)
|
352
|
+
: Harry | Langemann | 44
|
353
|
+
~~~
|
39
354
|
|
40
355
|
* __breaking change__
|
41
356
|
change of the definition of a schema specifier
|
42
357
|
before : $name(key1,key2,...)
|
43
|
-
now : @schema name(key1,key2,...)
|
44
|
-
this makes it different from variables
|
45
|
-
change of the use of a schema specifier
|
358
|
+
now : @schema name(key1,key2,...)
|
359
|
+
this makes it different from variables
|
360
|
+
change of the use of a schema specifier
|
46
361
|
before : , $name
|
47
362
|
now : , @schema name
|
48
|
-
|
363
|
+
|
49
364
|
* __breaking change__
|
50
365
|
default strings are no longer allowed to begin with one of the following characters: ;$!@&*:,
|
51
366
|
exception is a beginning string interpolation: $(var)
|
52
|
-
|
367
|
+
|
53
368
|
* __feature__
|
54
369
|
for a reference (e.g. ref)
|
55
370
|
@merge *ref : in a hash
|
56
371
|
@insert *ref : in an array
|
57
372
|
|
58
373
|
* __feature__
|
59
|
-
supporting references, definition: &ref, use: *ref
|
374
|
+
supporting references, definition: &ref, use: *ref
|
60
375
|
if a reference is used which was not defined before, then an exception is raised
|
61
376
|
|
62
377
|
* __feature__
|
@@ -73,7 +388,7 @@
|
|
73
388
|
|
74
389
|
* __bugfix__
|
75
390
|
again an error in escaping single-quoted and double-quoted strings
|
76
|
-
|
391
|
+
|
77
392
|
### 0.7.0 - (2018-11-09)
|
78
393
|
|
79
394
|
* __feature__
|
@@ -88,19 +403,19 @@
|
|
88
403
|
* __bugfix__
|
89
404
|
escaping in single-quoted and double-quoted strings was not handled properly
|
90
405
|
there also was a syntax issue
|
91
|
-
|
406
|
+
|
92
407
|
### 0.6.1 - (2018-10-27)
|
93
408
|
|
94
409
|
* __bugfix__
|
95
410
|
bugs in classic Ruby syntax fixed: [:a], and {a: :b} was not recognized
|
96
|
-
|
411
|
+
|
97
412
|
* __change__
|
98
413
|
if @env is not allowed (allow_env: false) then the result will be nil, it was "" before
|
99
414
|
if @r is not allowed (context: not set to binding) then the result will be nil, it was "" before
|
100
|
-
|
415
|
+
|
101
416
|
* __bugfix__
|
102
417
|
@env: now before and after the environment variable there are space characters allowed, they will be stripped off
|
103
|
-
|
418
|
+
|
104
419
|
* __bugfix__
|
105
420
|
now: between the definition of a key and a value there needs to be at least one space character or a block comment
|
106
421
|
before: for example, the definition lkmönnk was converted to { lkm: "önnk" }, now it produces a syntax error
|
@@ -130,11 +445,11 @@
|
|
130
445
|
that means: the default structure is a hash
|
131
446
|
|
132
447
|
* __breaking change__
|
133
|
-
syntax change: now after colon (:) for defining a hash, there needs to be at least one space character between the colon and the key
|
448
|
+
syntax change: now after colon (:) for defining a hash, there needs to be at least one space character between the colon and the key
|
134
449
|
(if it is on the same line)
|
135
450
|
|
136
451
|
* __bugfix__
|
137
|
-
if the definition ended without a newline character in some cases this produced errors
|
452
|
+
if the definition ended without a newline character in some cases this produced errors
|
138
453
|
|
139
454
|
* __bugfix__
|
140
455
|
error in single-quoted and double-quoted string:
|
@@ -144,7 +459,7 @@
|
|
144
459
|
|
145
460
|
* __bugfix__
|
146
461
|
0 and 0d0 was not recognized as an integer, it was recognized as a string ("0","0d0")
|
147
|
-
|
462
|
+
|
148
463
|
### 0.5.0 - (2018-09-06)
|
149
464
|
|
150
465
|
* some changes and reorganization
|