expressir 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +30 -17
- data/.gitignore +1 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +30 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +8 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +31 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +1 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +9 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +26 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +10 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +7 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +23 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +3 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +8 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +39 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +5 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +9 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +11 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +2 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +4 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +7 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +0 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +8 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +0 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +7 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +9 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +8 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +7 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +9 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +14 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +9 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +7 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +11 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +40 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +29 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +1 -1
- data/ext/express-parser/express_parser.cpp +20 -164
- data/ext/express-parser/extconf.rb +3 -4
- data/lib/expressir/express/parser.rb +17 -14
- data/lib/expressir/express/visitor.rb +3 -1
- data/lib/expressir/version.rb +1 -1
- metadata +2 -2
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'mkmf'
|
3
3
|
|
4
4
|
extension_name = 'express_parser'
|
5
|
-
cross_build =
|
5
|
+
cross_build = enable_config("cross-build")
|
6
6
|
|
7
7
|
antlr4_src = 'antlr4-upstream/runtime/Cpp/runtime/src'
|
8
8
|
src_paths = [
|
@@ -23,7 +23,7 @@ if cross_build
|
|
23
23
|
rice_root = Gem.loaded_specs["rice"].full_gem_path
|
24
24
|
rice_src = File.join(rice_root, "include", "rice")
|
25
25
|
rice_embed = File.join(__dir__, rice_subdir)
|
26
|
-
unless File.
|
26
|
+
unless File.exist?(rice_embed)
|
27
27
|
FileUtils.mkdir_p(rice_embed)
|
28
28
|
FileUtils.cp_r(Dir.glob(rice_src), rice_embed)
|
29
29
|
File.delete(*Dir.glob("#{rice_embed}/**/*.o"))
|
@@ -45,11 +45,10 @@ if cross_build
|
|
45
45
|
end
|
46
46
|
else
|
47
47
|
require 'mkmf-rice'
|
48
|
-
|
49
48
|
dir_config(extension_name)
|
50
49
|
end
|
51
50
|
|
52
|
-
$CPPFLAGS << " -std=c++17 -DANTLR4CPP_STATIC -DHAVE_CXX11"
|
51
|
+
$CPPFLAGS << " -std=c++17 -DANTLR4CPP_STATIC -DHAVE_CXX11 -fno-omit-frame-pointer"
|
53
52
|
$INCFLAGS << " -I#{__dir__}/#{antlr4_src}"
|
54
53
|
$srcs = []
|
55
54
|
|
@@ -33,23 +33,26 @@ module Expressir
|
|
33
33
|
def self.from_file(file, skip_references: nil, include_source: nil)
|
34
34
|
input = File.read(file)
|
35
35
|
|
36
|
-
|
36
|
+
# An important note re memory management
|
37
|
+
# parse, syntax, visitor methods return complex tree structures created in netive (C++) extension
|
38
|
+
# visit method references nodes and leaves of this structures but it is totally untransparent for Ruby GarbageCllector
|
39
|
+
# so in this class we keep those C++ structure marked for GC so theu are not freed
|
40
|
+
@parser = ::ExpressParser::Parser.parse(input)
|
41
|
+
@parse_tree = @parser.syntax()
|
37
42
|
|
38
|
-
|
43
|
+
@visitor = Visitor.new(@parser.tokens, include_source: include_source)
|
44
|
+
@repository = @visitor.visit(@parse_tree)
|
39
45
|
|
40
|
-
|
41
|
-
repository = visitor.visit(parse_tree)
|
42
|
-
|
43
|
-
repository.schemas.each do |schema|
|
46
|
+
@repository.schemas.each do |schema|
|
44
47
|
schema.file = file.to_s
|
45
48
|
end
|
46
49
|
|
47
50
|
unless skip_references
|
48
|
-
resolve_references_model_visitor = ResolveReferencesModelVisitor.new
|
49
|
-
resolve_references_model_visitor.visit(repository)
|
51
|
+
@resolve_references_model_visitor = ResolveReferencesModelVisitor.new
|
52
|
+
@resolve_references_model_visitor.visit(@repository)
|
50
53
|
end
|
51
54
|
|
52
|
-
repository
|
55
|
+
@repository
|
53
56
|
end
|
54
57
|
|
55
58
|
# Parses Express files into an Express model
|
@@ -65,16 +68,16 @@ module Expressir
|
|
65
68
|
repository.schemas
|
66
69
|
end.flatten
|
67
70
|
|
68
|
-
repository = Model::Repository.new(
|
71
|
+
@repository = Model::Repository.new(
|
69
72
|
schemas: schemas
|
70
73
|
)
|
71
74
|
|
72
|
-
unless skip_references
|
73
|
-
resolve_references_model_visitor = ResolveReferencesModelVisitor.new
|
74
|
-
resolve_references_model_visitor.visit(repository)
|
75
|
+
unless @skip_references
|
76
|
+
@resolve_references_model_visitor = ResolveReferencesModelVisitor.new
|
77
|
+
@resolve_references_model_visitor.visit(@repository)
|
75
78
|
end
|
76
79
|
|
77
|
-
repository
|
80
|
+
@repository
|
78
81
|
end
|
79
82
|
end
|
80
83
|
end
|
@@ -138,7 +138,9 @@ module Expressir
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def attach_remarks(ctx, node)
|
141
|
-
remark_tokens = get_tokens(ctx)
|
141
|
+
remark_tokens = get_tokens(ctx)
|
142
|
+
remark_tokens = remark_tokens.select{ |x| x.channel == REMARK_CHANNEL
|
143
|
+
}
|
142
144
|
|
143
145
|
# skip already attached remarks
|
144
146
|
remark_tokens = remark_tokens.select{|x| !@attached_remark_tokens.include?(x)}
|
data/lib/expressir/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expressir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04
|
11
|
+
date: 2022-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|