gdstruct 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b240f3ba1af106aee50c90fe52c39d5ce3be3094
4
- data.tar.gz: 0f4c4c2cd017f3c876a868a6891822e84529d824
3
+ metadata.gz: e02ef798f76626a1df6501ad1cd634f4f0217fde
4
+ data.tar.gz: 86b4c16796e9c6e90521b0d0a7da8f1b2dd5813b
5
5
  SHA512:
6
- metadata.gz: 2a29d61e3454509f5a38099a809bced2c4f43b49aa36443a8f67226eaf780c9198c81cb49a577f2660d8dcde97ce28e84b342f5a2bd6e861b76ddf393482e56e
7
- data.tar.gz: 136228b7786224a2d5ea20cbf81d10241add2d851fa0833245b19da69c5d3d58fe3658639dc4def1f494b9875b98be3d4d396889ed9f8a2eaf5dd1b0b9b4c261
6
+ metadata.gz: dd89f51355cd7aae46fedb75c6cac4c541c99324d26e9721fd0d1693d8581ca29e32980a93c44ac1200ee038391209ca1da56f6a1f0983d2e9cbffef61e6adee
7
+ data.tar.gz: 81bc9028c0596eb8fc0733ff66c09efd380c7391fcd576be8b1d2e9914b235f88ed5bdcf2a7549623250abc3f8dd29d4cb18620cae32c1d0d301fa6b6bdaac29
@@ -1,12 +1,76 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### 0.8.2 - (2019-03-18)
4
+
5
+ * __feature__
6
+ modification for classic Ruby syntax
7
+ inside an array definition: after the last element a comma (,) is allowed
8
+ this conforms to the Ruby syntax
9
+ ~~~
10
+ [ 1, 2, ]
11
+ ~~~
12
+
13
+ * __feature__
14
+ modification for classic Ruby syntax
15
+ inside a hash definition: after the last key-value pair a comma (,) is allowed
16
+ this conforms to the Ruby syntax
17
+ ~~~
18
+ { k1: 'v1', k2: 'v2', }
19
+ ~~~
20
+
21
+ * __feature__
22
+ 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
23
+ the following syntax is allowed now
24
+ ~~~
25
+ ,
26
+ : k
27
+ ~~~
28
+ ~~~
29
+ ,
30
+ : k1
31
+ k11 v11
32
+ ~~~
33
+ ~~~
34
+ ,
35
+ : k1
36
+ k11 v11
37
+ k2
38
+ ~~~
39
+ ~~~
40
+ ,
41
+ : k1
42
+ k2
43
+ ~~~
44
+
45
+ * __feature__
46
+ @merge can now follow a colon (:) on the same line, before you had to put it on a new line
47
+ the following syntax is allowed now
48
+ ~~~
49
+ init &init
50
+ prio 10
51
+ all,
52
+ : @merge *init
53
+ ~~~
54
+
3
55
  ### 0.8.1 - (2019-02-08)
4
56
 
5
57
  * __feature__
6
58
  improving the consistency of block comments; they can appear now at the beginning of every line and every construct
7
59
  now they even can appear before a colon (:) for the definition of a hash, and before a comma (,) for the definition of an array
8
- you just need to pay attention for the proper indentation
9
-
60
+ you just need to pay attention for the proper indentation
61
+ the following syntax is allowed now
62
+ ~~~
63
+ ,
64
+ /* !!! this block comment is allowed now !!! */ ,
65
+ 1
66
+ 2
67
+ ~~~
68
+ ~~~
69
+ ,
70
+ /* !!! this block comment is allowed now */ :
71
+ k1 v1
72
+ ~~~
73
+
10
74
  * __change__
11
75
  internal change: improving the grammar for the GDS language - reducing the number of rule alternatives
12
76
 
@@ -61,11 +125,11 @@
61
125
  change of the use of a schema specifier
62
126
  before : , $name
63
127
  now : , @schema name
64
-
128
+
65
129
  * __breaking change__
66
130
  default strings are no longer allowed to begin with one of the following characters: ;$!@&*:,
67
131
  exception is a beginning string interpolation: $(var)
68
-
132
+
69
133
  * __feature__
70
134
  for a reference (e.g. ref)
71
135
  @merge *ref : in a hash
@@ -89,7 +153,7 @@
89
153
 
90
154
  * __bugfix__
91
155
  again an error in escaping single-quoted and double-quoted strings
92
-
156
+
93
157
  ### 0.7.0 - (2018-11-09)
94
158
 
95
159
  * __feature__
@@ -104,19 +168,19 @@
104
168
  * __bugfix__
105
169
  escaping in single-quoted and double-quoted strings was not handled properly
106
170
  there also was a syntax issue
107
-
171
+
108
172
  ### 0.6.1 - (2018-10-27)
109
173
 
110
174
  * __bugfix__
111
175
  bugs in classic Ruby syntax fixed: [:a], and {a: :b} was not recognized
112
-
176
+
113
177
  * __change__
114
178
  if @env is not allowed (allow_env: false) then the result will be nil, it was "" before
115
179
  if @r is not allowed (context: not set to binding) then the result will be nil, it was "" before
116
-
180
+
117
181
  * __bugfix__
118
182
  @env: now before and after the environment variable there are space characters allowed, they will be stripped off
119
-
183
+
120
184
  * __bugfix__
121
185
  now: between the definition of a key and a value there needs to be at least one space character or a block comment
122
186
  before: for example, the definition lkmönnk was converted to { lkm: "önnk" }, now it produces a syntax error
@@ -146,11 +210,11 @@
146
210
  that means: the default structure is a hash
147
211
 
148
212
  * __breaking change__
149
- syntax change: now after colon (:) for defining a hash, there needs to be at least one space character between the colon and the key
213
+ syntax change: now after colon (:) for defining a hash, there needs to be at least one space character between the colon and the key
150
214
  (if it is on the same line)
151
215
 
152
216
  * __bugfix__
153
- if the definition ended without a newline character in some cases this produced errors
217
+ if the definition ended without a newline character in some cases this produced errors
154
218
 
155
219
  * __bugfix__
156
220
  error in single-quoted and double-quoted string:
@@ -160,7 +224,7 @@
160
224
 
161
225
  * __bugfix__
162
226
  0 and 0d0 was not recognized as an integer, it was recognized as a string ("0","0d0")
163
-
227
+
164
228
  ### 0.5.0 - (2018-09-06)
165
229
 
166
230
  * some changes and reorganization
@@ -1,18 +1,18 @@
1
- Copyright (c) 2018-2019 Ulrich Ramminger
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to
5
- deal in the Software without restriction, including without limitation the
6
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
- sell copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2018-2019 Ulrich Ramminger
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -10,7 +10,7 @@ You will find further information here: https://urasepandia.de/gds.html
10
10
  =end
11
11
  #===============================================================================
12
12
 
13
- require_relative 'gdstruct/gds_014'
13
+ require_relative 'gdstruct/gds_015'
14
14
 
15
15
  #===============================================================================
16
16
 
