expressir 0.2.5 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7ba84b2e2bb6810108340208cb5d2e72047af1576990acfeb73c4f077eb8ba2
|
4
|
+
data.tar.gz: e92db63b885211b20df63adb3f91e6bb299af7ce745aa4c6f9557e7deb583257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ded502bc8563615f49af32175de1127b41aa019f0efe42699ba953da542bc5df04d3639196c6355f55d1b12c94b496eb8bfe03e1e41a179df69bfd97270dc5a
|
7
|
+
data.tar.gz: 99015fc2a30fe12f69ccd861ffd49e54593666e6892176f0076c90f215df282bb77c83ddf7bf197915366bdab162757a1834851dd4118426de9fb38735c69855
|
data/.cross_rubies
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
3.0.0:i686-w64-mingw32
|
2
|
+
3.0.0:x86_64-w64-mingw32
|
3
|
+
3.0.0:i686-linux-gnu
|
4
|
+
3.0.0:x86_64-linux-gnu
|
5
|
+
3.0.0:x86_64-darwin
|
6
|
+
3.0.0:arm64-darwin
|
7
|
+
2.7.0:i686-w64-mingw32
|
8
|
+
2.7.0:x86_64-w64-mingw32
|
9
|
+
2.7.0:i686-linux-gnu
|
10
|
+
2.7.0:x86_64-linux-gnu
|
11
|
+
2.7.0:x86_64-darwin
|
12
|
+
2.7.0:arm64-darwin
|
13
|
+
2.6.0:i686-w64-mingw32
|
14
|
+
2.6.0:x86_64-w64-mingw32
|
15
|
+
2.6.0:i686-linux-gnu
|
16
|
+
2.6.0:x86_64-linux-gnu
|
17
|
+
2.6.0:x86_64-darwin
|
18
|
+
2.6.0:arm64-darwin
|
19
|
+
2.5.0:i686-w64-mingw32
|
20
|
+
2.5.0:x86_64-w64-mingw32
|
21
|
+
2.5.0:i686-linux-gnu
|
22
|
+
2.5.0:x86_64-linux-gnu
|
23
|
+
2.5.0:x86_64-darwin
|
24
|
+
2.5.0:arm64-darwin
|
25
|
+
2.4.0:i686-w64-mingw32
|
26
|
+
2.4.0:x86_64-w64-mingw32
|
27
|
+
2.4.0:i686-linux-gnu
|
28
|
+
2.4.0:x86_64-linux-gnu
|
29
|
+
2.4.0:x86_64-darwin
|
30
|
+
2.4.0:arm64-darwin
|
data/.github/workflows/rake.yml
CHANGED
@@ -3,8 +3,6 @@ name: rake
|
|
3
3
|
on:
|
4
4
|
push:
|
5
5
|
branches: [ master ]
|
6
|
-
tags:
|
7
|
-
- '*'
|
8
6
|
pull_request:
|
9
7
|
|
10
8
|
jobs:
|
@@ -18,28 +16,29 @@ jobs:
|
|
18
16
|
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
19
17
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
20
18
|
experimental: [ false ]
|
19
|
+
include:
|
20
|
+
- ruby: '3.0'
|
21
|
+
os: 'ubuntu-latest'
|
22
|
+
experimental: true
|
23
|
+
- ruby: '3.0'
|
24
|
+
os: 'windows-latest'
|
25
|
+
experimental: true
|
26
|
+
- ruby: '3.0'
|
27
|
+
os: 'macos-latest'
|
28
|
+
experimental: true
|
21
29
|
|
22
30
|
steps:
|
23
31
|
- uses: actions/checkout@v2
|
24
32
|
with:
|
25
33
|
submodules: recursive
|
26
34
|
|
27
|
-
- uses: ruby/setup-ruby@v1
|
28
|
-
with:
|
29
|
-
ruby-version: ${{ matrix.ruby }}
|
30
|
-
|
31
|
-
- uses: actions/cache@v2
|
32
|
-
with:
|
33
|
-
path: vendor/bundle
|
34
|
-
key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
|
35
|
-
restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
|
36
|
-
|
37
35
|
- if: matrix.os == 'macos-latest'
|
38
36
|
run: brew install autoconf automake libtool
|
39
37
|
|
40
|
-
-
|
41
|
-
|
42
|
-
|
38
|
+
- uses: ruby/setup-ruby@v1
|
39
|
+
with:
|
40
|
+
ruby-version: ${{ matrix.ruby }}
|
41
|
+
bundler-cache: true
|
43
42
|
|
44
43
|
- run: bundle exec rake compile
|
45
44
|
|
@@ -7,11 +7,11 @@ on:
|
|
7
7
|
|
8
8
|
jobs:
|
9
9
|
pack:
|
10
|
-
runs-on:
|
10
|
+
runs-on: ubuntu-18.04
|
11
11
|
strategy:
|
12
12
|
fail-fast: false
|
13
13
|
matrix:
|
14
|
-
|
14
|
+
host: [ linux, windows, darwin ]
|
15
15
|
steps:
|
16
16
|
- uses: actions/checkout@v2
|
17
17
|
with:
|
@@ -19,39 +19,48 @@ jobs:
|
|
19
19
|
|
20
20
|
- uses: ruby/setup-ruby@v1
|
21
21
|
with:
|
22
|
-
ruby-version: '2.
|
23
|
-
|
24
|
-
- if: matrix.os == 'macos-latest'
|
25
|
-
run: brew install autoconf automake libtool
|
22
|
+
ruby-version: '2.6'
|
26
23
|
|
27
24
|
- run: bundle install --jobs 4 --retry 3
|
28
25
|
|
29
|
-
- run:
|
26
|
+
- run: gem build expressir.gemspec
|
27
|
+
|
28
|
+
- if: matrix.host == 'linux'
|
29
|
+
uses: actions/upload-artifact@v2
|
30
|
+
with:
|
31
|
+
name: pkg-ruby
|
32
|
+
path: expressir-*.gem
|
30
33
|
|
31
|
-
- run: bundle exec rake
|
34
|
+
- run: bundle exec rake gem:${{ matrix.host }}
|
32
35
|
|
33
36
|
- uses: actions/upload-artifact@v2
|
34
37
|
with:
|
35
|
-
name: pkg-${{ matrix.
|
38
|
+
name: pkg-${{ matrix.host }}
|
36
39
|
path: pkg/*.gem
|
37
40
|
|
41
|
+
|
38
42
|
release:
|
39
43
|
runs-on: ubuntu-18.04
|
40
44
|
needs: pack
|
41
45
|
steps:
|
42
46
|
- uses: actions/download-artifact@v2
|
43
47
|
with:
|
44
|
-
name: pkg-
|
48
|
+
name: pkg-ruby
|
49
|
+
path: pkg
|
50
|
+
|
51
|
+
- uses: actions/download-artifact@v2
|
52
|
+
with:
|
53
|
+
name: pkg-linux
|
45
54
|
path: pkg
|
46
55
|
|
47
56
|
- uses: actions/download-artifact@v2
|
48
57
|
with:
|
49
|
-
name: pkg-windows
|
58
|
+
name: pkg-windows
|
50
59
|
path: pkg
|
51
60
|
|
52
61
|
- uses: actions/download-artifact@v2
|
53
62
|
with:
|
54
|
-
name: pkg-
|
63
|
+
name: pkg-darwin
|
55
64
|
path: pkg
|
56
65
|
|
57
66
|
- uses: ruby/setup-ruby@v1
|
@@ -62,14 +71,13 @@ jobs:
|
|
62
71
|
|
63
72
|
- name: Publish to rubygems.org
|
64
73
|
env:
|
65
|
-
RUBYGEMS_API_KEY: ${{secrets.LUTAML_CI_RUBYGEMS_API_KEY}}
|
74
|
+
RUBYGEMS_API_KEY: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
|
66
75
|
run: |
|
67
76
|
mkdir -p ~/.gem
|
68
|
-
cat
|
77
|
+
cat > ~/.gem/credentials << EOF
|
69
78
|
---
|
70
79
|
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
71
80
|
EOF
|
72
81
|
chmod 0600 ~/.gem/credentials
|
73
|
-
gem -v
|
74
82
|
gem signin
|
75
|
-
for gem in pkg/*.gem; do gem push $gem -V
|
83
|
+
for gem in pkg/*.gem; do gem push $gem -V; done
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -6,12 +6,6 @@ RSpec::Core::RakeTask.new(:spec)
|
|
6
6
|
|
7
7
|
task :default => :spec
|
8
8
|
|
9
|
-
|
9
|
+
GEMSPEC = Gem::Specification.load("expressir.gemspec")
|
10
10
|
|
11
|
-
|
12
|
-
Gem::PackageTask.new(spec) do |pkg|
|
13
|
-
end
|
14
|
-
|
15
|
-
ext = Rake::ExtensionTask.new("express_parser", spec) do |ext|
|
16
|
-
ext.ext_dir = "ext/express-parser"
|
17
|
-
end
|
11
|
+
Gem::PackageTask.new(GEMSPEC).define
|
data/expressir.gemspec
CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.metadata["source_code_uri"] = spec.homepage
|
18
18
|
spec.metadata["changelog_uri"] = "https://github.com/lutaml/expressir/releases"
|
19
19
|
|
20
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
21
|
+
|
20
22
|
spec.files = `git ls-files`.split("\n")\
|
21
23
|
+ Dir.glob('ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/**/*')
|
22
24
|
|
@@ -28,13 +30,14 @@ Gem::Specification.new do |spec|
|
|
28
30
|
|
29
31
|
spec.extensions = File.join(*%w(ext express-parser extconf.rb))
|
30
32
|
|
33
|
+
spec.add_runtime_dependency "nokogiri", "~> 1.10"
|
31
34
|
spec.add_runtime_dependency "thor", "~> 1.0"
|
32
|
-
spec.add_runtime_dependency "rice", "~>
|
35
|
+
spec.add_runtime_dependency "rice", "~> 3"
|
33
36
|
spec.add_development_dependency "antlr4-native", "~> 1.1.0"
|
34
|
-
spec.add_development_dependency "nokogiri", "~> 1.10"
|
35
37
|
spec.add_development_dependency "bundler", "~> 2.0"
|
36
38
|
spec.add_development_dependency "pry", "~> 0.12.2"
|
37
|
-
spec.add_development_dependency "rake", "~>
|
38
|
-
spec.add_development_dependency "rake-compiler", "~> 1.1
|
39
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
40
|
+
spec.add_development_dependency "rake-compiler", "~> 1.1"
|
41
|
+
spec.add_development_dependency "rake-compiler-dock", "~> 1.1"
|
39
42
|
spec.add_development_dependency "rspec", "~> 3.0"
|
40
43
|
end
|
@@ -1,24 +1,26 @@
|
|
1
1
|
#include <iostream>
|
2
2
|
|
3
|
-
#include
|
3
|
+
#include <antlr4-runtime.h>
|
4
4
|
|
5
|
-
#include "ExpressParser.h"
|
6
|
-
#include "ExpressBaseVisitor.h"
|
7
|
-
#include "ExpressLexer.h"
|
5
|
+
#include "antlrgen/ExpressParser.h"
|
6
|
+
#include "antlrgen/ExpressBaseVisitor.h"
|
7
|
+
#include "antlrgen/ExpressLexer.h"
|
8
8
|
|
9
|
-
#include
|
10
|
-
#include
|
11
|
-
#include
|
12
|
-
#include
|
9
|
+
#include <rice/Array.hpp>
|
10
|
+
#include <rice/Class.hpp>
|
11
|
+
#include <rice/Constructor.hpp>
|
12
|
+
#include <rice/Director.hpp>
|
13
13
|
|
14
14
|
#ifdef _WIN32
|
15
|
-
#undef FALSE
|
16
|
-
#undef TRUE
|
17
15
|
#undef OPTIONAL
|
18
16
|
#undef IN
|
19
17
|
#undef OUT
|
20
18
|
#endif
|
21
19
|
|
20
|
+
// ruby-3.0
|
21
|
+
#undef FALSE
|
22
|
+
#undef TRUE
|
23
|
+
|
22
24
|
using namespace std;
|
23
25
|
using namespace Rice;
|
24
26
|
using namespace antlr4;
|
@@ -1,34 +1,57 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems'
|
2
|
+
require 'mkmf'
|
2
3
|
|
3
4
|
extension_name = 'express_parser'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
'antlr4-upstream/runtime/Cpp/runtime/src/tree',
|
19
|
-
'antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern',
|
20
|
-
'antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath'
|
5
|
+
cross_build = enable_config("cross-build")
|
6
|
+
|
7
|
+
antlr4_src = 'antlr4-upstream/runtime/Cpp/runtime/src'
|
8
|
+
src_paths = [
|
9
|
+
".",
|
10
|
+
"antlrgen",
|
11
|
+
"#{antlr4_src}",
|
12
|
+
"#{antlr4_src}/atn",
|
13
|
+
"#{antlr4_src}/dfa",
|
14
|
+
"#{antlr4_src}/misc",
|
15
|
+
"#{antlr4_src}/support",
|
16
|
+
"#{antlr4_src}/tree",
|
17
|
+
"#{antlr4_src}/tree/pattern",
|
18
|
+
"#{antlr4_src}/tree/xpath",
|
21
19
|
]
|
22
20
|
|
23
|
-
|
21
|
+
if cross_build
|
22
|
+
rice_subdir = "rice-embed"
|
23
|
+
rice_root = Gem.loaded_specs["rice"].full_gem_path
|
24
|
+
rice_src = File.join(rice_root, "rice")
|
25
|
+
rice_embed = File.join(__dir__, rice_subdir)
|
26
|
+
unless File.exists?(rice_embed)
|
27
|
+
FileUtils.mkdir_p(rice_embed)
|
28
|
+
FileUtils.cp_r(Dir.glob(rice_src), rice_embed)
|
29
|
+
File.delete(*Dir.glob("#{rice_embed}/**/*.o"))
|
30
|
+
File.delete(*Dir.glob("#{rice_embed}/**/Makefile"))
|
31
|
+
end
|
24
32
|
|
25
|
-
|
26
|
-
$INCFLAGS << " -I#{__dir__}/#{include_path}"
|
27
|
-
$VPATH << "#{__dir__}/#{include_path}"
|
33
|
+
src_paths.push("#{rice_subdir}/rice", "#{rice_subdir}/rice/detail")
|
28
34
|
|
29
|
-
|
30
|
-
|
35
|
+
$INCFLAGS << " -I#{__dir__}/#{rice_subdir}"
|
36
|
+
|
37
|
+
if RbConfig::CONFIG['target_os'] =~ /mingw32|mswin/
|
38
|
+
# workaround for 'w64-mingw32-as: express_parser.o: too many sections'
|
39
|
+
$CXXFLAGS << " -O3 -Wa,-mbig-obj"
|
31
40
|
end
|
41
|
+
else
|
42
|
+
require 'mkmf-rice'
|
43
|
+
|
44
|
+
dir_config(extension_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
$CPPFLAGS << " -std=c++14 -DANTLR4CPP_STATIC -DHAVE_CXX11"
|
48
|
+
$INCFLAGS << " -I#{__dir__}/#{antlr4_src}"
|
49
|
+
$srcs = []
|
50
|
+
|
51
|
+
src_paths.each do |src_path|
|
52
|
+
abs_src_path = File.join(__dir__, src_path)
|
53
|
+
$VPATH << abs_src_path
|
54
|
+
$srcs.push(*Dir["#{abs_src_path}/*.cpp"])
|
32
55
|
end
|
33
56
|
|
34
|
-
create_makefile
|
57
|
+
create_makefile "expressir/express_exp/#{extension_name}"
|
@@ -233,6 +233,10 @@ module Expressir
|
|
233
233
|
end
|
234
234
|
|
235
235
|
def format_entity(node)
|
236
|
+
explicit_attributes = node.attributes.select{|x| x.kind == Model::Attribute::EXPLICIT}
|
237
|
+
derived_attributes = node.attributes.select{|x| x.kind == Model::Attribute::DERIVED}
|
238
|
+
inverse_attributes = node.attributes.select{|x| x.kind == Model::Attribute::INVERSE}
|
239
|
+
|
236
240
|
[
|
237
241
|
[
|
238
242
|
'ENTITY',
|
@@ -290,19 +294,19 @@ module Expressir
|
|
290
294
|
end,
|
291
295
|
';'
|
292
296
|
].join(''),
|
293
|
-
*if
|
294
|
-
indent(
|
297
|
+
*if explicit_attributes and explicit_attributes.length > 0
|
298
|
+
indent(explicit_attributes.map{|x| format(x)}.join("\n"))
|
295
299
|
end,
|
296
|
-
*if
|
300
|
+
*if derived_attributes and derived_attributes.length > 0
|
297
301
|
indent([
|
298
302
|
'DERIVE',
|
299
|
-
indent(
|
303
|
+
indent(derived_attributes.map{|x| format(x)}.join("\n")),
|
300
304
|
].join("\n"))
|
301
305
|
end,
|
302
|
-
*if
|
306
|
+
*if inverse_attributes and inverse_attributes.length > 0
|
303
307
|
indent([
|
304
308
|
'INVERSE',
|
305
|
-
indent(
|
309
|
+
indent(inverse_attributes.map{|x| format(x)}.join("\n")),
|
306
310
|
].join("\n"))
|
307
311
|
end,
|
308
312
|
*if node.unique and node.unique.length > 0
|
@@ -347,8 +351,20 @@ module Expressir
|
|
347
351
|
format(node.return_type),
|
348
352
|
';'
|
349
353
|
].join(''),
|
350
|
-
*if node.
|
351
|
-
indent(node.
|
354
|
+
*if node.types and node.types.length > 0
|
355
|
+
indent(node.types.map{|x| format(x)}.join("\n"))
|
356
|
+
end,
|
357
|
+
*if node.entities and node.entities.length > 0
|
358
|
+
indent(node.entities.map{|x| format(x)}.join("\n"))
|
359
|
+
end,
|
360
|
+
*if node.subtype_constraints and node.subtype_constraints.length > 0
|
361
|
+
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
362
|
+
end,
|
363
|
+
*if node.functions and node.functions.length > 0
|
364
|
+
indent(node.functions.map{|x| format(x)}.join("\n"))
|
365
|
+
end,
|
366
|
+
*if node.procedures and node.procedures.length > 0
|
367
|
+
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
352
368
|
end,
|
353
369
|
*if node.constants and node.constants.length > 0
|
354
370
|
indent([
|
@@ -395,7 +411,7 @@ module Expressir
|
|
395
411
|
"\n",
|
396
412
|
INDENT,
|
397
413
|
'(',
|
398
|
-
node.items.map{|x| format(x)},
|
414
|
+
node.items.map{|x| format(x)}.join(', '),
|
399
415
|
')'
|
400
416
|
].join('')
|
401
417
|
end,
|
@@ -434,8 +450,20 @@ module Expressir
|
|
434
450
|
end,
|
435
451
|
';'
|
436
452
|
].join(''),
|
437
|
-
*if node.
|
438
|
-
indent(node.
|
453
|
+
*if node.types and node.types.length > 0
|
454
|
+
indent(node.types.map{|x| format(x)}.join("\n"))
|
455
|
+
end,
|
456
|
+
*if node.entities and node.entities.length > 0
|
457
|
+
indent(node.entities.map{|x| format(x)}.join("\n"))
|
458
|
+
end,
|
459
|
+
*if node.subtype_constraints and node.subtype_constraints.length > 0
|
460
|
+
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
461
|
+
end,
|
462
|
+
*if node.functions and node.functions.length > 0
|
463
|
+
indent(node.functions.map{|x| format(x)}.join("\n"))
|
464
|
+
end,
|
465
|
+
*if node.procedures and node.procedures.length > 0
|
466
|
+
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
439
467
|
end,
|
440
468
|
*if node.constants and node.constants.length > 0
|
441
469
|
indent([
|
@@ -500,8 +528,20 @@ module Expressir
|
|
500
528
|
')',
|
501
529
|
';'
|
502
530
|
].join(''),
|
503
|
-
*if node.
|
504
|
-
indent(node.
|
531
|
+
*if node.types and node.types.length > 0
|
532
|
+
indent(node.types.map{|x| format(x)}.join("\n"))
|
533
|
+
end,
|
534
|
+
*if node.entities and node.entities.length > 0
|
535
|
+
indent(node.entities.map{|x| format(x)}.join("\n"))
|
536
|
+
end,
|
537
|
+
*if node.subtype_constraints and node.subtype_constraints.length > 0
|
538
|
+
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
539
|
+
end,
|
540
|
+
*if node.functions and node.functions.length > 0
|
541
|
+
indent(node.functions.map{|x| format(x)}.join("\n"))
|
542
|
+
end,
|
543
|
+
*if node.procedures and node.procedures.length > 0
|
544
|
+
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
505
545
|
end,
|
506
546
|
*if node.constants and node.constants.length > 0
|
507
547
|
indent([
|
@@ -566,8 +606,23 @@ module Expressir
|
|
566
606
|
].join('')
|
567
607
|
].join("\n")
|
568
608
|
end,
|
569
|
-
*if node.
|
570
|
-
node.
|
609
|
+
*if node.types and node.types.length > 0
|
610
|
+
node.types.map{|x| format(x)}.join("\n")
|
611
|
+
end,
|
612
|
+
*if node.entities and node.entities.length > 0
|
613
|
+
node.entities.map{|x| format(x)}.join("\n")
|
614
|
+
end,
|
615
|
+
*if node.subtype_constraints and node.subtype_constraints.length > 0
|
616
|
+
node.subtype_constraints.map{|x| format(x)}.join("\n")
|
617
|
+
end,
|
618
|
+
*if node.functions and node.functions.length > 0
|
619
|
+
node.functions.map{|x| format(x)}.join("\n")
|
620
|
+
end,
|
621
|
+
*if node.procedures and node.procedures.length > 0
|
622
|
+
node.procedures.map{|x| format(x)}.join("\n")
|
623
|
+
end,
|
624
|
+
*if node.rules and node.rules.length > 0
|
625
|
+
node.rules.map{|x| format(x)}.join("\n")
|
571
626
|
end,
|
572
627
|
[
|
573
628
|
'END_SCHEMA',
|
@@ -832,7 +887,7 @@ module Expressir
|
|
832
887
|
' ',
|
833
888
|
'<*',
|
834
889
|
' ',
|
835
|
-
format(node.
|
890
|
+
format(node.aggregate_source),
|
836
891
|
' ',
|
837
892
|
'|',
|
838
893
|
' ',
|
@@ -1226,7 +1281,7 @@ module Expressir
|
|
1226
1281
|
format(node.extension_type)
|
1227
1282
|
].join('')
|
1228
1283
|
end,
|
1229
|
-
*if node.extension_items
|
1284
|
+
*if node.extension_items and node.extension_items.length > 0
|
1230
1285
|
[
|
1231
1286
|
' ',
|
1232
1287
|
'WITH',
|
@@ -1330,7 +1385,7 @@ module Expressir
|
|
1330
1385
|
format(node.extension_type)
|
1331
1386
|
].join('')
|
1332
1387
|
end,
|
1333
|
-
*if node.extension_items
|
1388
|
+
*if node.extension_items and node.extension_items.length > 0
|
1334
1389
|
[
|
1335
1390
|
' ',
|
1336
1391
|
'WITH',
|
@@ -1437,11 +1492,7 @@ module Expressir
|
|
1437
1492
|
[
|
1438
1493
|
*format_remarks(node),
|
1439
1494
|
*if node.class.method_defined? :children
|
1440
|
-
node.children.
|
1441
|
-
if x != node
|
1442
|
-
format_scope_remarks(x)
|
1443
|
-
end
|
1444
|
-
end
|
1495
|
+
node.children.select{|x| x.parent == node}.flat_map{|x| format_scope_remarks(x)}
|
1445
1496
|
end
|
1446
1497
|
]
|
1447
1498
|
end
|