diff --git a/app/index.js b/app/index.js index cd0c70a25..cba9e4244 100644 --- a/app/index.js +++ b/app/index.js @@ -132,6 +132,7 @@ require("./scripts/services.js") require("./scripts/extended.js") require("./scripts/struct_services.js") require("./scripts/directives.js") +require("./scripts/directives/scroll.js") require("./scripts/filter_directives.js") require("./scripts/newsdesk.js") diff --git a/app/scripts/app.js b/app/scripts/app.js index 43bbf1d67..8cbb6c6ed 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -5,6 +5,7 @@ import { kwicPagerName, kwicPager } from "./components/pager" import { sidebarName, sidebarComponent } from "./components/sidebar" import * as autoc from "./components/autoc" import * as readingmode from "./components/readingmode" +import * as extendedAddBox from "./components/extended/extended_add_box" import { setDefaultConfigValues } from "./settings.js" setDefaultConfigValues() @@ -46,6 +47,7 @@ window.korpApp = angular.module("korpApp", [ korpApp.component(kwicPagerName, kwicPager).component(sidebarName, sidebarComponent) korpApp.component(readingmode.componentName, readingmode.component) korpApp.component(autoc.componentName, autoc.component) +korpApp.component(extendedAddBox.componentName, extendedAddBox.component) // load all custom components (imported in index.js) for(const componentName in window.customComponents) { diff --git a/app/scripts/components/autoc.js b/app/scripts/components/autoc.js index c8fb5612c..1214e40f1 100644 --- a/app/scripts/components/autoc.js +++ b/app/scripts/components/autoc.js @@ -57,7 +57,7 @@ export const component = { 'lexicons', function ($q, lexicons) { const ctrl = this - + ctrl.isError = false ctrl.$onChanges = () => { diff --git a/app/scripts/components/extended/extended_add_box.js b/app/scripts/components/extended/extended_add_box.js new file mode 100644 index 000000000..2d11f2e42 --- /dev/null +++ b/app/scripts/components/extended/extended_add_box.js @@ -0,0 +1,68 @@ +/** @format */ +export const componentName = "addBox" + +let html = String.raw +export const component = { + template: html` +
+ +
+ +
+ + +
+
+
+ + `, + bindings: { + addToken: "&", + addStructToken: "&", + }, + controller: function AddBoxCtrl() { + const ctrl = this + + ctrl.showStuffSelectButtons = false + + ctrl.addTokenLocal = function() { + ctrl.addToken() + } + + ctrl.showSelectButtons = function() { + ctrl.showStuffSelectButtons = true + } + + ctrl.addStructTokenLocal = function (start = true) { + ctrl.reset() + ctrl.addStructToken({ start }) + } + + ctrl.reset = function () { + ctrl.showStuffSelectButtons = false + } + }, +} diff --git a/app/scripts/components/pager.js b/app/scripts/components/pager.js index 0132021ad..d0bd6ad84 100644 --- a/app/scripts/components/pager.js +++ b/app/scripts/components/pager.js @@ -20,13 +20,13 @@ export const kwicPager = { rotate="false" >
- {{'goto_page' | loc:lang}} + {{'goto_page' | loc:$root.lang}} - {{'of' | loc:lang}} {{$ctrl.numPages}} + {{'of' | loc:$root.lang}} {{$ctrl.numPages}}
`, diff --git a/app/scripts/cqp_parser/CQPParser.js b/app/scripts/cqp_parser/CQPParser.js index 12b8c5ca1..fa86363ae 100644 --- a/app/scripts/cqp_parser/CQPParser.js +++ b/app/scripts/cqp_parser/CQPParser.js @@ -170,58 +170,67 @@ if(repeat) output.repeat = repeat return output - }, - peg$c11 = "{", - peg$c12 = peg$literalExpectation("{", false), - peg$c13 = /^[0-9]/, - peg$c14 = peg$classExpectation([["0", "9"]], false, false), - peg$c15 = ",", - peg$c16 = peg$literalExpectation(",", false), - peg$c17 = "}", - peg$c18 = peg$literalExpectation("}", false), - peg$c19 = function(from, to) { + }, + peg$c11 = "<", + peg$c12 = peg$literalExpectation("<", false), + peg$c13 = "/", + peg$c14 = peg$literalExpectation("/", false), + peg$c15 = /^[A-Za-z_0-9]/, + peg$c16 = peg$classExpectation([["A", "Z"], ["a", "z"], "_", ["0", "9"]], false, false), + peg$c17 = ">", + peg$c18 = peg$literalExpectation(">", false), + peg$c19 = function(end, tag) { + return { struct: tag.join(""), start: end ? false : true } + }, + peg$c20 = "{", + peg$c21 = peg$literalExpectation("{", false), + peg$c22 = /^[0-9]/, + peg$c23 = peg$classExpectation([["0", "9"]], false, false), + peg$c24 = ",", + peg$c25 = peg$literalExpectation(",", false), + peg$c26 = "}", + peg$c27 = peg$literalExpectation("}", false), + peg$c28 = function(from, to) { var output = [Number(from.join(""))] if(to.length) output.push(Number(to.join(""))) return output }, - peg$c20 = "lbound", - peg$c21 = peg$literalExpectation("lbound", false), - peg$c22 = "rbound", - peg$c23 = peg$literalExpectation("rbound", false), - peg$c24 = "(", - peg$c25 = peg$literalExpectation("(", false), - peg$c26 = "sentence", - peg$c27 = peg$literalExpectation("sentence", false), - peg$c28 = ")", - peg$c29 = peg$literalExpectation(")", false), - peg$c30 = function(val) { + peg$c29 = "lbound", + peg$c30 = peg$literalExpectation("lbound", false), + peg$c31 = "rbound", + peg$c32 = peg$literalExpectation("rbound", false), + peg$c33 = "(", + peg$c34 = peg$literalExpectation("(", false), + peg$c35 = "sentence", + peg$c36 = peg$literalExpectation("sentence", false), + peg$c37 = ")", + peg$c38 = peg$literalExpectation(")", false), + peg$c39 = function(val) { return val }, - peg$c31 = function(first, rest) { + peg$c40 = function(first, rest) { return unpack([first], rest) }, - peg$c32 = " | ", - peg$c33 = peg$literalExpectation(" | ", false), - peg$c34 = function(left, right) { + peg$c41 = " | ", + peg$c42 = peg$literalExpectation(" | ", false), + peg$c43 = function(left, right) { return {and_block : [unpack([left], right)]} }, - peg$c35 = function(bound) { + peg$c44 = function(bound) { bound = _.fromPairs(bound.map(function(item) { return [item, true] })) return {"bound" : bound, "and_block" : []} }, - peg$c36 = function(and) {return and}, - peg$c37 = "_.", - peg$c38 = peg$literalExpectation("_.", false), - peg$c39 = /^[A-Za-z_0-9]/, - peg$c40 = peg$classExpectation([["A", "Z"], ["a", "z"], "_", ["0", "9"]], false, false), - peg$c41 = " %", - peg$c42 = peg$literalExpectation(" %", false), - peg$c43 = /^[lcd]/, - peg$c44 = peg$classExpectation(["l", "c", "d"], false, false), - peg$c45 = function(lhs, infix_op, rhs, flags) { + peg$c45 = function(and) {return and}, + peg$c46 = "_.", + peg$c47 = peg$literalExpectation("_.", false), + peg$c48 = " %", + peg$c49 = peg$literalExpectation(" %", false), + peg$c50 = /^[lcd]/, + peg$c51 = peg$classExpectation(["l", "c", "d"], false, false), + peg$c52 = function(lhs, infix_op, rhs, flags) { var prefix = "" if(lhs[0]) prefix = lhs[0] @@ -231,88 +240,88 @@ } return makeObj(prefix + lhs[1].join(""), infix_op, rhs, flags) }, - peg$c46 = /^["]/, - peg$c47 = peg$classExpectation(["\""], false, false), - peg$c48 = "\"\"", - peg$c49 = peg$literalExpectation("\"\"", false), - peg$c50 = /^[^"]/, - peg$c51 = peg$classExpectation(["\""], true, false), - peg$c52 = function(rhs) { + peg$c53 = /^["]/, + peg$c54 = peg$classExpectation(["\""], false, false), + peg$c55 = "\"\"", + peg$c56 = peg$literalExpectation("\"\"", false), + peg$c57 = /^[^"]/, + peg$c58 = peg$classExpectation(["\""], true, false), + peg$c59 = function(rhs) { return rhs.join(""); }, - peg$c53 = /^[']/, - peg$c54 = peg$classExpectation(["'"], false, false), - peg$c55 = "\\'", - peg$c56 = peg$literalExpectation("\\'", false), - peg$c57 = /^[^']/, - peg$c58 = peg$classExpectation(["'"], true, false), - peg$c59 = "$", - peg$c60 = peg$literalExpectation("$", false), - peg$c61 = "date_interval", - peg$c62 = peg$literalExpectation("date_interval", false), - peg$c63 = "!=", - peg$c64 = peg$literalExpectation("!=", false), - peg$c65 = "=", - peg$c66 = peg$literalExpectation("=", false), - peg$c67 = /^["']/, - peg$c68 = peg$classExpectation(["\"", "'"], false, false), - peg$c69 = /^['"]/, - peg$c70 = peg$classExpectation(["'", "\""], false, false), - peg$c71 = function(op, val) { + peg$c60 = /^[']/, + peg$c61 = peg$classExpectation(["'"], false, false), + peg$c62 = "\\'", + peg$c63 = peg$literalExpectation("\\'", false), + peg$c64 = /^[^']/, + peg$c65 = peg$classExpectation(["'"], true, false), + peg$c66 = "$", + peg$c67 = peg$literalExpectation("$", false), + peg$c68 = "date_interval", + peg$c69 = peg$literalExpectation("date_interval", false), + peg$c70 = "!=", + peg$c71 = peg$literalExpectation("!=", false), + peg$c72 = "=", + peg$c73 = peg$literalExpectation("=", false), + peg$c74 = /^["']/, + peg$c75 = peg$classExpectation(["\"", "'"], false, false), + peg$c76 = /^['"]/, + peg$c77 = peg$classExpectation(["'", "\""], false, false), + peg$c78 = function(op, val) { val = _.filter(val, _.isArray).map(function(item) { return item.join("") }) return makeObj("date_interval", op, val) }, - peg$c72 = "^=", - peg$c73 = peg$literalExpectation("^=", false), - peg$c74 = "&=", - peg$c75 = peg$literalExpectation("&=", false), - peg$c76 = "_=", - peg$c77 = peg$literalExpectation("_=", false), - peg$c78 = "*=", - peg$c79 = peg$literalExpectation("*=", false), - peg$c80 = "!*=", - peg$c81 = peg$literalExpectation("!*=", false), - peg$c82 = "not contains", - peg$c83 = peg$literalExpectation("not contains", false), - peg$c84 = "contains", - peg$c85 = peg$literalExpectation("contains", false), - peg$c86 = "highest_rank", - peg$c87 = peg$literalExpectation("highest_rank", false), - peg$c88 = "not_highest_rank", - peg$c89 = peg$literalExpectation("not_highest_rank", false), - peg$c90 = "rank_contains", - peg$c91 = peg$literalExpectation("rank_contains", false), - peg$c92 = "not_rank_contains", - peg$c93 = peg$literalExpectation("not_rank_contains", false), - peg$c94 = "regexp_contains", - peg$c95 = peg$literalExpectation("regexp_contains", false), - peg$c96 = "not_regexp_contains", - peg$c97 = peg$literalExpectation("not_regexp_contains", false), - peg$c98 = "starts_with_contains", - peg$c99 = peg$literalExpectation("starts_with_contains", false), - peg$c100 = "ends_with_contains", - peg$c101 = peg$literalExpectation("ends_with_contains", false), - peg$c102 = "incontains_contains", - peg$c103 = peg$literalExpectation("incontains_contains", false), - peg$c104 = "not_starts_with_contains", - peg$c105 = peg$literalExpectation("not_starts_with_contains", false), - peg$c106 = "not_ends_with_contains", - peg$c107 = peg$literalExpectation("not_ends_with_contains", false), - peg$c108 = "not_incontains_contains", - peg$c109 = peg$literalExpectation("not_incontains_contains", false), - peg$c110 = " <= ", - peg$c111 = peg$literalExpectation(" <= ", false), - peg$c112 = " => ", - peg$c113 = peg$literalExpectation(" => ", false), - peg$c114 = " > ", - peg$c115 = peg$literalExpectation(" > ", false), - peg$c116 = " = ", - peg$c117 = peg$literalExpectation(" = ", false), - peg$c118 = " < ", - peg$c119 = peg$literalExpectation(" < ", false), + peg$c79 = "^=", + peg$c80 = peg$literalExpectation("^=", false), + peg$c81 = "&=", + peg$c82 = peg$literalExpectation("&=", false), + peg$c83 = "_=", + peg$c84 = peg$literalExpectation("_=", false), + peg$c85 = "*=", + peg$c86 = peg$literalExpectation("*=", false), + peg$c87 = "!*=", + peg$c88 = peg$literalExpectation("!*=", false), + peg$c89 = "not contains", + peg$c90 = peg$literalExpectation("not contains", false), + peg$c91 = "contains", + peg$c92 = peg$literalExpectation("contains", false), + peg$c93 = "highest_rank", + peg$c94 = peg$literalExpectation("highest_rank", false), + peg$c95 = "not_highest_rank", + peg$c96 = peg$literalExpectation("not_highest_rank", false), + peg$c97 = "rank_contains", + peg$c98 = peg$literalExpectation("rank_contains", false), + peg$c99 = "not_rank_contains", + peg$c100 = peg$literalExpectation("not_rank_contains", false), + peg$c101 = "regexp_contains", + peg$c102 = peg$literalExpectation("regexp_contains", false), + peg$c103 = "not_regexp_contains", + peg$c104 = peg$literalExpectation("not_regexp_contains", false), + peg$c105 = "starts_with_contains", + peg$c106 = peg$literalExpectation("starts_with_contains", false), + peg$c107 = "ends_with_contains", + peg$c108 = peg$literalExpectation("ends_with_contains", false), + peg$c109 = "incontains_contains", + peg$c110 = peg$literalExpectation("incontains_contains", false), + peg$c111 = "not_starts_with_contains", + peg$c112 = peg$literalExpectation("not_starts_with_contains", false), + peg$c113 = "not_ends_with_contains", + peg$c114 = peg$literalExpectation("not_ends_with_contains", false), + peg$c115 = "not_incontains_contains", + peg$c116 = peg$literalExpectation("not_incontains_contains", false), + peg$c117 = " <= ", + peg$c118 = peg$literalExpectation(" <= ", false), + peg$c119 = " => ", + peg$c120 = peg$literalExpectation(" => ", false), + peg$c121 = " > ", + peg$c122 = peg$literalExpectation(" > ", false), + peg$c123 = " = ", + peg$c124 = peg$literalExpectation(" = ", false), + peg$c125 = " < ", + peg$c126 = peg$literalExpectation(" < ", false), peg$currPos = 0, peg$savedPos = 0, @@ -661,6 +670,78 @@ peg$currPos = s0; s0 = peg$FAILED; } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 60) { + s1 = peg$c11; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c12); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s2 = peg$c13; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c14); } + } + if (s2 === peg$FAILED) { + s2 = null; + } + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c15.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c16); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c15.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c16); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s4 = peg$c17; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c19(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } } return s0; @@ -671,30 +752,30 @@ s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c11; + s1 = peg$c20; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } + if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } } } else { @@ -702,42 +783,42 @@ } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { - s3 = peg$c15; + s3 = peg$c24; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s3 !== peg$FAILED) { s4 = []; - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } while (s5 !== peg$FAILED) { s4.push(s5); - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } } if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { - s5 = peg$c17; + s5 = peg$c26; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c18); } + if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c19(s2, s4); + s1 = peg$c28(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -767,49 +848,49 @@ var s0, s1, s2, s3, s4; s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c20) { - s1 = peg$c20; + if (input.substr(peg$currPos, 6) === peg$c29) { + s1 = peg$c29; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c21); } + if (peg$silentFails === 0) { peg$fail(peg$c30); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c22) { - s1 = peg$c22; + if (input.substr(peg$currPos, 6) === peg$c31) { + s1 = peg$c31; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c23); } + if (peg$silentFails === 0) { peg$fail(peg$c32); } } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 40) { - s2 = peg$c24; + s2 = peg$c33; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c26) { - s3 = peg$c26; + if (input.substr(peg$currPos, 8) === peg$c35) { + s3 = peg$c35; peg$currPos += 8; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s4 = peg$c28; + s4 = peg$c37; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c30(s1); + s1 = peg$c39(s1); s0 = s1; } else { peg$currPos = s0; @@ -885,7 +966,7 @@ } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c31(s1, s2); + s1 = peg$c40(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -907,12 +988,12 @@ if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c32) { - s4 = peg$c32; + if (input.substr(peg$currPos, 3) === peg$c41) { + s4 = peg$c41; peg$currPos += 3; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } + if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s4 !== peg$FAILED) { s5 = peg$parseor(); @@ -930,12 +1011,12 @@ while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c32) { - s4 = peg$c32; + if (input.substr(peg$currPos, 3) === peg$c41) { + s4 = peg$c41; peg$currPos += 3; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } + if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s4 !== peg$FAILED) { s5 = peg$parseor(); @@ -953,7 +1034,7 @@ } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c34(s1, s2); + s1 = peg$c43(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -968,31 +1049,31 @@ s1 = peg$parsebound_block(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c35(s1); + s1 = peg$c44(s1); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c24; + s1 = peg$c33; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s1 !== peg$FAILED) { s2 = peg$parseand(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s3 = peg$c28; + s3 = peg$c37; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c36(s2); + s1 = peg$c45(s2); s0 = s1; } else { peg$currPos = s0; @@ -1017,34 +1098,34 @@ s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c37) { - s2 = peg$c37; + if (input.substr(peg$currPos, 2) === peg$c46) { + s2 = peg$c46; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = []; - if (peg$c39.test(input.charAt(peg$currPos))) { + if (peg$c15.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } + if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); - if (peg$c39.test(input.charAt(peg$currPos))) { + if (peg$c15.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } + if (peg$silentFails === 0) { peg$fail(peg$c16); } } } } else { @@ -1089,31 +1170,31 @@ s5 = peg$parsevalue_expr(); if (s5 !== peg$FAILED) { s6 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c41) { - s7 = peg$c41; + if (input.substr(peg$currPos, 2) === peg$c48) { + s7 = peg$c48; peg$currPos += 2; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c49); } } if (s7 !== peg$FAILED) { s8 = []; - if (peg$c43.test(input.charAt(peg$currPos))) { + if (peg$c50.test(input.charAt(peg$currPos))) { s9 = input.charAt(peg$currPos); peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c44); } + if (peg$silentFails === 0) { peg$fail(peg$c51); } } if (s9 !== peg$FAILED) { while (s9 !== peg$FAILED) { s8.push(s9); - if (peg$c43.test(input.charAt(peg$currPos))) { + if (peg$c50.test(input.charAt(peg$currPos))) { s9 = input.charAt(peg$currPos); peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c44); } + if (peg$silentFails === 0) { peg$fail(peg$c51); } } } } else { @@ -1135,7 +1216,7 @@ } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c45(s1, s3, s5, s6); + s1 = peg$c52(s1, s3, s5, s6); s0 = s1; } else { peg$currPos = s0; @@ -1172,61 +1253,61 @@ var s0, s1, s2, s3; s0 = peg$currPos; - if (peg$c46.test(input.charAt(peg$currPos))) { + if (peg$c53.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } + if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { s2 = []; - if (input.substr(peg$currPos, 2) === peg$c48) { - s3 = peg$c48; + if (input.substr(peg$currPos, 2) === peg$c55) { + s3 = peg$c55; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c49); } + if (peg$silentFails === 0) { peg$fail(peg$c56); } } if (s3 === peg$FAILED) { - if (peg$c50.test(input.charAt(peg$currPos))) { + if (peg$c57.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c51); } + if (peg$silentFails === 0) { peg$fail(peg$c58); } } } while (s3 !== peg$FAILED) { s2.push(s3); - if (input.substr(peg$currPos, 2) === peg$c48) { - s3 = peg$c48; + if (input.substr(peg$currPos, 2) === peg$c55) { + s3 = peg$c55; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c49); } + if (peg$silentFails === 0) { peg$fail(peg$c56); } } if (s3 === peg$FAILED) { - if (peg$c50.test(input.charAt(peg$currPos))) { + if (peg$c57.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c51); } + if (peg$silentFails === 0) { peg$fail(peg$c58); } } } } if (s2 !== peg$FAILED) { - if (peg$c46.test(input.charAt(peg$currPos))) { + if (peg$c53.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } + if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c52(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -1242,61 +1323,61 @@ } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (peg$c53.test(input.charAt(peg$currPos))) { + if (peg$c60.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } + if (peg$silentFails === 0) { peg$fail(peg$c61); } } if (s1 !== peg$FAILED) { s2 = []; - if (input.substr(peg$currPos, 2) === peg$c55) { - s3 = peg$c55; + if (input.substr(peg$currPos, 2) === peg$c62) { + s3 = peg$c62; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c56); } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s3 === peg$FAILED) { - if (peg$c57.test(input.charAt(peg$currPos))) { + if (peg$c64.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } + if (peg$silentFails === 0) { peg$fail(peg$c65); } } } while (s3 !== peg$FAILED) { s2.push(s3); - if (input.substr(peg$currPos, 2) === peg$c55) { - s3 = peg$c55; + if (input.substr(peg$currPos, 2) === peg$c62) { + s3 = peg$c62; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c56); } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s3 === peg$FAILED) { - if (peg$c57.test(input.charAt(peg$currPos))) { + if (peg$c64.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } + if (peg$silentFails === 0) { peg$fail(peg$c65); } } } } if (s2 !== peg$FAILED) { - if (peg$c53.test(input.charAt(peg$currPos))) { + if (peg$c60.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } + if (peg$silentFails === 0) { peg$fail(peg$c61); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c52(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -1320,19 +1401,19 @@ s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 36) { - s1 = peg$c59; + s1 = peg$c66; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } + if (peg$silentFails === 0) { peg$fail(peg$c67); } } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 13) === peg$c61) { - s2 = peg$c61; + if (input.substr(peg$currPos, 13) === peg$c68) { + s2 = peg$c68; peg$currPos += 13; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c62); } + if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 32) { @@ -1346,20 +1427,20 @@ s3 = null; } if (s3 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c63) { - s4 = peg$c63; + if (input.substr(peg$currPos, 2) === peg$c70) { + s4 = peg$c70; peg$currPos += 2; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } + if (peg$silentFails === 0) { peg$fail(peg$c71); } } if (s4 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { - s4 = peg$c65; + s4 = peg$c72; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } + if (peg$silentFails === 0) { peg$fail(peg$c73); } } } if (s4 !== peg$FAILED) { @@ -1374,32 +1455,32 @@ s5 = null; } if (s5 !== peg$FAILED) { - if (peg$c67.test(input.charAt(peg$currPos))) { + if (peg$c74.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c68); } + if (peg$silentFails === 0) { peg$fail(peg$c75); } } if (s6 !== peg$FAILED) { s7 = peg$currPos; s8 = []; - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s9 = input.charAt(peg$currPos); peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s9 !== peg$FAILED) { while (s9 !== peg$FAILED) { s8.push(s9); - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s9 = input.charAt(peg$currPos); peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } } } else { @@ -1407,30 +1488,30 @@ } if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { - s9 = peg$c15; + s9 = peg$c24; peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s9 !== peg$FAILED) { s10 = []; - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s11 = input.charAt(peg$currPos); peg$currPos++; } else { s11 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s11 !== peg$FAILED) { while (s11 !== peg$FAILED) { s10.push(s11); - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s11 = input.charAt(peg$currPos); peg$currPos++; } else { s11 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } } } else { @@ -1438,30 +1519,30 @@ } if (s10 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { - s11 = peg$c15; + s11 = peg$c24; peg$currPos++; } else { s11 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s11 !== peg$FAILED) { s12 = []; - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s13 = input.charAt(peg$currPos); peg$currPos++; } else { s13 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s13 !== peg$FAILED) { while (s13 !== peg$FAILED) { s12.push(s13); - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s13 = input.charAt(peg$currPos); peg$currPos++; } else { s13 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } } } else { @@ -1469,30 +1550,30 @@ } if (s12 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { - s13 = peg$c15; + s13 = peg$c24; peg$currPos++; } else { s13 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s13 !== peg$FAILED) { s14 = []; - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s15 = input.charAt(peg$currPos); peg$currPos++; } else { s15 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s15 !== peg$FAILED) { while (s15 !== peg$FAILED) { s14.push(s15); - if (peg$c13.test(input.charAt(peg$currPos))) { + if (peg$c22.test(input.charAt(peg$currPos))) { s15 = input.charAt(peg$currPos); peg$currPos++; } else { s15 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } } } else { @@ -1530,16 +1611,16 @@ s7 = peg$FAILED; } if (s7 !== peg$FAILED) { - if (peg$c69.test(input.charAt(peg$currPos))) { + if (peg$c76.test(input.charAt(peg$currPos))) { s8 = input.charAt(peg$currPos); peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$c77); } } if (s8 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c71(s4, s7); + s1 = peg$c78(s4, s7); s0 = s1; } else { peg$currPos = s0; @@ -1580,172 +1661,172 @@ function peg$parseinfix_op() { var s0; - if (input.substr(peg$currPos, 2) === peg$c72) { - s0 = peg$c72; + if (input.substr(peg$currPos, 2) === peg$c79) { + s0 = peg$c79; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c74) { - s0 = peg$c74; + if (input.substr(peg$currPos, 2) === peg$c81) { + s0 = peg$c81; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c76) { - s0 = peg$c76; + if (input.substr(peg$currPos, 2) === peg$c83) { + s0 = peg$c83; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c77); } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c78) { - s0 = peg$c78; + if (input.substr(peg$currPos, 2) === peg$c85) { + s0 = peg$c85; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c63) { - s0 = peg$c63; + if (input.substr(peg$currPos, 2) === peg$c70) { + s0 = peg$c70; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } + if (peg$silentFails === 0) { peg$fail(peg$c71); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { - s0 = peg$c65; + s0 = peg$c72; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } + if (peg$silentFails === 0) { peg$fail(peg$c73); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c80) { - s0 = peg$c80; + if (input.substr(peg$currPos, 3) === peg$c87) { + s0 = peg$c87; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$c88); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 12) === peg$c82) { - s0 = peg$c82; + if (input.substr(peg$currPos, 12) === peg$c89) { + s0 = peg$c89; peg$currPos += 12; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c83); } + if (peg$silentFails === 0) { peg$fail(peg$c90); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c84) { - s0 = peg$c84; + if (input.substr(peg$currPos, 8) === peg$c91) { + s0 = peg$c91; peg$currPos += 8; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c85); } + if (peg$silentFails === 0) { peg$fail(peg$c92); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 12) === peg$c86) { - s0 = peg$c86; + if (input.substr(peg$currPos, 12) === peg$c93) { + s0 = peg$c93; peg$currPos += 12; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c87); } + if (peg$silentFails === 0) { peg$fail(peg$c94); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 16) === peg$c88) { - s0 = peg$c88; + if (input.substr(peg$currPos, 16) === peg$c95) { + s0 = peg$c95; peg$currPos += 16; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c89); } + if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 13) === peg$c90) { - s0 = peg$c90; + if (input.substr(peg$currPos, 13) === peg$c97) { + s0 = peg$c97; peg$currPos += 13; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c91); } + if (peg$silentFails === 0) { peg$fail(peg$c98); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 17) === peg$c92) { - s0 = peg$c92; + if (input.substr(peg$currPos, 17) === peg$c99) { + s0 = peg$c99; peg$currPos += 17; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c93); } + if (peg$silentFails === 0) { peg$fail(peg$c100); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 15) === peg$c94) { - s0 = peg$c94; + if (input.substr(peg$currPos, 15) === peg$c101) { + s0 = peg$c101; peg$currPos += 15; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c95); } + if (peg$silentFails === 0) { peg$fail(peg$c102); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 19) === peg$c96) { - s0 = peg$c96; + if (input.substr(peg$currPos, 19) === peg$c103) { + s0 = peg$c103; peg$currPos += 19; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c104); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 20) === peg$c98) { - s0 = peg$c98; + if (input.substr(peg$currPos, 20) === peg$c105) { + s0 = peg$c105; peg$currPos += 20; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } + if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 18) === peg$c100) { - s0 = peg$c100; + if (input.substr(peg$currPos, 18) === peg$c107) { + s0 = peg$c107; peg$currPos += 18; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c101); } + if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 19) === peg$c102) { - s0 = peg$c102; + if (input.substr(peg$currPos, 19) === peg$c109) { + s0 = peg$c109; peg$currPos += 19; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c103); } + if (peg$silentFails === 0) { peg$fail(peg$c110); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 24) === peg$c104) { - s0 = peg$c104; + if (input.substr(peg$currPos, 24) === peg$c111) { + s0 = peg$c111; peg$currPos += 24; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } + if (peg$silentFails === 0) { peg$fail(peg$c112); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 22) === peg$c106) { - s0 = peg$c106; + if (input.substr(peg$currPos, 22) === peg$c113) { + s0 = peg$c113; peg$currPos += 22; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c107); } + if (peg$silentFails === 0) { peg$fail(peg$c114); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 23) === peg$c108) { - s0 = peg$c108; + if (input.substr(peg$currPos, 23) === peg$c115) { + s0 = peg$c115; peg$currPos += 23; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c109); } + if (peg$silentFails === 0) { peg$fail(peg$c116); } } } } @@ -1774,44 +1855,44 @@ function peg$parsedate_op() { var s0; - if (input.substr(peg$currPos, 4) === peg$c110) { - s0 = peg$c110; + if (input.substr(peg$currPos, 4) === peg$c117) { + s0 = peg$c117; peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c111); } + if (peg$silentFails === 0) { peg$fail(peg$c118); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c112) { - s0 = peg$c112; + if (input.substr(peg$currPos, 4) === peg$c119) { + s0 = peg$c119; peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } + if (peg$silentFails === 0) { peg$fail(peg$c120); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c114) { - s0 = peg$c114; + if (input.substr(peg$currPos, 3) === peg$c121) { + s0 = peg$c121; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } + if (peg$silentFails === 0) { peg$fail(peg$c122); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c116) { - s0 = peg$c116; + if (input.substr(peg$currPos, 3) === peg$c123) { + s0 = peg$c123; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c117); } + if (peg$silentFails === 0) { peg$fail(peg$c124); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c118) { - s0 = peg$c118; + if (input.substr(peg$currPos, 3) === peg$c125) { + s0 = peg$c125; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } + if (peg$silentFails === 0) { peg$fail(peg$c126); } } } } @@ -1832,12 +1913,12 @@ if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c32) { - s0 = peg$c32; + if (input.substr(peg$currPos, 3) === peg$c41) { + s0 = peg$c41; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } + if (peg$silentFails === 0) { peg$fail(peg$c42); } } } diff --git a/app/scripts/cqp_parser/CQPParser.pegjs b/app/scripts/cqp_parser/CQPParser.pegjs index f9efe29cc..97316804c 100644 --- a/app/scripts/cqp_parser/CQPParser.pegjs +++ b/app/scripts/cqp_parser/CQPParser.pegjs @@ -46,7 +46,10 @@ token if(repeat) output.repeat = repeat return output - } + } + / "<" end:"/"? tag:[A-Za-z_0-9]+ ">" { + return { struct: tag.join(""), start: end ? false : true } + } repeat = "{" from:[0-9]+ "," to:[0-9]* "}" diff --git a/app/scripts/cqp_parser/cqp.js b/app/scripts/cqp_parser/cqp.js index 6d34e6993..62da0cb34 100644 --- a/app/scripts/cqp_parser/cqp.js +++ b/app/scripts/cqp_parser/cqp.js @@ -86,6 +86,11 @@ const stringifyCqp = function (cqp_obj, expanded_format) { continue } + if (token.struct) { + output.push(`<${token.start ? '' : '/'}${token.struct}>`) + continue + } + const outer_and_array = [] for (let and_array of token.and_block) { const or_array = [] diff --git a/app/scripts/directives.js b/app/scripts/directives.js index d43042320..d685a7494 100644 --- a/app/scripts/directives.js +++ b/app/scripts/directives.js @@ -432,34 +432,7 @@ korpApp.directive("extendedList", () => ({ const s = $scope const setCQP = function (val) { - let token - try { - s.data = CQP.parse(val) - } catch (error) { - let output = [] - for (token of val.split("[")) { - if (!token) { - continue - } - token = `[${token}` - let tokenObj - try { - tokenObj = CQP.parse(token) - } catch (parseError) { - tokenObj = [{ cqp: token }] - } - output = output.concat(tokenObj) - } - - s.data = output - c.log("error parsing cqp", s.data) - } - - for (token of s.data) { - if (!("and_block" in token) || !token.and_block.length) { - token.and_block = CQP.parse('[word = ""]')[0].and_block - } - } + s.data = CQP.parse(val) } if (s.cqp == null) { @@ -467,7 +440,9 @@ korpApp.directive("extendedList", () => ({ } setCQP(s.cqp) - s.$watch("data", () => (s.cqp = CQP.stringify(s.data) || ""), true) + s.$watch("data", () => { + s.cqp = CQP.stringify(s.data) || "" + }, true) s.$watch("cqp", () => { setCQP(s.cqp) }) @@ -486,10 +461,34 @@ korpApp.directive("extendedList", () => ({ const token = { and_block: [s.addOr([])] } s.data.push(token) s.repeatError = false + s.showCloseButton = true + } + + function getTokenBoxes() { + return s.data.filter((box) => box.and_block); + } + + s.showCloseButton = getTokenBoxes().length > 1 + + s.scrollToStart = false + s.addStructToken = function(start = true, idx = -1, within) { + within = within ? within : Object.keys(settings.corpusListing.getCommonWithins())[0] + // TODO this is duplicated since s.tagTypes are not available in this scope + const token = { struct: within, start: true } + if (idx != -1) { + s.data.splice(idx, 0, token); + } else if (start) { + s.scrollToStart = true + s.data.unshift(token) + } else { + s.data.push(token) + } } s.removeToken = function (i) { - if (!(s.data.length > 1)) { + const tokenBoxes = getTokenBoxes() + s.showCloseButton = tokenBoxes.length > 2 + if (!(tokenBoxes.length > 1)) { return } s.data.splice(i, 1) @@ -503,16 +502,28 @@ korpApp.directive("extendedList", () => ({ s.repeatError = repeatError } + s.removeTag = function (i) { + s.data.splice(i, 1) + } + s.toggleRepeat = function (token) { if (!token.repeat) { token.repeat = [1, 1] s.repeatError = false } else { s.repeatError = false - return delete token.repeat + delete token.repeat } } + + s.toggleStart = (idx) => { + s.addStructToken(false, idx, "sentence") + } + s.toggleEnd = (idx) => { + s.addStructToken(false, idx + 1, "sentence") + } + s.repeatChange = function (repeat_idx, token_idx) { const token = s.data[token_idx] diff --git a/app/scripts/directives/scroll.js b/app/scripts/directives/scroll.js new file mode 100644 index 000000000..ffe0e2a61 --- /dev/null +++ b/app/scripts/directives/scroll.js @@ -0,0 +1,32 @@ +/** @format */ +const korpApp = angular.module("korpApp") + +korpApp.directive("scrollToStart", function () { + return { + restrict: "A", + link: function (scope, elm, attr) { + const pElm = elm[0].parentElement.parentElement + + let isStart + scope.$watch(attr.scrollToStart, function (newValue) { + newValue = !!newValue + console.log("## watch", newValue) + if (!isStart && newValue) { + console.log("## lets scroll!!!!") + pElm.scrollTo(0, 0) + } + isStart = newValue + }) + + angular.element(pElm).bind("scroll", function () { + if (pElm.scrollLeft !== 0 && isStart) { + scope.$apply(function () { + console.log("## fixit") + scope[attr.scrollToStart] = false + isStart = false + }) + } + }) + }, + } +}) diff --git a/app/scripts/search_controllers.js b/app/scripts/search_controllers.js index 77336ea05..94fbaa8d0 100644 --- a/app/scripts/search_controllers.js +++ b/app/scripts/search_controllers.js @@ -539,6 +539,7 @@ korpApp.controller("ExtendedToken", function ($scope, utils) { const lang = s.$parent.$parent && s.$parent.$parent.l && s.$parent.$parent.l.lang const allAttrs = settings.corpusListing.getAttributeGroups(lang) s.types = _.filter(allAttrs, (item) => !item.hideExtended) + s.tagTypes = settings.corpusListing.getCommonWithins() s.typeMapping = _.fromPairs( _.map(s.types, function (item) { if (item.isStructAttr) { @@ -565,19 +566,6 @@ korpApp.controller("ExtendedToken", function ($scope, utils) { s.addAnd = (token) => { token.and_block.push(s.addOr([])) } - - const toggleBound = function (token, bnd) { - if (!(token.bound && token.bound[bnd])) { - const boundObj = {} - boundObj[bnd] = true - token.bound = _.extend(token.bound || {}, boundObj) - } else if (token.bound) { - delete token.bound[bnd] - } - } - - s.toggleStart = (token) => toggleBound(token, "lbound") - s.toggleEnd = (token) => toggleBound(token, "rbound") }) korpApp.directive("advancedSearch", () => ({ diff --git a/app/scripts/util.js b/app/scripts/util.js index a58618c59..2f560bb4f 100644 --- a/app/scripts/util.js +++ b/app/scripts/util.js @@ -268,6 +268,26 @@ window.CorpusListing = class CorpusListing { return { default_within: defaultWithin, within } } + getCommonWithins() { + // only return withins that are available in every selected corpus + const allWithins = this.selected.map((corp) => corp.within) + const withins = allWithins.reduce((acc, curr) => { + for (const key in acc) { + if (!curr[key]) { + delete acc[key]; + } + } + return acc + }, _.pickBy(allWithins[0], (val, within) => { + // ignore withins that start with numbers, such as "5 sentence" + return !within.match(/^[0-9]/) + })) + if (_.isEmpty(withins)) { + return { sentence: { label: { sv: "mening", en: "sentence" }}} + } + return withins + } + getTimeInterval() { const all = _(this.selected) .map("time") diff --git a/app/styles/styles.scss b/app/styles/styles.scss index d19786591..6eaa788f5 100644 --- a/app/styles/styles.scss +++ b/app/styles/styles.scss @@ -647,25 +647,8 @@ table { padding: 0px 5px; } -.insert_token { - position: relative; - top: 54px; - margin-left: 10px; - // font-weight: bold; - color: #555; - &:hover { - color: #333; - } - .plus-btn { - position: relative; - top: -1px; - } -} - .query_token { background-color: #e1e1e1; - display: inline-block; - vertical-align: top; padding: 5px; border: 1px solid #999; margin-left: 0; @@ -680,7 +663,8 @@ table { transition: opacity 200ms ease; font-size : 15px; } - &:only-of-type .close_btn { + + .close_btn.show { opacity: 0; cursor: default; transition: opacity 200ms ease; @@ -769,24 +753,6 @@ table { } } - .close_token { - border-radius: 20px; - color: black; - background-color: rgb(242, 247, 255); - border: thin lightgrey solid; - padding-left: 5px; - padding-right: 2px; - cursor: default; - i { - cursor : pointer; - } - } - - .lower_footer { - text-align: right; - margin-top: 2px; - } - #opt_menu { display: none; font-size: .8em; @@ -1359,7 +1325,6 @@ label[for=lemgram_select]:before { } .query_arg { - border-radius: 2px; padding: 5px; background-color: #f7fceb; border: solid 1px #999; @@ -1375,6 +1340,10 @@ label[for=lemgram_select]:before { } } +.tag-box { + background-color: #dbeafe; +} + .query_arg:only-of-type .or_arg:only-child .remove_arg { cursor: default; opacity: 0; @@ -1562,6 +1531,14 @@ label[for=lemgram_select]:before { font-size: 1.3em; } +.arg_selects.word { + color: #222222; +} + +.arg_selects.word:hover { + color: #222222; +} + .error_msg ~ * { display: none !important; } @@ -2631,10 +2608,6 @@ li.active a span .num-to-find { } } -.or_container .word { - color: #222222; -} - .err_msg { font-size: .8em; color: red; diff --git a/app/translations/locale-en.json b/app/translations/locale-en.json index 52c86ecdb..8766d7d5d 100644 --- a/app/translations/locale-en.json +++ b/app/translations/locale-en.json @@ -127,6 +127,11 @@ "sent_start": "Sentence start", "sent_end": "Sentence end", + "before_token": "Before first token", + "after_token": "After last token", + "add_tag_box": "Add tag", + "starts": "starts", + "ends": "ends", "none_selected": "<none selected>", diff --git a/app/translations/locale-sv.json b/app/translations/locale-sv.json index 115177fe4..a62095206 100644 --- a/app/translations/locale-sv.json +++ b/app/translations/locale-sv.json @@ -126,6 +126,11 @@ "sent_start": "Meningsbörjan", "sent_end": "Meningsslut", + "before_token": "Före första tokenet", + "after_token": "Efter sista tokenet", + "add_tag_box": "Lägg till sak", + "starts": "börjar", + "ends": "slutar", "none_selected": "<ej vald>", diff --git a/app/views/extendedlist.html b/app/views/extendedlist.html index dabc954b9..96eab2365 100644 --- a/app/views/extendedlist.html +++ b/app/views/extendedlist.html @@ -1,87 +1,89 @@
-
-
-
- -
-
- -
-
- {{'and' | loc:lang}} - -
-
-
- -
-
-
- - - +
+
+
+
+ +
+
+ +
+
+ {{'and' | loc:lang}} + +
+
+
+ +
+
+
+ + + +
+
-
+
- + +
- - diff --git a/tailwind.config.js b/tailwind.config.js index 6f732f502..b61317dc3 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,28 +1,28 @@ +/** @format */ module.exports = { - // pug doesn't support special characters in class names, so no colon. - separator: '_', - purge: [ - "./app/**/*.js", - "./app/**/*.html", - "./app/**/*.pug" - ], - theme: { - extend: { - colors: { - gray: { - '100': '#f5f5f5', - '200': '#eeeeee', - '300': '#e0e0e0', - '400': '#bdbdbd', - '500': '#9e9e9e', - '600': '#757575', - '700': '#616161', - '800': '#424242', - '900': '#212121', - } - } + // pug doesn't support special characters in class names, so no colon. + separator: "_", + purge: ["./app/**/*.js", "./app/**/*.html", "./app/**/*.pug"], + theme: { + extend: { + colors: { + gray: { + "100": "#f5f5f5", + "200": "#eeeeee", + "300": "#e0e0e0", + "400": "#bdbdbd", + "500": "#9e9e9e", + "600": "#757575", + "700": "#616161", + "800": "#424242", + "900": "#212121", + }, + orange: { + "900": "#f2581a", + }, + }, + }, }, - }, - variants: {}, - plugins: [], + variants: {}, + plugins: [], }