openehr 2.4.0 → 2.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d4cd8f720ac22f26e89145ebfd23cb474b2ad3e900c97fd6ff01c20a90bf638
4
- data.tar.gz: ac478e309b65a00d314d3bf425b8d3ce25a7f07dd196e76c223508eca7410619
3
+ metadata.gz: 86ae366cb519cde86548c821f97ad6b6a436e6b6f56bef45be7db6686f35dbc4
4
+ data.tar.gz: 9f4f54f3b9ec3b6cf64993d9a33a7ab76cc528b9a4237b44483c9feed1c70bd5
5
5
  SHA512:
6
- metadata.gz: 4f72f3492c23d458ed840da441359318e03a58c4bc55ee2d35df060ff635f4ab98e9be5aafafd126d149d81dcc355620a5931f65b05ff6d9dee65666df371a62
7
- data.tar.gz: d4ca02374caaf65f3d6a29087fa788f4a6c57c9415d5c5ac576f9e746d56f4a6d25c4ef95fa3b2b56d905823f2ff7c08cb6bdb2f2f92944ab04d3b4f0734b97a
6
+ metadata.gz: ad76805a27fae1e62e90a90e73bf721d517ad7e531ead2776326afe08a5d8ff6efa196dd339aaed0dc3e2ebf93e4e4c8413a8ee5c8f01f0cf15f05a30ee1c3d5
7
+ data.tar.gz: b72051c293181e20c55718ab42b8f5083fb4c467a4641af8df30e7ea6fbf5ffed16acd615969c8b02fe7f31058078122cd8edbfad57fb85a8203f6b785d01dca
@@ -11,11 +11,12 @@ module OpenEHR
11
11
  class ParseError < Error
12
12
  attr_reader :line, :column
13
13
 
14
- def initialize(message, line: nil, column: nil)
14
+ def initialize(message, line: nil, column: nil, hint: nil)
15
15
  @line = line
16
16
  @column = column
17
17
  location = line && column ? " (line #{line}, column #{column})" : ''
18
- super("#{message}#{location}")
18
+ hint_text = hint ? "\nnote: #{hint}" : ''
19
+ super("#{message}#{location}#{hint_text}")
19
20
  end
20
21
  end
21
22
 
@@ -48,6 +48,7 @@ module OpenEHR
48
48
  top = check(:top) ? parse_top : nil
49
49
  columns = [parse_select_expr]
50
50
  columns << parse_select_expr while match(:comma)
51
+ @select_aliases = columns.filter_map(&:alias_name).to_set
51
52
  Model::SelectClause.new(columns: columns, distinct: distinct, top: top)
52
53
  end
53
54
 
@@ -298,7 +299,11 @@ module OpenEHR
298
299
  elsif match(:matches)
299
300
  Model::MatchesExpr.new(path: path, operand: parse_matches_operand)
300
301
  else
301
- raise error("expected a comparison operator, LIKE or MATCHES, got #{describe(peek)}")
302
+ identifier = peek.type == :identifier ? peek.value : nil
303
+ hint = if identifier && @select_aliases.include?(identifier)
304
+ "'#{identifier}' is a SELECT alias; aliases cannot be used in WHERE -- repeat the identified path"
305
+ end
306
+ raise error("expected a comparison operator, LIKE or MATCHES, got #{describe(peek)}", hint: hint)
302
307
  end
303
308
  end
304
309
 
@@ -476,8 +481,8 @@ module OpenEHR
476
481
  token.type == :eof ? 'end of input' : "#{token.type} #{token.value.inspect}"
477
482
  end
478
483
 
479
- def error(message)
480
- ParseError.new(message, line: peek.line, column: peek.column)
484
+ def error(message, hint: nil)
485
+ ParseError.new(message, line: peek.line, column: peek.column, hint: hint)
481
486
  end
482
487
  end
483
488
  end
@@ -61,6 +61,7 @@ module OpenEHR
61
61
 
62
62
  hash[ivar.to_s.delete_prefix('@')] = to_value(field, seen)
63
63
  end
64
+ seen.delete(value)
64
65
  hash
65
66
  end
66
67
  end
@@ -1,3 +1,3 @@
1
1
  module OpenEHR
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openehr
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinji KOBAYASHI