expressir 0.2.15-x64-mingw32 → 0.2.16-x64-mingw32

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: 38f40d5af0bb6f8d9d71a15fe4bf060933440af50eabfde86b4f397aa8d516bc
4
- data.tar.gz: f9133c2173e7f8d03c8f605f8f0841173c1e4e00e4f5b6203016543d569a5c1e
3
+ metadata.gz: 404006a617df67e0eac8847c70fc8e1705a435727e0db5e71cd547471c337117
4
+ data.tar.gz: 746be9cf9403a56861f5ee87b2d3abb52ad0f4e4419c286be977571dffe2ead5
5
5
  SHA512:
6
- metadata.gz: 51da2d73670e7e68124c40b205ee0bdaee73d40ff2be2d13422cf7edb1365df5778e27a5db5adeb9f2290273493a0dbd26be4aba19b670374453c6bc06d0141b
7
- data.tar.gz: c3e247487bcf77e138bd8ab9d53fac9582f6a15073af5c059f3a941c0bf3aabd85314b453c83308fc7ef930652bb71fde1ff1a70ad8ea2de47a99e1e481fbeca
6
+ metadata.gz: 59fb06d93b723e3a69a6428a0a61a943a5fe492e036c98359854c11dbaf61138d84c57d707f16d8ec8d051e75643f1385bd5c85d49d4e1ac773df70f40fc33cc
7
+ data.tar.gz: 73ac0793929ee667f86c5bc1c6ec2b00b4f0bf99a78ac899608f9cc83a78ed1335dfa5a59a8b5853966a1c949ed9dbe7fb0a71810f6d850a753731ef31403419
@@ -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: x64-mingw32
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