@@ -1,51 +1,51 @@
1
- #===============================================================================
2
-
3
- module LDLgeneratedLanguage
4
-
5
- class Gds_014_data
6
- def self.config
7
- @@config ||= {}
8
- end
9
- end
10
-
11
- class Gds
12
- require 'treetop'
13
-
14
- class SyntaxError < ::StandardError
15
- end
16
-
17
- def self.parse( s, config = {} )
18
- ::LDLgeneratedLanguage::Gds_014_data.config.replace( { allow_env: false, context: nil }.merge( config ) )
19
-
20
- @parserClass ||= begin
21
- Treetop.load_from_string GrammarDef
22
- instance_eval( 'Gds_014Parser' )
23
- end
24
- parser = @parserClass.new
25
-
26
- parseTree = parser.parse( s + "\n" )
27
-
28
- unless parseTree
29
- lineOfFailure = parser.failure_line
30
- columnOfFailure = parser.failure_column
31
-
32
- s = "GDS: Error happend, while parsing the definition: line #{lineOfFailure}, column #{columnOfFailure}" + "\n"
33
- s += parser.failure_reason + "\n" if parser.failure_reason
34
- s += "--->" + "\n"
35
- s += parser.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + "\n"
36
- s += ' '*((parser.failure_column) -1) + '^' + "\n"
37
- s += "<---" + "\n"
38
-
39
- raise SyntaxError, s
40
- end
41
-
42
- parseTree.ast
43
- end
44
-
45
- GrammarDef = "grammar Gds_014\n\n rule top\n &{ |s| @indentationLevels = []; true }\n defs ''\n {\n def ast\n eval 'class ::LDLgeneratedLanguage::Gds_014_data; def self.globalvars; @@globalvars ||= {}; end; end'\n ::LDLgeneratedLanguage::Gds_014_data.globalvars.clear\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata] ||= {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars] ||= {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences] ||= {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] ||= []\n defs.ast\n end\n }\n end\n\n rule defs\n wscommnl* predefs wscommnl* defs2 \n {\n def ast\n dummy = predefs.ast\n defs2.ast\n end\n }\n end\n\n rule predefs\n predef* \n {\n def ast\n elements.each { |e| e.ast }\n end\n }\n end\n\n rule predef\n wscommnl2 '@schema' wscommnl2 schemaname wscommnl2 '(' wscommnl2 schema_fieldlist wscommnl2 ')' \n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n end\n }\n /\n wscommnl2 '$' varname wscommnl2 '=' wscommnl2 vardef_rvalue \n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][varname.ast] = vardef_rvalue.ast\n end\n }\n end\n\n rule schemaname\n identifier '' \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule varname\n identifier ''\n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule vardef_rvalue\n valuedef_ind ''\n {\n def ast\n valuedef_ind.ast\n end\n }\n end\n\n rule schema_fieldlist\n schemafield ws ',' ws schema_fieldlist \n {\n def ast\n r = []\n r << schemafield.ast\n r.concat( schema_fieldlist.ast )\n r\n end\n }\n /\n schemafield '' \n {\n def ast\n r = []\n r << schemafield.ast\n r\n end\n }\n end\n\n rule schemafield\n identifier '' \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule defs2\n wscommnl2 ruby_standard_def wscommnl2\n {\n def ast\n ruby_standard_def.ast\n end\n }\n /\n wscommnl* special_indented_def wscommnl2\n {\n def ast\n special_indented_def.ast\n end\n }\n end\n\n rule ruby_standard_def\n hashdef ''\n {\n def ast\n hashdef.ast\n end\n }\n /\n arraydef ''\n {\n def ast\n arraydef.ast\n end\n }\n end\n\n rule special_indented_def\n arraydef_ind ''\n {\n def ast\n arraydef_ind.ast\n end\n }\n /\n hashdef_ind ''\n {\n def ast\n hashdef_ind.ast\n end\n }\n end\n\n rule hashdef\n wscommnl2 '{' wscommnl2 hashsubdefs wscommnl2 '}' \n {\n def ast\n hashsubdefs.ast\n end\n }\n end\n\n rule arraydef\n wscommnl2 '[' wscommnl2 arraysubdefs wscommnl2 ']' \n {\n def ast\n arraysubdefs.ast\n end\n }\n end\n\n rule hashsubdefs\n hashsubdef wscommnl2 morehashsubdefs \n {\n def ast\n r = {}\n r.merge!( hashsubdef.ast )\n r.merge!( morehashsubdefs.ast )\n r\n end\n }\n /\n ''\n {\n def ast\n {}\n end\n }\n end\n\n rule morehashsubdefs\n morehashsubdef*\n {\n def ast\n r = {}\n elements.each { |e| r.merge!( e.ast ) }\n r\n end\n }\n end\n\n rule morehashsubdef\n wscommnl2 ',' wscommnl2 hashsubdef\n {\n def ast\n hashsubdef.ast\n end\n }\n end\n\n rule hashsubdef\n keyvaluedef ''\n {\n def ast\n keyvaluedef.ast\n end\n }\n /\n keydef ':' wscommnl2 hashdef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashdef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 hashdef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashdef.ast ] )\n r\n end\n }\n /\n keydef ':' wscommnl2 arraydef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, arraydef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 arraydef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, arraydef.ast ] )\n r\n end\n }\n end\n\n rule arraysubdefs\n arraysubdef wscommnl2 morearraysubdefs \n {\n def ast\n r = []\n r << arraysubdef.ast\n r.concat( morearraysubdefs.ast )\n r\n end\n }\n /\n '' \n {\n def ast\n r = []\n r\n end\n }\n end\n\n rule morearraysubdefs\n morearraysubdef* \n {\n def ast\n r = []\n elements.each do |e|\n r << e.ast\n end\n r\n end\n }\n end\n\n rule morearraysubdef\n wscommnl2 ',' wscommnl2 arraysubdef\n {\n def ast\n arraysubdef.ast\n end\n }\n end\n\n rule arraysubdef\n valuedef ''\n {\n def ast\n valuedef.ast\n end\n }\n /\n arraydef ''\n {\n def ast\n arraydef.ast\n end\n }\n /\n hashdef ''\n {\n def ast\n hashdef.ast\n end\n }\n /\n hashsubdef ''\n {\n def ast\n hashsubdef.ast\n end\n }\n end\n\n rule hashdef_ind\n indentation bc_0_l:(bc_0*) ws ': ' ws refdef_tl:refdef? ws keyvaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = keyvaluedefs_ind.ast unless refdef_tl.empty?\n r.merge!( keyvaluedefs_ind.ast )\n r.merge!( hashsubdefs_ind.ast )\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n hashsubdefs_ind.ast\n end\n }\n /\n indentation '' \n &{ |s| level = s[0].text_value.length; @lastIndentation=level; true } \n &{ |s| false }\n {\n def ast\n end\n }\n /\n &{ |s| @indentationLevels << (@lastIndentation-2); true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( hashsubdefs_ind.ast )\n r\n end\n }\n end\n\n rule arraydef_ind\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n ###orig-ok# raise SyntaxError, \"GDS: undefined schema specifier: \#{schemaname.ast}\"\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws refdef_tl:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = valuedefs_ind.ast unless refdef_tl.empty?\n r = []\n r.concat( valuedefs_ind.ast )\n r.concat( arraysubdefs_ind.ast )\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n arraysubdefs_ind.ast\n end\n }\n end\n\n rule hashsubdefs_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n hashsubdef_ind '' \n )*\n {\n def ast\n r = {}\n elements.each { |e| r.merge!( e.hashsubdef_ind.ast ) }\n r\n end\n }\n end\n\n rule hashsubdef_ind\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws keydef ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws rd3:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd3.ast] = valuedefs_ind.ast unless rd3.empty?\n r.merge!( Hash[ keydef.ast, begin [].concat( valuedefs_ind.ast ).concat( arraysubdefs_ind.ast ) end ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = r[keydef.ast] unless rd2.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = hashsubdefs_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, hashsubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws keyvaluedefs_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n r = keyvaluedefs_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws '@merge' ws refuse_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n refuse_ind.ast\n end\n }\n end\n\n rule arraysubdefs_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n arraysubdef_ind '' \n )*\n {\n def ast\n r = []\n elements.each do |e|\n e1 = e.arraysubdef_ind.ast\n if e1.is_a?( Array )\n r.concat e1\n else\n r << e1\n end\n end\n r\n end\n }\n end\n\n rule arraysubdef_ind\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws ': ' ws rd2:refdef? ws keyvaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = keyvaluedefs_ind.ast unless rd2.empty?\n r.merge!( keyvaluedefs_ind.ast )\n r.merge!( hashsubdefs_ind.ast )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = hashsubdefs_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashsubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = r[keydef.ast] unless rd2.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws ',' ws rd2:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = valuedefs_ind.ast unless rd2.empty?\n r = []\n r.concat( valuedefs_ind.ast )\n r.concat( arraysubdefs_ind.ast )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n [\n r\n ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = arraysubdefs_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n [\n r\n ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws '@insert' ws refuse_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n refuse_ind.ast\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws valuedefs_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n r = valuedefs_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n end\n\n rule arraysubdefs_schema_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n arraysubdef_schema_ind '' \n )*\n {\n def ast\n r = []\n elements.each do |e|\n e1 = e.arraysubdef_schema_ind.ast\n if e1.is_a?( Array )\n r.concat e1\n else\n r << e1\n end\n end\n r\n end\n }\n end\n\n rule arraysubdef_schema_ind\n indentation rd1:refdef? ws ': ' ws rd2:refdef? ws schemavaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n if schemavaluedefs_ind.ast.length > ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].last.length\n s = \"GDS: too many values for schema definition: \"\n nt = schemavaluedefs_ind\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n result = {}\n r1 = schemavaluedefs_ind.ast.each_with_index.map do |e,i|\n (e.is_a?(Hash) && e[:valuedirective]==:@na) ? ({}) : (Hash[ ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].last[i], e ])\n end.inject({}){ |res,e| res.merge!(e) }\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = result unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = r1 unless rd2.empty?\n result.merge!( r1 ).merge!( hashsubdefs_ind.ast )\n \n end\n }\n /\n arraysubdef_ind ''\n {\n def ast\n arraysubdef_ind.ast\n end\n }\n end\n\n rule schemavaluedefs_ind\n schemavaluedef_ind ws '|' ws schemavaluedefs_ind \n {\n def ast\n r = []\n r << schemavaluedef_ind.ast\n r.concat( schemavaluedefs_ind.ast )\n r\n end\n }\n /\n schemavaluedef_ind '' \n {\n def ast\n r = []\n r << schemavaluedef_ind.ast\n r\n end\n }\n end\n\n rule schemavaluedef_ind\n value_directive_ind ''\n {\n def ast\n value_directive_ind.ast\n end\n }\n /\n valuedef_ind ''\n {\n def ast\n valuedef_ind.ast\n end\n }\n end\n\n rule refdef\n '&' identifier \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule keyvaluedefs_ind\n keyvaluedef_ind ws '|' ws keyvaluedefs_ind \n {\n def ast\n r = {}\n r.merge!( keyvaluedef_ind.ast )\n r.merge!( keyvaluedefs_ind.ast )\n r\n end\n }\n /\n keyvaluedef_ind ''\n {\n def ast\n keyvaluedef_ind.ast\n end\n }\n end\n\n rule keyvaluedef_ind\n keydef wsc_l:(wsc+) valuedef_ind \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef_ind.ast ] )\n r\n end\n }\n end\n\n rule valuedef_ind\n variable_val_ind ''\n {\n def ast\n variable_val_ind.ast\n end\n }\n /\n refuse_ind ''\n {\n def ast\n refuse_ind.ast\n end\n }\n /\n valuedef_gen_ind ''\n {\n def ast\n valuedef_gen_ind.ast\n end\n }\n /\n special_value_ind ''\n {\n def ast\n special_value_ind.ast\n end\n }\n /\n string_no_leading_space ''\n {\n def ast\n string_no_leading_space.ast\n end\n }\n end\n\n rule keyvaluedef\n keydef ':' wscommnl2 valuedef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 valuedef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef.ast ] )\n r\n end\n }\n end\n\n rule valuedefs_ind\n valuedef_ind ws '|' ws valuedefs_ind \n {\n def ast\n r = []\n r << valuedef_ind.ast\n r.concat( valuedefs_ind.ast )\n r\n end\n }\n /\n valuedef_ind '' \n {\n def ast\n r = []\n r << valuedef_ind.ast\n r\n end\n }\n end\n\n rule valuedef\n variable_val ''\n {\n def ast\n variable_val.ast\n end\n }\n /\n valuedef_gen ''\n {\n def ast\n valuedef_gen.ast\n end\n }\n /\n special_value ''\n {\n def ast\n special_value.ast\n end\n }\n end\n\n rule valuedef_gen\n number_float ''\n {\n def ast\n number_float.ast\n end\n }\n /\n number_int ''\n {\n def ast\n number_int.ast\n end\n }\n /\n rubysymbol ''\n {\n def ast\n rubysymbol.ast\n end\n }\n /\n string_with_quotes ''\n {\n def ast\n string_with_quotes.ast\n end\n }\n end\n\n rule valuedef_gen_ind\n ruby_eval ''\n {\n def ast\n ruby_eval.ast\n end\n }\n /\n number_float ''\n {\n def ast\n number_float.ast\n end\n }\n /\n number_int ''\n {\n def ast\n number_int.ast\n end\n }\n /\n rubysymbol_ind ''\n {\n def ast\n rubysymbol_ind.ast\n end\n }\n /\n string_with_quotes ''\n {\n def ast\n string_with_quotes.ast\n end\n }\n end\n\n rule special_value\n 'nil' \n {\n def ast\n nil\n end\n }\n /\n 'true' \n {\n def ast\n true\n end\n }\n /\n 'false' \n {\n def ast\n false\n end\n }\n end\n\n rule special_value_ind\n '!nil' \n {\n def ast\n nil\n end\n }\n /\n '!true' \n {\n def ast\n true\n end\n }\n /\n '!false' \n {\n def ast\n false\n end\n }\n end\n\n rule value_directive_ind\n '@na' \n {\n def ast\n r = {}\n r.merge!( Hash[ :valuedirective, :@na ] )\n r\n end\n }\n end\n\n rule string_with_quotes\n string_with_doublequotes ''\n {\n def ast\n string_with_doublequotes.ast\n end\n }\n /\n string_with_singlequotes ''\n {\n def ast\n string_with_singlequotes.ast\n end\n }\n end\n\n rule string_with_doublequotes\n '\"' string_double_q '\"'\n {\n def ast\n string_double_q.ast\n end\n }\n end\n\n rule string_double_q\n ('\\\\\\\\' / '\\\"' / !'\"' .)* \n {\n def ast\n \n text_value.gsub(/(\\\\\\\\)|(\\\\n)|(\\\\\")/, '\\\\\\\\'=>'\\\\', \"\\\\n\"=>\"\\n\", '\\\\\"'=>'\"').gsub( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) { |s1| key = s1.match('[_a-zA-Z0-9]+')[0].to_sym\n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars].key?(key)\n s = \"GDS: undefined variable in string interpolation: \"\n nt = self\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size + text_value.index( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) + 2\n s += \"\#{key}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][key].to_s }.gsub(/\\\\\\$/, \"$\" )\n \n end\n }\n end\n\n rule string_with_singlequotes\n '\\'' string_single_q '\\''\n {\n def ast\n string_single_q.ast\n end\n }\n end\n\n rule string_single_q\n ('\\\\\\\\'/ '\\\\\\'' / !'\\'' .)* \n {\n def ast\n text_value.gsub(/(\\\\\\\\)|(\\\\n)|(\\\\')/, '\\\\\\\\'=>'\\\\', \"\\\\n\"=>\"\\n\", \"\\\\'\"=>\"'\")\n end\n }\n end\n\n rule string_no_leading_space\n (&\"$(\" / ( !\"$\" !';' !'!' !'@' !'&' !'*' !' ' !':' !',' !\"|\" !'#' !'/*')) (!\"\\n\" !\"|\" !'#' !'/*' .)+ \n {\n def ast\n \n text_value.rstrip.gsub( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) { |s1| key = s1.match('[_a-zA-Z0-9]+')[0].to_sym\n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars].key?(key)\n s = \"GDS: undefined variable in string interpolation: \"\n nt = self\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size + text_value.index( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) + 2\n s += \"\#{key}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][key].to_s }.gsub(/\\\\\\$/, \"$\" )\n \n end\n }\n end\n\n rule keydef\n string_with_quotes '' \n {\n def ast\n string_with_quotes.ast.to_sym \n end\n }\n /\n identifier ''\n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule variable_val\n wscommnl2 '$' varname \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars].key?(varname.ast)\n s = \"GDS: undefined variable: \"\n nt = varname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][varname.ast]\n \n end\n }\n end\n\n rule variable_val_ind\n '$' varname \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars].key?(varname.ast)\n s = \"GDS: undefined variable: \"\n nt = varname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][varname.ast]\n \n end\n }\n end\n\n rule refuse_ind\n '*' identifier \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][identifier.ast]\n s = \"GDS: undefined reference: \"\n nt = identifier\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][identifier.ast]\n \n end\n }\n end\n\n rule number_int\n octal_int ''\n {\n def ast\n octal_int.ast\n end\n }\n /\n binary_int ''\n {\n def ast\n binary_int.ast\n end\n }\n /\n hexa_int ''\n {\n def ast\n hexa_int.ast\n end\n }\n /\n decimal_int ''\n {\n def ast\n decimal_int.ast\n end\n }\n end\n\n rule octal_int\n ('-'/'+')? ( '0o' / '0' ) [0-7] ( [0-7] / '_' [0-7] )* \n {\n def ast\n text_value.to_i(8)\n end\n }\n end\n\n rule binary_int\n ('-'/'+')? '0b' [01] ( [01] / '_' [01] )* \n {\n def ast\n text_value.to_i(2)\n end\n }\n end\n\n rule hexa_int\n ('-'/'+')? '0x' [0-9a-fA-F] ( [0-9a-fA-F] / '_' [0-9a-fA-F] )* \n {\n def ast\n text_value.to_i(16)\n end\n }\n end\n\n rule decimal_int\n ('-'/'+')? ('0d')? [1-9] ( [0-9] / '_' [0-9] )* \n {\n def ast\n text_value.to_i\n end\n }\n /\n ('0d')? [0] \n {\n def ast\n text_value.to_i\n end\n }\n end\n\n rule number_float\n [+-]? ( [0-9] / '_' [0-9] )* [.] [0-9] ( [0-9] / '_' [0-9] )* (('e'/'E') [+-]? [0-9] ( [0-9] / '_' [0-9] )* )? \n {\n def ast\n text_value.to_f\n end\n }\n end\n\n rule rubysymbol\n wscommnl2 ':' rubysymbolcontent \n {\n def ast\n rubysymbolcontent.ast\n end\n }\n end\n\n rule rubysymbolcontent\n wscommnl2 '\"' rubysymbol_in_double_quotes '\"' \n {\n def ast\n rubysymbol_in_double_quotes.ast\n end\n }\n /\n wscommnl2 '\\'' rubysymbol_in_single_quotes '\\'' \n {\n def ast\n rubysymbol_in_single_quotes.ast\n end\n }\n /\n ( !'}' !' ' !',' !']' !'#' !'/*' !'*/' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_ind\n ':' rubysymbolcontent_ind \n {\n def ast\n rubysymbolcontent_ind.ast\n end\n }\n end\n\n rule rubysymbolcontent_ind\n '\"' rubysymbol_in_double_quotes '\"' \n {\n def ast\n rubysymbol_in_double_quotes.ast\n end\n }\n /\n '\\'' rubysymbol_in_single_quotes '\\'' \n {\n def ast\n rubysymbol_in_single_quotes.ast\n end\n }\n /\n (!' ' !'|' !'#' !'/*' !'*/' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_in_double_quotes\n ('\\\"' / !'\"' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_in_single_quotes\n ('\\\\\\'' / !'\\'' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule ruby_eval\n '@r' ws evalexpr \n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.config[:context] ? (eval(evalexpr.ast, ::LDLgeneratedLanguage::Gds_014_data.config[:context])) : nil \n end\n }\n /\n '@env' ws evalexpr \n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.config[:allow_env] ? (eval(\"ENV['\#{evalexpr.ast.strip}']\")) : nil \n end\n }\n end\n\n rule evalexpr\n evalexpr_0_with_nesting ''\n {\n def ast\n evalexpr_0_with_nesting.ast\n end\n }\n end\n\n rule evalexpr_0_with_nesting\n &{ |s| @evalexpr_0_with_nestingLevel = 0; true }\n '(' evalexpr_0_with_nesting_sub ')'\n {\n def ast\n evalexpr_0_with_nesting_sub.ast\n end\n }\n end\n\n rule evalexpr_0_with_nesting_sub\n '(' \n &{ |s| @evalexpr_0_with_nestingLevel += 1; true }\n evalexpr_0_with_nesting_sub\n {\n def ast\n '(' + evalexpr_0_with_nesting_sub.ast\n end\n }\n /\n ')' \n &{ |s| ok = (@evalexpr_0_with_nestingLevel > 0); ok } \n &{ |s| @evalexpr_0_with_nestingLevel -= 1; true }\n evalexpr_0_with_nesting_sub\n {\n def ast\n ')' + evalexpr_0_with_nesting_sub.ast\n end\n }\n /\n ( !\"(\" !\")\" . )+ evalexpr_0_with_nesting_sub\n {\n def ast\n text_value\n end\n }\n /\n ''\n {\n def ast\n ''\n end\n }\n end\n\n rule evalexpr_0_with_nesting_onechar\n ( !\")\" . )\n {\n def ast\n text_value\n end\n }\n end\n\n rule bc_0\n &{ |s| @bc_0Level = 0; true }\n '/*' bc_0_sub '*/'\n {\n def ast\n \"/*\" + bc_0_sub.ast + \"*/\"\n end\n }\n end\n\n rule bc_0_sub\n '/*' \n &{ |s| @bc_0Level += 1; true }\n bc_0_sub\n {\n def ast\n '/*' + bc_0_sub.ast\n end\n }\n /\n '*/' \n &{ |s| ok = (@bc_0Level > 0); ok } \n &{ |s| @bc_0Level -= 1; true }\n bc_0_sub\n {\n def ast\n '*/' + bc_0_sub.ast\n end\n }\n /\n ( !\"/*\" !\"*/\" . )+ bc_0_sub\n {\n def ast\n text_value\n end\n }\n /\n ''\n {\n def ast\n ''\n end\n }\n end\n\n rule bc_0_onechar\n ( !\"*/\" . )\n {\n def ast\n text_value\n end\n }\n end\n\n rule wsc\n [ \\t] \n {\n }\n /\n bc_0 '' \n {\n }\n end\n\n rule identifier\n ([a-zA-Z_] [a-zA-Z0-9_]*)\n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule string_no_space\n [a-zA-Z0-9_/.:]+\n {\n def ast\n text_value\n end\n }\n end\n\n rule indentation\n ' '*\n end\n\n rule ws\n wsc*\n end\n\n rule icomm\n '#' \n end\n\n rule wscommnl\n ws ( icomm ( !\"\\n\" . )* )? \"\\n\"\n end\n\n rule wscommnl2\n ( icomm ( !\"\\n\" . )* \"\\n\" / \"\\n\" / wsc )*\n end\n\nend\n"
46
-
47
- end
48
- end
49
-
50
- #===============================================================================
51
-
1
+ #===============================================================================
2
+
3
+ module LDLgeneratedLanguage
4
+
5
+ class Gds_014_data
6
+ def self.config
7
+ @@config ||= {}
8
+ end
9
+ end
10
+
11
+ class Gds
12
+ require 'treetop'
13
+
14
+ class SyntaxError < ::StandardError
15
+ end
16
+
17
+ def self.parse( s, config = {} )
18
+ ::LDLgeneratedLanguage::Gds_014_data.config.replace( { allow_env: false, context: nil }.merge( config ) )
19
+
20
+ @parserClass ||= begin
21
+ Treetop.load_from_string GrammarDef
22
+ instance_eval( 'Gds_014Parser' )
23
+ end
24
+ parser = @parserClass.new
25
+
26
+ parseTree = parser.parse( s + "\n" )
27
+
28
+ unless parseTree
29
+ lineOfFailure = parser.failure_line
30
+ columnOfFailure = parser.failure_column
31
+
32
+ s = "GDS: Error happend, while parsing the definition: line #{lineOfFailure}, column #{columnOfFailure}" + "\n"
33
+ s += parser.failure_reason + "\n" if parser.failure_reason
34
+ s += "--->" + "\n"
35
+ s += parser.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + "\n"
36
+ s += ' '*((parser.failure_column) -1) + '^' + "\n"
37
+ s += "<---" + "\n"
38
+
39
+ raise SyntaxError, s
40
+ end
41
+
42
+ parseTree.ast
43
+ end
44
+
45
+ GrammarDef = "grammar Gds_014\n\n rule top\n &{ |s| @indentationLevels = []; true }\n defs ''\n {\n def ast\n eval 'class ::LDLgeneratedLanguage::Gds_014_data; def self.globalvars; @@globalvars ||= {}; end; end'\n ::LDLgeneratedLanguage::Gds_014_data.globalvars.clear\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata] ||= {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars] ||= {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences] ||= {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] ||= []\n defs.ast\n end\n }\n end\n\n rule defs\n wscommnl* predefs wscommnl* defs2 \n {\n def ast\n dummy = predefs.ast\n defs2.ast\n end\n }\n end\n\n rule predefs\n predef* \n {\n def ast\n elements.each { |e| e.ast }\n end\n }\n end\n\n rule predef\n wscommnl2 '@schema' wscommnl2 schemaname wscommnl2 '(' wscommnl2 schema_fieldlist wscommnl2 ')' \n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n end\n }\n /\n wscommnl2 '$' varname wscommnl2 '=' wscommnl2 vardef_rvalue \n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][varname.ast] = vardef_rvalue.ast\n end\n }\n end\n\n rule schemaname\n identifier '' \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule varname\n identifier ''\n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule vardef_rvalue\n valuedef_ind ''\n {\n def ast\n valuedef_ind.ast\n end\n }\n end\n\n rule schema_fieldlist\n schemafield ws ',' ws schema_fieldlist \n {\n def ast\n r = []\n r << schemafield.ast\n r.concat( schema_fieldlist.ast )\n r\n end\n }\n /\n schemafield '' \n {\n def ast\n r = []\n r << schemafield.ast\n r\n end\n }\n end\n\n rule schemafield\n identifier '' \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule defs2\n wscommnl2 ruby_standard_def wscommnl2\n {\n def ast\n ruby_standard_def.ast\n end\n }\n /\n wscommnl* special_indented_def wscommnl2\n {\n def ast\n special_indented_def.ast\n end\n }\n end\n\n rule ruby_standard_def\n hashdef ''\n {\n def ast\n hashdef.ast\n end\n }\n /\n arraydef ''\n {\n def ast\n arraydef.ast\n end\n }\n end\n\n rule special_indented_def\n arraydef_ind ''\n {\n def ast\n arraydef_ind.ast\n end\n }\n /\n hashdef_ind ''\n {\n def ast\n hashdef_ind.ast\n end\n }\n end\n\n rule hashdef\n wscommnl2 '{' wscommnl2 hashsubdefs wscommnl2 '}' \n {\n def ast\n hashsubdefs.ast\n end\n }\n end\n\n rule arraydef\n wscommnl2 '[' wscommnl2 arraysubdefs wscommnl2 ']' \n {\n def ast\n arraysubdefs.ast\n end\n }\n end\n\n rule hashsubdefs\n hashsubdef wscommnl2 morehashsubdefs \n {\n def ast\n r = {}\n r.merge!( hashsubdef.ast )\n r.merge!( morehashsubdefs.ast )\n r\n end\n }\n /\n ''\n {\n def ast\n {}\n end\n }\n end\n\n rule morehashsubdefs\n morehashsubdef*\n {\n def ast\n r = {}\n elements.each { |e| r.merge!( e.ast ) }\n r\n end\n }\n end\n\n rule morehashsubdef\n wscommnl2 ',' wscommnl2 hashsubdef\n {\n def ast\n hashsubdef.ast\n end\n }\n end\n\n rule hashsubdef\n keyvaluedef ''\n {\n def ast\n keyvaluedef.ast\n end\n }\n /\n keydef ':' wscommnl2 hashdef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashdef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 hashdef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashdef.ast ] )\n r\n end\n }\n /\n keydef ':' wscommnl2 arraydef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, arraydef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 arraydef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, arraydef.ast ] )\n r\n end\n }\n end\n\n rule arraysubdefs\n arraysubdef wscommnl2 morearraysubdefs \n {\n def ast\n r = []\n r << arraysubdef.ast\n r.concat( morearraysubdefs.ast )\n r\n end\n }\n /\n '' \n {\n def ast\n r = []\n r\n end\n }\n end\n\n rule morearraysubdefs\n morearraysubdef* \n {\n def ast\n r = []\n elements.each do |e|\n r << e.ast\n end\n r\n end\n }\n end\n\n rule morearraysubdef\n wscommnl2 ',' wscommnl2 arraysubdef\n {\n def ast\n arraysubdef.ast\n end\n }\n end\n\n rule arraysubdef\n valuedef ''\n {\n def ast\n valuedef.ast\n end\n }\n /\n arraydef ''\n {\n def ast\n arraydef.ast\n end\n }\n /\n hashdef ''\n {\n def ast\n hashdef.ast\n end\n }\n /\n hashsubdef ''\n {\n def ast\n hashsubdef.ast\n end\n }\n end\n\n rule hashdef_ind\n indentation bc_0_l:(bc_0*) ws ': ' ws refdef_tl:refdef? ws keyvaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = keyvaluedefs_ind.ast unless refdef_tl.empty?\n r.merge!( keyvaluedefs_ind.ast )\n r.merge!( hashsubdefs_ind.ast )\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n hashsubdefs_ind.ast\n end\n }\n /\n indentation '' \n &{ |s| level = s[0].text_value.length; @lastIndentation=level; true } \n &{ |s| false }\n {\n def ast\n end\n }\n /\n &{ |s| @indentationLevels << (@lastIndentation-2); true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( hashsubdefs_ind.ast )\n r\n end\n }\n end\n\n rule arraydef_ind\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n ###orig-ok# raise SyntaxError, \"GDS: undefined schema specifier: \#{schemaname.ast}\"\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws refdef_tl:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = valuedefs_ind.ast unless refdef_tl.empty?\n r = []\n r.concat( valuedefs_ind.ast )\n r.concat( arraysubdefs_ind.ast )\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n arraysubdefs_ind.ast\n end\n }\n end\n\n rule hashsubdefs_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n hashsubdef_ind '' \n )*\n {\n def ast\n r = {}\n elements.each { |e| r.merge!( e.hashsubdef_ind.ast ) }\n r\n end\n }\n end\n\n rule hashsubdef_ind\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws keydef ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws rd3:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd3.ast] = valuedefs_ind.ast unless rd3.empty?\n r.merge!( Hash[ keydef.ast, begin [].concat( valuedefs_ind.ast ).concat( arraysubdefs_ind.ast ) end ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = r[keydef.ast] unless rd2.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = hashsubdefs_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, hashsubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws keyvaluedefs_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n r = keyvaluedefs_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws '@merge' ws refuse_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n refuse_ind.ast\n end\n }\n end\n\n rule arraysubdefs_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n arraysubdef_ind '' \n )*\n {\n def ast\n r = []\n elements.each do |e|\n e1 = e.arraysubdef_ind.ast\n if e1.is_a?( Array )\n r.concat e1\n else\n r << e1\n end\n end\n r\n end\n }\n end\n\n rule arraysubdef_ind\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws ': ' ws rd2:refdef? ws keyvaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = keyvaluedefs_ind.ast unless rd2.empty?\n r.merge!( keyvaluedefs_ind.ast )\n r.merge!( hashsubdefs_ind.ast )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = hashsubdefs_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashsubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = r[keydef.ast] unless rd2.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schemata][schemaname.ast]\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws ',' ws rd2:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = valuedefs_ind.ast unless rd2.empty?\n r = []\n r.concat( valuedefs_ind.ast )\n r.concat( arraysubdefs_ind.ast )\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n [\n r\n ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = arraysubdefs_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n [\n r\n ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws '@insert' ws refuse_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n refuse_ind.ast\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws valuedefs_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n r = valuedefs_ind.ast\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n end\n\n rule arraysubdefs_schema_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n arraysubdef_schema_ind '' \n )*\n {\n def ast\n r = []\n elements.each do |e|\n e1 = e.arraysubdef_schema_ind.ast\n if e1.is_a?( Array )\n r.concat e1\n else\n r << e1\n end\n end\n r\n end\n }\n end\n\n rule arraysubdef_schema_ind\n indentation rd1:refdef? ws ': ' ws rd2:refdef? ws schemavaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n if schemavaluedefs_ind.ast.length > ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].last.length\n s = \"GDS: too many values for schema definition: \"\n nt = schemavaluedefs_ind\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n result = {}\n r1 = schemavaluedefs_ind.ast.each_with_index.map do |e,i|\n (e.is_a?(Hash) && e[:valuedirective]==:@na) ? ({}) : (Hash[ ::LDLgeneratedLanguage::Gds_014_data.globalvars[:schema].last[i], e ])\n end.inject({}){ |res,e| res.merge!(e) }\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd1.ast] = result unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][rd2.ast] = r1 unless rd2.empty?\n result.merge!( r1 ).merge!( hashsubdefs_ind.ast )\n \n end\n }\n /\n arraysubdef_ind ''\n {\n def ast\n arraysubdef_ind.ast\n end\n }\n end\n\n rule schemavaluedefs_ind\n schemavaluedef_ind ws '|' ws schemavaluedefs_ind \n {\n def ast\n r = []\n r << schemavaluedef_ind.ast\n r.concat( schemavaluedefs_ind.ast )\n r\n end\n }\n /\n schemavaluedef_ind '' \n {\n def ast\n r = []\n r << schemavaluedef_ind.ast\n r\n end\n }\n end\n\n rule schemavaluedef_ind\n value_directive_ind ''\n {\n def ast\n value_directive_ind.ast\n end\n }\n /\n valuedef_ind ''\n {\n def ast\n valuedef_ind.ast\n end\n }\n end\n\n rule refdef\n '&' identifier \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule keyvaluedefs_ind\n keyvaluedef_ind ws '|' ws keyvaluedefs_ind \n {\n def ast\n r = {}\n r.merge!( keyvaluedef_ind.ast )\n r.merge!( keyvaluedefs_ind.ast )\n r\n end\n }\n /\n keyvaluedef_ind ''\n {\n def ast\n keyvaluedef_ind.ast\n end\n }\n end\n\n rule keyvaluedef_ind\n keydef wsc_l:(wsc+) valuedef_ind \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef_ind.ast ] )\n r\n end\n }\n end\n\n rule valuedef_ind\n variable_val_ind ''\n {\n def ast\n variable_val_ind.ast\n end\n }\n /\n refuse_ind ''\n {\n def ast\n refuse_ind.ast\n end\n }\n /\n valuedef_gen_ind ''\n {\n def ast\n valuedef_gen_ind.ast\n end\n }\n /\n special_value_ind ''\n {\n def ast\n special_value_ind.ast\n end\n }\n /\n string_no_leading_space ''\n {\n def ast\n string_no_leading_space.ast\n end\n }\n end\n\n rule keyvaluedef\n keydef ':' wscommnl2 valuedef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 valuedef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef.ast ] )\n r\n end\n }\n end\n\n rule valuedefs_ind\n valuedef_ind ws '|' ws valuedefs_ind \n {\n def ast\n r = []\n r << valuedef_ind.ast\n r.concat( valuedefs_ind.ast )\n r\n end\n }\n /\n valuedef_ind '' \n {\n def ast\n r = []\n r << valuedef_ind.ast\n r\n end\n }\n end\n\n rule valuedef\n variable_val ''\n {\n def ast\n variable_val.ast\n end\n }\n /\n valuedef_gen ''\n {\n def ast\n valuedef_gen.ast\n end\n }\n /\n special_value ''\n {\n def ast\n special_value.ast\n end\n }\n end\n\n rule valuedef_gen\n number_float ''\n {\n def ast\n number_float.ast\n end\n }\n /\n number_int ''\n {\n def ast\n number_int.ast\n end\n }\n /\n rubysymbol ''\n {\n def ast\n rubysymbol.ast\n end\n }\n /\n string_with_quotes ''\n {\n def ast\n string_with_quotes.ast\n end\n }\n end\n\n rule valuedef_gen_ind\n ruby_eval ''\n {\n def ast\n ruby_eval.ast\n end\n }\n /\n number_float ''\n {\n def ast\n number_float.ast\n end\n }\n /\n number_int ''\n {\n def ast\n number_int.ast\n end\n }\n /\n rubysymbol_ind ''\n {\n def ast\n rubysymbol_ind.ast\n end\n }\n /\n string_with_quotes ''\n {\n def ast\n string_with_quotes.ast\n end\n }\n end\n\n rule special_value\n 'nil' \n {\n def ast\n nil\n end\n }\n /\n 'true' \n {\n def ast\n true\n end\n }\n /\n 'false' \n {\n def ast\n false\n end\n }\n end\n\n rule special_value_ind\n '!nil' \n {\n def ast\n nil\n end\n }\n /\n '!true' \n {\n def ast\n true\n end\n }\n /\n '!false' \n {\n def ast\n false\n end\n }\n end\n\n rule value_directive_ind\n '@na' \n {\n def ast\n r = {}\n r.merge!( Hash[ :valuedirective, :@na ] )\n r\n end\n }\n end\n\n rule string_with_quotes\n string_with_doublequotes ''\n {\n def ast\n string_with_doublequotes.ast\n end\n }\n /\n string_with_singlequotes ''\n {\n def ast\n string_with_singlequotes.ast\n end\n }\n end\n\n rule string_with_doublequotes\n '\"' string_double_q '\"'\n {\n def ast\n string_double_q.ast\n end\n }\n end\n\n rule string_double_q\n ('\\\\\\\\' / '\\\"' / !'\"' .)* \n {\n def ast\n \n text_value.gsub(/(\\\\\\\\)|(\\\\n)|(\\\\\")/, '\\\\\\\\'=>'\\\\', \"\\\\n\"=>\"\\n\", '\\\\\"'=>'\"').gsub( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) { |s1| key = s1.match('[_a-zA-Z0-9]+')[0].to_sym\n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars].key?(key)\n s = \"GDS: undefined variable in string interpolation: \"\n nt = self\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size + text_value.index( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) + 2\n s += \"\#{key}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][key].to_s }.gsub(/\\\\\\$/, \"$\" )\n \n end\n }\n end\n\n rule string_with_singlequotes\n '\\'' string_single_q '\\''\n {\n def ast\n string_single_q.ast\n end\n }\n end\n\n rule string_single_q\n ('\\\\\\\\'/ '\\\\\\'' / !'\\'' .)* \n {\n def ast\n text_value.gsub(/(\\\\\\\\)|(\\\\n)|(\\\\')/, '\\\\\\\\'=>'\\\\', \"\\\\n\"=>\"\\n\", \"\\\\'\"=>\"'\")\n end\n }\n end\n\n rule string_no_leading_space\n (&\"$(\" / ( !\"$\" !';' !'!' !'@' !'&' !'*' !' ' !':' !',' !\"|\" !'#' !'/*')) (!\"\\n\" !\"|\" !'#' !'/*' .)+ \n {\n def ast\n \n text_value.rstrip.gsub( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) { |s1| key = s1.match('[_a-zA-Z0-9]+')[0].to_sym\n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars].key?(key)\n s = \"GDS: undefined variable in string interpolation: \"\n nt = self\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size + text_value.index( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) + 2\n s += \"\#{key}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][key].to_s }.gsub(/\\\\\\$/, \"$\" )\n \n end\n }\n end\n\n rule keydef\n string_with_quotes '' \n {\n def ast\n string_with_quotes.ast.to_sym \n end\n }\n /\n identifier ''\n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule variable_val\n wscommnl2 '$' varname \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars].key?(varname.ast)\n s = \"GDS: undefined variable: \"\n nt = varname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][varname.ast]\n \n end\n }\n end\n\n rule variable_val_ind\n '$' varname \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars].key?(varname.ast)\n s = \"GDS: undefined variable: \"\n nt = varname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:gdsglobvars][varname.ast]\n \n end\n }\n end\n\n rule refuse_ind\n '*' identifier \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][identifier.ast]\n s = \"GDS: undefined reference: \"\n nt = identifier\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_014_data.globalvars[:internreferences][identifier.ast]\n \n end\n }\n end\n\n rule number_int\n octal_int ''\n {\n def ast\n octal_int.ast\n end\n }\n /\n binary_int ''\n {\n def ast\n binary_int.ast\n end\n }\n /\n hexa_int ''\n {\n def ast\n hexa_int.ast\n end\n }\n /\n decimal_int ''\n {\n def ast\n decimal_int.ast\n end\n }\n end\n\n rule octal_int\n ('-'/'+')? ( '0o' / '0' ) [0-7] ( [0-7] / '_' [0-7] )* \n {\n def ast\n text_value.to_i(8)\n end\n }\n end\n\n rule binary_int\n ('-'/'+')? '0b' [01] ( [01] / '_' [01] )* \n {\n def ast\n text_value.to_i(2)\n end\n }\n end\n\n rule hexa_int\n ('-'/'+')? '0x' [0-9a-fA-F] ( [0-9a-fA-F] / '_' [0-9a-fA-F] )* \n {\n def ast\n text_value.to_i(16)\n end\n }\n end\n\n rule decimal_int\n ('-'/'+')? ('0d')? [1-9] ( [0-9] / '_' [0-9] )* \n {\n def ast\n text_value.to_i\n end\n }\n /\n ('0d')? [0] \n {\n def ast\n text_value.to_i\n end\n }\n end\n\n rule number_float\n [+-]? ( [0-9] / '_' [0-9] )* [.] [0-9] ( [0-9] / '_' [0-9] )* (('e'/'E') [+-]? [0-9] ( [0-9] / '_' [0-9] )* )? \n {\n def ast\n text_value.to_f\n end\n }\n end\n\n rule rubysymbol\n wscommnl2 ':' rubysymbolcontent \n {\n def ast\n rubysymbolcontent.ast\n end\n }\n end\n\n rule rubysymbolcontent\n wscommnl2 '\"' rubysymbol_in_double_quotes '\"' \n {\n def ast\n rubysymbol_in_double_quotes.ast\n end\n }\n /\n wscommnl2 '\\'' rubysymbol_in_single_quotes '\\'' \n {\n def ast\n rubysymbol_in_single_quotes.ast\n end\n }\n /\n ( !'}' !' ' !',' !']' !'#' !'/*' !'*/' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_ind\n ':' rubysymbolcontent_ind \n {\n def ast\n rubysymbolcontent_ind.ast\n end\n }\n end\n\n rule rubysymbolcontent_ind\n '\"' rubysymbol_in_double_quotes '\"' \n {\n def ast\n rubysymbol_in_double_quotes.ast\n end\n }\n /\n '\\'' rubysymbol_in_single_quotes '\\'' \n {\n def ast\n rubysymbol_in_single_quotes.ast\n end\n }\n /\n (!' ' !'|' !'#' !'/*' !'*/' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_in_double_quotes\n ('\\\"' / !'\"' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_in_single_quotes\n ('\\\\\\'' / !'\\'' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule ruby_eval\n '@r' ws evalexpr \n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.config[:context] ? (eval(evalexpr.ast, ::LDLgeneratedLanguage::Gds_014_data.config[:context])) : nil \n end\n }\n /\n '@env' ws evalexpr \n {\n def ast\n ::LDLgeneratedLanguage::Gds_014_data.config[:allow_env] ? (eval(\"ENV['\#{evalexpr.ast.strip}']\")) : nil \n end\n }\n end\n\n rule evalexpr\n evalexpr_0_with_nesting ''\n {\n def ast\n evalexpr_0_with_nesting.ast\n end\n }\n end\n\n rule evalexpr_0_with_nesting\n &{ |s| @evalexpr_0_with_nestingLevel = 0; true }\n '(' evalexpr_0_with_nesting_sub ')'\n {\n def ast\n evalexpr_0_with_nesting_sub.ast\n end\n }\n end\n\n rule evalexpr_0_with_nesting_sub\n '(' \n &{ |s| @evalexpr_0_with_nestingLevel += 1; true }\n evalexpr_0_with_nesting_sub\n {\n def ast\n '(' + evalexpr_0_with_nesting_sub.ast\n end\n }\n /\n ')' \n &{ |s| ok = (@evalexpr_0_with_nestingLevel > 0); ok } \n &{ |s| @evalexpr_0_with_nestingLevel -= 1; true }\n evalexpr_0_with_nesting_sub\n {\n def ast\n ')' + evalexpr_0_with_nesting_sub.ast\n end\n }\n /\n ( !\"(\" !\")\" . )+ evalexpr_0_with_nesting_sub\n {\n def ast\n text_value\n end\n }\n /\n ''\n {\n def ast\n ''\n end\n }\n end\n\n rule evalexpr_0_with_nesting_onechar\n ( !\")\" . )\n {\n def ast\n text_value\n end\n }\n end\n\n rule bc_0\n &{ |s| @bc_0Level = 0; true }\n '/*' bc_0_sub '*/'\n {\n def ast\n \"/*\" + bc_0_sub.ast + \"*/\"\n end\n }\n end\n\n rule bc_0_sub\n '/*' \n &{ |s| @bc_0Level += 1; true }\n bc_0_sub\n {\n def ast\n '/*' + bc_0_sub.ast\n end\n }\n /\n '*/' \n &{ |s| ok = (@bc_0Level > 0); ok } \n &{ |s| @bc_0Level -= 1; true }\n bc_0_sub\n {\n def ast\n '*/' + bc_0_sub.ast\n end\n }\n /\n ( !\"/*\" !\"*/\" . )+ bc_0_sub\n {\n def ast\n text_value\n end\n }\n /\n ''\n {\n def ast\n ''\n end\n }\n end\n\n rule bc_0_onechar\n ( !\"*/\" . )\n {\n def ast\n text_value\n end\n }\n end\n\n rule wsc\n [ \\t] \n {\n }\n /\n bc_0 '' \n {\n }\n end\n\n rule identifier\n ([a-zA-Z_] [a-zA-Z0-9_]*)\n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule string_no_space\n [a-zA-Z0-9_/.:]+\n {\n def ast\n text_value\n end\n }\n end\n\n rule indentation\n ' '*\n end\n\n rule ws\n wsc*\n end\n\n rule icomm\n '#' \n end\n\n rule wscommnl\n ws ( icomm ( !\"\\n\" . )* )? \"\\n\"\n end\n\n rule wscommnl2\n ( icomm ( !\"\\n\" . )* \"\\n\" / \"\\n\" / wsc )*\n end\n\nend\n"
46
+
47
+ end
48
+ end
49
+
50
+ #===============================================================================
51
+
@@ -0,0 +1,51 @@
1
+ #===============================================================================
2
+
3
+ module LDLgeneratedLanguage
4
+
5
+ class Gds_015_data
6
+ def self.config
7
+ @@config ||= {}
8
+ end
9
+ end
10
+
11
+ class Gds
12
+ require 'treetop'
13
+
14
+ class SyntaxError < ::StandardError
15
+ end
16
+
17
+ def self.parse( s, config = {} )
18
+ ::LDLgeneratedLanguage::Gds_015_data.config.replace( { allow_env: false, context: nil }.merge( config ) )
19
+
20
+ @parserClass ||= begin
21
+ Treetop.load_from_string GrammarDef
22
+ instance_eval( 'Gds_015Parser' )
23
+ end
24
+ parser = @parserClass.new
25
+
26
+ parseTree = parser.parse( s + "\n" )
27
+
28
+ unless parseTree
29
+ lineOfFailure = parser.failure_line
30
+ columnOfFailure = parser.failure_column
31
+
32
+ s = "GDS: Error happend, while parsing the definition: line #{lineOfFailure}, column #{columnOfFailure}" + "\n"
33
+ s += parser.failure_reason + "\n" if parser.failure_reason
34
+ s += "--->" + "\n"
35
+ s += parser.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + "\n"
36
+ s += ' '*((parser.failure_column) -1) + '^' + "\n"
37
+ s += "<---" + "\n"
38
+
39
+ raise SyntaxError, s
40
+ end
41
+
42
+ parseTree.ast
43
+ end
44
+
45
+ GrammarDef = "grammar Gds_015\n\n rule top\n &{ |s| @indentationLevels = []; true }\n defs ''\n {\n def ast\n eval 'class ::LDLgeneratedLanguage::Gds_015_data; def self.globalvars; @@globalvars ||= {}; end; end'\n ::LDLgeneratedLanguage::Gds_015_data.globalvars.clear\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata] ||= {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars] ||= {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences] ||= {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] ||= []\n defs.ast\n end\n }\n end\n\n rule defs\n wscommnl* predefs wscommnl* defs2 \n {\n def ast\n dummy = predefs.ast\n defs2.ast\n end\n }\n end\n\n rule predefs\n predef* \n {\n def ast\n elements.each { |e| e.ast }\n end\n }\n end\n\n rule predef\n wscommnl2 '@schema' wscommnl2 schemaname wscommnl2 '(' wscommnl2 schema_fieldlist wscommnl2 ')' \n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n end\n }\n /\n wscommnl2 '$' varname wscommnl2 '=' wscommnl2 vardef_rvalue \n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars][varname.ast] = vardef_rvalue.ast\n end\n }\n end\n\n rule schemaname\n identifier '' \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule varname\n identifier ''\n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule vardef_rvalue\n valuedef_ind ''\n {\n def ast\n valuedef_ind.ast\n end\n }\n end\n\n rule schema_fieldlist\n schemafield ws ',' ws schema_fieldlist \n {\n def ast\n r = []\n r << schemafield.ast\n r2 = schema_fieldlist.ast\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n schemafield '' \n {\n def ast\n r = []\n r << schemafield.ast\n r\n end\n }\n end\n\n rule schemafield\n identifier '' \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule defs2\n wscommnl2 ruby_standard_def wscommnl2\n {\n def ast\n ruby_standard_def.ast\n end\n }\n /\n wscommnl* special_indented_def wscommnl2\n {\n def ast\n special_indented_def.ast\n end\n }\n end\n\n rule ruby_standard_def\n hashdef ''\n {\n def ast\n hashdef.ast\n end\n }\n /\n arraydef ''\n {\n def ast\n arraydef.ast\n end\n }\n end\n\n rule special_indented_def\n arraydef_ind ''\n {\n def ast\n arraydef_ind.ast\n end\n }\n /\n hashdef_ind ''\n {\n def ast\n hashdef_ind.ast\n end\n }\n end\n\n rule hashdef\n wscommnl2 '{' wscommnl2 hashsubdefs wscommnl2 '}' \n {\n def ast\n hashsubdefs.ast\n end\n }\n end\n\n rule arraydef\n wscommnl2 '[' wscommnl2 arraysubdefs wscommnl2 ']' \n {\n def ast\n arraysubdefs.ast\n end\n }\n end\n\n rule hashsubdefs\n hashsubdef wscommnl2 morehashsubdefs wscommnl2 ','? \n {\n def ast\n r = {}\n r.merge!( hashsubdef.ast )\n r.merge!( morehashsubdefs.ast )\n r\n end\n }\n /\n ''\n {\n def ast\n {}\n end\n }\n end\n\n rule morehashsubdefs\n morehashsubdef*\n {\n def ast\n r = {}\n elements.each { |e| r.merge!( e.ast ) }\n r\n end\n }\n end\n\n rule morehashsubdef\n wscommnl2 ',' wscommnl2 hashsubdef\n {\n def ast\n hashsubdef.ast\n end\n }\n end\n\n rule hashsubdef\n keyvaluedef ''\n {\n def ast\n keyvaluedef.ast\n end\n }\n /\n keydef ':' wscommnl2 hashdef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashdef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 hashdef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashdef.ast ] )\n r\n end\n }\n /\n keydef ':' wscommnl2 arraydef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, arraydef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 arraydef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, arraydef.ast ] )\n r\n end\n }\n end\n\n rule arraysubdefs\n arraysubdef wscommnl2 morearraysubdefs wscommnl2 ','? \n {\n def ast\n r = []\n r << arraysubdef.ast\n r2 = morearraysubdefs.ast\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n '' \n {\n def ast\n r = []\n r\n end\n }\n end\n\n rule morearraysubdefs\n morearraysubdef* \n {\n def ast\n r = []\n elements.each do |e|\n r << e.ast\n end\n r\n end\n }\n end\n\n rule morearraysubdef\n wscommnl2 ',' wscommnl2 arraysubdef\n {\n def ast\n arraysubdef.ast\n end\n }\n end\n\n rule arraysubdef\n valuedef ''\n {\n def ast\n valuedef.ast\n end\n }\n /\n arraydef ''\n {\n def ast\n arraydef.ast\n end\n }\n /\n hashdef ''\n {\n def ast\n hashdef.ast\n end\n }\n /\n hashsubdef ''\n {\n def ast\n hashsubdef.ast\n end\n }\n end\n\n rule hashdef_ind\n indentation bc_0_l:(bc_0*) ws ': ' ws refdef_tl:refdef? ws keyvaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = keyvaluedefs_ind.ast unless refdef_tl.empty?\n r.merge!( keyvaluedefs_ind.ast )\n r.merge!( hashsubdefs_ind.ast )\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n hashsubdefs_ind.ast\n end\n }\n /\n indentation '' \n &{ |s| level = s[0].text_value.length; @lastIndentation=level; true } \n &{ |s| false }\n {\n def ast\n end\n }\n /\n &{ |s| @indentationLevels << (@lastIndentation-2); true }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( hashsubdefs_ind.ast )\n r\n end\n }\n end\n\n rule arraydef_ind\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << schema_fieldlist.ast\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast]\n ###orig-ok# raise SyntaxError, \"GDS: undefined schema specifier: \#{schemaname.ast}\"\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast]\n res = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws refdef_tl:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = valuedefs_ind.ast unless refdef_tl.empty?\n r = []\n r2 = valuedefs_ind.ast\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r2 = arraysubdefs_ind.ast\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n arraysubdefs_ind.ast\n end\n }\n end\n\n rule hashsubdefs_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n hashsubdef_ind '' \n )*\n {\n def ast\n r = {}\n elements.each { |e| r.merge!( e.hashsubdef_ind.ast ) }\n r\n end\n }\n end\n\n rule hashsubdef_ind\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n \n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast]\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws keydef ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n \n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast]\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n res = r\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' ws rd3:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd3.ast] = valuedefs_ind.ast unless rd3.empty?\n r.merge!( Hash[ keydef.ast, begin [].concat( valuedefs_ind.ast ).concat( arraysubdefs_ind.ast ) end ] )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = r[keydef.ast] unless rd2.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = hashsubdefs_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, hashsubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws keyvaluedefs_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n r = keyvaluedefs_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws '@merge' ws refuse_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n refuse_ind.ast\n end\n }\n end\n\n rule arraysubdefs_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n arraysubdef_ind '' \n )*\n {\n def ast\n r = []\n elements.each do |e|\n e1 = e.arraysubdef_ind.ast\n if e1.is_a?( Array )\n r.concat e1\n else\n r << e1\n end\n end\n r\n end\n }\n end\n\n rule arraysubdef_ind\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws ': ' ws rd2:refdef? ws keyvaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = keyvaluedefs_ind.ast unless rd2.empty?\n r.merge!( keyvaluedefs_ind.ast )\n r.merge!( hashsubdefs_ind.ast )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = hashsubdefs_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ':' ws '@merge' ws refuse_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( refuse_ind.ast )\n r.merge!( hashsubdefs_ind.ast )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws ': ' ws keydef ws rd2:refdef? wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n hashsub1:hashsubdefs_ind? \n &{ |s| node_cache[:hashsubdefs_ind].delete( index ); @indentationLevels.pop; true }\n hashsub2:hashsubdefs_ind? \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashsub1.ast ] )\n r.merge!( hashsub2.ast )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = r[keydef.ast] unless rd2.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws keydef ws rd2:refdef? ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, hashsubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = r[keydef.ast] unless rd2.empty?\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws schemaname ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws '(' ws schema_fieldlist ws ')' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' ws '@schema' ws schemaname wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n \n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema] << ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schemata][schemaname.ast]\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws rd1:refdef? ws ',' ws rd2:refdef? ws valuedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = valuedefs_ind.ast unless rd2.empty?\n r = []\n r2 = valuedefs_ind.ast\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r2 = arraysubdefs_ind.ast\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n [\n r\n ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = arraysubdefs_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n [\n r\n ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws '@insert' ws refuse_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n refuse_ind.ast\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws refdef_tl:refdef? ws valuedefs_ind \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl+\n {\n def ast\n r = valuedefs_ind.ast\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n r\n end\n }\n end\n\n rule arraysubdefs_schema_ind\n ( \n &{ |s| save = index; i = _nt_indentation; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n arraysubdef_schema_ind '' \n )*\n {\n def ast\n r = []\n elements.each do |e|\n e1 = e.arraysubdef_schema_ind.ast\n if e1.is_a?( Array )\n r.concat e1\n else\n r << e1\n end\n end\n r\n end\n }\n end\n\n rule arraysubdef_schema_ind\n indentation rd1:refdef? ws ': ' ws rd2:refdef? ws schemavaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n \n if schemavaluedefs_ind.ast.length > ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].last.length\n s = \"GDS: too many values for schema definition: \"\n nt = schemavaluedefs_ind\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n result = {}\n r1 = schemavaluedefs_ind.ast.each_with_index.map do |e,i|\n (e.is_a?(Hash) && e[:valuedirective]==:@na) ? ({}) : (Hash[ ::LDLgeneratedLanguage::Gds_015_data.globalvars[:schema].last[i], e ])\n end.inject({}){ |res,e| res.merge!(e) }\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd1.ast] = result unless rd1.empty?\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][rd2.ast] = r1 unless rd2.empty?\n result.merge!( r1 ).merge!( hashsubdefs_ind.ast )\n \n end\n }\n /\n arraysubdef_ind ''\n {\n def ast\n arraysubdef_ind.ast\n end\n }\n end\n\n rule schemavaluedefs_ind\n schemavaluedef_ind ws '|' ws schemavaluedefs_ind \n {\n def ast\n r = []\n r << schemavaluedef_ind.ast\n r2 = schemavaluedefs_ind.ast\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n schemavaluedef_ind '' \n {\n def ast\n r = []\n r << schemavaluedef_ind.ast\n r\n end\n }\n end\n\n rule schemavaluedef_ind\n value_directive_ind ''\n {\n def ast\n value_directive_ind.ast\n end\n }\n /\n valuedef_ind ''\n {\n def ast\n valuedef_ind.ast\n end\n }\n end\n\n rule refdef\n '&' identifier \n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule keyvaluedefs_ind\n keyvaluedef_ind ws '|' ws keyvaluedefs_ind \n {\n def ast\n r = {}\n r.merge!( keyvaluedef_ind.ast )\n r.merge!( keyvaluedefs_ind.ast )\n r\n end\n }\n /\n keyvaluedef_ind ''\n {\n def ast\n keyvaluedef_ind.ast\n end\n }\n end\n\n rule keyvaluedef_ind\n keydef wsc_l:(wsc+) valuedef_ind \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef_ind.ast ] )\n r\n end\n }\n end\n\n rule valuedef_ind\n variable_val_ind ''\n {\n def ast\n variable_val_ind.ast\n end\n }\n /\n refuse_ind ''\n {\n def ast\n refuse_ind.ast\n end\n }\n /\n valuedef_gen_ind ''\n {\n def ast\n valuedef_gen_ind.ast\n end\n }\n /\n special_value_ind ''\n {\n def ast\n special_value_ind.ast\n end\n }\n /\n string_no_leading_space ''\n {\n def ast\n string_no_leading_space.ast\n end\n }\n end\n\n rule keyvaluedef\n keydef ':' wscommnl2 valuedef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef.ast ] )\n r\n end\n }\n /\n wscommnl2 ':' keydef wscommnl2 '=>' wscommnl2 valuedef \n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, valuedef.ast ] )\n r\n end\n }\n end\n\n rule valuedefs_ind\n valuedef_ind ws '|' ws valuedefs_ind \n {\n def ast\n r = []\n r << valuedef_ind.ast\n r2 = valuedefs_ind.ast\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n valuedef_ind '' \n {\n def ast\n r = []\n r << valuedef_ind.ast\n r\n end\n }\n end\n\n rule valuedef\n variable_val ''\n {\n def ast\n variable_val.ast\n end\n }\n /\n valuedef_gen ''\n {\n def ast\n valuedef_gen.ast\n end\n }\n /\n special_value ''\n {\n def ast\n special_value.ast\n end\n }\n end\n\n rule valuedef_gen\n number_float ''\n {\n def ast\n number_float.ast\n end\n }\n /\n number_int ''\n {\n def ast\n number_int.ast\n end\n }\n /\n rubysymbol ''\n {\n def ast\n rubysymbol.ast\n end\n }\n /\n string_with_quotes ''\n {\n def ast\n string_with_quotes.ast\n end\n }\n end\n\n rule valuedef_gen_ind\n ruby_eval ''\n {\n def ast\n ruby_eval.ast\n end\n }\n /\n number_float ''\n {\n def ast\n number_float.ast\n end\n }\n /\n number_int ''\n {\n def ast\n number_int.ast\n end\n }\n /\n rubysymbol_ind ''\n {\n def ast\n rubysymbol_ind.ast\n end\n }\n /\n string_with_quotes ''\n {\n def ast\n string_with_quotes.ast\n end\n }\n end\n\n rule special_value\n 'nil' \n {\n def ast\n nil\n end\n }\n /\n 'true' \n {\n def ast\n true\n end\n }\n /\n 'false' \n {\n def ast\n false\n end\n }\n end\n\n rule special_value_ind\n '!nil' \n {\n def ast\n nil\n end\n }\n /\n '!true' \n {\n def ast\n true\n end\n }\n /\n '!false' \n {\n def ast\n false\n end\n }\n end\n\n rule value_directive_ind\n '@na' \n {\n def ast\n r = {}\n r.merge!( Hash[ :valuedirective, :@na ] )\n r\n end\n }\n end\n\n rule string_with_quotes\n string_with_doublequotes ''\n {\n def ast\n string_with_doublequotes.ast\n end\n }\n /\n string_with_singlequotes ''\n {\n def ast\n string_with_singlequotes.ast\n end\n }\n end\n\n rule string_with_doublequotes\n '\"' string_double_q '\"'\n {\n def ast\n string_double_q.ast\n end\n }\n end\n\n rule string_double_q\n ('\\\\\\\\' / '\\\"' / !'\"' .)* \n {\n def ast\n \n text_value.gsub(/(\\\\\\\\)|(\\\\n)|(\\\\\")/, '\\\\\\\\'=>'\\\\', \"\\\\n\"=>\"\\n\", '\\\\\"'=>'\"').gsub( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) { |s1| key = s1.match('[_a-zA-Z0-9]+')[0].to_sym\n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars].key?(key)\n s = \"GDS: undefined variable in string interpolation: \"\n nt = self\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size + text_value.index( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) + 2\n s += \"\#{key}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars][key].to_s }.gsub(/\\\\\\$/, \"$\" )\n \n end\n }\n end\n\n rule string_with_singlequotes\n '\\'' string_single_q '\\''\n {\n def ast\n string_single_q.ast\n end\n }\n end\n\n rule string_single_q\n ('\\\\\\\\'/ '\\\\\\'' / !'\\'' .)* \n {\n def ast\n text_value.gsub(/(\\\\\\\\)|(\\\\n)|(\\\\')/, '\\\\\\\\'=>'\\\\', \"\\\\n\"=>\"\\n\", \"\\\\'\"=>\"'\")\n end\n }\n end\n\n rule string_no_leading_space\n (&\"$(\" / ( !\"$\" !';' !'!' !'@' !'&' !'*' !' ' !':' !',' !\"|\" !'#' !'/*')) (!\"\\n\" !\"|\" !'#' !'/*' .)+ \n {\n def ast\n \n text_value.rstrip.gsub( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) { |s1| key = s1.match('[_a-zA-Z0-9]+')[0].to_sym\n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars].key?(key)\n s = \"GDS: undefined variable in string interpolation: \"\n nt = self\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size + text_value.index( /(?<!\\\\)\\$\\(([_a-zA-Z][_a-zA-Z0-9]*)\\)/ ) + 2\n s += \"\#{key}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars][key].to_s }.gsub(/\\\\\\$/, \"$\" )\n \n end\n }\n end\n\n rule keydef\n string_with_quotes '' \n {\n def ast\n string_with_quotes.ast.to_sym \n end\n }\n /\n identifier ''\n {\n def ast\n identifier.ast\n end\n }\n end\n\n rule variable_val\n wscommnl2 '$' varname \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars].key?(varname.ast)\n s = \"GDS: undefined variable: \"\n nt = varname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars][varname.ast]\n \n end\n }\n end\n\n rule variable_val_ind\n '$' varname \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars].key?(varname.ast)\n s = \"GDS: undefined variable: \"\n nt = varname\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:gdsglobvars][varname.ast]\n \n end\n }\n end\n\n rule refuse_ind\n '*' identifier \n {\n def ast\n \n unless ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][identifier.ast]\n s = \"GDS: undefined reference: \"\n nt = identifier\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast}, line \#{lineOfFailure}, column \#{columnOfFailure}\" + \"\\n\"\n s += \"--->\" + \"\\n\"\n s += nt.input.lines[((lineOfFailure-1-5)>0 ? (lineOfFailure-1-5) : 0)..(lineOfFailure-1)].join.chomp + \"\\n\"\n s += ' '*((columnOfFailure) -1) + '^' + \"\\n\"\n s += \"<---\" + \"\\n\"\n raise SyntaxError, s\n end\n ::LDLgeneratedLanguage::Gds_015_data.globalvars[:internreferences][identifier.ast]\n \n end\n }\n end\n\n rule number_int\n octal_int ''\n {\n def ast\n octal_int.ast\n end\n }\n /\n binary_int ''\n {\n def ast\n binary_int.ast\n end\n }\n /\n hexa_int ''\n {\n def ast\n hexa_int.ast\n end\n }\n /\n decimal_int ''\n {\n def ast\n decimal_int.ast\n end\n }\n end\n\n rule octal_int\n ('-'/'+')? ( '0o' / '0' ) [0-7] ( [0-7] / '_' [0-7] )* \n {\n def ast\n text_value.to_i(8)\n end\n }\n end\n\n rule binary_int\n ('-'/'+')? '0b' [01] ( [01] / '_' [01] )* \n {\n def ast\n text_value.to_i(2)\n end\n }\n end\n\n rule hexa_int\n ('-'/'+')? '0x' [0-9a-fA-F] ( [0-9a-fA-F] / '_' [0-9a-fA-F] )* \n {\n def ast\n text_value.to_i(16)\n end\n }\n end\n\n rule decimal_int\n ('-'/'+')? ('0d')? [1-9] ( [0-9] / '_' [0-9] )* \n {\n def ast\n text_value.to_i\n end\n }\n /\n ('0d')? [0] \n {\n def ast\n text_value.to_i\n end\n }\n end\n\n rule number_float\n [+-]? ( [0-9] / '_' [0-9] )* [.] [0-9] ( [0-9] / '_' [0-9] )* (('e'/'E') [+-]? [0-9] ( [0-9] / '_' [0-9] )* )? \n {\n def ast\n text_value.to_f\n end\n }\n end\n\n rule rubysymbol\n wscommnl2 ':' rubysymbolcontent \n {\n def ast\n rubysymbolcontent.ast\n end\n }\n end\n\n rule rubysymbolcontent\n wscommnl2 '\"' rubysymbol_in_double_quotes '\"' \n {\n def ast\n rubysymbol_in_double_quotes.ast\n end\n }\n /\n wscommnl2 '\\'' rubysymbol_in_single_quotes '\\'' \n {\n def ast\n rubysymbol_in_single_quotes.ast\n end\n }\n /\n ( !'}' !' ' !',' !']' !'#' !'/*' !'*/' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_ind\n ':' rubysymbolcontent_ind \n {\n def ast\n rubysymbolcontent_ind.ast\n end\n }\n end\n\n rule rubysymbolcontent_ind\n '\"' rubysymbol_in_double_quotes '\"' \n {\n def ast\n rubysymbol_in_double_quotes.ast\n end\n }\n /\n '\\'' rubysymbol_in_single_quotes '\\'' \n {\n def ast\n rubysymbol_in_single_quotes.ast\n end\n }\n /\n (!' ' !'|' !'#' !'/*' !'*/' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_in_double_quotes\n ('\\\"' / !'\"' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_in_single_quotes\n ('\\\\\\'' / !'\\'' !\"\\n\" .)+ \n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule ruby_eval\n '@r' ws evalexpr \n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.config[:context] ? (eval(evalexpr.ast, ::LDLgeneratedLanguage::Gds_015_data.config[:context])) : nil \n end\n }\n /\n '@env' ws evalexpr \n {\n def ast\n ::LDLgeneratedLanguage::Gds_015_data.config[:allow_env] ? (eval(\"ENV['\#{evalexpr.ast.strip}']\")) : nil \n end\n }\n end\n\n rule evalexpr\n evalexpr_0_with_nesting ''\n {\n def ast\n evalexpr_0_with_nesting.ast\n end\n }\n end\n\n rule evalexpr_0_with_nesting\n &{ |s| @evalexpr_0_with_nestingLevel = 0; true }\n '(' evalexpr_0_with_nesting_sub ')'\n {\n def ast\n evalexpr_0_with_nesting_sub.ast\n end\n }\n end\n\n rule evalexpr_0_with_nesting_sub\n '(' \n &{ |s| @evalexpr_0_with_nestingLevel += 1; true }\n evalexpr_0_with_nesting_sub\n {\n def ast\n '(' + evalexpr_0_with_nesting_sub.ast\n end\n }\n /\n ')' \n &{ |s| ok = (@evalexpr_0_with_nestingLevel > 0); ok } \n &{ |s| @evalexpr_0_with_nestingLevel -= 1; true }\n evalexpr_0_with_nesting_sub\n {\n def ast\n ')' + evalexpr_0_with_nesting_sub.ast\n end\n }\n /\n ( !\"(\" !\")\" . )+ evalexpr_0_with_nesting_sub\n {\n def ast\n text_value\n end\n }\n /\n ''\n {\n def ast\n ''\n end\n }\n end\n\n rule evalexpr_0_with_nesting_onechar\n ( !\")\" . )\n {\n def ast\n text_value\n end\n }\n end\n\n rule bc_0\n &{ |s| @bc_0Level = 0; true }\n '/*' bc_0_sub '*/'\n {\n def ast\n \"/*\" + bc_0_sub.ast + \"*/\"\n end\n }\n end\n\n rule bc_0_sub\n '/*' \n &{ |s| @bc_0Level += 1; true }\n bc_0_sub\n {\n def ast\n '/*' + bc_0_sub.ast\n end\n }\n /\n '*/' \n &{ |s| ok = (@bc_0Level > 0); ok } \n &{ |s| @bc_0Level -= 1; true }\n bc_0_sub\n {\n def ast\n '*/' + bc_0_sub.ast\n end\n }\n /\n ( !\"/*\" !\"*/\" . )+ bc_0_sub\n {\n def ast\n text_value\n end\n }\n /\n ''\n {\n def ast\n ''\n end\n }\n end\n\n rule bc_0_onechar\n ( !\"*/\" . )\n {\n def ast\n text_value\n end\n }\n end\n\n rule wsc\n [ \\t] \n {\n }\n /\n bc_0 '' \n {\n }\n end\n\n rule identifier\n ([a-zA-Z_] [a-zA-Z0-9_]*)\n {\n def ast\n text_value.to_sym\n end\n }\n end\n\n rule string_no_space\n [a-zA-Z0-9_/.:]+\n {\n def ast\n text_value\n end\n }\n end\n\n rule indentation\n ' '*\n end\n\n rule ws\n wsc*\n end\n\n rule icomm\n '#' \n end\n\n rule wscommnl\n ws ( icomm ( !\"\\n\" . )* )? \"\\n\"\n end\n\n rule wscommnl2\n ( icomm ( !\"\\n\" . )* \"\\n\" / \"\\n\" / wsc )*\n end\n\nend\n"
46
+
47
+ end
48
+ end
49
+
50
+ #===============================================================================
51
+
@@ -1,4 +1,4 @@
1
1
 
2
2
  class GDstruct
3
- VERSION = '0.8.1'
3
+ VERSION = '0.8.2'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdstruct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uli Ramminger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-08 00:00:00.000000000 Z
11
+ date: 2019-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop
@@ -75,6 +75,7 @@ files:
75
75
  - Rakefile
76
76
  - lib/gdstruct.rb
77
77
  - lib/gdstruct/gds_014.rb
78
+ - lib/gdstruct/gds_015.rb
78
79
  - lib/gdstruct/version.rb
79
80
  homepage: https://urasepandia.de/gds.html
80
81
  licenses: