gdstruct 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +65 -0
- data/MIT-LICENSE +1 -1
- data/README.md +1 -1
- data/lib/gdstruct/lng_gds.rb +4 -11
- data/lib/gdstruct/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b86f66bb75720b88a546ab58c83d8b13be2f4f444d36afd55b79ed84d47f2d22
|
4
|
+
data.tar.gz: c49892116726acf04745c951272cb15bae4627862d66ef71621c76989a1e5e63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cccc3d2d5e150d8329881005a018a44923e66f84c5a1845c9536c21f8c13d997b466e7b88f5c6c729869c65c527a1f7d579f28c2f332777a2a678907099cb5f6
|
7
|
+
data.tar.gz: 14e71fc3d18b4592c32880c8431bc92b27b086f5fe4f7f7b464467430e0984639c551d6a43c9d193d17f4b062ee97593ba2b40fbe7e2b068663e8fedd0783f0f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,70 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### 0.9.3 - (2024-04-30)
|
4
|
+
|
5
|
+
* __fix__
|
6
|
+
In version 0.9.2 the embedded Ruby code feature (__@r__ directive) was not working.
|
7
|
+
|
8
|
+
* __feature__
|
9
|
+
__@env__ directive can now handle a default value
|
10
|
+
if the access to environment variables is not allowed (parameter __allow_env__) or if the environment variable does not exist then the default value is returned
|
11
|
+
the default value is a single-quoted or double-quoted string literal
|
12
|
+
~~~
|
13
|
+
host @env( DATABASE_HOST, 'localhost' )
|
14
|
+
|
15
|
+
# if the environment variable DATABASE_HOST does not exist:
|
16
|
+
# => { host: 'localhost' }
|
17
|
+
~~~
|
18
|
+
double-quoted strings support string interpolation
|
19
|
+
~~~
|
20
|
+
$basename = myproject
|
21
|
+
database @env( DATABASE_NAME, "$(basename)_development" )
|
22
|
+
|
23
|
+
# if the environment variable DATABASE_NAME does not exist:
|
24
|
+
# => { database: 'myproject_development' }
|
25
|
+
~~~
|
26
|
+
|
27
|
+
* __feature__
|
28
|
+
new syntax style: an array element can be defined as a hash with a key and the related value as an array defined with a schema definition, everything written on the same line
|
29
|
+
all three types of schema definitions are supported: predefined, defined at first time use and anonymous
|
30
|
+
~~~
|
31
|
+
@schema valuedef( name, value )
|
32
|
+
all ,
|
33
|
+
: vals , @schema valuedef
|
34
|
+
: n1 | v1
|
35
|
+
: n2 | v2
|
36
|
+
|
37
|
+
# => { all: [ { vals: [ { name: "n1", value: "v1" }, { name: "n2", value: "v2" } ] } ] }
|
38
|
+
~~~
|
39
|
+
~~~
|
40
|
+
all ,
|
41
|
+
: vals , @schema valuedef( name, value )
|
42
|
+
: n1 | v1
|
43
|
+
: n2 | v2
|
44
|
+
|
45
|
+
# => { all: [ { vals: [ { name: "n1", value: "v1" }, { name: "n2", value: "v2" } ] } ] }
|
46
|
+
~~~
|
47
|
+
~~~
|
48
|
+
all ,
|
49
|
+
: vals , @schema( name, value )
|
50
|
+
: n1 | v1
|
51
|
+
: n2 | v2
|
52
|
+
|
53
|
+
# => { all: [ { vals: [ { name: "n1", value: "v1" }, { name: "n2", value: "v2" } ] } ] }
|
54
|
+
~~~
|
55
|
+
|
56
|
+
### 0.9.2 - (2020-07-31)
|
57
|
+
|
58
|
+
* __change__
|
59
|
+
the keyword literal for true is changed to __@true__; the old literal __!true__ is still working, but is deprecated
|
60
|
+
the segil __@__ is more consistent with the overall GDS syntax and the leading __!__
|
61
|
+
could be confusing because in many programming languages it is used as a logical negation operator
|
62
|
+
the keyword literal for false is changed to __@false__; the old literal __!false__ is still working, but is deprecated
|
63
|
+
the keyword literal for nil is changed to __@nil__; the old literal __!nil__ is still working, but is deprecated
|
64
|
+
|
65
|
+
* __internal changes__
|
66
|
+
different handling of global variables and context (binding) for embedded Ruby
|
67
|
+
|
3
68
|
### 0.9.1 - (2019-08-16)
|
4
69
|
|
5
70
|
* __feature__
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
data/lib/gdstruct/lng_gds.rb
CHANGED
@@ -3,13 +3,6 @@
|
|
3
3
|
# ATTENTION: this file is generated
|
4
4
|
|
5
5
|
module LDLgeneratedLanguage
|
6
|
-
|
7
|
-
class Language_gds_03_data
|
8
|
-
def self.config
|
9
|
-
@@config ||= {}
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
6
|
class Gds
|
14
7
|
require 'treetop'
|
15
8
|
|
@@ -17,8 +10,6 @@ module LDLgeneratedLanguage
|
|
17
10
|
end
|
18
11
|
|
19
12
|
def self.parse( s, config = {} )
|
20
|
-
::LDLgeneratedLanguage::Language_gds_03_data.config.replace( { allow_env: false, context: nil }.merge( config ) )
|
21
|
-
|
22
13
|
@parserClass ||= begin
|
23
14
|
Treetop.load_from_string GrammarDef
|
24
15
|
instance_eval( 'Language_gds_03Parser' )
|
@@ -41,10 +32,12 @@ module LDLgeneratedLanguage
|
|
41
32
|
raise SyntaxError, s
|
42
33
|
end
|
43
34
|
|
44
|
-
|
35
|
+
context = Struct.new( :config, :globalvars ).new( { allow_env: false, context: nil }.merge( config ), {} )
|
36
|
+
|
37
|
+
parseTree.ast( context )
|
45
38
|
end
|
46
39
|
|
47
|
-
GrammarDef = "grammar Language_gds_03\n\n rule top\n &{ |s| @indentationLevels = []; true }\n defs ''\n {\n def ast\n eval 'class ::LDLgeneratedLanguage::Language_gds_03_data; def self.globalvars; @@globalvars ||= {}; end; end'\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars.clear\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schemata] ||= {}\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:gdsglobvars] ||= {}\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences] ||= {}\n ::LDLgeneratedLanguage::Language_gds_03_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 r = defs2.ast\n r\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::Language_gds_03_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::Language_gds_03_data.globalvars[:gdsglobvars][varname.ast] = vardef_rvalue.ast\n end\n }\n end\n\n rule schemaname\n identifier '' \n {\n def ast\n r = identifier.ast\n r\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 r = identifier.ast\n r\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 r = hashsubdefs.ast\n r\n end\n }\n end\n\n rule arraydef\n wscommnl2 '[' wscommnl2 arraysubdefs wscommnl2 ']' \n {\n def ast\n r = arraysubdefs.ast\n r\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::Language_gds_03_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 ': ' ws keydef ws refdef_tl:refdef? wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; @indentationLevels << (2+level); true }\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::Language_gds_03_data.globalvars[:internreferences][refdef_tl.ast] = r[keydef.ast] unless refdef_tl.empty?\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 r = hashsubdefs_ind.ast\n r\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::Language_gds_03_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schemata][schemaname.ast]\n r = arraysubdefs_schema_ind.ast\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schema].pop\n res\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws ':' ws rd1:refdef? ws keyvaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; @indentationLevels << (2+level); true }\n hashsubdefs_ind \n &{ |s| node_cache[:arraysubdefs_ind].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = keyvaluedefs_ind.ast unless rd1.empty?\n r = begin [].push( ->(;r){ r={};r.merge!( keyvaluedefs_ind.ast );r.merge!( hashsubdefs_ind.ast ); r }.() ).concat( arraysubdefs_ind.ast ) end\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws ': ' ws keydef ws rd2:refdef? wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; @indentationLevels << (2+level); @indentationLevels << (4+level); true }\n hashsub1:hashsubdefs_ind? \n &{ |s| node_cache[:hashsubdefs_ind].delete( index ); @indentationLevels.pop; true }\n hashsub2:hashsubdefs_ind? \n &{ |s| node_cache[:arraysubdefs_ind].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd2.ast] = hashsub1.ast unless rd2.empty?\n r = begin [].push( ->(;r){ r={};r.store( keydef.ast, hashsub1.ast );r.merge!( hashsub2.ast ); r }.() ).concat( arraysubdefs_ind.ast ) end\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; @indentationLevels << (2+level); true }\n hashsubdefs_ind \n &{ |s| node_cache[:arraysubdefs_ind].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = begin [].push( ->(;r){ r={};r.merge!( hashsubdefs_ind.ast ); r }.() ).concat( arraysubdefs_ind.ast ) end\n r\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::Language_gds_03_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 r = arraysubdefs_ind.ast\n r\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::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schemata][schemaname.ast]\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_schema_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schemata][schemaname.ast]\n r.merge!( Hash[ keydef.ast, arraysubdefs_schema_ind.ast ] )\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_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::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_data.globalvars[:internreferences][rd2.ast] = arraysubdefs_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, arraysubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_data.globalvars[:internreferences][rd2.ast] = hashsubdefs_ind.ast unless rd2.empty?\n r.merge!( Hash[ keydef.ast, hashsubdefs_ind.ast ] )\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_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 r = refuse_ind.ast\n r\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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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? 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; @indentationLevels << (2+level); end; ok }\n arraysubdefs_ind \n &{ |s| node_cache[:hashsubdefs_ind].delete( index ); @indentationLevels.pop; true }\n hashsub1:hashsubdefs_ind? \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n ::LDLgeneratedLanguage::Language_gds_03_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 r.merge!( hashsub1.ast )\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Language_gds_03_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 ': ' ws keydef ws rd2:refdef? ws ',' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n arraysubdefs_ind \n &{ |s| node_cache[:hashsubdefs_ind].delete( index ); @indentationLevels.pop; true }\n hashsub1:hashsubdefs_ind? \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = {}\n r.merge!( Hash[ keydef.ast, arraysubdefs_ind.ast ] )\n r.merge!( hashsub1.ast )\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Language_gds_03_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 ': ' 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::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = r unless rd1.empty?\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << schema_fieldlist.ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schemata][schemaname.ast] = schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << schema_fieldlist.ast\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_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::Language_gds_03_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::Language_gds_03_data.globalvars[:schema] << ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schemata][schemaname.ast]\n r = arraysubdefs_schema_ind.ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][refdef_tl.ast] = r unless refdef_tl.empty?\n res = r\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws ':' ws rd1:refdef? ws keyvaluedefs_ind wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n hashsubdefs_ind \n &{ |s| node_cache[:arraysubdefs_ind].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = keyvaluedefs_ind.ast unless rd1.empty?\n r = begin [].push( begin [].push( ->(;r){ r={};r.merge!( keyvaluedefs_ind.ast );r.merge!( hashsubdefs_ind.ast ); r }.() ).concat( arraysubdefs_ind.ast ) end ) end\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' 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); @indentationLevels << (4+level); end; ok }\n hashsub1:hashsubdefs_ind? \n &{ |s| node_cache[:hashsubdefs_ind].delete( index ); @indentationLevels.pop; true }\n hashsub2:hashsubdefs_ind? \n &{ |s| node_cache[:arraysubdefs_ind].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd2.ast] = hashsub1.ast unless rd2.empty?\n r = begin [].push( begin [].push( ->(;r){ r={};r.store( keydef.ast, hashsub1.ast );r.merge!( hashsub2.ast ); r }.() ).concat( arraysubdefs_ind.ast ) end ) end\n r\n end\n }\n /\n indentation bc_0_l:(bc_0*) ws ',' ws ':' wscommnl+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n hashsubdefs_ind \n &{ |s| node_cache[:arraysubdefs_ind].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind \n &{ |s| @indentationLevels.pop; true }\n wscommnl*\n {\n def ast\n r = begin [].push( begin [].push( ->(;r){ r={};r.merge!( hashsubdefs_ind.ast ); r }.() ).concat( arraysubdefs_ind.ast ) end ) end\n r\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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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 r = refuse_ind.ast\n r\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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_data.globalvars[:schema].last[i], e ])\n end.inject({}){ |res,e| res.merge!(e) }\n ::LDLgeneratedLanguage::Language_gds_03_data.globalvars[:internreferences][rd1.ast] = result unless rd1.empty?\n ::LDLgeneratedLanguage::Language_gds_03_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 r = identifier.ast\n r\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::Language_gds_03_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::Language_gds_03_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 r = text_value\n r.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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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::Language_gds_03_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 r = text_value\n r.to_i(8)\n end\n }\n end\n\n rule binary_int\n ('-'/'+')? '0b' [01] ( [01] / '_' [01] )* \n {\n def ast\n r = text_value\n r.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 r = text_value\n r.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 r = rubysymbolcontent.ast\n r\n end\n }\n end\n\n rule rubysymbolcontent\n wscommnl2 '\"' rubysymbol_in_double_quotes '\"' \n {\n def ast\n r = rubysymbol_in_double_quotes.ast\n r\n end\n }\n /\n wscommnl2 '\\'' rubysymbol_in_single_quotes '\\'' \n {\n def ast\n r = rubysymbol_in_single_quotes.ast\n r\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 r = rubysymbolcontent_ind.ast\n r\n end\n }\n end\n\n rule rubysymbolcontent_ind\n '\"' rubysymbol_in_double_quotes '\"' \n {\n def ast\n r = rubysymbol_in_double_quotes.ast\n r\n end\n }\n /\n '\\'' rubysymbol_in_single_quotes '\\'' \n {\n def ast\n r = rubysymbol_in_single_quotes.ast\n r\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 r = text_value\n r.gsub(/(\\\\\\\\)|(\\\\\")/, '\\\\\\\\'=>'\\\\', '\\\\\"'=>'\"').to_sym\n end\n }\n end\n\n rule rubysymbol_in_single_quotes\n ('\\\\\\\\' / '\\\\\\'' / !'\\'' !\"\\n\" .)* \n {\n def ast\n r = text_value\n r.gsub(/(\\\\\\\\)|(\\\\')/, '\\\\\\\\'=>'\\\\', \"\\\\'\"=>\"'\").to_sym\n end\n }\n end\n\n rule ruby_eval\n '@r' ws evalexpr \n {\n def ast\n ::LDLgeneratedLanguage::Language_gds_03_data.config[:context] ? (eval(evalexpr.ast, ::LDLgeneratedLanguage::Language_gds_03_data.config[:context])) : nil \n end\n }\n /\n '@env' ws evalexpr \n {\n def ast\n ::LDLgeneratedLanguage::Language_gds_03_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 identifierstr\n ([a-zA-Z_] [a-zA-Z0-9_]*)\n {\n def ast\n text_value\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"
|
40
|
+
GrammarDef = "grammar Language_gds_03\n\n rule top_r\n &{ |s| @indentationLevels = []; true }\n defs_r ''\n {\n def ast( context )\n context.globalvars[:schemata] ||= {}\n context.globalvars[:gdsglobvars] ||= {}\n context.globalvars[:internreferences] ||= {}\n context.globalvars[:schema] ||= []\n defs_r.ast( context )\n end\n }\n end\n\n rule defs_r\n wscommnl_r* predefs_r wscommnl_r* defs2_r \n {\n def ast( context )\n dummy = predefs_r.ast( context )\n r = defs2_r.ast( context )\n r\n end\n }\n end\n\n rule predefs_r\n predef_r* \n {\n def ast( context )\n elements.each { |e| e.ast( context ) }\n end\n }\n end\n\n rule predef_r\n wscommnl2_r '@schema' wscommnl2_r schemaname_r wscommnl2_r '(' wscommnl2_r schema_fieldlist_r wscommnl2_r ')' \n {\n def ast( context )\n context.globalvars[:schemata][schemaname_r.ast( context )] = schema_fieldlist_r.ast( context )\n end\n }\n /\n wscommnl2_r '$' varname_r wscommnl2_r '=' wscommnl2_r vardef_rvalue_r \n {\n def ast( context )\n context.globalvars[:gdsglobvars][varname_r.ast( context )] = vardef_rvalue_r.ast( context )\n end\n }\n end\n\n rule schemaname_r\n identifier_r '' \n {\n def ast( context )\n r = identifier_r.ast( context )\n r\n end\n }\n end\n\n rule varname_r\n identifier_r ''\n {\n def ast( context )\n identifier_r.ast( context )\n end\n }\n end\n\n rule vardef_rvalue_r\n valuedef_ind_r ''\n {\n def ast( context )\n valuedef_ind_r.ast( context )\n end\n }\n end\n\n rule schema_fieldlist_r\n schemafield_r ws_r ',' ws_r schema_fieldlist_r \n {\n def ast( context )\n r = []\n r << schemafield_r.ast( context )\n r2 = schema_fieldlist_r.ast( context )\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n schemafield_r '' \n {\n def ast( context )\n r = []\n r << schemafield_r.ast( context )\n r\n end\n }\n end\n\n rule schemafield_r\n identifier_r '' \n {\n def ast( context )\n r = identifier_r.ast( context )\n r\n end\n }\n end\n\n rule defs2_r\n wscommnl2_r ruby_standard_def_r wscommnl2_r\n {\n def ast( context )\n ruby_standard_def_r.ast( context )\n end\n }\n /\n wscommnl_r* special_indented_def_r wscommnl2_r\n {\n def ast( context )\n special_indented_def_r.ast( context )\n end\n }\n end\n\n rule ruby_standard_def_r\n hashdef_r ''\n {\n def ast( context )\n hashdef_r.ast( context )\n end\n }\n /\n arraydef_r ''\n {\n def ast( context )\n arraydef_r.ast( context )\n end\n }\n end\n\n rule special_indented_def_r\n arraydef_ind_r ''\n {\n def ast( context )\n arraydef_ind_r.ast( context )\n end\n }\n /\n hashdef_ind_r ''\n {\n def ast( context )\n hashdef_ind_r.ast( context )\n end\n }\n end\n\n rule hashdef_r\n wscommnl2_r '{' wscommnl2_r hashsubdefs_r wscommnl2_r '}' \n {\n def ast( context )\n r = hashsubdefs_r.ast( context )\n r\n end\n }\n end\n\n rule arraydef_r\n wscommnl2_r '[' wscommnl2_r arraysubdefs_r wscommnl2_r ']' \n {\n def ast( context )\n r = arraysubdefs_r.ast( context )\n r\n end\n }\n end\n\n rule hashsubdefs_r\n hashsubdef_r wscommnl2_r morehashsubdefs_r wscommnl2_r ','? \n {\n def ast( context )\n r = {}\n r.merge!( hashsubdef_r.ast( context ) )\n r.merge!( morehashsubdefs_r.ast( context ) )\n r\n end\n }\n /\n ''\n {\n def ast( context )\n {}\n end\n }\n end\n\n rule morehashsubdefs_r\n morehashsubdef_r*\n {\n def ast( context )\n r = {}\n elements.each { |e| r.merge!( e.ast( context ) ) }\n r\n end\n }\n end\n\n rule morehashsubdef_r\n wscommnl2_r ',' wscommnl2_r hashsubdef_r\n {\n def ast( context )\n hashsubdef_r.ast( context )\n end\n }\n end\n\n rule hashsubdef_r\n keyvaluedef_r ''\n {\n def ast( context )\n keyvaluedef_r.ast( context )\n end\n }\n /\n keydef_r ':' wscommnl2_r hashdef_r \n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), hashdef_r.ast( context ) ] )\n r\n end\n }\n /\n wscommnl2_r ':' keydef_r wscommnl2_r '=>' wscommnl2_r hashdef_r \n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), hashdef_r.ast( context ) ] )\n r\n end\n }\n /\n keydef_r ':' wscommnl2_r arraydef_r \n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), arraydef_r.ast( context ) ] )\n r\n end\n }\n /\n wscommnl2_r ':' keydef_r wscommnl2_r '=>' wscommnl2_r arraydef_r \n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), arraydef_r.ast( context ) ] )\n r\n end\n }\n end\n\n rule arraysubdefs_r\n arraysubdef_r wscommnl2_r morearraysubdefs_r wscommnl2_r ','? \n {\n def ast( context )\n r = []\n r << arraysubdef_r.ast( context )\n r2 = morearraysubdefs_r.ast( context )\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n '' \n {\n def ast( context )\n r = []\n r\n end\n }\n end\n\n rule morearraysubdefs_r\n morearraysubdef_r* \n {\n def ast( context )\n r = []\n elements.each do |e|\n r << e.ast( context )\n end\n r\n end\n }\n end\n\n rule morearraysubdef_r\n wscommnl2_r ',' wscommnl2_r arraysubdef_r\n {\n def ast( context )\n arraysubdef_r.ast( context )\n end\n }\n end\n\n rule arraysubdef_r\n valuedef_r ''\n {\n def ast( context )\n valuedef_r.ast( context )\n end\n }\n /\n arraydef_r ''\n {\n def ast( context )\n arraydef_r.ast( context )\n end\n }\n /\n hashdef_r ''\n {\n def ast( context )\n hashdef_r.ast( context )\n end\n }\n /\n hashsubdef_r ''\n {\n def ast( context )\n hashsubdef_r.ast( context )\n end\n }\n end\n\n rule hashdef_ind_r\n indentation_r bc_0_l:(bc_0_r*) ws_r ': ' ws_r refdef_tl:refdef_r? ws_r keyvaluedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:internreferences][refdef_tl.ast( context )] = keyvaluedefs_ind_r.ast( context ) unless refdef_tl.empty?\n r.merge!( keyvaluedefs_ind_r.ast( context ) )\n r.merge!( hashsubdefs_ind_r.ast( context ) )\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ': ' ws_r keydef_r ws_r refdef_tl:refdef_r? wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; @indentationLevels << (2+level); true }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub2_r:hashsubdefs_ind_r? \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), hashsub1_r.ast( context ) ] )\n r.merge!( hashsub2_r.ast( context ) )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r[keydef_r.ast( context )] unless refdef_tl.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ':' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = hashsubdefs_ind_r.ast( context )\n r\n end\n }\n /\n indentation_r '' \n &{ |s| level = s[0].text_value.length; @lastIndentation=level; true } \n &{ |s| false }\n {\n def ast( context )\n end\n }\n /\n &{ |s| @indentationLevels << (@lastIndentation-2); true }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n r.merge!( hashsubdefs_ind_r.ast( context ) )\n r\n end\n }\n end\n\n rule arraydef_ind_r\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r '@schema' ws_r schemaname_r ws_r '(' ws_r schema_fieldlist_r ws_r ')' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:schema] << schema_fieldlist_r.ast( context )\n context.globalvars[:schemata][schemaname_r.ast( context )] = schema_fieldlist_r.ast( context )\n r = arraysubdefs_schema_ind_r.ast( context )\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r '@schema' ws_r '(' ws_r schema_fieldlist_r ws_r ')' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:schema] << schema_fieldlist_r.ast( context )\n r = arraysubdefs_schema_ind_r.ast( context )\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r '@schema' ws_r schemaname_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n \n unless context.globalvars[:schemata][schemaname_r.ast( context )]\n ###orig-ok# raise SyntaxError, \"GDS: undefined schema specifier: \#{schemaname.ast}\"\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname_r\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast( context )}, 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 context.globalvars[:schema] << context.globalvars[:schemata][schemaname_r.ast( context )]\n r = arraysubdefs_schema_ind_r.ast( context )\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r ':' ws_r rd1_r:refdef_r? ws_r keyvaluedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; @indentationLevels << (2+level); true }\n hashsubdefs_ind_r \n &{ |s| node_cache[:arraysubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:internreferences][rd1_r.ast( context )] = keyvaluedefs_ind_r.ast( context ) unless rd1_r.empty?\n r = begin [].push( ->(;r){ r={};r.merge!( keyvaluedefs_ind_r.ast( context ) );r.merge!( hashsubdefs_ind_r.ast( context ) ); r }.() ).concat( arraysubdefs_ind_r.ast( context ) ) end\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r ': ' ws_r keydef_r ws_r rd2_r:refdef_r? wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; @indentationLevels << (2+level); @indentationLevels << (4+level); true }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub2_r:hashsubdefs_ind_r? \n &{ |s| node_cache[:arraysubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:internreferences][rd2_r.ast( context )] = hashsub1_r.ast( context ) unless rd2_r.empty?\n r = begin [].push( ->(;r){ r={};r.store( keydef_r.ast( context ), hashsub1_r.ast( context ) );r.merge!( hashsub2_r.ast( context ) ); r }.() ).concat( arraysubdefs_ind_r.ast( context ) ) end\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r ':' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; @indentationLevels << (2+level); true }\n hashsubdefs_ind_r \n &{ |s| node_cache[:arraysubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = begin [].push( ->(;r){ r={};r.merge!( hashsubdefs_ind_r.ast( context ) ); r }.() ).concat( arraysubdefs_ind_r.ast( context ) ) end\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r refdef_tl:refdef_r? ws_r valuedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = valuedefs_ind_r.ast( context ) unless refdef_tl.empty?\n r = []\n r2 = valuedefs_ind_r.ast( context )\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r2 = arraysubdefs_ind_r.ast( context )\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; @indentationLevels << level; true }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = arraysubdefs_ind_r.ast( context )\n r\n end\n }\n end\n\n rule hashsubdefs_ind_r\n ( \n &{ |s| save = index; i = _nt_indentation_r; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n hashsubdef_ind_r '' \n )*\n {\n def ast( context )\n r = {}\n elements.each { |e| r.merge!( e.hashsubdef_ind_r.ast( context ) ) }\n r\n end\n }\n end\n\n rule hashsubdef_ind_r\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' ws_r '@schema' ws_r schemaname_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n \n unless context.globalvars[:schemata][schemaname_r.ast( context )]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname_r\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast( context )}, 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 context.globalvars[:schema] << context.globalvars[:schemata][schemaname_r.ast( context )]\n context.globalvars[:internreferences][rd2_r.ast( context )] = arraysubdefs_schema_ind_r.ast( context ) unless rd2_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_schema_ind_r.ast( context ) ] )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' ws_r '@schema' ws_r '(' ws_r schema_fieldlist_r ws_r ')' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:schema] << schema_fieldlist_r.ast( context )\n context.globalvars[:internreferences][rd2_r.ast( context )] = arraysubdefs_schema_ind_r.ast( context ) unless rd2_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_schema_ind_r.ast( context ) ] )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' ws_r '@schema' ws_r schemaname_r ws_r '(' ws_r schema_fieldlist_r ws_r ')' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:schema] << schema_fieldlist_r.ast( context )\n context.globalvars[:schemata][schemaname_r.ast( context )] = schema_fieldlist_r.ast( context )\n context.globalvars[:internreferences][rd2_r.ast( context )] = arraysubdefs_schema_ind_r.ast( context ) unless rd2_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_schema_ind_r.ast( context ) ] )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r keydef_r ws_r ',' ws_r '@schema' ws_r schemaname_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n \n unless context.globalvars[:schemata][schemaname_r.ast( context )]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname_r\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast( context )}, 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 context.globalvars[:schema] << context.globalvars[:schemata][schemaname_r.ast( context )]\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_schema_ind_r.ast( context ) ] )\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' ws_r rd3_r:refdef_r? ws_r valuedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:internreferences][rd3_r.ast( context )] = valuedefs_ind_r.ast( context ) unless rd3_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), begin [].concat( valuedefs_ind_r.ast( context ) ).concat( arraysubdefs_ind_r.ast( context ) ) end ] )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n context.globalvars[:internreferences][rd2_r.ast( context )] = r[keydef_r.ast( context )] unless rd2_r.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:internreferences][rd2_r.ast( context )] = arraysubdefs_ind_r.ast( context ) unless rd2_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_ind_r.ast( context ) ] )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r keydef_r ws_r rd2_r:refdef_r? wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:internreferences][rd2_r.ast( context )] = hashsubdefs_ind_r.ast( context ) unless rd2_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), hashsubdefs_ind_r.ast( context ) ] )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r refdef_tl:refdef_r? ws_r keyvaluedefs_ind_r \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl_r+\n {\n def ast( context )\n r = keyvaluedefs_ind_r.ast( context )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r '@merge' ws_r refuse_ind_r \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl_r+\n {\n def ast( context )\n r = refuse_ind_r.ast( context )\n r\n end\n }\n end\n\n rule arraysubdefs_ind_r\n ( \n &{ |s| save = index; i = _nt_indentation_r; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n arraysubdef_ind_r '' \n )*\n {\n def ast( context )\n r = []\n elements.each do |e|\n e1 = e.arraysubdef_ind_r.ast( context )\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_r\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r ': ' ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' ws_r '@schema' ws_r schemaname_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n \n unless context.globalvars[:schemata][schemaname_r.ast( context )]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname_r\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast( context )}, 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 context.globalvars[:schema] << context.globalvars[:schemata][schemaname_r.ast( context )]\n context.globalvars[:internreferences][rd2_r.ast( context )] = arraysubdefs_schema_ind_r.ast( context ) unless rd2_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_schema_ind_r.ast( context ) ] )\n r.merge!( hashsub1_r.ast( context ) )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r ': ' ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' ws_r '@schema' ws_r '(' ws_r schema_fieldlist_r ws_r ')' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:schema] << schema_fieldlist_r.ast( context )\n context.globalvars[:internreferences][rd2_r.ast( context )] = arraysubdefs_schema_ind_r.ast( context ) unless rd2_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_schema_ind_r.ast( context ) ] )\n r.merge!( hashsub1_r.ast( context ) )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r ': ' ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' ws_r '@schema' ws_r schemaname_r ws_r '(' ws_r schema_fieldlist_r ws_r ')' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:schema] << schema_fieldlist_r.ast( context )\n context.globalvars[:schemata][schemaname_r.ast( context )] = schema_fieldlist_r.ast( context )\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_schema_ind_r.ast( context ) ] )\n r.merge!( hashsub1_r.ast( context ) )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n context.globalvars[:internreferences][rd2_r.ast( context )] = r[keydef_r.ast( context )] unless rd2_r.empty?\n res = r\n context.globalvars[:schema].pop\n res\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r ': ' ws_r rd2_r:refdef_r? ws_r keyvaluedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:internreferences][rd2_r.ast( context )] = keyvaluedefs_ind_r.ast( context ) unless rd2_r.empty?\n r.merge!( keyvaluedefs_ind_r.ast( context ) )\n r.merge!( hashsubdefs_ind_r.ast( context ) )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r refdef_tl:refdef_r? ws_r ':' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = hashsubdefs_ind_r.ast( context )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r refdef_tl:refdef_r? ws_r ':' ws_r '@merge' ws_r refuse_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n r.merge!( refuse_ind_r.ast( context ) )\n r.merge!( hashsubdefs_ind_r.ast( context ) )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r unless refdef_tl.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r ': ' ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' ws_r rd3_r:refdef_r? ws_r valuedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n arraysubdefs_ind_r \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n context.globalvars[:internreferences][rd3_r.ast( context )] = valuedefs_ind_r.ast( context ) unless rd3_r.empty?\n r.merge!( Hash[ keydef_r.ast( context ), begin [].concat( valuedefs_ind_r.ast( context ) ).concat( arraysubdefs_ind_r.ast( context ) ) end ] )\n r.merge!( hashsub1_r.ast( context ) )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n context.globalvars[:internreferences][rd2_r.ast( context )] = r[keydef_r.ast( context )] unless rd2_r.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r ': ' ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ',' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n arraysubdefs_ind_r \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), arraysubdefs_ind_r.ast( context ) ] )\n r.merge!( hashsub1_r.ast( context ) )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n context.globalvars[:internreferences][rd2_r.ast( context )] = r[keydef_r.ast( context )] unless rd2_r.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r ': ' ws_r keydef_r ws_r rd2_r:refdef_r? wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub2_r:hashsubdefs_ind_r? \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), hashsub1_r.ast( context ) ] )\n r.merge!( hashsub2_r.ast( context ) )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n context.globalvars[:internreferences][rd2_r.ast( context )] = r[keydef_r.ast( context )] unless rd2_r.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r keydef_r ws_r rd2_r:refdef_r? ws_r ':' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), hashsubdefs_ind_r.ast( context ) ] )\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n context.globalvars[:internreferences][rd2_r.ast( context )] = r[keydef_r.ast( context )] unless rd2_r.empty?\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r refdef_tl:refdef_r? ws_r ',' ws_r '@schema' ws_r schemaname_r ws_r '(' ws_r schema_fieldlist_r ws_r ')' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:schema] << schema_fieldlist_r.ast( context )\n context.globalvars[:schemata][schemaname_r.ast( context )] = schema_fieldlist_r.ast( context )\n r = arraysubdefs_schema_ind_r.ast( context )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r unless refdef_tl.empty?\n res = r\n context.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r refdef_tl:refdef_r? ws_r ',' ws_r '@schema' ws_r '(' ws_r schema_fieldlist_r ws_r ')' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:schema] << schema_fieldlist_r.ast( context )\n r = arraysubdefs_schema_ind_r.ast( context )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r unless refdef_tl.empty?\n res = r\n context.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r refdef_tl:refdef_r? ws_r ',' ws_r '@schema' ws_r schemaname_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_schema_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n \n unless context.globalvars[:schemata][schemaname_r.ast( context )]\n s = \"GDS: undefined schema specifier: \"\n nt = schemaname_r\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast( context )}, 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 context.globalvars[:schema] << context.globalvars[:schemata][schemaname_r.ast( context )]\n r = arraysubdefs_schema_ind_r.ast( context )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r unless refdef_tl.empty?\n res = r\n context.globalvars[:schema].pop\n [ res ]\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r ':' ws_r rd1_r:refdef_r? ws_r keyvaluedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n hashsubdefs_ind_r \n &{ |s| node_cache[:arraysubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:internreferences][rd1_r.ast( context )] = keyvaluedefs_ind_r.ast( context ) unless rd1_r.empty?\n r = begin [].push( begin [].push( ->(;r){ r={};r.merge!( keyvaluedefs_ind_r.ast( context ) );r.merge!( hashsubdefs_ind_r.ast( context ) ); r }.() ).concat( arraysubdefs_ind_r.ast( context ) ) end ) end\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r ': ' ws_r keydef_r ws_r rd2_r:refdef_r? wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); @indentationLevels << (4+level); end; ok }\n hashsub1_r:hashsubdefs_ind_r? \n &{ |s| node_cache[:hashsubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n hashsub2_r:hashsubdefs_ind_r? \n &{ |s| node_cache[:arraysubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:internreferences][rd2_r.ast( context )] = hashsub1_r.ast( context ) unless rd2_r.empty?\n r = begin [].push( begin [].push( ->(;r){ r={};r.store( keydef_r.ast( context ), hashsub1_r.ast( context ) );r.merge!( hashsub2_r.ast( context ) ); r }.() ).concat( arraysubdefs_ind_r.ast( context ) ) end ) end\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r ',' ws_r ':' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; @indentationLevels << (2+level); end; ok }\n hashsubdefs_ind_r \n &{ |s| node_cache[:arraysubdefs_ind_r].delete( index ); @indentationLevels.pop; true }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = begin [].push( begin [].push( ->(;r){ r={};r.merge!( hashsubdefs_ind_r.ast( context ) ); r }.() ).concat( arraysubdefs_ind_r.ast( context ) ) end ) end\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r rd1_r:refdef_r? ws_r ',' ws_r rd2_r:refdef_r? ws_r valuedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n context.globalvars[:internreferences][rd2_r.ast( context )] = valuedefs_ind_r.ast( context ) unless rd2_r.empty?\n r = []\n r2 = valuedefs_ind_r.ast( context )\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r2 = arraysubdefs_ind_r.ast( context )\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n context.globalvars[:internreferences][rd1_r.ast( context )] = r unless rd1_r.empty?\n [\n r\n ]\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r refdef_tl:refdef_r? ws_r ',' wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n arraysubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n r = arraysubdefs_ind_r.ast( context )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r unless refdef_tl.empty?\n [\n r\n ]\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r '@insert' ws_r refuse_ind_r \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl_r+\n {\n def ast( context )\n r = refuse_ind_r.ast( context )\n r\n end\n }\n /\n indentation_r bc_0_l:(bc_0_r*) ws_r refdef_tl:refdef_r? ws_r valuedefs_ind_r \n &{ |s| level = s[0].text_value.length; (@indentationLevels.last + 2 == level) }\n wscommnl_r+\n {\n def ast( context )\n r = valuedefs_ind_r.ast( context )\n context.globalvars[:internreferences][refdef_tl.ast( context )] = r unless refdef_tl.empty?\n r\n end\n }\n end\n\n rule arraysubdefs_schema_ind_r\n ( \n &{ |s| save = index; i = _nt_indentation_r; level = i.text_value.length; index = save; ok = (level == (2 + @indentationLevels.last)); ok }\n arraysubdef_schema_ind_r '' \n )*\n {\n def ast( context )\n r = []\n elements.each do |e|\n e1 = e.arraysubdef_schema_ind_r.ast( context )\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_r\n indentation_r rd1_r:refdef_r? ws_r ': ' ws_r rd2_r:refdef_r? ws_r schemavaluedefs_ind_r wscommnl_r+ \n &{ |s| level = s[0].text_value.length; ok = (@indentationLevels.last + 2 == level); if(ok); @indentationLevels << level; end; ok }\n hashsubdefs_ind_r \n &{ |s| @indentationLevels.pop; true }\n wscommnl_r*\n {\n def ast( context )\n \n if schemavaluedefs_ind_r.ast( context ).length > context.globalvars[:schema].last.length\n s = \"GDS: too many values for schema definition: \"\n nt = schemavaluedefs_ind_r\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_r.ast( context ).each_with_index.map do |e,i|\n (e.is_a?(Hash) && e[:valuedirective]==:@na) ? ({}) : (Hash[ context.globalvars[:schema].last[i], e ])\n end.inject({}){ |res,e| res.merge!(e) }\n context.globalvars[:internreferences][rd1_r.ast( context )] = result unless rd1_r.empty?\n context.globalvars[:internreferences][rd2_r.ast( context )] = r1 unless rd2_r.empty?\n result.merge!( r1 ).merge!( hashsubdefs_ind_r.ast( context ) )\n \n end\n }\n /\n arraysubdef_ind_r ''\n {\n def ast( context )\n arraysubdef_ind_r.ast( context )\n end\n }\n end\n\n rule schemavaluedefs_ind_r\n schemavaluedef_ind_r ws_r '|' ws_r schemavaluedefs_ind_r \n {\n def ast( context )\n r = []\n r << schemavaluedef_ind_r.ast( context )\n r2 = schemavaluedefs_ind_r.ast( context )\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n schemavaluedef_ind_r '' \n {\n def ast( context )\n r = []\n r << schemavaluedef_ind_r.ast( context )\n r\n end\n }\n end\n\n rule schemavaluedef_ind_r\n value_directive_ind_r ''\n {\n def ast( context )\n value_directive_ind_r.ast( context )\n end\n }\n /\n valuedef_ind_r ''\n {\n def ast( context )\n valuedef_ind_r.ast( context )\n end\n }\n end\n\n rule refdef_r\n '&' identifier_r \n {\n def ast( context )\n r = identifier_r.ast( context )\n r\n end\n }\n end\n\n rule keyvaluedefs_ind_r\n keyvaluedef_ind_r ws_r '|' ws_r keyvaluedefs_ind_r \n {\n def ast( context )\n r = {}\n r.merge!( keyvaluedef_ind_r.ast( context ) )\n r.merge!( keyvaluedefs_ind_r.ast( context ) )\n r\n end\n }\n /\n keyvaluedef_ind_r ''\n {\n def ast( context )\n keyvaluedef_ind_r.ast( context )\n end\n }\n end\n\n rule keyvaluedef_ind_r\n keydef_r wsc_l:(wsc_r+) valuedef_ind_r \n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), valuedef_ind_r.ast( context ) ] )\n r\n end\n }\n end\n\n rule valuedef_ind_r\n variable_val_ind_r ''\n {\n def ast( context )\n variable_val_ind_r.ast( context )\n end\n }\n /\n refuse_ind_r ''\n {\n def ast( context )\n refuse_ind_r.ast( context )\n end\n }\n /\n valuedef_gen_ind_r ''\n {\n def ast( context )\n valuedef_gen_ind_r.ast( context )\n end\n }\n /\n special_value_ind_r ''\n {\n def ast( context )\n special_value_ind_r.ast( context )\n end\n }\n /\n string_no_leading_space_r ''\n {\n def ast( context )\n string_no_leading_space_r.ast( context )\n end\n }\n end\n\n rule keyvaluedef_r\n keydef_r ':' wscommnl2_r valuedef_r \n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), valuedef_r.ast( context ) ] )\n r\n end\n }\n /\n wscommnl2_r ':' keydef_r wscommnl2_r '=>' wscommnl2_r valuedef_r \n {\n def ast( context )\n r = {}\n r.merge!( Hash[ keydef_r.ast( context ), valuedef_r.ast( context ) ] )\n r\n end\n }\n end\n\n rule valuedefs_ind_r\n valuedef_ind_r ws_r '|' ws_r valuedefs_ind_r \n {\n def ast( context )\n r = []\n r << valuedef_ind_r.ast( context )\n r2 = valuedefs_ind_r.ast( context )\n if r2.is_a?(Array); r.concat( r2 ); else r << r2; end\n r\n end\n }\n /\n valuedef_ind_r '' \n {\n def ast( context )\n r = []\n r << valuedef_ind_r.ast( context )\n r\n end\n }\n end\n\n rule valuedef_r\n variable_val_r ''\n {\n def ast( context )\n variable_val_r.ast( context )\n end\n }\n /\n valuedef_gen_r ''\n {\n def ast( context )\n valuedef_gen_r.ast( context )\n end\n }\n /\n special_value_r ''\n {\n def ast( context )\n special_value_r.ast( context )\n end\n }\n end\n\n rule valuedef_gen_r\n number_float_r ''\n {\n def ast( context )\n number_float_r.ast( context )\n end\n }\n /\n number_int_r ''\n {\n def ast( context )\n number_int_r.ast( context )\n end\n }\n /\n rubysymbol_r ''\n {\n def ast( context )\n rubysymbol_r.ast( context )\n end\n }\n /\n string_with_quotes_r ''\n {\n def ast( context )\n string_with_quotes_r.ast( context )\n end\n }\n end\n\n rule valuedef_gen_ind_r\n ruby_eval_r ''\n {\n def ast( context )\n ruby_eval_r.ast( context )\n end\n }\n /\n number_float_r ''\n {\n def ast( context )\n number_float_r.ast( context )\n end\n }\n /\n number_int_r ''\n {\n def ast( context )\n number_int_r.ast( context )\n end\n }\n /\n rubysymbol_ind_r ''\n {\n def ast( context )\n rubysymbol_ind_r.ast( context )\n end\n }\n /\n string_with_quotes_r ''\n {\n def ast( context )\n string_with_quotes_r.ast( context )\n end\n }\n end\n\n rule special_value_r\n 'nil' \n {\n def ast( context )\n nil\n end\n }\n /\n 'true' \n {\n def ast( context )\n true\n end\n }\n /\n 'false' \n {\n def ast( context )\n false\n end\n }\n end\n\n rule special_value_ind_r\n '!nil' \n {\n def ast( context )\n nil\n end\n }\n /\n '@nil' \n {\n def ast( context )\n nil\n end\n }\n /\n '!true' \n {\n def ast( context )\n true\n end\n }\n /\n '@true' \n {\n def ast( context )\n true\n end\n }\n /\n '!false' \n {\n def ast( context )\n false\n end\n }\n /\n '@false' \n {\n def ast( context )\n false\n end\n }\n end\n\n rule value_directive_ind_r\n '@na' \n {\n def ast( context )\n r = {}\n r.merge!( Hash[ :valuedirective, :@na ] )\n r\n end\n }\n end\n\n rule string_with_quotes_r\n string_with_doublequotes_r ''\n {\n def ast( context )\n string_with_doublequotes_r.ast( context )\n end\n }\n /\n string_with_singlequotes_r ''\n {\n def ast( context )\n string_with_singlequotes_r.ast( context )\n end\n }\n end\n\n rule string_with_doublequotes_r\n '\"' string_double_q_r '\"'\n {\n def ast( context )\n string_double_q_r.ast( context )\n end\n }\n end\n\n rule string_double_q_r\n ('\\\\\\\\' / '\\\"' / !'\"' .)* \n {\n def ast( context )\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 context.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 context.globalvars[:gdsglobvars][key].to_s }.gsub(/\\\\\\$/, \"$\" )\n \n end\n }\n end\n\n rule string_with_singlequotes_r\n '\\'' string_single_q_r '\\''\n {\n def ast( context )\n string_single_q_r.ast( context )\n end\n }\n end\n\n rule string_single_q_r\n ('\\\\\\\\' / '\\\\\\'' / !'\\'' .)* \n {\n def ast( context )\n r = text_value\n r.gsub(/(\\\\\\\\)|(\\\\n)|(\\\\')/, '\\\\\\\\'=>'\\\\', \"\\\\n\"=>\"\\n\", \"\\\\'\"=>\"'\")\n end\n }\n end\n\n rule string_no_leading_space_r\n (&\"$(\" / ( !\"$\" !';' !'!' !'@' !'&' !'*' !' ' !':' !',' !\"|\" !'#' !'/*')) (!\"\\n\" !\"|\" !'#' !'/*' .)+ \n {\n def ast( context )\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 context.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 context.globalvars[:gdsglobvars][key].to_s }.gsub(/\\\\\\$/, \"$\" )\n \n end\n }\n end\n\n rule keydef_r\n string_with_quotes_r '' \n {\n def ast( context )\n string_with_quotes_r.ast( context ).to_sym \n end\n }\n /\n identifier_r ''\n {\n def ast( context )\n identifier_r.ast( context )\n end\n }\n end\n\n rule variable_val_r\n wscommnl2_r '$' varname_r \n {\n def ast( context )\n \n unless context.globalvars[:gdsglobvars].key?(varname_r.ast( context ))\n s = \"GDS: undefined variable: \"\n nt = varname_r\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast( context )}, 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 context.globalvars[:gdsglobvars][varname_r.ast( context )]\n \n end\n }\n end\n\n rule variable_val_ind_r\n '$' varname_r \n {\n def ast( context )\n \n unless context.globalvars[:gdsglobvars].key?(varname_r.ast( context ))\n s = \"GDS: undefined variable: \"\n nt = varname_r\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast( context )}, 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 context.globalvars[:gdsglobvars][varname_r.ast( context )]\n \n end\n }\n end\n\n rule refuse_ind_r\n '*' identifier_r \n {\n def ast( context )\n \n unless context.globalvars[:internreferences][identifier_r.ast( context )]\n s = \"GDS: undefined reference: \"\n nt = identifier_r\n lines = nt.input[0..nt.interval.begin].lines\n lineOfFailure = lines.size\n columnOfFailure = lines.last.size\n s += \"\#{nt.ast( context )}, 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 context.globalvars[:internreferences][identifier_r.ast( context )]\n \n end\n }\n end\n\n rule number_int_r\n octal_int_r ''\n {\n def ast( context )\n octal_int_r.ast( context )\n end\n }\n /\n binary_int_r ''\n {\n def ast( context )\n binary_int_r.ast( context )\n end\n }\n /\n hexa_int_r ''\n {\n def ast( context )\n hexa_int_r.ast( context )\n end\n }\n /\n decimal_int_r ''\n {\n def ast( context )\n decimal_int_r.ast( context )\n end\n }\n end\n\n rule octal_int_r\n ('-'/'+')? ( '0o' / '0' ) [0-7] ( [0-7] / '_' [0-7] )* \n {\n def ast( context )\n r = text_value\n r.to_i(8)\n end\n }\n end\n\n rule binary_int_r\n ('-'/'+')? '0b' [01] ( [01] / '_' [01] )* \n {\n def ast( context )\n r = text_value\n r.to_i(2)\n end\n }\n end\n\n rule hexa_int_r\n ('-'/'+')? '0x' [0-9a-fA-F] ( [0-9a-fA-F] / '_' [0-9a-fA-F] )* \n {\n def ast( context )\n r = text_value\n r.to_i(16)\n end\n }\n end\n\n rule decimal_int_r\n ('-'/'+')? ('0d')? [1-9] ( [0-9] / '_' [0-9] )* \n {\n def ast( context )\n text_value.to_i\n end\n }\n /\n ('0d')? [0] \n {\n def ast( context )\n text_value.to_i\n end\n }\n end\n\n rule number_float_r\n [+-]? ( [0-9] / '_' [0-9] )* [.] [0-9] ( [0-9] / '_' [0-9] )* (('e'/'E') [+-]? [0-9] ( [0-9] / '_' [0-9] )* )? \n {\n def ast( context )\n text_value.to_f\n end\n }\n end\n\n rule rubysymbol_r\n wscommnl2_r ':' rubysymbolcontent_r \n {\n def ast( context )\n r = rubysymbolcontent_r.ast( context )\n r\n end\n }\n end\n\n rule rubysymbolcontent_r\n wscommnl2_r '\"' rubysymbol_in_double_quotes_r '\"' \n {\n def ast( context )\n r = rubysymbol_in_double_quotes_r.ast( context )\n r\n end\n }\n /\n wscommnl2_r '\\'' rubysymbol_in_single_quotes_r '\\'' \n {\n def ast( context )\n r = rubysymbol_in_single_quotes_r.ast( context )\n r\n end\n }\n /\n ( !\"'\" !'\"' !'}' !' ' !',' !']' !'#' !'/*' !'*/' !\"\\n\" .)+\n {\n def ast( context )\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_ind_r\n ':' rubysymbolcontent_ind_r \n {\n def ast( context )\n r = rubysymbolcontent_ind_r.ast( context )\n r\n end\n }\n end\n\n rule rubysymbolcontent_ind_r\n '\"' rubysymbol_in_double_quotes_r '\"' \n {\n def ast( context )\n r = rubysymbol_in_double_quotes_r.ast( context )\n r\n end\n }\n /\n '\\'' rubysymbol_in_single_quotes_r '\\'' \n {\n def ast( context )\n r = rubysymbol_in_single_quotes_r.ast( context )\n r\n end\n }\n /\n (!\"'\" !'\"' !' ' !'|' !'#' !'/*' !'*/' !\"\\n\" .)+\n {\n def ast( context )\n text_value.to_sym\n end\n }\n end\n\n rule rubysymbol_in_double_quotes_r\n ('\\\\\\\\' / '\\\\\"' / !'\"' !\"\\n\" .)* \n {\n def ast( context )\n r = text_value\n r.gsub(/(\\\\\\\\)|(\\\\\")/, '\\\\\\\\'=>'\\\\', '\\\\\"'=>'\"').to_sym\n end\n }\n end\n\n rule rubysymbol_in_single_quotes_r\n ('\\\\\\\\' / '\\\\\\'' / !'\\'' !\"\\n\" .)* \n {\n def ast( context )\n r = text_value\n r.gsub(/(\\\\\\\\)|(\\\\')/, '\\\\\\\\'=>'\\\\', \"\\\\'\"=>\"'\").to_sym\n end\n }\n end\n\n rule ruby_eval_r\n '@r' ws_r evalexpr_r \n {\n def ast( context )\n context.config[:context] ? (eval(evalexpr_r.ast( context ), context.config[:context])) : nil \n end\n }\n /\n '@env' ws_r '(' ws_r envvar_r ws_r ',' ws_r string_with_quotes_r ws_r ')' \n {\n def ast( context )\n context.config[:allow_env] ? ( (res=eval(\"ENV['\#{envvar_r.ast( context ).strip}']\")) ? res : string_with_quotes_r.ast( context ) ) : string_with_quotes_r.ast( context ) \n end\n }\n /\n '@env' ws_r evalexpr_r \n {\n def ast( context )\n context.config[:allow_env] ? (eval(\"ENV['\#{evalexpr_r.ast( context ).strip}']\")) : nil \n end\n }\n end\n\n rule envvar_r\n identifier_r '' \n {\n def ast( context )\n text_value\n end\n }\n end\n\n rule evalexpr_r\n evalexpr_0_with_nesting_r ''\n {\n def ast( context )\n evalexpr_0_with_nesting_r.ast( context )\n end\n }\n end\n\n rule evalexpr_0_with_nesting_r\n &{ |s| @evalexpr_0_with_nestingLevel = 0; true }\n '(' evalexpr_0_with_nesting_sub_r ')'\n {\n def ast( context )\n evalexpr_0_with_nesting_sub_r.ast( context )\n end\n }\n end\n\n rule evalexpr_0_with_nesting_sub_r\n '(' \n &{ |s| @evalexpr_0_with_nestingLevel += 1; true }\n evalexpr_0_with_nesting_sub_r\n {\n def ast( context )\n '(' + evalexpr_0_with_nesting_sub_r.ast( context )\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_r\n {\n def ast( context )\n ')' + evalexpr_0_with_nesting_sub_r.ast( context )\n end\n }\n /\n ( !\"(\" !\")\" . )+ evalexpr_0_with_nesting_sub_r\n {\n def ast( context )\n text_value\n end\n }\n /\n ''\n {\n def ast( context )\n ''\n end\n }\n end\n\n rule evalexpr_0_with_nesting_onechar_r\n ( !\")\" . )\n {\n def ast( context )\n text_value\n end\n }\n end\n\n rule bc_0_r\n &{ |s| @bc_0Level = 0; true }\n '/*' bc_0_sub_r '*/'\n {\n def ast( context )\n \"/*\" + bc_0_sub_r.ast( context ) + \"*/\"\n end\n }\n end\n\n rule bc_0_sub_r\n '/*' \n &{ |s| @bc_0Level += 1; true }\n bc_0_sub_r\n {\n def ast( context )\n '/*' + bc_0_sub_r.ast( context )\n end\n }\n /\n '*/' \n &{ |s| ok = (@bc_0Level > 0); ok } \n &{ |s| @bc_0Level -= 1; true }\n bc_0_sub_r\n {\n def ast( context )\n '*/' + bc_0_sub_r.ast( context )\n end\n }\n /\n ( !\"/*\" !\"*/\" . )+ bc_0_sub_r\n {\n def ast( context )\n text_value\n end\n }\n /\n ''\n {\n def ast( context )\n ''\n end\n }\n end\n\n rule bc_0_onechar_r\n ( !\"*/\" . )\n {\n def ast( context )\n text_value\n end\n }\n end\n\n rule wsc_r\n [ \\t] \n {\n }\n /\n bc_0_r '' \n {\n }\n end\n\n rule identifier_r\n ([a-zA-Z_] [a-zA-Z0-9_]*)\n {\n def ast( context )\n text_value.to_sym\n end\n }\n end\n\n rule identifierstr_r\n ([a-zA-Z_] [a-zA-Z0-9_]*)\n {\n def ast( context )\n text_value\n end\n }\n end\n\n rule string_no_space_r\n [a-zA-Z0-9_/.:]+\n {\n def ast( context )\n text_value\n end\n }\n end\n\n rule indentation_r\n ' '*\n end\n\n rule ws_r\n wsc_r*\n end\n\n rule icomm_r\n '#' \n end\n\n rule wscommnl_r\n ws_r ( icomm_r ( !\"\\n\" . )* )? \"\\n\"\n end\n\n rule wscommnl2_r\n ( icomm_r ( !\"\\n\" . )* \"\\n\" / \"\\n\" / wsc_r )*\n end\n\nend\n"
|
48
41
|
|
49
42
|
end
|
50
43
|
end
|
data/lib/gdstruct/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uli Ramminger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: treetop
|
@@ -80,7 +80,7 @@ homepage: https://urasepandia.de/gds.html
|
|
80
80
|
licenses:
|
81
81
|
- MIT
|
82
82
|
metadata: {}
|
83
|
-
post_install_message:
|
83
|
+
post_install_message:
|
84
84
|
rdoc_options: []
|
85
85
|
require_paths:
|
86
86
|
- lib
|
@@ -95,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
|
99
|
-
|
100
|
-
signing_key:
|
98
|
+
rubygems_version: 3.1.6
|
99
|
+
signing_key:
|
101
100
|
specification_version: 4
|
102
101
|
summary: gdstruct - GDS (General Data Structure), a universal, composable data structure,
|
103
102
|
used to store any kind of data
|