@iebh/polyglot 4.8.3 → 4.8.4

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.
@@ -138,7 +138,23 @@ var parse = function parse(query, options) {
138
138
  while (q.length) {
139
139
  var cropString = true; // Whether to remove one charcater from the beginning of the string (set to false if the lexical match handles this behaviour itself)
140
140
  var match;
141
- if (/^\(/.test(q)) {
141
+ if (match = /^\$1\b/.exec(q)) {
142
+ // $1
143
+ branch.nodes.push({
144
+ type: 'dollarOne'
145
+ });
146
+ offset += match[0].length;
147
+ q = q.substr(match[0].length);
148
+ cropString = false;
149
+ } else if (match = /^\$[2-9]\b/.exec(q)) {
150
+ // $2 to $9
151
+ branch.nodes.push({
152
+ type: 'dollarOtherNum'
153
+ });
154
+ offset += match[0].length;
155
+ q = q.substr(match[0].length);
156
+ cropString = false;
157
+ } else if (/^\(/.test(q)) {
142
158
  var newGroup = {
143
159
  type: 'group',
144
160
  nodes: []
@@ -156,22 +172,6 @@ var parse = function parse(query, options) {
156
172
  // branch.msg = "Extra closing bracket removed after term"
157
173
  }
158
174
  leaf = branch.nodes;
159
- } else if (match = /^\$1\b/.exec(q)) {
160
- // $1
161
- branch.nodes.push({
162
- type: 'dollarOne'
163
- });
164
- offset += match[0].length;
165
- q = q.substr(match[0].length);
166
- cropString = false;
167
- } else if (match = /^\$[2-9]\b/.exec(q)) {
168
- // $2 to $9
169
- branch.nodes.push({
170
- type: 'dollarOtherNum'
171
- });
172
- offset += match[0].length;
173
- q = q.substr(match[0].length);
174
- cropString = false;
175
175
  } else if (match = /^([0-9]+)\s*[‐\-]\s*([0-9]+)(?:\/(AND|OR|NOT))/i.exec(q)) {
176
176
  // 1-7/OR
177
177
  branch.nodes.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iebh/polyglot",
3
- "version": "4.8.3",
3
+ "version": "4.8.4",
4
4
  "description": "IEBH-SRA tool to convert between different medical database search formats",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {