rsel-exprparser-basic

Parses RSel-specific expression text and rebuilds it in the UI.

As of 2016-03-17. See the latest version.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greatest.deepsurf.us/scripts/17641/113850/rsel-exprparser-basic.js

  1. // ==UserScript==
  2. // @name rsel-exprparser-basic
  3. // @namespace https://greatest.deepsurf.us/users/11629-TheLastTaterTot
  4. // @version 0.5.2
  5. // @description Parses RSel-specific expression text and rebuilds it in the UI.
  6. // @author TheLastTaterTot
  7. // @include https://editor-beta.waze.com/*editor/*
  8. // @include https://www.waze.com/*editor/*
  9. // @exclude https://www.waze.com/*user/editor/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. // Main usage: RSelExprParser.updateExpression(<rsel expression text>)
  14.  
  15. var RSelExprParser = {
  16. version: '0.5.2',
  17. new__EXPR_DEBUGINFO: function(m, exprWord, exprPhrase) {
  18. return {
  19. m: m,
  20. exprMatches: exprWord,
  21. exprMatchPhrases: exprPhrase,
  22. exprBuild: {},
  23. err: null ,
  24. errorMsg: null
  25. };
  26. },
  27. _getSelectionIndex: function(selector, selText) {
  28. for (var s = 0, sLength = selector.length; s < sLength; s++) {
  29. if (new RegExp(selText,'i').test(selector[s].text) && !selector[s].disabled) {
  30. return selector[s].value;
  31. }
  32. }
  33. },
  34. _getSelectOptions: function(selector) {
  35. for (var opts = [], s = 0, sLength = selector.length; s < sLength; s++) {
  36. if (!selector[s].disabled) {
  37. opts[s] = selector[s].text.toLowerCase();
  38. }
  39. }
  40. return opts;
  41. },
  42. _getNewExprBuild: function() {
  43. return {
  44. cond: null ,
  45. op: null ,
  46. op2: null ,
  47. val: null ,
  48. val2: null ,
  49. condmod: null ,
  50. errorCode: 0
  51.  
  52. }
  53. },
  54. getCurrentExprText: function(){
  55. return document.getElementById('outRSExpr').value;
  56. },
  57. /*Using RSel DOM elements rather than requesting dev to provide direct modifiction of RSel's expr object.
  58. This is so the RSel dev can feel free to significantly change his object storage structure if needed. */
  59. rselButtons: {
  60. lfParens: function() {
  61. try {
  62. document.getElementById('btnRSLBkt').click();
  63. } catch (err) {}
  64. },
  65. rtParens: function() {
  66. try {
  67. document.getElementById('btnRSRBkt').click();
  68. } catch (err) {}
  69. },
  70. and: function() {
  71. try {
  72. document.getElementById('btnRSAnd').click()
  73. } catch (err) {}
  74. },
  75. or: function() {
  76. try {
  77. document.getElementById('btnRSOr').click()
  78. } catch (err) {}
  79. },
  80. not: function() {
  81. try {
  82. document.getElementById('btnRSNot').click()
  83. } catch (err) {}
  84. },
  85. clear: function() {
  86. try {
  87. document.getElementById('btnRSClear').click()
  88. } catch (err) {}
  89. }
  90. },
  91. rselConditions: {
  92. country: {
  93. op: function(selText) {
  94. selText = '^' + selText + '$';
  95. document.getElementById('opRSCountry').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSCountry').options, selText);
  96. },
  97. val: function(selText) {
  98. selText = '^' + selText + '$';
  99. document.getElementById('selRSCountry').value = RSelExprParser._getSelectionIndex(document.getElementById('selRSCountry').options, selText);
  100. },
  101. add: function() {
  102. document.getElementById('btnRSAddCountry').click();
  103. }
  104. },
  105. state: {
  106. op: function(selText) {
  107. selText = '^' + selText + '$';
  108. document.getElementById('opRSState').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSState').options, selText);
  109. },
  110. val: function(val) {
  111. document.getElementById('inRSState').value = val;
  112. },
  113. add: function() {
  114. document.getElementById('btnRSAddState').click();
  115. }
  116. },
  117. city: {
  118. op: function(selText) {
  119. selText = '^' + selText + '$';
  120. document.getElementById('opRSCity').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSCity').options, selText);
  121. },
  122. val: function(val) {
  123. document.getElementById('inRSCity').value = val;
  124. },
  125. condmod: function(val) {
  126. document.getElementById('selRSAltCity').value = val;
  127. },
  128. add: function() {
  129. document.getElementById('btnRSAddCity').click();
  130. }
  131. },
  132. street: {
  133. op: function(selText) {
  134. selText = '^' + selText + '$';
  135. document.getElementById('opRSStreet').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSStreet').options, selText);
  136. },
  137. val: function(val) {
  138. document.getElementById('inRSStreet').value = val;
  139. },
  140. condmod: function(val) {
  141. document.getElementById('selRSAlttStreet').value = val;
  142. },
  143. add: function() {
  144. document.getElementById('btnRSAddStreet').click();
  145. }
  146. },
  147. unnamed: {
  148. op: function(checked) {
  149. document.getElementById('cbRSNoName').checked = checked;
  150. },
  151. //checked - has no name
  152. op2: function(checked) {
  153. document.getElementById('cbRSAltNoName').checked = checked;
  154. },
  155. //checked - alt name
  156. add: function() {
  157. document.getElementById('btnRSAddNoName').click();
  158. }
  159. },
  160. road: {
  161. op: function(selText) {
  162. selText = '^' + selText + '$';
  163. document.getElementById('opRSRoadType').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSRoadType').options, selText);
  164. },
  165. val: function(selText) {
  166. selText = '^' + selText + '$';
  167. document.getElementById('selRSRoadType').value = RSelExprParser._getSelectionIndex(document.getElementById('selRSRoadType').options, selText);
  168. },
  169. add: function() {
  170. document.getElementById('btnRSAddRoadType').click();
  171. }
  172. },
  173. direction: {
  174. op: function(selText) {
  175. selText = '^' + selText + '$';
  176. document.getElementById('opRSDirection').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSDirection').options, selText);
  177. },
  178. val: function(selText) {
  179. document.getElementById('selRSDirection').value = RSelExprParser._getSelectionIndex(document.getElementById('selRSDirection').options, selText);
  180. },
  181. add: function() {
  182. document.getElementById('btnRSAddDirection').click();
  183. }
  184. },
  185. elevation: {
  186. op: function(selText) {
  187. selText = '^' + selText + '$';
  188. document.getElementById('opRSElevation').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSElevation').options, selText);
  189. },
  190. val: function(selText) {
  191. selText = '^' + selText + '$';
  192. document.getElementById('selRSElevation').value = RSelExprParser._getSelectionIndex(document.getElementById('selRSElevation').options, selText);
  193. },
  194. add: function() {
  195. document.getElementById('btnRSAddElevation').click();
  196. }
  197. },
  198. manlock: {
  199. op: function(selText) {
  200. selText = '^' + selText + '$';
  201. document.getElementById('opRSManLock').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSManLock').options, selText);
  202. },
  203. val: function(val) {
  204. document.getElementById('selRSManLock').value = val;
  205. },
  206. add: function() {
  207. document.getElementById('btnRSAddManLock').click();
  208. }
  209. },
  210. traflock: {
  211. op: function(selText) {
  212. selText = '^' + selText + '$';
  213. document.getElementById('opRSTrLock').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSTrLock').options, selText);
  214. },
  215. val: function(val) {
  216. document.getElementById('selRSTrLock').value = val;
  217. },
  218. add: function() {
  219. document.getElementById('btnRSAddTrLock').click();
  220. }
  221. },
  222. speed: {
  223. opOptNodes: function() { return document.getElementById('opRSSpeed').options },
  224. op: function(selText) {
  225. selText = '^' + selText + '$';
  226. document.getElementById('opRSSpeed').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSSpeed').options, selText);
  227. },
  228. val: function(val) {
  229. document.getElementById('inRSSpeed').value = val;
  230. },
  231. add: function() {
  232. document.getElementById('btnRSAddSpeed').click();
  233. }
  234. },
  235. closure: {
  236. op: function(checked) {
  237. document.getElementById('cbRSClsr').checked = checked;
  238. },
  239. op2: function(selText) {
  240. selText = '^' + selText + '$';
  241. document.getElementById('opRSClsrStrtEnd').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSClsrStrtEnd').options, selText);
  242. },
  243. val: function(val) {
  244. document.getElementById('inRSClsrDays').value = val;
  245. },
  246. condmod: function(selText) {
  247. selText = '^' + selText + '$';
  248. document.getElementById('opRSClsrBeforeAter').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSClsrBeforeAter').options, selText);
  249. },
  250. add: function() {
  251. document.getElementById('btnRSAddClsr').click();
  252. }
  253. },
  254. updatedby: {
  255. op: function(selText) {
  256. selText = '^' + selText + '$';
  257. document.getElementById('opRSUpdtd').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSUpdtd').options, selText);
  258. },
  259. val: function(val) {
  260. document.getElementById('inRSUpdtd').value = val;
  261. },
  262. add: function() {
  263. document.getElementById('btnRSAddUpdtd').click();
  264. }
  265. },
  266. createdby: {
  267. op: function(selText) {
  268. selText = '^' + selText + '$';
  269. document.getElementById('opRSCrtd').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSCrtd').options, selText);
  270. },
  271. val: function(val) {
  272. document.getElementById('inRSCrtd').value = val;
  273. },
  274. add: function() {
  275. document.getElementById('btnRSAddCrtd').click();
  276. }
  277. },
  278. last: {
  279. op: function(selText) {
  280. selText = '^' + selText + '$';
  281. document.getElementById('opRSLastU').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSLastU').options, selText);
  282. },
  283. val: function(val) {
  284. document.getElementById('inRSLastU').value = val;
  285. },
  286. add: function() {
  287. document.getElementById('btnRSAddLastU').click();
  288. }
  289. },
  290. length: {
  291. op: function(selText) {
  292. selText = '^' + selText + '$';
  293. document.getElementById('opRSLength').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSLength').options, selText);
  294. },
  295. val: function(val) {
  296. document.getElementById('inRSLength').value = val;
  297. },
  298. condmod: function(selText) {
  299. selText = '^' + selText + '$';
  300. document.getElementById('unitRSLength').value = RSelExprParser._getSelectionIndex(document.getElementById('unitRSLength').options, selText);
  301. },
  302. add: function() {
  303. document.getElementById('btnRSAddLength').click();
  304. }
  305. },
  306. id: {
  307. op: function(selText) {
  308. selText = '^' + selText + '$';
  309. document.getElementById('opRSSegId').value = RSelExprParser._getSelectionIndex(document.getElementById('opRSSegId').options, selText);
  310. },
  311. val: function(val) {
  312. document.getElementById('inRSSegId').value = val;
  313. },
  314. add: function() {
  315. document.getElementById('btnRSAddSegId').click();
  316. }
  317. },
  318. roundabout: {
  319. op: function(checked) {
  320. document.getElementById('cbRSIsRound').checked = checked;
  321. },
  322. add: function() {
  323. document.getElementById('btnRSAddIsRound').click();
  324. }
  325. },
  326. toll: {
  327. op: function(checked) {
  328. document.getElementById('cbRSIsToll').checked = checked;
  329. },
  330. add: function() {
  331. document.getElementById('btnRSAddIsToll').click();
  332. }
  333. },
  334. tunnel: {
  335. op: function(checked) {
  336. document.getElementById('cbRSTunnel').checked = checked;
  337. },
  338. add: function() {
  339. document.getElementById('btnRSAddTunnel').click();
  340. }
  341. },
  342. new: {
  343. op: function(checked) {
  344. document.getElementById('cbRSIsNew').checked = checked;
  345. },
  346. add: function() {
  347. document.getElementById('btnRSAddIsNew').click();
  348. }
  349. },
  350. changed: {
  351. op: function(checked) {
  352. document.getElementById('cbRSIsChngd').checked = checked;
  353. },
  354. add: function() {
  355. document.getElementById('btnRSAddIsChngd').click();
  356. }
  357. },
  358. screen: {
  359. op: function(checked) {
  360. document.getElementById('cbRSOnScr').checked = checked;
  361. },
  362. add: function() {
  363. document.getElementById('btnRSAddOnScr').click();
  364. }
  365. },
  366. restriction: {
  367. op: function(checked) {
  368. document.getElementById('cbRSRestr').checked = checked;
  369. },
  370. add: function() {
  371. document.getElementById('btnRSAddRestr').click();
  372. }
  373. },
  374. editable: {
  375. op: function(checked) {
  376. document.getElementById('cbRSEdtbl').checked = checked;
  377. },
  378. add: function() {
  379. document.getElementById('btnRSAddEdtbl').click();
  380. }
  381. }
  382. },
  383. addExpr: function(eb) {
  384. var checkKeys = false;
  385. Object.keys(this.rselConditions).map(function(a, i) {
  386. if (a === eb.cond)
  387. checkKeys = true;
  388. });
  389. if (checkKeys) {
  390. try {
  391. this.rselConditions[eb.cond].op(eb.op);
  392. if (eb.op2 !== null )
  393. this.rselConditions[eb.cond].op2(eb.op2);
  394. if (eb.condmod !== null )
  395. this.rselConditions[eb.cond].condmod(eb.condmod);
  396.  
  397. if (eb.val2 === null ) {
  398. if (eb.val !== null )
  399. this.rselConditions[eb.cond].val(eb.val);
  400. this.rselConditions[eb.cond].add();
  401. } else {
  402. this.rselButtons.lfParens();
  403. this.rselConditions[eb.cond].val(eb.val);
  404. this.rselConditions[eb.cond].add();
  405. this.rselButtons.or();
  406. this.rselConditions[eb.cond].val(eb.val2);
  407. this.rselConditions[eb.cond].add();
  408. this.rselButtons.rtParens();
  409. }
  410.  
  411. } catch (err) {
  412. return {
  413. errorCode: 101,
  414. errorMsg: 'Error: Unable to parse expression text.',
  415. err: err
  416. };
  417. }
  418. } else {
  419. return {
  420. errorCode: 3,
  421. errorMsg: 'Selection condition was not recognized'
  422. };
  423. //
  424. }
  425. return {
  426. errorCode: 0
  427. };
  428. },
  429. //=============================================================================
  430. parseExpr: function(parseThis) {
  431. //---------------------------------------------------------------
  432. parseThis = parseThis.replace(/\bpri?m?(?:ary|\.)?\s?(?:or)\s?alt(?:ern|s)?(?:\.)?/ig, 'any');
  433. parseThis = parseThis.replace(/\b((?:un)?name[ds]?)\b|\b(road) type\b|\b(last) update\b|\b(speed) limits?\b/ig, '$1$2$3$4')
  434. parseThis = parseThis.replace(/\b(man)ual (lock)s?\b|\b(traf)[fic]* (lock)s?\b/ig, '$1$2$3$4');
  435. parseThis = parseThis.replace(/\b(created|updated)\s(by)\b/ig, '$1$2');
  436. parseThis = parseThis.replace(/\bon screen/ig, 'onscreen');
  437. //\b(?:in|on|off|out|outside)(?: of)?[- ]?screen\b
  438. parseThis = parseThis.replace(/\b(?:off|out)(?: of)?[- ]?screen/ig, 'offscreen');
  439.  
  440. var parseExprArray = parseThis.match(
  441. /(\(['"].*?['"]\)|".*?"|'.*?')|\bno[\s-]alt|\b(?:street[\s-]?)?name\(s\)|\bstreet(?:\snames?)\b|\btoll(?:[-\s]?ro?a?d)?\b|\bdoes(?:\s?n[o']t)\b|(?:!\s?)?contains?\b|!=|>=|<=|([ab](<-|->)[ab])|&&|\|\||!=|[|&<>=()!~]|[\u0023-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]+/gi),
  442. parseExprHistory = [],
  443. condMatches = [],
  444. condMatchPhrases = [],
  445. exprMatches = [],
  446. exprMatchPhrases = [],
  447. exprFragment, unwantedWordsSearch,
  448. e, f, b, fLength;
  449.  
  450. // The following parses the expression text into unique chunks within separate array elements
  451. e = parseExprArray.length;
  452. while (e-- > 0) {
  453. try {
  454. exprFragment = parseExprArray.shift();
  455. //console.info(exprFragment);
  456.  
  457. // Find operators that join individual expressions (AND|OR|!|parenthesis)
  458. if (/^(?:and|or|&&|\|\||!=|[=&|()!])$/i.test(exprFragment)) {
  459. exprMatches.push(exprFragment.toLowerCase());
  460. exprMatchPhrases.push(exprFragment.toLowerCase());
  461. }
  462.  
  463. // Identify elements that contain selection condition names
  464. if (
  465. /^country|^state|^city|^street|^(?:un|street[\s-]?)?name|^road|^round|^toll|^speed|^dir|^elevation|^tun|^manlock|^traflock|^speed|^new|^changed|screen$|^restrict|^clos|^createdby|^last|^updatedby|^length|^id|^editable/i
  466. .test(exprFragment)) {
  467. condMatches.push(exprFragment.toLowerCase());
  468. // lists specific selection conditions
  469. exprMatches.push(exprFragment.toLowerCase());
  470. //same as condMatches, but includes operations as separate array elements
  471.  
  472. try {
  473. //search phrase fowards
  474. fLength = parseExprArray.length;
  475. f = 0;
  476. while (!(/^(and|or|&&|\|\||[&|)])$/i.test(parseExprArray[f])) && (++f < fLength)) {}
  477. //search phrase backwards
  478. b = parseExprHistory.length;
  479. while (!(/^(and|or|&&|\|\||[&|(])$/i.test(parseExprHistory[b - 1])) && (--b > 0)) {}
  480.  
  481. condMatchPhrases.push(parseExprHistory.slice(b).concat(exprFragment, parseExprArray.slice(0, f)));
  482. //list specific selection conditions and its criteria
  483.  
  484. unwantedWordsSearch = parseExprHistory.slice(b);
  485. if (unwantedWordsSearch && unwantedWordsSearch.length) {
  486. unwantedWordsSearch = unwantedWordsSearch.filter(function(a) {
  487. return !/\b(has|have|is|=|are|does|was|were)\b/i.test(a)
  488. });
  489. }
  490. if (/!|!=/.test(unwantedWordsSearch[0]))
  491. unwantedWordsSearch.splice(0, 1);
  492.  
  493. exprMatchPhrases.push(unwantedWordsSearch.concat(parseExprArray.slice(0, f)));
  494. //excludes the match cond
  495.  
  496. parseExprHistory = parseExprHistory.concat(exprFragment, parseExprArray.slice(0, f));
  497. parseExprArray = parseExprArray.slice(f);
  498. e -= f;
  499. } catch (err) {
  500. return {
  501. errorCode: 101,
  502. errorMsg: 'Error parsing expression at ' + exprFragment,
  503. err: err
  504. };
  505. }
  506. } else {
  507. parseExprHistory.push(exprFragment);
  508. }
  509. } catch (err) {
  510. return {
  511. errorCode: 101,
  512. errdebug: 'Error parsing expression at ' + exprFragment,
  513. err: err
  514. };
  515. }
  516. }
  517. //while
  518.  
  519.  
  520. //---------------------------------------------------------------
  521. // Quick crude check for unmatched parentheses
  522. var nOpenParens = exprMatches.toString().match(/\(/g),
  523. nCloseParens = exprMatches.toString().match(/\)/g);
  524. if (!nOpenParens) nOpenParens = [];
  525. if (!nCloseParens) nCloseParens = [];
  526. if (nOpenParens.length !== nCloseParens.length)
  527. return {
  528. errorCode: 1,
  529. errorMsg: 'Warning: Open and close paretheses may be unmatched.'
  530. };
  531.  
  532. //---------------------------------------------------------------
  533.  
  534. return {
  535. errorCode: 0,
  536. exprMatches: exprMatches,
  537. exprMatchPhrases: exprMatchPhrases,
  538. condMatches: condMatches,
  539. condMatchPhrases: condMatchPhrases
  540. };
  541. },
  542. buildExpr: function(exprWord, exprPhrase) {
  543.  
  544. var exprBuild = RSelExprParser._getNewExprBuild();
  545. exprBuild.cond = exprWord;
  546.  
  547. //if (m===10) debugger;
  548.  
  549. //============================================================
  550. // Where the magic happens... sort of.
  551. //============================================================
  552. switch (true) {
  553. case exprWord === '(':
  554. this.rselButtons.lfParens();
  555. return false;
  556. case exprWord === ')':
  557. this.rselButtons.rtParens();
  558. return false;
  559. case 'and' === exprWord:
  560. this.rselButtons.and();
  561. return false;
  562. case 'or' === exprWord:
  563. this.rselButtons.or();
  564. return false;
  565. case /no alt/i.test(exprPhrase):
  566. exprBuild.cond = 'unnamed';
  567. exprBuild.op = true;
  568. exprBuild.op2 = true;
  569. return exprBuild;
  570. case '!' === exprWord:
  571. this.rselButtons.not();
  572. return false;
  573. case /^unnamed/.test(exprBuild.cond):
  574. exprBuild.cond = 'unnamed';
  575. exprBuild.op = true;
  576. exprBuild.op2 = false;
  577. return exprBuild;
  578.  
  579. // SPEED LIMITS
  580. case 'speed' === exprBuild.cond:
  581. try {
  582. if (exprPhrase.length < 2 && /\bnot?\b|!|!=/i.test(exprPhrase[0])) {
  583. exprBuild.op = 'none';
  584. } else {
  585. exprPhrase = exprPhrase.join(' ');
  586.  
  587. if (/\bnot?\b|!|!=/i.test(exprPhrase)) {
  588. RSelExprParser.rselButtons.not();
  589. }
  590.  
  591. var optionText = RSelExprParser._getSelectOptions(RSelExprParser.rselConditions.speed.opOptNodes());
  592. optionText = RegExp(optionText.join('|'), 'i').exec(exprPhrase);
  593. if (optionText) exprBuild.op = optionText[0];
  594. else exprBuild.op = 'any';
  595. }
  596.  
  597. if (exprPhrase.length > 1) {
  598. exprBuild.val = exprPhrase.replace(/.*?(\d+)\s?mph.*|.*?(\d+)\s?km.*/i,'$1$2');
  599. } else {
  600. exprBuild.val = '';
  601. }
  602. } catch (err) {
  603. exprBuild.errorCode = 101;
  604. exprBuild.err = err;
  605. return exprBuild;
  606. }
  607. return exprBuild;
  608.  
  609. // BINARY CONDITIONS:
  610. case exprPhrase.length === 0 || //suggests binary
  611. /^(screen|roundabout|toll|tun|new|changed|restrict|editable)/.test(exprBuild.cond) || //binary selection conditions
  612. (/^name.*|^closure/i.test(exprBuild.cond) && exprPhrase.length <= 1):
  613. //selection conditions that have both binary and multiple options
  614.  
  615. exprPhrase = exprPhrase.join(' ');
  616.  
  617. exprBuild.cond = exprBuild.cond.replace(/^name.*/, 'name');
  618. exprBuild.cond = exprBuild.cond.replace(/^toll\s.*/, 'toll');
  619.  
  620. if (/\bnot?\b|!|!=/i.test(exprPhrase)) {
  621. exprBuild.op = false;
  622. } else {
  623. exprBuild.op = true;
  624. }
  625. switch (exprBuild.cond) {
  626. case 'name':
  627. try {
  628. if (/alt/i.test(exprPhrase)) {
  629. exprBuild.cond = 'unnamed';
  630. exprBuild.op = false;
  631. exprBuild.op2 = true;
  632. } else {
  633. exprBuild.cond = 'unnamed';
  634. exprBuild.op = false;
  635. exprBuild.op2 = false;
  636. }
  637. return exprBuild;
  638. } catch (err) {
  639. exprBuild.errorCode = 101;
  640. exprBuild.err = err;
  641. return exprBuild;
  642. }
  643. case 'closure':
  644. exprBuild.op2 = '---';
  645. exprBuild.val = '';
  646. return exprBuild;
  647. case 'onscreen':
  648. exprBuild.cond = 'screen';
  649. exprBuild.op = true;
  650. return exprBuild;
  651. case 'offscreen':
  652. exprBuild.cond = 'screen';
  653. exprBuild.op = false;
  654. return exprBuild;
  655. case 'roundabout':
  656. case 'toll':
  657. case 'tunnel':
  658. case 'new':
  659. case 'changed':
  660. case 'restriction':
  661. case 'editable':
  662. return exprBuild;
  663. default:
  664. exprBuild.errorCode = 101;
  665. exprBuild.errorMsg = 'Error: Presumed binary selector had no match.';
  666. return exprBuild;
  667. }
  668. //switch
  669.  
  670. //--------------------------------------------------------------------
  671.  
  672. case /^closure/.test(exprBuild.cond):
  673. try {
  674. exprPhrase = exprPhrase.join().toLowerCase();
  675. exprBuild.op = !(/does\s?n['o]t|!|!=/.test(exprPhrase));
  676. //checkbox
  677. exprBuild.op2 = /start|end/.exec(exprPhrase) + 's';
  678. //starts/ends
  679. exprBuild.condmod = /before|after|\bin\b/.exec(exprPhrase) + '';
  680. //in/before/after
  681. if (!exprBuild.condmod)
  682. exprBuild.condmod = 'in';
  683. exprBuild.val = /\d+/.exec(exprPhrase) + '';
  684. //days ago
  685. } catch (err) {
  686. exprBuild.errorCode = 101;
  687. exprBuild.err = err;
  688. return exprBuild;
  689. }
  690. return exprBuild;
  691.  
  692. default:
  693. // CONDITION NAME MATCHING (TYPE OF SELECTION)
  694. try {
  695. if (/^(str.*|cit.*)/.test(exprBuild.cond)) {
  696. exprBuild.cond = exprBuild.cond.replace(/^str.*/, 'street');
  697. exprBuild.cond = exprBuild.cond.replace(/^cit.*/, 'city');
  698. var exprStart = exprPhrase.slice(0, -1), //don't include last element bc it should be the name itself
  699. prim, alt;
  700. if (exprStart) {
  701. //exprStart = exprStart.toString().toLowerCase();
  702. prim = /\bprim?(?:ary|\.)?\b/i.test(exprStart);
  703. alt = /\balt(?:ern\w*|\.)?\b/i.test(exprStart);
  704. any = /\bany\b/i.test(exprStart);
  705. exprPhrase = exprStart.filter(function(a) {return !/^pr|^alt|^any/i.test(a)}).concat(exprPhrase.slice(-1));
  706. } else {
  707. prim = false;
  708. alt = false;
  709. }
  710. if ((prim && alt) || any)
  711. exprBuild.condmod = 2;
  712. else if (prim)
  713. exprBuild.condmod = 0;
  714. else if (alt)
  715. exprBuild.condmod = 1;
  716. else
  717. exprBuild.condmod = 0;
  718. }
  719. } catch (err) {
  720. exprBuild.errorCode = 101;
  721. exprBuild.err = err;
  722. return exprBuild;
  723. }
  724.  
  725. // COMPARATOR OPERATION MATCHING
  726. try {
  727. // Convert to standard comparator operations
  728. var exprPhraseStr = exprPhrase.join(' ').replace(/\bcontains?/i, 'contains').replace(/(?:\bdo(?:es)?\s?n[o']t\s|!\s?)(contains)/i, '! $1');
  729. //.replace(/\b(?:do(?:es)?\s?n[o']t\s|!\s?)contains?/i, '!^').replace(/\bcontains?/i,'\u220b');
  730.  
  731. // Comparator operations with standard representation
  732. exprBuild.op = /(?:! )?contains|[!<>=~]{1,2}/i.exec(exprPhraseStr) + '';
  733.  
  734. } catch (err) {
  735. exprBuild.errorCode = 101;
  736. exprBuild.err = err;
  737. return exprBuild;
  738. }
  739.  
  740. // SELECTION VALUE MATCHING
  741. if (/^length|^last/.test(exprBuild.cond)) {
  742. exprBuild.val = exprPhraseStr.match(/\b\d+/) + '';
  743. } else {
  744. try {
  745. var blackmagic = '[\u0023-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]+',
  746. whitemagic = '^\\(["\'](.*?)[\'"]\\)$|^\\s?["\'](.*)["\']$|^["\'](.*)[\'"]$|\\b(';
  747.  
  748. // The following line is kind of elaborate bc it needed to grab text between parens/quotes while keeping the inner quotes
  749. exprBuild.val = exprPhraseStr.replace(new RegExp('^(?:\\s?' + exprBuild.op + '\\s)(.*)','i'),'$1').replace(new RegExp(whitemagic + blackmagic + '?)\\b','ig'),'$1$2$3$4').replace(new RegExp('(") (' + blackmagic + ') (")','ig'),'$1$2$3');
  750.  
  751. } catch (err) {
  752. exprBuild.errorCode = 2;
  753. exprBuild.err = err;
  754. return exprBuild;
  755. }
  756.  
  757. if (/^direction/.test(exprBuild.cond)) {
  758. exprBuild.val = exprBuild.val.match(/A[<>-\s]*B|B[<>-\s]*A|unknown/i) + '';
  759. //reduce to unique key words...
  760. }
  761. }
  762.  
  763. return exprBuild;
  764. }
  765. //switch
  766. },
  767. //parseExpr()
  768. updateExpression: function(parseThis) {
  769. this.rselButtons.clear();
  770. if (parseThis) {
  771. //console.info('*** Begin parsing expression... ***');
  772.  
  773.  
  774. var parsed = this.parseExpr(parseThis);
  775.  
  776. if (parsed && !parsed.errorCode) {
  777. var exprMatches = parsed.exprMatches,
  778. exprMatchPhrases = parsed.exprMatchPhrases,
  779. exprFragment, exprFragPhrase, mLength, m;
  780.  
  781. mLength = exprMatchPhrases.length;
  782. for (m = 0; m < mLength; m++) {
  783. RSelExprParser.__EXPR_DEBUGINFO = this.new__EXPR_DEBUGINFO(m, exprMatches[m], exprMatchPhrases[m]);
  784.  
  785. //if (m > 3) debugger;
  786.  
  787. exprFragment = exprMatches[m];
  788. exprFragPhrase = exprMatchPhrases[m];
  789.  
  790. if (exprFragPhrase.constructor !== Array) exprFragPhrase = [exprFragPhrase];
  791.  
  792. var exprBuild = this.buildExpr(exprFragment, exprFragPhrase);
  793.  
  794. if (exprBuild && !exprBuild.errorCode) {
  795. RSelExprParser.__EXPR_DEBUGINFO.errorStatus = this.addExpr(exprBuild);
  796.  
  797. if (RSelExprParser.__EXPR_DEBUGINFO.errorStatus && RSelExprParser.__EXPR_DEBUGINFO.errorStatus.errorCode) {
  798. console.warn('updateExpression() may have partly failed. Check results.');
  799. RSelExprParser.__EXPR_DEBUGINFO.exprBuild = exprBuild;
  800. console.debug(RSelExprParser.__EXPR_DEBUGINFO);
  801. return false;
  802. }
  803. } else if (exprBuild && exprBuild.errorCode) {
  804. console.warn('updateExpression() may have partly failed. Check results.');
  805. RSelExprParser.__EXPR_DEBUGINFO.exprBuild = exprBuild;
  806. console.debug(RSelExprParser.__EXPR_DEBUGINFO);
  807. return false;
  808. }
  809. } //for each condition matched
  810.  
  811. return this.getCurrentExprText();
  812. } else {
  813. console.debug(parsed);
  814. return false;
  815. }
  816. } else {
  817. return null;
  818. }
  819. }
  820. };