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 +4 -4
- data/lib/openehr/aql/errors.rb +3 -2
- data/lib/openehr/aql/parser.rb +8 -3
- data/lib/openehr/serializer/rm_json_serializer.rb +1 -0
- data/lib/openehr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86ae366cb519cde86548c821f97ad6b6a436e6b6f56bef45be7db6686f35dbc4
|
|
4
|
+
data.tar.gz: 9f4f54f3b9ec3b6cf64993d9a33a7ab76cc528b9a4237b44483c9feed1c70bd5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad76805a27fae1e62e90a90e73bf721d517ad7e531ead2776326afe08a5d8ff6efa196dd339aaed0dc3e2ebf93e4e4c8413a8ee5c8f01f0cf15f05a30ee1c3d5
|
|
7
|
+
data.tar.gz: b72051c293181e20c55718ab42b8f5083fb4c467a4641af8df30e7ea6fbf5ffed16acd615969c8b02fe7f31058078122cd8edbfad57fb85a8203f6b785d01dca
|
data/lib/openehr/aql/errors.rb
CHANGED
|
@@ -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
|
-
|
|
18
|
+
hint_text = hint ? "\nnote: #{hint}" : ''
|
|
19
|
+
super("#{message}#{location}#{hint_text}")
|
|
19
20
|
end
|
|
20
21
|
end
|
|
21
22
|
|
data/lib/openehr/aql/parser.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
data/lib/openehr/version.rb
CHANGED