expressir 0.2.15-arm64-darwin → 0.2.16-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 208d83cf0aee5461042d62fc1c42ca4b214fe99940d11e73f923014c378cc211
4
- data.tar.gz: 73f0554790b85512af8e50427cbd018952369e70a0ea0fa41cd100c62657ba0f
3
+ metadata.gz: 4434e8950479964d24b92001471b18b255280bff72bde3b884694d531e978340
4
+ data.tar.gz: 9ea6ecaffa01cd72aae09b6c26fb35356bd930609523fe665d0b8646a70f3af9
5
5
  SHA512:
6
- metadata.gz: 2cb92ced284a85576cb9969f9fc420d1ab29657b78884a47373b1533fdfc5879dfd99f4e8d6132d44b85cd3e91de02d9a3a4d71eecd84ce9545083e41e9bef7c
7
- data.tar.gz: d66e291200114f68200b95e2844b99d8fb95c874e8de88601b954682f39b4d11fb2b0f9cfe449d0dda43b79f5177f055db410a3ec63e8139f49aca98d9df7add
6
+ metadata.gz: 6d758cecab5718d38be4c4699d070af1f295c882ce69812c75360ba0aea67d501accc91228c01721b26254a3493f4048789f47bb7750c76969c10d0986eee2fc
7
+ data.tar.gz: aa436fdd2e147002268af92851fcdebb34014698a3ba62488a245d00721fbd69a9cc4f683010f38df298c9781429d3960b2eafed56d62568df5ed50eb3dc6073
@@ -1,8 +1,6 @@
1
- require "expressir/express_exp/formatter"
2
-
3
1
  module Expressir
4
2
  module ExpressExp
5
- class HyperlinkFormatter < Formatter
3
+ module HyperlinkFormatter
6
4
  def format_expressions_simple_reference(node)
7
5
  return node.id if node.parent.is_a? Model::Expressions::AttributeReference
8
6
 
@@ -1,8 +1,6 @@
1
- require "expressir/express_exp/formatter"
2
-
3
1
  module Expressir
4
2
  module ExpressExp
5
- class SchemaHeadFormatter < Formatter
3
+ module SchemaHeadFormatter
6
4
  def format_schema(node)
7
5
  [
8
6
  "SCHEMA #{node.id}#{node.version ? " #{format(node.version)}" : ""};",
@@ -92,35 +92,11 @@ module Expressir
92
92
  @tokens[start_index..stop_index]
93
93
  end
94
94
 
95
- def get_head_tokens(ctx)
96
- start_index, stop_index = if ctx.is_a? ::ExpressParser::SchemaDeclContext
97
- start_index = ctx.start.token_index
98
- stop_index = if ctx.schema_body.interface_specification.length > 0
99
- ctx.schema_body.interface_specification.last.stop.token_index
100
- elsif ctx.schema_version_id
101
- ctx.schema_version_id.stop.token_index + 1
102
- else
103
- ctx.schema_id.stop.token_index + 1
104
- end
105
-
106
- [start_index, stop_index]
107
- end
108
-
109
- if start_index and stop_index
110
- @tokens[start_index..stop_index]
111
- end
112
- end
113
-
114
95
  def attach_source(ctx, node)
115
96
  if node.class.method_defined? :source
116
97
  tokens = get_tokens(ctx)
117
98
  node.source = get_tokens_source(tokens)
118
99
  end
119
-
120
- if node.class.method_defined? :head_source
121
- tokens = get_head_tokens(ctx)
122
- node.head_source = get_tokens_source(tokens)
123
- end
124
100
  end
125
101
 
126
102
  def find_remark_target(node, path)
@@ -5,8 +5,6 @@ module Expressir
5
5
 
6
6
  include Identifier
7
7
 
8
- attr_accessor :head_source
9
-
10
8
  attr_accessor :version
11
9
  attr_accessor :interfaces
12
10
  attr_accessor :constants
@@ -23,7 +21,6 @@ module Expressir
23
21
  @id = options[:id]
24
22
  @remarks = options.fetch(:remarks, [])
25
23
  @source = options[:source]
26
- @head_source = options[:head_source]
27
24
 
28
25
  @version = options[:version]
29
26
  @interfaces = options.fetch(:interfaces, [])
@@ -1,3 +1,3 @@
1
1
  module Expressir
2
- VERSION = "0.2.15".freeze
2
+ VERSION = "0.2.16".freeze
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require "spec_helper"
2
2
  require "expressir/express_exp/parser"
3
+ require "expressir/express_exp/formatter"
3
4
  require "expressir/express_exp/hyperlink_formatter"
4
5
 
5
6
  RSpec.describe Expressir::ExpressExp::HyperlinkFormatter do
@@ -7,7 +8,10 @@ RSpec.describe Expressir::ExpressExp::HyperlinkFormatter do
7
8
  it "formats hyperlink" do
8
9
  repo = Expressir::ExpressExp::Parser.from_file(input_file)
9
10
 
10
- result = Expressir::ExpressExp::HyperlinkFormatter.format(repo)
11
+ class CustomFormatter < Expressir::ExpressExp::Formatter
12
+ include Expressir::ExpressExp::HyperlinkFormatter
13
+ end
14
+ result = CustomFormatter.format(repo)
11
15
  expected_result = File.read(output_file)
12
16
 
13
17
  expect(result).to eq(expected_result)
@@ -1,5 +1,6 @@
1
1
  require "spec_helper"
2
2
  require "expressir/express_exp/parser"
3
+ require "expressir/express_exp/formatter"
3
4
  require "expressir/express_exp/schema_head_formatter"
4
5
 
5
6
  RSpec.describe Expressir::ExpressExp::SchemaHeadFormatter do
@@ -7,7 +8,10 @@ RSpec.describe Expressir::ExpressExp::SchemaHeadFormatter do
7
8
  it "formats schema head" do
8
9
  repo = Expressir::ExpressExp::Parser.from_file(sample_file)
9
10
 
10
- result = Expressir::ExpressExp::SchemaHeadFormatter.format(repo)
11
+ class CustomFormatter < Expressir::ExpressExp::Formatter
12
+ include Expressir::ExpressExp::SchemaHeadFormatter
13
+ end
14
+ result = CustomFormatter.format(repo)
11
15
 
12
16
  expect(result).to eq(<<~EXP.strip
13
17
  SCHEMA syntax_schema 'version';
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: 0.2.15
4
+ version: 0.2.16
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-02 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -342,7 +342,6 @@ files:
342
342
  - spec/expressir/express_exp/formatter/remark_spec.rb
343
343
  - spec/expressir/express_exp/formatter/syntax_spec.rb
344
344
  - spec/expressir/express_exp/hyperlink_formatter_spec.rb
345
- - spec/expressir/express_exp/parser/head_source_spec.rb
346
345
  - spec/expressir/express_exp/parser/multiple_spec.rb
347
346
  - spec/expressir/express_exp/parser/remark_spec.rb
348
347
  - spec/expressir/express_exp/parser/source_spec.rb
@@ -1,38 +0,0 @@
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_file(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