Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
870 changes: 472 additions & 398 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fumifier",
"version": "2.1.0",
"version": "2.1.1",
"description": "Fumifier is the core FLASH DSL engine inside FUME - It parses, compiles and executes FHIR related transformation logic expressed with FUME's specialized syntax (FLASH) and applies it to JSON data structures.",
"author": "Outburn Ltd.",
"main": "./dist/index.cjs",
Expand Down Expand Up @@ -98,7 +98,7 @@
"chai": "^6.2.2",
"chai-as-promised": "^8.0.2",
"eslint": "9.39.2",
"eslint-plugin-jsdoc": "^62.5.0",
"eslint-plugin-jsdoc": "^62.5.4",
"eslint-plugin-promise": "^7.2.1",
"fhir-package-explorer": "^1.9.2",
"fhir-snapshot-generator": "^2.2.2",
Expand Down
2 changes: 1 addition & 1 deletion src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ const parser = (() => {
token: node.value,
});
}
if (node.type !== 'name' && node.type !== 'number') {
if (node.type !== 'name' && node.type !== 'number' && node.type !== 'url') {
return handleError({
code: "F1027", // invalid slice token
position: node.position,
Expand Down
10 changes: 7 additions & 3 deletions src/utils/tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,13 @@ export default function (path) {
)
) {
let url = path.substring(position, position += 4); // at least the 4 first chars have been confirmed to be part of the string
while (position < length && path.charAt(position) !== ')' && !/[\s]/.test(path.charAt(position))) {
// swallow any thing until encountering a ')' or any whitespace
url += path.charAt(position);
while (position < length) {
const ch = path.charAt(position);
// swallow anything until encountering a structural delimiter or whitespace
if (ch === ')' || ch === ']' || ch === '}' || ch === ',' || ch === ';' || /[\s]/.test(ch)) {
break;
}
url += ch;
position++;
}
return create('url', url);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
InstanceOf: http://hl7.org/fhir/StructureDefinition/Patient
* extension[patient-birthPlace].valueAddress.text = 'neverland'
* gender
* extension[http://hl7.org/fhir/StructureDefinition/data-absent-reason].valueCode = 'unknown'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
InstanceOf: Patient
* extension[http://hl7.org/fhir/StructureDefinition/patient-birthPlace].value.text = 'a'
* gender.extension[http://hl7.org/fhir/StructureDefinition/data-absent-reason].value = 'unknown'
50 changes: 50 additions & 0 deletions test/test-suite/groups/flash-slices/url-slices-in-brackets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"description": "Slice syntax supports URL inside brackets (Patient extension + primitive _gender) - should PASS",
"data": null,
"result": {
"resourceType": "Patient",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace",
"valueAddress": {
"text": "a"
}
}
],
"_gender": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
"valueCode": "unknown"
}
]
}
},
"expr-file": "url-slices-in-brackets.fume"
},
{
"description": "URL InstanceOf with URL slice brackets (Patient) - should PASS",
"data": null,
"result": {
"resourceType": "Patient",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace",
"valueAddress": {
"text": "neverland"
}
}
],
"_gender": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
"valueCode": "unknown"
}
]
}
},
"expr-file": "url-slices-in-brackets-instanceof-url.fume"
}
]