expressir 0.2.5 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cross_rubies +30 -0
- data/.github/workflows/rake.yml +14 -15
- data/.github/workflows/release.yml +24 -16
- data/.gitignore +3 -1
- data/Gemfile +0 -2
- data/Rakefile +2 -8
- data/expressir.gemspec +7 -4
- data/ext/express-parser/express_parser.cpp +12 -10
- data/ext/express-parser/extconf.rb +48 -25
- data/lib/expressir/express_exp/formatter.rb +74 -23
- data/lib/expressir/express_exp/parser.rb +20 -2
- data/lib/expressir/express_exp/visitor.rb +201 -96
- data/lib/expressir/model.rb +3 -0
- data/lib/expressir/model/attribute.rb +3 -1
- data/lib/expressir/model/constant.rb +3 -1
- data/lib/expressir/model/entity.rb +12 -19
- data/lib/expressir/model/enumeration_item.rb +3 -1
- data/lib/expressir/model/expressions/aggregate_initializer.rb +2 -2
- data/lib/expressir/model/expressions/aggregate_item.rb +1 -1
- data/lib/expressir/model/expressions/attribute_reference.rb +1 -1
- data/lib/expressir/model/expressions/binary_expression.rb +1 -1
- data/lib/expressir/model/expressions/call.rb +2 -2
- data/lib/expressir/model/expressions/entity_constructor.rb +2 -2
- data/lib/expressir/model/expressions/group_reference.rb +1 -1
- data/lib/expressir/model/expressions/index_reference.rb +1 -1
- data/lib/expressir/model/expressions/interval.rb +1 -1
- data/lib/expressir/model/expressions/query_expression.rb +5 -3
- data/lib/expressir/model/expressions/simple_reference.rb +1 -1
- data/lib/expressir/model/expressions/unary_expression.rb +1 -1
- data/lib/expressir/model/function.rb +32 -38
- data/lib/expressir/model/identifier.rb +1 -0
- data/lib/expressir/model/informal_proposition.rb +13 -0
- data/lib/expressir/model/interface.rb +2 -2
- data/lib/expressir/model/literals/binary.rb +1 -1
- data/lib/expressir/model/literals/integer.rb +1 -1
- data/lib/expressir/model/literals/logical.rb +1 -1
- data/lib/expressir/model/literals/real.rb +1 -1
- data/lib/expressir/model/literals/string.rb +1 -1
- data/lib/expressir/model/model_element.rb +67 -0
- data/lib/expressir/model/parameter.rb +3 -1
- data/lib/expressir/model/procedure.rb +33 -39
- data/lib/expressir/model/renamed_ref.rb +1 -1
- data/lib/expressir/model/repository.rb +3 -3
- data/lib/expressir/model/rule.rb +35 -38
- data/lib/expressir/model/schema.rb +35 -46
- data/lib/expressir/model/scope.rb +49 -3
- data/lib/expressir/model/statements/alias.rb +4 -2
- data/lib/expressir/model/statements/assignment.rb +1 -1
- data/lib/expressir/model/statements/call.rb +2 -2
- data/lib/expressir/model/statements/case.rb +2 -2
- data/lib/expressir/model/statements/case_action.rb +2 -2
- data/lib/expressir/model/statements/compound.rb +2 -2
- data/lib/expressir/model/statements/escape.rb +1 -1
- data/lib/expressir/model/statements/if.rb +3 -3
- data/lib/expressir/model/statements/null.rb +1 -1
- data/lib/expressir/model/statements/repeat.rb +4 -2
- data/lib/expressir/model/statements/return.rb +1 -1
- data/lib/expressir/model/statements/skip.rb +1 -1
- data/lib/expressir/model/subtype_constraint.rb +3 -1
- data/lib/expressir/model/type.rb +13 -3
- data/lib/expressir/model/types/aggregate.rb +3 -1
- data/lib/expressir/model/types/array.rb +1 -1
- data/lib/expressir/model/types/bag.rb +1 -1
- data/lib/expressir/model/types/binary.rb +1 -1
- data/lib/expressir/model/types/boolean.rb +1 -1
- data/lib/expressir/model/types/enumeration.rb +3 -3
- data/lib/expressir/model/types/generic.rb +3 -1
- data/lib/expressir/model/types/generic_entity.rb +3 -1
- data/lib/expressir/model/types/integer.rb +1 -1
- data/lib/expressir/model/types/list.rb +1 -1
- data/lib/expressir/model/types/logical.rb +1 -1
- data/lib/expressir/model/types/number.rb +1 -1
- data/lib/expressir/model/types/real.rb +1 -1
- data/lib/expressir/model/types/select.rb +3 -3
- data/lib/expressir/model/types/set.rb +1 -1
- data/lib/expressir/model/types/string.rb +1 -1
- data/lib/expressir/model/unique.rb +4 -2
- data/lib/expressir/model/variable.rb +3 -1
- data/lib/expressir/model/where.rb +3 -1
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/remark.exp +64 -20
- data/original/examples/syntax/remark_formatted.exp +63 -24
- data/original/examples/syntax/simple.exp +3 -0
- data/original/examples/syntax/source.exp +16 -0
- data/original/examples/syntax/syntax.exp +194 -181
- data/original/examples/syntax/syntax_formatted.exp +354 -787
- data/rakelib/cross-ruby.rake +308 -0
- data/spec/expressir/express_exp/head_source_spec.rb +38 -0
- data/spec/expressir/express_exp/parse_multiple_spec.rb +32 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +122 -56
- data/spec/expressir/express_exp/parse_syntax_spec.rb +1619 -1569
- data/spec/expressir/express_exp/source_spec.rb +29 -0
- data/spec/expressir/model/model_element_spec.rb +59 -0
- data/spec/expressir/model/{find_spec.rb → scope_spec.rb} +20 -7
- metadata +45 -21
@@ -0,0 +1,308 @@
|
|
1
|
+
require "rbconfig"
|
2
|
+
require "shellwords"
|
3
|
+
|
4
|
+
CrossRuby = Struct.new(:version, :host) do
|
5
|
+
WINDOWS_PLATFORM_REGEX = /mingw|mswin/
|
6
|
+
MINGW32_PLATFORM_REGEX = /mingw32/
|
7
|
+
LINUX_PLATFORM_REGEX = /linux/
|
8
|
+
DARWIN_PLATFORM_REGEX = /darwin/
|
9
|
+
|
10
|
+
def windows?
|
11
|
+
!!(platform =~ WINDOWS_PLATFORM_REGEX)
|
12
|
+
end
|
13
|
+
|
14
|
+
def linux?
|
15
|
+
!!(platform =~ LINUX_PLATFORM_REGEX)
|
16
|
+
end
|
17
|
+
|
18
|
+
def darwin?
|
19
|
+
!!(platform =~ DARWIN_PLATFORM_REGEX)
|
20
|
+
end
|
21
|
+
|
22
|
+
def ver
|
23
|
+
@ver ||= version[/\A[^-]+/]
|
24
|
+
end
|
25
|
+
|
26
|
+
def minor_ver
|
27
|
+
@minor_ver ||= ver[/\A\d\.\d(?=\.)/]
|
28
|
+
end
|
29
|
+
|
30
|
+
def api_ver_suffix
|
31
|
+
case minor_ver
|
32
|
+
when nil
|
33
|
+
raise "CrossRuby.api_ver_suffix: unsupported version: #{ver}"
|
34
|
+
else
|
35
|
+
minor_ver.delete(".") << "0"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def platform
|
40
|
+
@platform ||= case host
|
41
|
+
when /\Ax86_64.*mingw32/
|
42
|
+
"x64-mingw32"
|
43
|
+
when /\Ai[3-6]86.*mingw32/
|
44
|
+
"x86-mingw32"
|
45
|
+
when /\Ax86_64.*linux/
|
46
|
+
"x86_64-linux"
|
47
|
+
when /\Ai[3-6]86.*linux/
|
48
|
+
"x86-linux"
|
49
|
+
when /\Ax86_64-darwin/
|
50
|
+
"x86_64-darwin"
|
51
|
+
when /\Aarm64-darwin/
|
52
|
+
"arm64-darwin"
|
53
|
+
else
|
54
|
+
raise "CrossRuby.platform: unsupported host: #{host}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def tool(name)
|
59
|
+
(@binutils_prefix ||= case platform
|
60
|
+
when "x64-mingw32"
|
61
|
+
"x86_64-w64-mingw32-"
|
62
|
+
when "x86-mingw32"
|
63
|
+
"i686-w64-mingw32-"
|
64
|
+
when "x86_64-linux"
|
65
|
+
"x86_64-redhat-linux-"
|
66
|
+
when "x86-linux"
|
67
|
+
"i686-redhat-linux-"
|
68
|
+
when /x86_64.*darwin/
|
69
|
+
"x86_64-apple-darwin-"
|
70
|
+
when /a.*64.*darwin/
|
71
|
+
"aarch64-apple-darwin-"
|
72
|
+
else
|
73
|
+
raise "CrossRuby.tool: unmatched platform: #{platform}"
|
74
|
+
end) + name
|
75
|
+
end
|
76
|
+
|
77
|
+
def target_file_format
|
78
|
+
case platform
|
79
|
+
when "x64-mingw32"
|
80
|
+
"pei-x86-64"
|
81
|
+
when "x86-mingw32"
|
82
|
+
"pei-i386"
|
83
|
+
when "x86_64-linux"
|
84
|
+
"elf64-x86-64"
|
85
|
+
when "x86-linux"
|
86
|
+
"elf32-i386"
|
87
|
+
when "x86_64-darwin"
|
88
|
+
"Mach-O 64-bit x86-64" # hmm
|
89
|
+
when "arm64-darwin"
|
90
|
+
"Mach-O arm64"
|
91
|
+
else
|
92
|
+
raise "CrossRuby.target_file_format: unmatched platform: #{platform}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def dll_ext
|
97
|
+
darwin? ? "bundle" : "so"
|
98
|
+
end
|
99
|
+
|
100
|
+
def dll_staging_path
|
101
|
+
"tmp/#{platform}/stage/lib/#{GEMSPEC.name}/#{minor_ver}/#{GEMSPEC.name}.#{dll_ext}"
|
102
|
+
end
|
103
|
+
|
104
|
+
def libruby_dll
|
105
|
+
case platform
|
106
|
+
when "x64-mingw32"
|
107
|
+
"x64-msvcrt-ruby#{api_ver_suffix}.dll"
|
108
|
+
when "x86-mingw32"
|
109
|
+
"msvcrt-ruby#{api_ver_suffix}.dll"
|
110
|
+
else
|
111
|
+
raise "CrossRuby.libruby_dll: unmatched platform: #{platform}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def allowed_dlls
|
116
|
+
case platform
|
117
|
+
when MINGW32_PLATFORM_REGEX
|
118
|
+
[
|
119
|
+
"kernel32.dll",
|
120
|
+
"msvcrt.dll",
|
121
|
+
"ws2_32.dll",
|
122
|
+
"user32.dll",
|
123
|
+
"advapi32.dll",
|
124
|
+
libruby_dll,
|
125
|
+
]
|
126
|
+
when LINUX_PLATFORM_REGEX
|
127
|
+
[
|
128
|
+
"libm.so.6",
|
129
|
+
*(case
|
130
|
+
when ver < "2.6.0"
|
131
|
+
"libpthread.so.0"
|
132
|
+
end),
|
133
|
+
"libc.so.6",
|
134
|
+
"libdl.so.2", # on old dists only - now in libc
|
135
|
+
]
|
136
|
+
when DARWIN_PLATFORM_REGEX
|
137
|
+
[
|
138
|
+
"/usr/lib/libSystem.B.dylib",
|
139
|
+
"/usr/lib/liblzma.5.dylib",
|
140
|
+
"/usr/lib/libobjc.A.dylib",
|
141
|
+
]
|
142
|
+
else
|
143
|
+
raise "CrossRuby.allowed_dlls: unmatched platform: #{platform}"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def dll_ref_versions
|
148
|
+
case platform
|
149
|
+
when LINUX_PLATFORM_REGEX
|
150
|
+
{ "GLIBC" => "2.17" }
|
151
|
+
else
|
152
|
+
raise "CrossRuby.dll_ref_versions: unmatched platform: #{platform}"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
CROSS_RUBIES = File.read(".cross_rubies").split("\n").map do |line|
|
158
|
+
case line
|
159
|
+
when /\A([^#]+):([^#]+)/
|
160
|
+
CrossRuby.new($1, $2)
|
161
|
+
end
|
162
|
+
end.compact
|
163
|
+
|
164
|
+
ENV["RUBY_CC_VERSION"] = CROSS_RUBIES.map(&:ver).uniq.join(":")
|
165
|
+
|
166
|
+
require "rake_compiler_dock"
|
167
|
+
|
168
|
+
def verify_dll(dll, cross_ruby)
|
169
|
+
allowed_imports = cross_ruby.allowed_dlls
|
170
|
+
dump = `#{["env", "LANG=C", cross_ruby.tool("objdump"), "-p", dll].shelljoin}`
|
171
|
+
|
172
|
+
if cross_ruby.windows?
|
173
|
+
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target_file_format)}\s/ === dump
|
174
|
+
raise "export function Init_nokogiri not in dll #{dll}" unless /Table.*\sInit_nokogiri\s/mi === dump
|
175
|
+
|
176
|
+
# Verify that the DLL dependencies are all allowed.
|
177
|
+
actual_imports = dump.scan(/DLL Name: (.*)$/).map(&:first).map(&:downcase).uniq
|
178
|
+
if !(actual_imports - allowed_imports).empty?
|
179
|
+
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
180
|
+
end
|
181
|
+
|
182
|
+
elsif cross_ruby.linux?
|
183
|
+
nm = `#{["env", "LANG=C", cross_ruby.tool("nm"), "-D", dll].shelljoin}`
|
184
|
+
|
185
|
+
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target_file_format)}\s/ === dump
|
186
|
+
raise "export function Init_nokogiri not in dll #{dll}" unless / T Init_nokogiri/ === nm
|
187
|
+
|
188
|
+
# Verify that the DLL dependencies are all allowed.
|
189
|
+
actual_imports = dump.scan(/NEEDED\s+(.*)/).map(&:first).uniq
|
190
|
+
if !(actual_imports - allowed_imports).empty?
|
191
|
+
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
192
|
+
end
|
193
|
+
|
194
|
+
# Verify that the expected so version requirements match the actual dependencies.
|
195
|
+
ref_versions_data = dump.scan(/0x[\da-f]+ 0x[\da-f]+ \d+ (\w+)_([\d\.]+)$/i)
|
196
|
+
# Build a hash of library versions like {"LIBUDEV"=>"183", "GLIBC"=>"2.17"}
|
197
|
+
actual_ref_versions = ref_versions_data.each.with_object({}) do |(lib, ver), h|
|
198
|
+
if !h[lib] || ver.split(".").map(&:to_i).pack("C*") > h[lib].split(".").map(&:to_i).pack("C*")
|
199
|
+
h[lib] = ver
|
200
|
+
end
|
201
|
+
end
|
202
|
+
if actual_ref_versions != cross_ruby.dll_ref_versions
|
203
|
+
raise "unexpected so version requirements #{actual_ref_versions.inspect} in #{dll}"
|
204
|
+
end
|
205
|
+
|
206
|
+
elsif cross_ruby.darwin?
|
207
|
+
nm = `#{["env", "LANG=C", cross_ruby.tool("nm"), "-g", dll].shelljoin}`
|
208
|
+
|
209
|
+
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target_file_format)}\s/ === dump
|
210
|
+
raise "export function Init_nokogiri not in dll #{dll}" unless / T _?Init_nokogiri/ === nm
|
211
|
+
|
212
|
+
# if liblzma is being referenced, let's make sure it's referring
|
213
|
+
# to the system-installed file and not the homebrew-installed file.
|
214
|
+
ldd = `#{["env", "LANG=C", cross_ruby.tool("otool"), "-L", dll].shelljoin}`
|
215
|
+
if liblzma_refs = ldd.scan(/^\t([^ ]+) /).map(&:first).uniq.grep(/liblzma/)
|
216
|
+
liblzma_refs.each do |ref|
|
217
|
+
new_ref = File.join("/usr/lib", File.basename(ref))
|
218
|
+
sh ["env", "LANG=C", cross_ruby.tool("install_name_tool"), "-change", ref, new_ref, dll].shelljoin
|
219
|
+
end
|
220
|
+
|
221
|
+
# reload!
|
222
|
+
ldd = `#{["env", "LANG=C", cross_ruby.tool("otool"), "-L", dll].shelljoin}`
|
223
|
+
end
|
224
|
+
|
225
|
+
# Verify that the DLL dependencies are all allowed.
|
226
|
+
ldd = `#{["env", "LANG=C", cross_ruby.tool("otool"), "-L", dll].shelljoin}`
|
227
|
+
actual_imports = ldd.scan(/^\t([^ ]+) /).map(&:first).uniq
|
228
|
+
if !(actual_imports - allowed_imports).empty?
|
229
|
+
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
puts "verify_dll: #{dll}: passed shared library sanity checks"
|
233
|
+
end
|
234
|
+
|
235
|
+
CROSS_RUBIES.each do |cross_ruby|
|
236
|
+
task cross_ruby.dll_staging_path do |t|
|
237
|
+
verify_dll t.name, cross_ruby
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def gem_builder(plat)
|
242
|
+
# use Task#invoke because the pkg/*gem task is defined at runtime
|
243
|
+
Rake::Task["native:#{plat}"].invoke
|
244
|
+
Rake::Task["pkg/#{GEMSPEC.full_name}-#{Gem::Platform.new(plat).to_s}.gem"].invoke
|
245
|
+
end
|
246
|
+
|
247
|
+
namespace "gem" do
|
248
|
+
CROSS_RUBIES.find_all { |cr| cr.windows? || cr.linux? || cr.darwin? }.map(&:platform).uniq.each do |plat|
|
249
|
+
pre_req = case plat
|
250
|
+
when /\linux/
|
251
|
+
"sudo yum install -y git"
|
252
|
+
else
|
253
|
+
"sudo apt-get update -y && sudo apt-get install -y automake autoconf libtool build-essential"
|
254
|
+
end
|
255
|
+
desc "build native gem for #{plat} platform"
|
256
|
+
task plat do
|
257
|
+
RakeCompilerDock.sh <<~EOT, platform: plat
|
258
|
+
#{pre_req} &&
|
259
|
+
gem install bundler --no-document &&
|
260
|
+
bundle &&
|
261
|
+
bundle exec rake gem:#{plat}:builder MAKE='nice make -j`nproc`'
|
262
|
+
EOT
|
263
|
+
end
|
264
|
+
|
265
|
+
namespace plat do
|
266
|
+
desc "build native gem for #{plat} platform (guest container)"
|
267
|
+
task "builder" do
|
268
|
+
gem_builder(plat)
|
269
|
+
end
|
270
|
+
task "guest" => "builder" # TODO: remove me after this code is on master, temporary backwards compat for CI
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
desc "build native gems for windows"
|
275
|
+
multitask "windows" => CROSS_RUBIES.find_all(&:windows?).map(&:platform).uniq
|
276
|
+
|
277
|
+
desc "build native gems for linux"
|
278
|
+
multitask "linux" => CROSS_RUBIES.find_all(&:linux?).map(&:platform).uniq
|
279
|
+
|
280
|
+
desc "build native gems for darwin"
|
281
|
+
multitask "darwin" => CROSS_RUBIES.find_all(&:darwin?).map(&:platform).uniq
|
282
|
+
end
|
283
|
+
|
284
|
+
namespace "native" do
|
285
|
+
plat = "x86_64-darwin"
|
286
|
+
namespace plat do
|
287
|
+
desc "build native gem for #{plat} platform on host OS"
|
288
|
+
task "builder" do
|
289
|
+
gem_builder(plat)
|
290
|
+
end
|
291
|
+
task "guest" => "builder" # TODO: remove me after this code is on master, temporary backwards compat for CI
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
require "rake/extensiontask"
|
296
|
+
|
297
|
+
Rake::ExtensionTask.new("express_parser", GEMSPEC) do |ext|
|
298
|
+
ext.ext_dir = "ext/express-parser"
|
299
|
+
ext.lib_dir = File.join(*['lib', 'expressir', 'express_exp', ENV['FAT_DIR']].compact)
|
300
|
+
ext.config_options << ENV['EXTOPTS']
|
301
|
+
ext.cross_compile = true
|
302
|
+
ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
|
303
|
+
ext.cross_config_options << "--enable-cross-build"
|
304
|
+
ext.cross_compiling do |spec|
|
305
|
+
spec.files.reject! { |path| File.fnmatch?('ext/*', path) }
|
306
|
+
spec.dependencies.reject! { |dep| dep.name == 'rice' }
|
307
|
+
end
|
308
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
|
4
|
+
RSpec.describe Expressir::ExpressExp::Parser do
|
5
|
+
describe ".head_source" do
|
6
|
+
it "contains original head source" do
|
7
|
+
input = File.read(sample_file)
|
8
|
+
repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
|
9
|
+
|
10
|
+
repo.schemas[0].tap do |x|
|
11
|
+
start_index = x.source.index("SCHEMA")
|
12
|
+
stop_index = x.source.index(";") + ";".length - 1
|
13
|
+
expected_result = x.source[start_index..stop_index]
|
14
|
+
expect(x.head_source).to eq(expected_result)
|
15
|
+
end
|
16
|
+
|
17
|
+
repo.schemas[1].tap do |x|
|
18
|
+
start_index = x.source.index("SCHEMA")
|
19
|
+
stop_index = x.source.index(";") + ";".length - 1
|
20
|
+
expected_result = x.source[start_index..stop_index]
|
21
|
+
expect(x.head_source).to eq(expected_result)
|
22
|
+
end
|
23
|
+
|
24
|
+
repo.schemas[2].tap do |x|
|
25
|
+
start_index = x.source.index("SCHEMA")
|
26
|
+
stop_index = x.source.index("REFERENCE FROM contract_schema;") + "REFERENCE FROM contract_schema;".length - 1
|
27
|
+
expected_result = x.source[start_index..stop_index]
|
28
|
+
expect(x.head_source).to eq(expected_result)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def sample_file
|
34
|
+
@sample_file ||= Expressir.root_path.join(
|
35
|
+
"original", "examples", "syntax", "source.exp"
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
|
4
|
+
RSpec.describe Expressir::ExpressExp::Parser do
|
5
|
+
describe ".from_files" do
|
6
|
+
it "build an instance from multiple files file" do
|
7
|
+
repo = Expressir::ExpressExp::Parser.from_files(sample_files)
|
8
|
+
|
9
|
+
schemas = repo.schemas
|
10
|
+
expect(schemas.count).to eq(5)
|
11
|
+
expect(schemas[0].id).to eq("syntax_schema")
|
12
|
+
expect(schemas[1].id).to eq("remark_schema")
|
13
|
+
expect(schemas[2].id).to eq("entity_schema")
|
14
|
+
expect(schemas[3].id).to eq("version_entity_schema")
|
15
|
+
expect(schemas[4].id).to eq("version_interface_entity_schema")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def sample_files
|
20
|
+
@sample_files ||= [
|
21
|
+
Expressir.root_path.join(
|
22
|
+
"original", "examples", "syntax", "syntax.exp"
|
23
|
+
),
|
24
|
+
Expressir.root_path.join(
|
25
|
+
"original", "examples", "syntax", "remark.exp"
|
26
|
+
),
|
27
|
+
Expressir.root_path.join(
|
28
|
+
"original", "examples", "syntax", "source.exp"
|
29
|
+
)
|
30
|
+
]
|
31
|
+
end
|
32
|
+
end
|
@@ -11,13 +11,14 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
11
11
|
schema.tap do |x|
|
12
12
|
expect(x).to be_instance_of(Expressir::Model::Schema)
|
13
13
|
expect(x.remarks).to be_instance_of(Array)
|
14
|
-
expect(x.remarks.count).to eq(
|
14
|
+
expect(x.remarks.count).to eq(5)
|
15
15
|
expect(x.remarks[0]).to eq("Any character within the EXPRESS character set may occur between the start and end of\nan embedded remark including the newline character; therefore, embedded remarks can span\nseveral physical lines.")
|
16
16
|
expect(x.remarks[1]).to eq("The tail remark is written at the end of a physical line.")
|
17
|
-
expect(x.remarks[2]).to eq("
|
18
|
-
expect(x.remarks[3]).to eq("universal scope - schema")
|
17
|
+
expect(x.remarks[2]).to eq("UTF8 test: Příliš žluťoučký kůň úpěl ďábelské ódy.")
|
18
|
+
expect(x.remarks[3]).to eq("universal scope - schema before")
|
19
|
+
expect(x.remarks[4]).to eq("universal scope - schema")
|
19
20
|
end
|
20
|
-
|
21
|
+
|
21
22
|
schema.constants.first.tap do |x|
|
22
23
|
expect(x).to be_instance_of(Expressir::Model::Constant)
|
23
24
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -25,7 +26,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
25
26
|
expect(x.remarks[0]).to eq("schema scope - constant")
|
26
27
|
expect(x.remarks[1]).to eq("universal scope - constant")
|
27
28
|
end
|
28
|
-
|
29
|
+
|
29
30
|
schema.types.first.tap do |x|
|
30
31
|
expect(x).to be_instance_of(Expressir::Model::Type)
|
31
32
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -37,12 +38,38 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
37
38
|
x.type.items.first.tap do |x|
|
38
39
|
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
39
40
|
expect(x.remarks).to be_instance_of(Array)
|
40
|
-
expect(x.remarks.count).to eq(
|
41
|
+
expect(x.remarks.count).to eq(4)
|
41
42
|
expect(x.remarks[0]).to eq("schema scope - enumeration item")
|
42
|
-
expect(x.remarks[1]).to eq("
|
43
|
+
expect(x.remarks[1]).to eq("schema scope - enumeration item, on the same level as the type")
|
44
|
+
expect(x.remarks[2]).to eq("universal scope - enumeration item")
|
45
|
+
expect(x.remarks[3]).to eq("universal scope - enumeration item, on the same level as the type")
|
43
46
|
end
|
44
47
|
end
|
45
|
-
|
48
|
+
|
49
|
+
schema.types.first.where.first.tap do |x|
|
50
|
+
expect(x).to be_instance_of(Expressir::Model::Where)
|
51
|
+
expect(x.remarks).to be_instance_of(Array)
|
52
|
+
expect(x.remarks.count).to eq(6)
|
53
|
+
expect(x.remarks[0]).to eq("type scope - type where")
|
54
|
+
expect(x.remarks[1]).to eq("type scope - type where, with prefix")
|
55
|
+
expect(x.remarks[2]).to eq("schema scope - type where")
|
56
|
+
expect(x.remarks[3]).to eq("schema scope - type where, with prefix")
|
57
|
+
expect(x.remarks[4]).to eq("universal scope - type where")
|
58
|
+
expect(x.remarks[5]).to eq("universal scope - type where, with prefix")
|
59
|
+
end
|
60
|
+
|
61
|
+
schema.types.first.informal_propositions.first.tap do |x|
|
62
|
+
expect(x).to be_instance_of(Expressir::Model::InformalProposition)
|
63
|
+
expect(x.remarks).to be_instance_of(Array)
|
64
|
+
expect(x.remarks.count).to eq(6)
|
65
|
+
expect(x.remarks[0]).to eq("type scope - type informal proposition")
|
66
|
+
expect(x.remarks[1]).to eq("type scope - type informal proposition, with prefix")
|
67
|
+
expect(x.remarks[2]).to eq("schema scope - type informal proposition")
|
68
|
+
expect(x.remarks[3]).to eq("schema scope - type informal proposition, with prefix")
|
69
|
+
expect(x.remarks[4]).to eq("universal scope - type informal proposition")
|
70
|
+
expect(x.remarks[5]).to eq("universal scope - type informal proposition, with prefix")
|
71
|
+
end
|
72
|
+
|
46
73
|
schema.entities.first.tap do |x|
|
47
74
|
expect(x).to be_instance_of(Expressir::Model::Entity)
|
48
75
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -50,8 +77,8 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
50
77
|
expect(x.remarks[0]).to eq("schema scope - entity")
|
51
78
|
expect(x.remarks[1]).to eq("universal scope - entity")
|
52
79
|
end
|
53
|
-
|
54
|
-
schema.entities.first.
|
80
|
+
|
81
|
+
schema.entities.first.attributes.find{|x| x.kind == Expressir::Model::Attribute::EXPLICIT}.tap do |x|
|
55
82
|
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
56
83
|
expect(x.kind).to eq(Expressir::Model::Attribute::EXPLICIT)
|
57
84
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -60,8 +87,8 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
60
87
|
expect(x.remarks[1]).to eq("schema scope - entity attribute")
|
61
88
|
expect(x.remarks[2]).to eq("universal scope - entity attribute")
|
62
89
|
end
|
63
|
-
|
64
|
-
schema.entities.first.
|
90
|
+
|
91
|
+
schema.entities.first.attributes.find{|x| x.kind == Expressir::Model::Attribute::DERIVED}.tap do |x|
|
65
92
|
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
66
93
|
expect(x.kind).to eq(Expressir::Model::Attribute::DERIVED)
|
67
94
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -70,8 +97,8 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
70
97
|
expect(x.remarks[1]).to eq("schema scope - entity derived attribute")
|
71
98
|
expect(x.remarks[2]).to eq("universal scope - entity derived attribute")
|
72
99
|
end
|
73
|
-
|
74
|
-
schema.entities.first.
|
100
|
+
|
101
|
+
schema.entities.first.attributes.find{|x| x.kind == Expressir::Model::Attribute::INVERSE}.tap do |x|
|
75
102
|
expect(x).to be_instance_of(Expressir::Model::Attribute)
|
76
103
|
expect(x.kind).to eq(Expressir::Model::Attribute::INVERSE)
|
77
104
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -80,7 +107,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
80
107
|
expect(x.remarks[1]).to eq("schema scope - entity inverse attribute")
|
81
108
|
expect(x.remarks[2]).to eq("universal scope - entity inverse attribute")
|
82
109
|
end
|
83
|
-
|
110
|
+
|
84
111
|
schema.entities.first.unique.first.tap do |x|
|
85
112
|
expect(x).to be_instance_of(Expressir::Model::Unique)
|
86
113
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -89,16 +116,31 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
89
116
|
expect(x.remarks[1]).to eq("schema scope - entity unique")
|
90
117
|
expect(x.remarks[2]).to eq("universal scope - entity unique")
|
91
118
|
end
|
92
|
-
|
119
|
+
|
93
120
|
schema.entities.first.where.first.tap do |x|
|
94
121
|
expect(x).to be_instance_of(Expressir::Model::Where)
|
95
122
|
expect(x.remarks).to be_instance_of(Array)
|
96
|
-
expect(x.remarks.count).to eq(
|
123
|
+
expect(x.remarks.count).to eq(6)
|
97
124
|
expect(x.remarks[0]).to eq("entity scope - entity where")
|
98
|
-
expect(x.remarks[1]).to eq("
|
99
|
-
expect(x.remarks[2]).to eq("
|
125
|
+
expect(x.remarks[1]).to eq("entity scope - entity where, with prefix")
|
126
|
+
expect(x.remarks[2]).to eq("schema scope - entity where")
|
127
|
+
expect(x.remarks[3]).to eq("schema scope - entity where, with prefix")
|
128
|
+
expect(x.remarks[4]).to eq("universal scope - entity where")
|
129
|
+
expect(x.remarks[5]).to eq("universal scope - entity where, with prefix")
|
130
|
+
end
|
131
|
+
|
132
|
+
schema.entities.first.informal_propositions.first.tap do |x|
|
133
|
+
expect(x).to be_instance_of(Expressir::Model::InformalProposition)
|
134
|
+
expect(x.remarks).to be_instance_of(Array)
|
135
|
+
expect(x.remarks.count).to eq(6)
|
136
|
+
expect(x.remarks[0]).to eq("entity scope - entity informal proposition")
|
137
|
+
expect(x.remarks[1]).to eq("entity scope - entity informal proposition, with prefix")
|
138
|
+
expect(x.remarks[2]).to eq("schema scope - entity informal proposition")
|
139
|
+
expect(x.remarks[3]).to eq("schema scope - entity informal proposition, with prefix")
|
140
|
+
expect(x.remarks[4]).to eq("universal scope - entity informal proposition")
|
141
|
+
expect(x.remarks[5]).to eq("universal scope - entity informal proposition, with prefix")
|
100
142
|
end
|
101
|
-
|
143
|
+
|
102
144
|
schema.subtype_constraints.first.tap do |x|
|
103
145
|
expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
|
104
146
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -106,7 +148,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
106
148
|
expect(x.remarks[0]).to eq("schema scope - subtype constraint")
|
107
149
|
expect(x.remarks[1]).to eq("universal scope - subtype constraint")
|
108
150
|
end
|
109
|
-
|
151
|
+
|
110
152
|
schema.functions.first.tap do |x|
|
111
153
|
expect(x).to be_instance_of(Expressir::Model::Function)
|
112
154
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -114,7 +156,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
114
156
|
expect(x.remarks[0]).to eq("schema scope - function")
|
115
157
|
expect(x.remarks[1]).to eq("universal scope - function")
|
116
158
|
end
|
117
|
-
|
159
|
+
|
118
160
|
schema.functions.first.parameters.first.tap do |x|
|
119
161
|
expect(x).to be_instance_of(Expressir::Model::Parameter)
|
120
162
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -123,7 +165,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
123
165
|
expect(x.remarks[1]).to eq("schema scope - function parameter")
|
124
166
|
expect(x.remarks[2]).to eq("universal scope - function parameter")
|
125
167
|
end
|
126
|
-
|
168
|
+
|
127
169
|
schema.functions.first.types.first.tap do |x|
|
128
170
|
expect(x).to be_instance_of(Expressir::Model::Type)
|
129
171
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -136,13 +178,16 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
136
178
|
x.type.items.first.tap do |x|
|
137
179
|
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
138
180
|
expect(x.remarks).to be_instance_of(Array)
|
139
|
-
expect(x.remarks.count).to eq(
|
181
|
+
expect(x.remarks.count).to eq(6)
|
140
182
|
expect(x.remarks[0]).to eq("function scope - function enumeration item")
|
141
|
-
expect(x.remarks[1]).to eq("
|
142
|
-
expect(x.remarks[2]).to eq("
|
183
|
+
expect(x.remarks[1]).to eq("function scope - function enumeration item, on the same level as the type")
|
184
|
+
expect(x.remarks[2]).to eq("schema scope - function enumeration item")
|
185
|
+
expect(x.remarks[3]).to eq("schema scope - function enumeration item, on the same level as the type")
|
186
|
+
expect(x.remarks[4]).to eq("universal scope - function enumeration item")
|
187
|
+
expect(x.remarks[5]).to eq("universal scope - function enumeration item, on the same level as the type")
|
143
188
|
end
|
144
189
|
end
|
145
|
-
|
190
|
+
|
146
191
|
schema.functions.first.constants.first.tap do |x|
|
147
192
|
expect(x).to be_instance_of(Expressir::Model::Constant)
|
148
193
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -151,7 +196,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
151
196
|
expect(x.remarks[1]).to eq("schema scope - function constant")
|
152
197
|
expect(x.remarks[2]).to eq("universal scope - function constant")
|
153
198
|
end
|
154
|
-
|
199
|
+
|
155
200
|
schema.functions.first.variables.first.tap do |x|
|
156
201
|
expect(x).to be_instance_of(Expressir::Model::Variable)
|
157
202
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -160,21 +205,21 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
160
205
|
expect(x.remarks[1]).to eq("schema scope - function variable")
|
161
206
|
expect(x.remarks[2]).to eq("universal scope - function variable")
|
162
207
|
end
|
163
|
-
|
208
|
+
|
164
209
|
schema.functions.first.statements[0].tap do |x|
|
165
210
|
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
166
211
|
expect(x.remarks).to be_instance_of(Array)
|
167
212
|
expect(x.remarks.count).to eq(1)
|
168
213
|
expect(x.remarks[0]).to eq("function alias scope - function alias")
|
169
214
|
end
|
170
|
-
|
215
|
+
|
171
216
|
schema.functions.first.statements[1].tap do |x|
|
172
217
|
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
173
218
|
expect(x.remarks).to be_instance_of(Array)
|
174
219
|
expect(x.remarks.count).to eq(1)
|
175
220
|
expect(x.remarks[0]).to eq("function repeat scope - function repeat")
|
176
221
|
end
|
177
|
-
|
222
|
+
|
178
223
|
schema.functions.first.statements[2].tap do |x|
|
179
224
|
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
180
225
|
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
@@ -182,7 +227,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
182
227
|
expect(x.expression.remarks.count).to eq(1)
|
183
228
|
expect(x.expression.remarks[0]).to eq("function query scope - function query")
|
184
229
|
end
|
185
|
-
|
230
|
+
|
186
231
|
schema.procedures.first.tap do |x|
|
187
232
|
expect(x).to be_instance_of(Expressir::Model::Procedure)
|
188
233
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -190,7 +235,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
190
235
|
expect(x.remarks[0]).to eq("schema scope - procedure")
|
191
236
|
expect(x.remarks[1]).to eq("universal scope - procedure")
|
192
237
|
end
|
193
|
-
|
238
|
+
|
194
239
|
schema.procedures.first.parameters.first.tap do |x|
|
195
240
|
expect(x).to be_instance_of(Expressir::Model::Parameter)
|
196
241
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -199,7 +244,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
199
244
|
expect(x.remarks[1]).to eq("schema scope - procedure parameter")
|
200
245
|
expect(x.remarks[2]).to eq("universal scope - procedure parameter")
|
201
246
|
end
|
202
|
-
|
247
|
+
|
203
248
|
schema.procedures.first.types.first.tap do |x|
|
204
249
|
expect(x).to be_instance_of(Expressir::Model::Type)
|
205
250
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -212,13 +257,16 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
212
257
|
x.type.items.first.tap do |x|
|
213
258
|
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
214
259
|
expect(x.remarks).to be_instance_of(Array)
|
215
|
-
expect(x.remarks.count).to eq(
|
260
|
+
expect(x.remarks.count).to eq(6)
|
216
261
|
expect(x.remarks[0]).to eq("procedure scope - procedure enumeration item")
|
217
|
-
expect(x.remarks[1]).to eq("
|
218
|
-
expect(x.remarks[2]).to eq("
|
262
|
+
expect(x.remarks[1]).to eq("procedure scope - procedure enumeration item, on the same level as the type")
|
263
|
+
expect(x.remarks[2]).to eq("schema scope - procedure enumeration item")
|
264
|
+
expect(x.remarks[3]).to eq("schema scope - procedure enumeration item, on the same level as the type")
|
265
|
+
expect(x.remarks[4]).to eq("universal scope - procedure enumeration item")
|
266
|
+
expect(x.remarks[5]).to eq("universal scope - procedure enumeration item, on the same level as the type")
|
219
267
|
end
|
220
268
|
end
|
221
|
-
|
269
|
+
|
222
270
|
schema.procedures.first.constants.first.tap do |x|
|
223
271
|
expect(x).to be_instance_of(Expressir::Model::Constant)
|
224
272
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -227,7 +275,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
227
275
|
expect(x.remarks[1]).to eq("schema scope - procedure constant")
|
228
276
|
expect(x.remarks[2]).to eq("universal scope - procedure constant")
|
229
277
|
end
|
230
|
-
|
278
|
+
|
231
279
|
schema.procedures.first.variables.first.tap do |x|
|
232
280
|
expect(x).to be_instance_of(Expressir::Model::Variable)
|
233
281
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -236,21 +284,21 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
236
284
|
expect(x.remarks[1]).to eq("schema scope - procedure variable")
|
237
285
|
expect(x.remarks[2]).to eq("universal scope - procedure variable")
|
238
286
|
end
|
239
|
-
|
287
|
+
|
240
288
|
schema.procedures.first.statements[0].tap do |x|
|
241
289
|
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
242
290
|
expect(x.remarks).to be_instance_of(Array)
|
243
291
|
expect(x.remarks.count).to eq(1)
|
244
292
|
expect(x.remarks[0]).to eq("procedure alias scope - procedure alias")
|
245
293
|
end
|
246
|
-
|
294
|
+
|
247
295
|
schema.procedures.first.statements[1].tap do |x|
|
248
296
|
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
249
297
|
expect(x.remarks).to be_instance_of(Array)
|
250
298
|
expect(x.remarks.count).to eq(1)
|
251
299
|
expect(x.remarks[0]).to eq("procedure repeat scope - procedure repeat")
|
252
300
|
end
|
253
|
-
|
301
|
+
|
254
302
|
schema.procedures.first.statements[2].tap do |x|
|
255
303
|
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
256
304
|
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
@@ -258,7 +306,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
258
306
|
expect(x.expression.remarks.count).to eq(1)
|
259
307
|
expect(x.expression.remarks[0]).to eq("procedure query scope - procedure query")
|
260
308
|
end
|
261
|
-
|
309
|
+
|
262
310
|
schema.rules.first.tap do |x|
|
263
311
|
expect(x).to be_instance_of(Expressir::Model::Rule)
|
264
312
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -266,7 +314,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
266
314
|
expect(x.remarks[0]).to eq("schema scope - rule")
|
267
315
|
expect(x.remarks[1]).to eq("universal scope - rule")
|
268
316
|
end
|
269
|
-
|
317
|
+
|
270
318
|
schema.rules.first.types.first.tap do |x|
|
271
319
|
expect(x).to be_instance_of(Expressir::Model::Type)
|
272
320
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -279,13 +327,16 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
279
327
|
x.type.items.first.tap do |x|
|
280
328
|
expect(x).to be_instance_of(Expressir::Model::EnumerationItem)
|
281
329
|
expect(x.remarks).to be_instance_of(Array)
|
282
|
-
expect(x.remarks.count).to eq(
|
330
|
+
expect(x.remarks.count).to eq(6)
|
283
331
|
expect(x.remarks[0]).to eq("rule scope - rule enumeration item")
|
284
|
-
expect(x.remarks[1]).to eq("
|
285
|
-
expect(x.remarks[2]).to eq("
|
332
|
+
expect(x.remarks[1]).to eq("rule scope - rule enumeration item, on the same level as the type")
|
333
|
+
expect(x.remarks[2]).to eq("schema scope - rule enumeration item")
|
334
|
+
expect(x.remarks[3]).to eq("schema scope - rule enumeration item, on the same level as the type")
|
335
|
+
expect(x.remarks[4]).to eq("universal scope - rule enumeration item")
|
336
|
+
expect(x.remarks[5]).to eq("universal scope - rule enumeration item, on the same level as the type")
|
286
337
|
end
|
287
338
|
end
|
288
|
-
|
339
|
+
|
289
340
|
schema.rules.first.constants.first.tap do |x|
|
290
341
|
expect(x).to be_instance_of(Expressir::Model::Constant)
|
291
342
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -294,7 +345,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
294
345
|
expect(x.remarks[1]).to eq("schema scope - rule constant")
|
295
346
|
expect(x.remarks[2]).to eq("universal scope - rule constant")
|
296
347
|
end
|
297
|
-
|
348
|
+
|
298
349
|
schema.rules.first.variables.first.tap do |x|
|
299
350
|
expect(x).to be_instance_of(Expressir::Model::Variable)
|
300
351
|
expect(x.remarks).to be_instance_of(Array)
|
@@ -303,21 +354,21 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
303
354
|
expect(x.remarks[1]).to eq("schema scope - rule variable")
|
304
355
|
expect(x.remarks[2]).to eq("universal scope - rule variable")
|
305
356
|
end
|
306
|
-
|
357
|
+
|
307
358
|
schema.rules.first.statements[0].tap do |x|
|
308
359
|
expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
|
309
360
|
expect(x.remarks).to be_instance_of(Array)
|
310
361
|
expect(x.remarks.count).to eq(1)
|
311
362
|
expect(x.remarks[0]).to eq("rule alias scope - rule alias")
|
312
363
|
end
|
313
|
-
|
364
|
+
|
314
365
|
schema.rules.first.statements[1].tap do |x|
|
315
366
|
expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
|
316
367
|
expect(x.remarks).to be_instance_of(Array)
|
317
368
|
expect(x.remarks.count).to eq(1)
|
318
369
|
expect(x.remarks[0]).to eq("rule repeat scope - rule repeat")
|
319
370
|
end
|
320
|
-
|
371
|
+
|
321
372
|
schema.rules.first.statements[2].tap do |x|
|
322
373
|
expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
|
323
374
|
expect(x.expression).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
|
@@ -325,14 +376,29 @@ RSpec.describe Expressir::ExpressExp::Parser do
|
|
325
376
|
expect(x.expression.remarks.count).to eq(1)
|
326
377
|
expect(x.expression.remarks[0]).to eq("rule query scope - rule query")
|
327
378
|
end
|
328
|
-
|
379
|
+
|
329
380
|
schema.rules.first.where.first.tap do |x|
|
330
381
|
expect(x).to be_instance_of(Expressir::Model::Where)
|
331
382
|
expect(x.remarks).to be_instance_of(Array)
|
332
|
-
expect(x.remarks.count).to eq(
|
383
|
+
expect(x.remarks.count).to eq(6)
|
333
384
|
expect(x.remarks[0]).to eq("rule scope - rule where")
|
334
|
-
expect(x.remarks[1]).to eq("
|
335
|
-
expect(x.remarks[2]).to eq("
|
385
|
+
expect(x.remarks[1]).to eq("rule scope - rule where, with prefix")
|
386
|
+
expect(x.remarks[2]).to eq("schema scope - rule where")
|
387
|
+
expect(x.remarks[3]).to eq("schema scope - rule where, with prefix")
|
388
|
+
expect(x.remarks[4]).to eq("universal scope - rule where")
|
389
|
+
expect(x.remarks[5]).to eq("universal scope - rule where, with prefix")
|
390
|
+
end
|
391
|
+
|
392
|
+
schema.rules.first.informal_propositions.first.tap do |x|
|
393
|
+
expect(x).to be_instance_of(Expressir::Model::InformalProposition)
|
394
|
+
expect(x.remarks).to be_instance_of(Array)
|
395
|
+
expect(x.remarks.count).to eq(6)
|
396
|
+
expect(x.remarks[0]).to eq("rule scope - rule informal proposition")
|
397
|
+
expect(x.remarks[1]).to eq("rule scope - rule informal proposition, with prefix")
|
398
|
+
expect(x.remarks[2]).to eq("schema scope - rule informal proposition")
|
399
|
+
expect(x.remarks[3]).to eq("schema scope - rule informal proposition, with prefix")
|
400
|
+
expect(x.remarks[4]).to eq("universal scope - rule informal proposition")
|
401
|
+
expect(x.remarks[5]).to eq("universal scope - rule informal proposition, with prefix")
|
336
402
|
end
|
337
403
|
end
|
338
404
|
end
|