How to use s1 method in ng-mocks

Best JavaScript code snippet using ng-mocks

parser.js

Source:parser.js Github

copy

Full Screen

1module.exports = parse2function parse(input, opts) {3 // Wrap parser.parse to allow specifying the start rule4 // as a shorthand option5 if (!opts) {6 opts = {}7 }8 else if (typeof opts == 'string') {9 opts = { startRule: opts }10 }11 return parser.parse(input, opts)12}13var parser=(function() {14 "use strict";15 /*16 * Generated by PEG.js 0.9.0.17 *18 * http://pegjs.org/19 */20 function peg$subclass(child, parent) {21 function ctor() { this.constructor = child; }22 ctor.prototype = parent.prototype;23 child.prototype = new ctor();24 }25 function peg$SyntaxError(message, expected, found, location) {26 this.message = message;27 this.expected = expected;28 this.found = found;29 this.location = location;30 this.name = "SyntaxError";31 if (typeof Error.captureStackTrace === "function") {32 Error.captureStackTrace(this, peg$SyntaxError);33 }34 }35 peg$subclass(peg$SyntaxError, Error);36 function peg$parse(input) {37 var options = arguments.length > 1 ? arguments[1] : {},38 parser = this,39 peg$FAILED = {},40 peg$startRuleFunctions = { script: peg$parsescript, command: peg$parsecommand, argument: peg$parseargument, continuationStart: peg$parsecontinuationStart },41 peg$startRuleFunction = peg$parsescript,42 peg$c0 = function(statements) {43 return statements || []44 },45 peg$c1 = function(head, tail, last) {46 var statements = [head]47 var prev = head48 map(tail, function (spaceOpSpaceCmd, i, cmds) {49 setOperator(spaceOpSpaceCmd[0], prev)50 statements.push(prev = spaceOpSpaceCmd[2])51 })52 if (last) {53 if (!prev) { debugger }54 setOperator(last, prev)55 }56 return statements57 function setOperator(operator, command) {58 while (command.next) {59 command = command.next60 }61 command.control = operator62 }63 },64 peg$c2 = function(statement, next) {65 if (typeof next !== 'undefined' && next) {66 next = next[1]67 statement.control = next[0]68 statement.next = next[1]69 } else {70 statement.control = ';'71 statement.next = null72 }73 return statement74 },75 peg$c3 = "&&",76 peg$c4 = { type: "literal", value: "&&", description: "\"&&\"" },77 peg$c5 = "||",78 peg$c6 = { type: "literal", value: "||", description: "\"||\"" },79 peg$c7 = function(operator, statement) {80 return [operator, statement]81 },82 peg$c8 = { type: "other", description: "a subshell" },83 peg$c9 = "(",84 peg$c10 = { type: "literal", value: "(", description: "\"(\"" },85 peg$c11 = ")",86 peg$c12 = { type: "literal", value: ")", description: "\")\"" },87 peg$c13 = function(statements) {88 return {89 type: 'subshell',90 statements: statements,91 }92 },93 peg$c14 = { type: "other", description: "a single command" },94 peg$c15 = function(pre, name, post, pipe) {95 var command = {96 type: 'command',97 command: name,98 args: [],99 redirects: [],100 env: {},101 control: ';',102 next: null,103 }104 map(pre, first).concat(map(post, second)).forEach(function (token) {105 if (!token || !token.type) return106 switch (token.type) {107 case 'moveFd':108 case 'duplicateFd':109 case 'redirectFd':110 return command.redirects.push(token)111 case 'variableAssignment':112 return command.env[token.name] = token.value113 default:114 command.args.push(token)115 }116 })117 if (pipe) {118 command.redirects.push(pipe[1])119 }120 return command121 },122 peg$c16 = function(test) {123 return test124 },125 peg$c17 = { type: "other", description: "an if/elif/else statement" },126 peg$c18 = "if",127 peg$c19 = { type: "literal", value: "if", description: "\"if\"" },128 peg$c20 = "then",129 peg$c21 = { type: "literal", value: "then", description: "\"then\"" },130 peg$c22 = "else",131 peg$c23 = { type: "literal", value: "else", description: "\"else\"" },132 peg$c24 = "fi",133 peg$c25 = { type: "literal", value: "fi", description: "\"fi\"" },134 peg$c26 = function(test, body, elifBlocks, elseBody) {135 return {136 type: 'ifElse',137 test: test,138 body: body,139 elifBlocks: elifBlocks.length ? elifBlocks : null,140 elseBody: elseBody ? elseBody[1] : null,141 }142 },143 peg$c27 = "elif",144 peg$c28 = { type: "literal", value: "elif", description: "\"elif\"" },145 peg$c29 = function(test, body) {146 return {147 type: 'ifElse',148 test: test,149 body: body150 }151 },152 peg$c30 = { type: "other", description: "a while/until loop" },153 peg$c31 = "while",154 peg$c32 = { type: "literal", value: "while", description: "\"while\"" },155 peg$c33 = "until",156 peg$c34 = { type: "literal", value: "until", description: "\"until\"" },157 peg$c35 = "do",158 peg$c36 = { type: "literal", value: "do", description: "\"do\"" },159 peg$c37 = "done",160 peg$c38 = { type: "literal", value: "done", description: "\"done\"" },161 peg$c39 = function(kind, test, body) {162 return {163 type: kind + 'Loop',164 test: test,165 body: body166 }167 },168 peg$c40 = { type: "other", description: "a for loop" },169 peg$c41 = "for",170 peg$c42 = { type: "literal", value: "for", description: "\"for\"" },171 peg$c43 = "in",172 peg$c44 = { type: "literal", value: "in", description: "\"in\"" },173 peg$c45 = ";",174 peg$c46 = { type: "literal", value: ";", description: "\";\"" },175 peg$c47 = "\n",176 peg$c48 = { type: "literal", value: "\n", description: "\"\\n\"" },177 peg$c49 = function(loopVar, subjects, body) {178 return {179 type: 'forLoop',180 loopVariable: loopVar,181 subjects: subjects[1].map(second),182 body: body183 }184 },185 peg$c50 = { type: "other", description: "time builtin" },186 peg$c51 = "time",187 peg$c52 = { type: "literal", value: "time", description: "\"time\"" },188 peg$c53 = "-",189 peg$c54 = { type: "literal", value: "-", description: "\"-\"" },190 peg$c55 = /^[a-z]/,191 peg$c56 = { type: "class", value: "[a-z]", description: "[a-z]" },192 peg$c57 = function(flags, statements) {193 return {194 type: 'time',195 flags: flags,196 command: statements197 }198 },199 peg$c58 = { type: "other", description: "declare builtin" },200 peg$c59 = "declare",201 peg$c60 = { type: "literal", value: "declare", description: "\"declare\"" },202 peg$c61 = "typeset",203 peg$c62 = { type: "literal", value: "typeset", description: "\"typeset\"" },204 peg$c63 = /^[^\n]/,205 peg$c64 = { type: "class", value: "[^\\n]", description: "[^\\n]" },206 peg$c65 = { type: "other", description: "a variable assignment" },207 peg$c66 = "=",208 peg$c67 = { type: "literal", value: "=", description: "\"=\"" },209 peg$c68 = function(name, value) {210 return {type: 'variableAssignment', name: name, value: value}211 },212 peg$c69 = { type: "other", description: "command name" },213 peg$c70 = function(name) {214 return name215 },216 peg$c71 = "[[",217 peg$c72 = { type: "literal", value: "[[", description: "\"[[\"" },218 peg$c73 = "[",219 peg$c74 = { type: "literal", value: "[", description: "\"[\"" },220 peg$c75 = { type: "other", description: "command argument" },221 peg$c76 = { type: "other", description: "concatenation of strings and/or variables" },222 peg$c77 = function(pieces) {223 return flattenConcatenation(pieces)224 },225 peg$c78 = { type: "other", description: "bareword" },226 peg$c79 = "#",227 peg$c80 = { type: "literal", value: "#", description: "\"#\"" },228 peg$c81 = function(cs) { return literal(cs) },229 peg$c82 = "\\",230 peg$c83 = { type: "literal", value: "\\", description: "\"\\\\\"" },231 peg$c84 = function(chr) { return chr },232 peg$c85 = { type: "any", description: "any character" },233 peg$c86 = /^[$"';&<>\n()[*?|` ]/,234 peg$c87 = { type: "class", value: "[$\"';&<>\\n()\\[*?|` ]", description: "[$\"';&<>\\n()\\[*?|` ]" },235 peg$c88 = "*",236 peg$c89 = { type: "literal", value: "*", description: "\"*\"" },237 peg$c90 = "?",238 peg$c91 = { type: "literal", value: "?", description: "\"?\"" },239 peg$c92 = function() {240 return {241 type: 'glob',242 value: text()243 }244 },245 peg$c93 = "]",246 peg$c94 = { type: "literal", value: "]", description: "\"]\"" },247 peg$c95 = "$",248 peg$c96 = { type: "literal", value: "$", description: "\"$\"" },249 peg$c97 = "{",250 peg$c98 = { type: "literal", value: "{", description: "\"{\"" },251 peg$c99 = "}",252 peg$c100 = { type: "literal", value: "}", description: "\"}\"" },253 peg$c101 = "'",254 peg$c102 = { type: "literal", value: "'", description: "\"'\"" },255 peg$c103 = /^[^']/,256 peg$c104 = { type: "class", value: "[^']", description: "[^']" },257 peg$c105 = function(inner) { return literal(inner) },258 peg$c106 = "\"",259 peg$c107 = { type: "literal", value: "\"", description: "\"\\\"\"" },260 peg$c108 = function(contents) {261 var pieces = contents.map(function (it) {262 return isArray(it) ? literal(it) : it263 })264 return flattenConcatenation(pieces)265 },266 peg$c109 = "\\\\",267 peg$c110 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },268 peg$c111 = function() { return '\\' },269 peg$c112 = "`",270 peg$c113 = { type: "literal", value: "`", description: "\"`\"" },271 peg$c114 = function(name) {272 return {type: 'variable', name: name}273 },274 peg$c115 = /^[a-zA-Z0-9_]/,275 peg$c116 = { type: "class", value: "[a-zA-Z0-9_]", description: "[a-zA-Z0-9_]" },276 peg$c117 = function() { return text() },277 peg$c118 = "${",278 peg$c119 = { type: "literal", value: "${", description: "\"${\"" },279 peg$c120 = /^[^}]/,280 peg$c121 = { type: "class", value: "[^}]", description: "[^}]" },281 peg$c122 = function(expr) {282 return {283 type: 'variableSubstitution',284 expression: join(expr), // TODO subParser285 }286 },287 peg$c123 = "$(",288 peg$c124 = { type: "literal", value: "$(", description: "\"$(\"" },289 peg$c125 = function(commands) {290 return {291 type: 'commandSubstitution',292 commands: commands293 }294 },295 peg$c126 = function(input) {296 return { type: 'commandSubstitution', commands: parse(input.join('')) }297 },298 peg$c127 = "\\`",299 peg$c128 = { type: "literal", value: "\\`", description: "\"\\\\`\"" },300 peg$c129 = function() { return '`' },301 peg$c130 = /^[<>]/,302 peg$c131 = { type: "class", value: "[<>]", description: "[<>]" },303 peg$c132 = function(rw, commands) {304 return {305 type: 'processSubstitution',306 readWrite: rw,307 commands: commands,308 }309 },310 peg$c133 = "<&",311 peg$c134 = { type: "literal", value: "<&", description: "\"<&\"" },312 peg$c135 = ">&",313 peg$c136 = { type: "literal", value: ">&", description: "\">&\"" },314 peg$c137 = function(fd, op, dest) {315 if (fd == null) fd = op[0] == '<' ? 0 : 1;316 return {317 type: 'moveFd',318 fd: fd,319 op: op,320 dest: dest321 }322 },323 peg$c138 = function(src, op, dest) {324 if (src == null) src = op[0] == '<' ? 0 : 1;325 return {326 type: 'duplicateFd',327 srcFd: src,328 op: op,329 destFd: dest,330 }331 },332 peg$c139 = function(fd, op, filename) {333 if (fd == null) fd = op[0] == '<' ? 0 : 1;334 return {335 type: 'redirectFd',336 fd: fd,337 op: op,338 filename: filename339 }340 },341 peg$c140 = ">|",342 peg$c141 = { type: "literal", value: ">|", description: "\">|\"" },343 peg$c142 = ">>",344 peg$c143 = { type: "literal", value: ">>", description: "\">>\"" },345 peg$c144 = "&>>",346 peg$c145 = { type: "literal", value: "&>>", description: "\"&>>\"" },347 peg$c146 = "&>",348 peg$c147 = { type: "literal", value: "&>", description: "\"&>\"" },349 peg$c148 = "<",350 peg$c149 = { type: "literal", value: "<", description: "\"<\"" },351 peg$c150 = ">",352 peg$c151 = { type: "literal", value: ">", description: "\">\"" },353 peg$c152 = /^[0-9]/,354 peg$c153 = { type: "class", value: "[0-9]", description: "[0-9]" },355 peg$c154 = function(digits) { return parseInt(join(digits), 10) },356 peg$c155 = "&",357 peg$c156 = { type: "literal", value: "&", description: "\"&\"" },358 peg$c157 = function(op) {359 return op == '\n' ? ';' : op360 },361 peg$c158 = "|",362 peg$c159 = { type: "literal", value: "|", description: "\"|\"" },363 peg$c160 = function(command) {364 return {type: 'pipe', command: command}365 },366 peg$c161 = { type: "other", description: "whitespace" },367 peg$c162 = " ",368 peg$c163 = { type: "literal", value: " ", description: "\" \"" },369 peg$c164 = "\t",370 peg$c165 = { type: "literal", value: "\t", description: "\"\\t\"" },371 peg$c166 = { type: "other", description: "a comment" },372 peg$c167 = "case",373 peg$c168 = { type: "literal", value: "case", description: "\"case\"" },374 peg$c169 = "esac",375 peg$c170 = { type: "literal", value: "esac", description: "\"esac\"" },376 peg$currPos = 0,377 peg$savedPos = 0,378 peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],379 peg$maxFailPos = 0,380 peg$maxFailExpected = [],381 peg$silentFails = 0,382 peg$result;383 if ("startRule" in options) {384 if (!(options.startRule in peg$startRuleFunctions)) {385 throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");386 }387 peg$startRuleFunction = peg$startRuleFunctions[options.startRule];388 }389 function text() {390 return input.substring(peg$savedPos, peg$currPos);391 }392 function location() {393 return peg$computeLocation(peg$savedPos, peg$currPos);394 }395 function expected(description) {396 throw peg$buildException(397 null,398 [{ type: "other", description: description }],399 input.substring(peg$savedPos, peg$currPos),400 peg$computeLocation(peg$savedPos, peg$currPos)401 );402 }403 function error(message) {404 throw peg$buildException(405 message,406 null,407 input.substring(peg$savedPos, peg$currPos),408 peg$computeLocation(peg$savedPos, peg$currPos)409 );410 }411 function peg$computePosDetails(pos) {412 var details = peg$posDetailsCache[pos],413 p, ch;414 if (details) {415 return details;416 } else {417 p = pos - 1;418 while (!peg$posDetailsCache[p]) {419 p--;420 }421 details = peg$posDetailsCache[p];422 details = {423 line: details.line,424 column: details.column,425 seenCR: details.seenCR426 };427 while (p < pos) {428 ch = input.charAt(p);429 if (ch === "\n") {430 if (!details.seenCR) { details.line++; }431 details.column = 1;432 details.seenCR = false;433 } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {434 details.line++;435 details.column = 1;436 details.seenCR = true;437 } else {438 details.column++;439 details.seenCR = false;440 }441 p++;442 }443 peg$posDetailsCache[pos] = details;444 return details;445 }446 }447 function peg$computeLocation(startPos, endPos) {448 var startPosDetails = peg$computePosDetails(startPos),449 endPosDetails = peg$computePosDetails(endPos);450 return {451 start: {452 offset: startPos,453 line: startPosDetails.line,454 column: startPosDetails.column455 },456 end: {457 offset: endPos,458 line: endPosDetails.line,459 column: endPosDetails.column460 }461 };462 }463 function peg$fail(expected) {464 if (peg$currPos < peg$maxFailPos) { return; }465 if (peg$currPos > peg$maxFailPos) {466 peg$maxFailPos = peg$currPos;467 peg$maxFailExpected = [];468 }469 peg$maxFailExpected.push(expected);470 }471 function peg$buildException(message, expected, found, location) {472 function cleanupExpected(expected) {473 var i = 1;474 expected.sort(function(a, b) {475 if (a.description < b.description) {476 return -1;477 } else if (a.description > b.description) {478 return 1;479 } else {480 return 0;481 }482 });483 while (i < expected.length) {484 if (expected[i - 1] === expected[i]) {485 expected.splice(i, 1);486 } else {487 i++;488 }489 }490 }491 function buildMessage(expected, found) {492 function stringEscape(s) {493 function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }494 return s495 .replace(/\\/g, '\\\\')496 .replace(/"/g, '\\"')497 .replace(/\x08/g, '\\b')498 .replace(/\t/g, '\\t')499 .replace(/\n/g, '\\n')500 .replace(/\f/g, '\\f')501 .replace(/\r/g, '\\r')502 .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })503 .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })504 .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })505 .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });506 }507 var expectedDescs = new Array(expected.length),508 expectedDesc, foundDesc, i;509 for (i = 0; i < expected.length; i++) {510 expectedDescs[i] = expected[i].description;511 }512 expectedDesc = expected.length > 1513 ? expectedDescs.slice(0, -1).join(", ")514 + " or "515 + expectedDescs[expected.length - 1]516 : expectedDescs[0];517 foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";518 return "Expected " + expectedDesc + " but " + foundDesc + " found.";519 }520 if (expected !== null) {521 cleanupExpected(expected);522 }523 return new peg$SyntaxError(524 message !== null ? message : buildMessage(expected, found),525 expected,526 found,527 location528 );529 }530 function peg$parsescript() {531 var s0, s1, s2;532 s0 = peg$currPos;533 s1 = [];534 s2 = peg$parsespaceNL();535 while (s2 !== peg$FAILED) {536 s1.push(s2);537 s2 = peg$parsespaceNL();538 }539 if (s1 !== peg$FAILED) {540 s2 = peg$parsestatementList();541 if (s2 === peg$FAILED) {542 s2 = null;543 }544 if (s2 !== peg$FAILED) {545 peg$savedPos = s0;546 s1 = peg$c0(s2);547 s0 = s1;548 } else {549 peg$currPos = s0;550 s0 = peg$FAILED;551 }552 } else {553 peg$currPos = s0;554 s0 = peg$FAILED;555 }556 return s0;557 }558 function peg$parsestatementList() {559 var s0, s1, s2, s3, s4, s5, s6;560 s0 = peg$currPos;561 s1 = peg$parsestatement();562 if (s1 !== peg$FAILED) {563 s2 = [];564 s3 = peg$currPos;565 s4 = peg$parsecontrolOperator();566 if (s4 !== peg$FAILED) {567 s5 = [];568 s6 = peg$parsespaceNL();569 while (s6 !== peg$FAILED) {570 s5.push(s6);571 s6 = peg$parsespaceNL();572 }573 if (s5 !== peg$FAILED) {574 s6 = peg$parsestatement();575 if (s6 !== peg$FAILED) {576 s4 = [s4, s5, s6];577 s3 = s4;578 } else {579 peg$currPos = s3;580 s3 = peg$FAILED;581 }582 } else {583 peg$currPos = s3;584 s3 = peg$FAILED;585 }586 } else {587 peg$currPos = s3;588 s3 = peg$FAILED;589 }590 while (s3 !== peg$FAILED) {591 s2.push(s3);592 s3 = peg$currPos;593 s4 = peg$parsecontrolOperator();594 if (s4 !== peg$FAILED) {595 s5 = [];596 s6 = peg$parsespaceNL();597 while (s6 !== peg$FAILED) {598 s5.push(s6);599 s6 = peg$parsespaceNL();600 }601 if (s5 !== peg$FAILED) {602 s6 = peg$parsestatement();603 if (s6 !== peg$FAILED) {604 s4 = [s4, s5, s6];605 s3 = s4;606 } else {607 peg$currPos = s3;608 s3 = peg$FAILED;609 }610 } else {611 peg$currPos = s3;612 s3 = peg$FAILED;613 }614 } else {615 peg$currPos = s3;616 s3 = peg$FAILED;617 }618 }619 if (s2 !== peg$FAILED) {620 s3 = [];621 s4 = peg$parsespace();622 while (s4 !== peg$FAILED) {623 s3.push(s4);624 s4 = peg$parsespace();625 }626 if (s3 !== peg$FAILED) {627 s4 = peg$parsecontrolOperator();628 if (s4 === peg$FAILED) {629 s4 = null;630 }631 if (s4 !== peg$FAILED) {632 s5 = [];633 s6 = peg$parsespaceNL();634 while (s6 !== peg$FAILED) {635 s5.push(s6);636 s6 = peg$parsespaceNL();637 }638 if (s5 !== peg$FAILED) {639 peg$savedPos = s0;640 s1 = peg$c1(s1, s2, s4);641 s0 = s1;642 } else {643 peg$currPos = s0;644 s0 = peg$FAILED;645 }646 } else {647 peg$currPos = s0;648 s0 = peg$FAILED;649 }650 } else {651 peg$currPos = s0;652 s0 = peg$FAILED;653 }654 } else {655 peg$currPos = s0;656 s0 = peg$FAILED;657 }658 } else {659 peg$currPos = s0;660 s0 = peg$FAILED;661 }662 return s0;663 }664 function peg$parsestatement() {665 var s0, s1, s2, s3, s4;666 s0 = peg$currPos;667 s1 = peg$parsesubshell();668 if (s1 === peg$FAILED) {669 s1 = peg$parsebashExtensions();670 if (s1 === peg$FAILED) {671 s1 = peg$parsecommand();672 if (s1 === peg$FAILED) {673 s1 = peg$parsevariableAssignment();674 if (s1 === peg$FAILED) {675 s1 = peg$parseifBlock();676 if (s1 === peg$FAILED) {677 s1 = peg$parseconditionalLoop();678 if (s1 === peg$FAILED) {679 s1 = peg$parseforLoop();680 }681 }682 }683 }684 }685 }686 if (s1 !== peg$FAILED) {687 s2 = peg$currPos;688 s3 = [];689 s4 = peg$parsespace();690 while (s4 !== peg$FAILED) {691 s3.push(s4);692 s4 = peg$parsespace();693 }694 if (s3 !== peg$FAILED) {695 s4 = peg$parsechainedStatement();696 if (s4 !== peg$FAILED) {697 s3 = [s3, s4];698 s2 = s3;699 } else {700 peg$currPos = s2;701 s2 = peg$FAILED;702 }703 } else {704 peg$currPos = s2;705 s2 = peg$FAILED;706 }707 if (s2 === peg$FAILED) {708 s2 = null;709 }710 if (s2 !== peg$FAILED) {711 peg$savedPos = s0;712 s1 = peg$c2(s1, s2);713 s0 = s1;714 } else {715 peg$currPos = s0;716 s0 = peg$FAILED;717 }718 } else {719 peg$currPos = s0;720 s0 = peg$FAILED;721 }722 return s0;723 }724 function peg$parsechainedStatement() {725 var s0, s1, s2, s3;726 s0 = peg$currPos;727 if (input.substr(peg$currPos, 2) === peg$c3) {728 s1 = peg$c3;729 peg$currPos += 2;730 } else {731 s1 = peg$FAILED;732 if (peg$silentFails === 0) { peg$fail(peg$c4); }733 }734 if (s1 === peg$FAILED) {735 if (input.substr(peg$currPos, 2) === peg$c5) {736 s1 = peg$c5;737 peg$currPos += 2;738 } else {739 s1 = peg$FAILED;740 if (peg$silentFails === 0) { peg$fail(peg$c6); }741 }742 }743 if (s1 !== peg$FAILED) {744 s2 = [];745 s3 = peg$parsespaceNL();746 while (s3 !== peg$FAILED) {747 s2.push(s3);748 s3 = peg$parsespaceNL();749 }750 if (s2 !== peg$FAILED) {751 s3 = peg$parsestatement();752 if (s3 !== peg$FAILED) {753 peg$savedPos = s0;754 s1 = peg$c7(s1, s3);755 s0 = s1;756 } else {757 peg$currPos = s0;758 s0 = peg$FAILED;759 }760 } else {761 peg$currPos = s0;762 s0 = peg$FAILED;763 }764 } else {765 peg$currPos = s0;766 s0 = peg$FAILED;767 }768 return s0;769 }770 function peg$parsesubshell() {771 var s0, s1, s2, s3, s4, s5;772 peg$silentFails++;773 s0 = peg$currPos;774 if (input.charCodeAt(peg$currPos) === 40) {775 s1 = peg$c9;776 peg$currPos++;777 } else {778 s1 = peg$FAILED;779 if (peg$silentFails === 0) { peg$fail(peg$c10); }780 }781 if (s1 !== peg$FAILED) {782 s2 = [];783 s3 = peg$parsespace();784 while (s3 !== peg$FAILED) {785 s2.push(s3);786 s3 = peg$parsespace();787 }788 if (s2 !== peg$FAILED) {789 s3 = peg$parsestatementList();790 if (s3 !== peg$FAILED) {791 s4 = [];792 s5 = peg$parsespace();793 while (s5 !== peg$FAILED) {794 s4.push(s5);795 s5 = peg$parsespace();796 }797 if (s4 !== peg$FAILED) {798 if (input.charCodeAt(peg$currPos) === 41) {799 s5 = peg$c11;800 peg$currPos++;801 } else {802 s5 = peg$FAILED;803 if (peg$silentFails === 0) { peg$fail(peg$c12); }804 }805 if (s5 !== peg$FAILED) {806 peg$savedPos = s0;807 s1 = peg$c13(s3);808 s0 = s1;809 } else {810 peg$currPos = s0;811 s0 = peg$FAILED;812 }813 } else {814 peg$currPos = s0;815 s0 = peg$FAILED;816 }817 } else {818 peg$currPos = s0;819 s0 = peg$FAILED;820 }821 } else {822 peg$currPos = s0;823 s0 = peg$FAILED;824 }825 } else {826 peg$currPos = s0;827 s0 = peg$FAILED;828 }829 peg$silentFails--;830 if (s0 === peg$FAILED) {831 s1 = peg$FAILED;832 if (peg$silentFails === 0) { peg$fail(peg$c8); }833 }834 return s0;835 }836 function peg$parsecommand() {837 var s0, s1, s2, s3, s4, s5, s6;838 peg$silentFails++;839 s0 = peg$currPos;840 s1 = [];841 s2 = peg$currPos;842 s3 = peg$parsevariableAssignment();843 if (s3 === peg$FAILED) {844 s3 = peg$parseredirect();845 }846 if (s3 !== peg$FAILED) {847 s4 = [];848 s5 = peg$parsespace();849 if (s5 !== peg$FAILED) {850 while (s5 !== peg$FAILED) {851 s4.push(s5);852 s5 = peg$parsespace();853 }854 } else {855 s4 = peg$FAILED;856 }857 if (s4 !== peg$FAILED) {858 s3 = [s3, s4];859 s2 = s3;860 } else {861 peg$currPos = s2;862 s2 = peg$FAILED;863 }864 } else {865 peg$currPos = s2;866 s2 = peg$FAILED;867 }868 while (s2 !== peg$FAILED) {869 s1.push(s2);870 s2 = peg$currPos;871 s3 = peg$parsevariableAssignment();872 if (s3 === peg$FAILED) {873 s3 = peg$parseredirect();874 }875 if (s3 !== peg$FAILED) {876 s4 = [];877 s5 = peg$parsespace();878 if (s5 !== peg$FAILED) {879 while (s5 !== peg$FAILED) {880 s4.push(s5);881 s5 = peg$parsespace();882 }883 } else {884 s4 = peg$FAILED;885 }886 if (s4 !== peg$FAILED) {887 s3 = [s3, s4];888 s2 = s3;889 } else {890 peg$currPos = s2;891 s2 = peg$FAILED;892 }893 } else {894 peg$currPos = s2;895 s2 = peg$FAILED;896 }897 }898 if (s1 !== peg$FAILED) {899 s2 = peg$parsecommandName();900 if (s2 === peg$FAILED) {901 s2 = peg$parsebuiltinCommandName();902 }903 if (s2 !== peg$FAILED) {904 s3 = [];905 s4 = peg$currPos;906 s5 = [];907 s6 = peg$parsespace();908 if (s6 !== peg$FAILED) {909 while (s6 !== peg$FAILED) {910 s5.push(s6);911 s6 = peg$parsespace();912 }913 } else {914 s5 = peg$FAILED;915 }916 if (s5 !== peg$FAILED) {917 s6 = peg$parseredirect();918 if (s6 === peg$FAILED) {919 s6 = peg$parseargument();920 }921 if (s6 !== peg$FAILED) {922 s5 = [s5, s6];923 s4 = s5;924 } else {925 peg$currPos = s4;926 s4 = peg$FAILED;927 }928 } else {929 peg$currPos = s4;930 s4 = peg$FAILED;931 }932 while (s4 !== peg$FAILED) {933 s3.push(s4);934 s4 = peg$currPos;935 s5 = [];936 s6 = peg$parsespace();937 if (s6 !== peg$FAILED) {938 while (s6 !== peg$FAILED) {939 s5.push(s6);940 s6 = peg$parsespace();941 }942 } else {943 s5 = peg$FAILED;944 }945 if (s5 !== peg$FAILED) {946 s6 = peg$parseredirect();947 if (s6 === peg$FAILED) {948 s6 = peg$parseargument();949 }950 if (s6 !== peg$FAILED) {951 s5 = [s5, s6];952 s4 = s5;953 } else {954 peg$currPos = s4;955 s4 = peg$FAILED;956 }957 } else {958 peg$currPos = s4;959 s4 = peg$FAILED;960 }961 }962 if (s3 !== peg$FAILED) {963 s4 = peg$currPos;964 s5 = [];965 s6 = peg$parsespace();966 while (s6 !== peg$FAILED) {967 s5.push(s6);968 s6 = peg$parsespace();969 }970 if (s5 !== peg$FAILED) {971 s6 = peg$parsepipe();972 if (s6 !== peg$FAILED) {973 s5 = [s5, s6];974 s4 = s5;975 } else {976 peg$currPos = s4;977 s4 = peg$FAILED;978 }979 } else {980 peg$currPos = s4;981 s4 = peg$FAILED;982 }983 if (s4 === peg$FAILED) {984 s4 = null;985 }986 if (s4 !== peg$FAILED) {987 peg$savedPos = s0;988 s1 = peg$c15(s1, s2, s3, s4);989 s0 = s1;990 } else {991 peg$currPos = s0;992 s0 = peg$FAILED;993 }994 } else {995 peg$currPos = s0;996 s0 = peg$FAILED;997 }998 } else {999 peg$currPos = s0;1000 s0 = peg$FAILED;1001 }1002 } else {1003 peg$currPos = s0;1004 s0 = peg$FAILED;1005 }1006 peg$silentFails--;1007 if (s0 === peg$FAILED) {1008 s1 = peg$FAILED;1009 if (peg$silentFails === 0) { peg$fail(peg$c14); }1010 }1011 return s0;1012 }1013 function peg$parsecondition() {1014 var s0, s1;1015 s0 = peg$currPos;1016 s1 = peg$parsescript();1017 if (s1 !== peg$FAILED) {1018 peg$savedPos = s0;1019 s1 = peg$c16(s1);1020 }1021 s0 = s1;1022 return s0;1023 }1024 function peg$parseifBlock() {1025 var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;1026 peg$silentFails++;1027 s0 = peg$currPos;1028 if (input.substr(peg$currPos, 2) === peg$c18) {1029 s1 = peg$c18;1030 peg$currPos += 2;1031 } else {1032 s1 = peg$FAILED;1033 if (peg$silentFails === 0) { peg$fail(peg$c19); }1034 }1035 if (s1 !== peg$FAILED) {1036 s2 = [];1037 s3 = peg$parsespaceNL();1038 if (s3 !== peg$FAILED) {1039 while (s3 !== peg$FAILED) {1040 s2.push(s3);1041 s3 = peg$parsespaceNL();1042 }1043 } else {1044 s2 = peg$FAILED;1045 }1046 if (s2 !== peg$FAILED) {1047 s3 = peg$parsecondition();1048 if (s3 !== peg$FAILED) {1049 if (input.substr(peg$currPos, 4) === peg$c20) {1050 s4 = peg$c20;1051 peg$currPos += 4;1052 } else {1053 s4 = peg$FAILED;1054 if (peg$silentFails === 0) { peg$fail(peg$c21); }1055 }1056 if (s4 !== peg$FAILED) {1057 s5 = [];1058 s6 = peg$parsespaceNL();1059 if (s6 !== peg$FAILED) {1060 while (s6 !== peg$FAILED) {1061 s5.push(s6);1062 s6 = peg$parsespaceNL();1063 }1064 } else {1065 s5 = peg$FAILED;1066 }1067 if (s5 !== peg$FAILED) {1068 s6 = peg$parsescript();1069 if (s6 !== peg$FAILED) {1070 s7 = [];1071 s8 = peg$parseelifBlock();1072 while (s8 !== peg$FAILED) {1073 s7.push(s8);1074 s8 = peg$parseelifBlock();1075 }1076 if (s7 !== peg$FAILED) {1077 s8 = peg$currPos;1078 if (input.substr(peg$currPos, 4) === peg$c22) {1079 s9 = peg$c22;1080 peg$currPos += 4;1081 } else {1082 s9 = peg$FAILED;1083 if (peg$silentFails === 0) { peg$fail(peg$c23); }1084 }1085 if (s9 !== peg$FAILED) {1086 s10 = peg$parsescript();1087 if (s10 !== peg$FAILED) {1088 s9 = [s9, s10];1089 s8 = s9;1090 } else {1091 peg$currPos = s8;1092 s8 = peg$FAILED;1093 }1094 } else {1095 peg$currPos = s8;1096 s8 = peg$FAILED;1097 }1098 if (s8 === peg$FAILED) {1099 s8 = null;1100 }1101 if (s8 !== peg$FAILED) {1102 if (input.substr(peg$currPos, 2) === peg$c24) {1103 s9 = peg$c24;1104 peg$currPos += 2;1105 } else {1106 s9 = peg$FAILED;1107 if (peg$silentFails === 0) { peg$fail(peg$c25); }1108 }1109 if (s9 !== peg$FAILED) {1110 peg$savedPos = s0;1111 s1 = peg$c26(s3, s6, s7, s8);1112 s0 = s1;1113 } else {1114 peg$currPos = s0;1115 s0 = peg$FAILED;1116 }1117 } else {1118 peg$currPos = s0;1119 s0 = peg$FAILED;1120 }1121 } else {1122 peg$currPos = s0;1123 s0 = peg$FAILED;1124 }1125 } else {1126 peg$currPos = s0;1127 s0 = peg$FAILED;1128 }1129 } else {1130 peg$currPos = s0;1131 s0 = peg$FAILED;1132 }1133 } else {1134 peg$currPos = s0;1135 s0 = peg$FAILED;1136 }1137 } else {1138 peg$currPos = s0;1139 s0 = peg$FAILED;1140 }1141 } else {1142 peg$currPos = s0;1143 s0 = peg$FAILED;1144 }1145 } else {1146 peg$currPos = s0;1147 s0 = peg$FAILED;1148 }1149 peg$silentFails--;1150 if (s0 === peg$FAILED) {1151 s1 = peg$FAILED;1152 if (peg$silentFails === 0) { peg$fail(peg$c17); }1153 }1154 return s0;1155 }1156 function peg$parseelifBlock() {1157 var s0, s1, s2, s3, s4, s5, s6;1158 s0 = peg$currPos;1159 if (input.substr(peg$currPos, 4) === peg$c27) {1160 s1 = peg$c27;1161 peg$currPos += 4;1162 } else {1163 s1 = peg$FAILED;1164 if (peg$silentFails === 0) { peg$fail(peg$c28); }1165 }1166 if (s1 !== peg$FAILED) {1167 s2 = [];1168 s3 = peg$parsespaceNL();1169 if (s3 !== peg$FAILED) {1170 while (s3 !== peg$FAILED) {1171 s2.push(s3);1172 s3 = peg$parsespaceNL();1173 }1174 } else {1175 s2 = peg$FAILED;1176 }1177 if (s2 !== peg$FAILED) {1178 s3 = peg$parsecondition();1179 if (s3 !== peg$FAILED) {1180 if (input.substr(peg$currPos, 4) === peg$c20) {1181 s4 = peg$c20;1182 peg$currPos += 4;1183 } else {1184 s4 = peg$FAILED;1185 if (peg$silentFails === 0) { peg$fail(peg$c21); }1186 }1187 if (s4 !== peg$FAILED) {1188 s5 = [];1189 s6 = peg$parsespaceNL();1190 if (s6 !== peg$FAILED) {1191 while (s6 !== peg$FAILED) {1192 s5.push(s6);1193 s6 = peg$parsespaceNL();1194 }1195 } else {1196 s5 = peg$FAILED;1197 }1198 if (s5 !== peg$FAILED) {1199 s6 = peg$parsescript();1200 if (s6 !== peg$FAILED) {1201 peg$savedPos = s0;1202 s1 = peg$c29(s3, s6);1203 s0 = s1;1204 } else {1205 peg$currPos = s0;1206 s0 = peg$FAILED;1207 }1208 } else {1209 peg$currPos = s0;1210 s0 = peg$FAILED;1211 }1212 } else {1213 peg$currPos = s0;1214 s0 = peg$FAILED;1215 }1216 } else {1217 peg$currPos = s0;1218 s0 = peg$FAILED;1219 }1220 } else {1221 peg$currPos = s0;1222 s0 = peg$FAILED;1223 }1224 } else {1225 peg$currPos = s0;1226 s0 = peg$FAILED;1227 }1228 return s0;1229 }1230 function peg$parseconditionalLoop() {1231 var s0, s1, s2, s3, s4, s5, s6, s7;1232 peg$silentFails++;1233 s0 = peg$currPos;1234 if (input.substr(peg$currPos, 5) === peg$c31) {1235 s1 = peg$c31;1236 peg$currPos += 5;1237 } else {1238 s1 = peg$FAILED;1239 if (peg$silentFails === 0) { peg$fail(peg$c32); }1240 }1241 if (s1 === peg$FAILED) {1242 if (input.substr(peg$currPos, 5) === peg$c33) {1243 s1 = peg$c33;1244 peg$currPos += 5;1245 } else {1246 s1 = peg$FAILED;1247 if (peg$silentFails === 0) { peg$fail(peg$c34); }1248 }1249 }1250 if (s1 !== peg$FAILED) {1251 s2 = [];1252 s3 = peg$parsespaceNL();1253 if (s3 !== peg$FAILED) {1254 while (s3 !== peg$FAILED) {1255 s2.push(s3);1256 s3 = peg$parsespaceNL();1257 }1258 } else {1259 s2 = peg$FAILED;1260 }1261 if (s2 !== peg$FAILED) {1262 s3 = peg$parsecondition();1263 if (s3 !== peg$FAILED) {1264 if (input.substr(peg$currPos, 2) === peg$c35) {1265 s4 = peg$c35;1266 peg$currPos += 2;1267 } else {1268 s4 = peg$FAILED;1269 if (peg$silentFails === 0) { peg$fail(peg$c36); }1270 }1271 if (s4 !== peg$FAILED) {1272 s5 = [];1273 s6 = peg$parsespaceNL();1274 if (s6 !== peg$FAILED) {1275 while (s6 !== peg$FAILED) {1276 s5.push(s6);1277 s6 = peg$parsespaceNL();1278 }1279 } else {1280 s5 = peg$FAILED;1281 }1282 if (s5 !== peg$FAILED) {1283 s6 = peg$parsescript();1284 if (s6 !== peg$FAILED) {1285 if (input.substr(peg$currPos, 4) === peg$c37) {1286 s7 = peg$c37;1287 peg$currPos += 4;1288 } else {1289 s7 = peg$FAILED;1290 if (peg$silentFails === 0) { peg$fail(peg$c38); }1291 }1292 if (s7 !== peg$FAILED) {1293 peg$savedPos = s0;1294 s1 = peg$c39(s1, s3, s6);1295 s0 = s1;1296 } else {1297 peg$currPos = s0;1298 s0 = peg$FAILED;1299 }1300 } else {1301 peg$currPos = s0;1302 s0 = peg$FAILED;1303 }1304 } else {1305 peg$currPos = s0;1306 s0 = peg$FAILED;1307 }1308 } else {1309 peg$currPos = s0;1310 s0 = peg$FAILED;1311 }1312 } else {1313 peg$currPos = s0;1314 s0 = peg$FAILED;1315 }1316 } else {1317 peg$currPos = s0;1318 s0 = peg$FAILED;1319 }1320 } else {1321 peg$currPos = s0;1322 s0 = peg$FAILED;1323 }1324 peg$silentFails--;1325 if (s0 === peg$FAILED) {1326 s1 = peg$FAILED;1327 if (peg$silentFails === 0) { peg$fail(peg$c30); }1328 }1329 return s0;1330 }1331 function peg$parseforLoop() {1332 var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;1333 peg$silentFails++;1334 s0 = peg$currPos;1335 if (input.substr(peg$currPos, 3) === peg$c41) {1336 s1 = peg$c41;1337 peg$currPos += 3;1338 } else {1339 s1 = peg$FAILED;1340 if (peg$silentFails === 0) { peg$fail(peg$c42); }1341 }1342 if (s1 !== peg$FAILED) {1343 s2 = [];1344 s3 = peg$parsespace();1345 if (s3 !== peg$FAILED) {1346 while (s3 !== peg$FAILED) {1347 s2.push(s3);1348 s3 = peg$parsespace();1349 }1350 } else {1351 s2 = peg$FAILED;1352 }1353 if (s2 !== peg$FAILED) {1354 s3 = peg$parsewritableVariableName();1355 if (s3 !== peg$FAILED) {1356 s4 = [];1357 s5 = peg$parsespaceNL();1358 if (s5 !== peg$FAILED) {1359 while (s5 !== peg$FAILED) {1360 s4.push(s5);1361 s5 = peg$parsespaceNL();1362 }1363 } else {1364 s4 = peg$FAILED;1365 }1366 if (s4 !== peg$FAILED) {1367 s5 = peg$currPos;1368 if (input.substr(peg$currPos, 2) === peg$c43) {1369 s6 = peg$c43;1370 peg$currPos += 2;1371 } else {1372 s6 = peg$FAILED;1373 if (peg$silentFails === 0) { peg$fail(peg$c44); }1374 }1375 if (s6 !== peg$FAILED) {1376 s7 = [];1377 s8 = peg$currPos;1378 s9 = [];1379 s10 = peg$parsespace();1380 if (s10 !== peg$FAILED) {1381 while (s10 !== peg$FAILED) {1382 s9.push(s10);1383 s10 = peg$parsespace();1384 }1385 } else {1386 s9 = peg$FAILED;1387 }1388 if (s9 !== peg$FAILED) {1389 s10 = peg$parseargument();1390 if (s10 !== peg$FAILED) {1391 s9 = [s9, s10];1392 s8 = s9;1393 } else {1394 peg$currPos = s8;1395 s8 = peg$FAILED;1396 }1397 } else {1398 peg$currPos = s8;1399 s8 = peg$FAILED;1400 }1401 while (s8 !== peg$FAILED) {1402 s7.push(s8);1403 s8 = peg$currPos;1404 s9 = [];1405 s10 = peg$parsespace();1406 if (s10 !== peg$FAILED) {1407 while (s10 !== peg$FAILED) {1408 s9.push(s10);1409 s10 = peg$parsespace();1410 }1411 } else {1412 s9 = peg$FAILED;1413 }1414 if (s9 !== peg$FAILED) {1415 s10 = peg$parseargument();1416 if (s10 !== peg$FAILED) {1417 s9 = [s9, s10];1418 s8 = s9;1419 } else {1420 peg$currPos = s8;1421 s8 = peg$FAILED;1422 }1423 } else {1424 peg$currPos = s8;1425 s8 = peg$FAILED;1426 }1427 }1428 if (s7 !== peg$FAILED) {1429 s6 = [s6, s7];1430 s5 = s6;1431 } else {1432 peg$currPos = s5;1433 s5 = peg$FAILED;1434 }1435 } else {1436 peg$currPos = s5;1437 s5 = peg$FAILED;1438 }1439 if (s5 === peg$FAILED) {1440 s5 = null;1441 }1442 if (s5 !== peg$FAILED) {1443 s6 = [];1444 s7 = peg$parsespace();1445 while (s7 !== peg$FAILED) {1446 s6.push(s7);1447 s7 = peg$parsespace();1448 }1449 if (s6 !== peg$FAILED) {1450 if (input.charCodeAt(peg$currPos) === 59) {1451 s7 = peg$c45;1452 peg$currPos++;1453 } else {1454 s7 = peg$FAILED;1455 if (peg$silentFails === 0) { peg$fail(peg$c46); }1456 }1457 if (s7 === peg$FAILED) {1458 if (input.charCodeAt(peg$currPos) === 10) {1459 s7 = peg$c47;1460 peg$currPos++;1461 } else {1462 s7 = peg$FAILED;1463 if (peg$silentFails === 0) { peg$fail(peg$c48); }1464 }1465 }1466 if (s7 !== peg$FAILED) {1467 s8 = [];1468 s9 = peg$parsespaceNL();1469 while (s9 !== peg$FAILED) {1470 s8.push(s9);1471 s9 = peg$parsespaceNL();1472 }1473 if (s8 !== peg$FAILED) {1474 if (input.substr(peg$currPos, 2) === peg$c35) {1475 s9 = peg$c35;1476 peg$currPos += 2;1477 } else {1478 s9 = peg$FAILED;1479 if (peg$silentFails === 0) { peg$fail(peg$c36); }1480 }1481 if (s9 !== peg$FAILED) {1482 s10 = [];1483 s11 = peg$parsespaceNL();1484 if (s11 !== peg$FAILED) {1485 while (s11 !== peg$FAILED) {1486 s10.push(s11);1487 s11 = peg$parsespaceNL();1488 }1489 } else {1490 s10 = peg$FAILED;1491 }1492 if (s10 !== peg$FAILED) {1493 s11 = peg$parsestatementList();1494 if (s11 !== peg$FAILED) {1495 s12 = [];1496 s13 = peg$parsespaceNL();1497 while (s13 !== peg$FAILED) {1498 s12.push(s13);1499 s13 = peg$parsespaceNL();1500 }1501 if (s12 !== peg$FAILED) {1502 if (input.substr(peg$currPos, 4) === peg$c37) {1503 s13 = peg$c37;1504 peg$currPos += 4;1505 } else {1506 s13 = peg$FAILED;1507 if (peg$silentFails === 0) { peg$fail(peg$c38); }1508 }1509 if (s13 !== peg$FAILED) {1510 peg$savedPos = s0;1511 s1 = peg$c49(s3, s5, s11);1512 s0 = s1;1513 } else {1514 peg$currPos = s0;1515 s0 = peg$FAILED;1516 }1517 } else {1518 peg$currPos = s0;1519 s0 = peg$FAILED;1520 }1521 } else {1522 peg$currPos = s0;1523 s0 = peg$FAILED;1524 }1525 } else {1526 peg$currPos = s0;1527 s0 = peg$FAILED;1528 }1529 } else {1530 peg$currPos = s0;1531 s0 = peg$FAILED;1532 }1533 } else {1534 peg$currPos = s0;1535 s0 = peg$FAILED;1536 }1537 } else {1538 peg$currPos = s0;1539 s0 = peg$FAILED;1540 }1541 } else {1542 peg$currPos = s0;1543 s0 = peg$FAILED;1544 }1545 } else {1546 peg$currPos = s0;1547 s0 = peg$FAILED;1548 }1549 } else {1550 peg$currPos = s0;1551 s0 = peg$FAILED;1552 }1553 } else {1554 peg$currPos = s0;1555 s0 = peg$FAILED;1556 }1557 } else {1558 peg$currPos = s0;1559 s0 = peg$FAILED;1560 }1561 } else {1562 peg$currPos = s0;1563 s0 = peg$FAILED;1564 }1565 peg$silentFails--;1566 if (s0 === peg$FAILED) {1567 s1 = peg$FAILED;1568 if (peg$silentFails === 0) { peg$fail(peg$c40); }1569 }1570 return s0;1571 }1572 function peg$parsebashExtensions() {1573 var s0;1574 s0 = peg$parsetime();1575 if (s0 === peg$FAILED) {1576 s0 = peg$parsedeclare();1577 }1578 return s0;1579 }1580 function peg$parsetime() {1581 var s0, s1, s2, s3, s4, s5, s6, s7, s8;1582 peg$silentFails++;1583 s0 = peg$currPos;1584 if (input.substr(peg$currPos, 4) === peg$c51) {1585 s1 = peg$c51;1586 peg$currPos += 4;1587 } else {1588 s1 = peg$FAILED;1589 if (peg$silentFails === 0) { peg$fail(peg$c52); }1590 }1591 if (s1 !== peg$FAILED) {1592 s2 = [];1593 s3 = peg$parsespace();1594 if (s3 !== peg$FAILED) {1595 while (s3 !== peg$FAILED) {1596 s2.push(s3);1597 s3 = peg$parsespace();1598 }1599 } else {1600 s2 = peg$FAILED;1601 }1602 if (s2 !== peg$FAILED) {1603 s3 = [];1604 s4 = peg$currPos;1605 if (input.charCodeAt(peg$currPos) === 45) {1606 s5 = peg$c53;1607 peg$currPos++;1608 } else {1609 s5 = peg$FAILED;1610 if (peg$silentFails === 0) { peg$fail(peg$c54); }1611 }1612 if (s5 !== peg$FAILED) {1613 s6 = [];1614 if (peg$c55.test(input.charAt(peg$currPos))) {1615 s7 = input.charAt(peg$currPos);1616 peg$currPos++;1617 } else {1618 s7 = peg$FAILED;1619 if (peg$silentFails === 0) { peg$fail(peg$c56); }1620 }1621 if (s7 !== peg$FAILED) {1622 while (s7 !== peg$FAILED) {1623 s6.push(s7);1624 if (peg$c55.test(input.charAt(peg$currPos))) {1625 s7 = input.charAt(peg$currPos);1626 peg$currPos++;1627 } else {1628 s7 = peg$FAILED;1629 if (peg$silentFails === 0) { peg$fail(peg$c56); }1630 }1631 }1632 } else {1633 s6 = peg$FAILED;1634 }1635 if (s6 !== peg$FAILED) {1636 s7 = [];1637 s8 = peg$parsespace();1638 if (s8 !== peg$FAILED) {1639 while (s8 !== peg$FAILED) {1640 s7.push(s8);1641 s8 = peg$parsespace();1642 }1643 } else {1644 s7 = peg$FAILED;1645 }1646 if (s7 !== peg$FAILED) {1647 s5 = [s5, s6, s7];1648 s4 = s5;1649 } else {1650 peg$currPos = s4;1651 s4 = peg$FAILED;1652 }1653 } else {1654 peg$currPos = s4;1655 s4 = peg$FAILED;1656 }1657 } else {1658 peg$currPos = s4;1659 s4 = peg$FAILED;1660 }1661 while (s4 !== peg$FAILED) {1662 s3.push(s4);1663 s4 = peg$currPos;1664 if (input.charCodeAt(peg$currPos) === 45) {1665 s5 = peg$c53;1666 peg$currPos++;1667 } else {1668 s5 = peg$FAILED;1669 if (peg$silentFails === 0) { peg$fail(peg$c54); }1670 }1671 if (s5 !== peg$FAILED) {1672 s6 = [];1673 if (peg$c55.test(input.charAt(peg$currPos))) {1674 s7 = input.charAt(peg$currPos);1675 peg$currPos++;1676 } else {1677 s7 = peg$FAILED;1678 if (peg$silentFails === 0) { peg$fail(peg$c56); }1679 }1680 if (s7 !== peg$FAILED) {1681 while (s7 !== peg$FAILED) {1682 s6.push(s7);1683 if (peg$c55.test(input.charAt(peg$currPos))) {1684 s7 = input.charAt(peg$currPos);1685 peg$currPos++;1686 } else {1687 s7 = peg$FAILED;1688 if (peg$silentFails === 0) { peg$fail(peg$c56); }1689 }1690 }1691 } else {1692 s6 = peg$FAILED;1693 }1694 if (s6 !== peg$FAILED) {1695 s7 = [];1696 s8 = peg$parsespace();1697 if (s8 !== peg$FAILED) {1698 while (s8 !== peg$FAILED) {1699 s7.push(s8);1700 s8 = peg$parsespace();1701 }1702 } else {1703 s7 = peg$FAILED;1704 }1705 if (s7 !== peg$FAILED) {1706 s5 = [s5, s6, s7];1707 s4 = s5;1708 } else {1709 peg$currPos = s4;1710 s4 = peg$FAILED;1711 }1712 } else {1713 peg$currPos = s4;1714 s4 = peg$FAILED;1715 }1716 } else {1717 peg$currPos = s4;1718 s4 = peg$FAILED;1719 }1720 }1721 if (s3 !== peg$FAILED) {1722 s4 = peg$parsestatementList();1723 if (s4 !== peg$FAILED) {1724 peg$savedPos = s0;1725 s1 = peg$c57(s3, s4);1726 s0 = s1;1727 } else {1728 peg$currPos = s0;1729 s0 = peg$FAILED;1730 }1731 } else {1732 peg$currPos = s0;1733 s0 = peg$FAILED;1734 }1735 } else {1736 peg$currPos = s0;1737 s0 = peg$FAILED;1738 }1739 } else {1740 peg$currPos = s0;1741 s0 = peg$FAILED;1742 }1743 peg$silentFails--;1744 if (s0 === peg$FAILED) {1745 s1 = peg$FAILED;1746 if (peg$silentFails === 0) { peg$fail(peg$c50); }1747 }1748 return s0;1749 }1750 function peg$parsedeclare() {1751 var s0, s1, s2, s3;1752 peg$silentFails++;1753 s0 = peg$currPos;1754 if (input.substr(peg$currPos, 7) === peg$c59) {1755 s1 = peg$c59;1756 peg$currPos += 7;1757 } else {1758 s1 = peg$FAILED;1759 if (peg$silentFails === 0) { peg$fail(peg$c60); }1760 }1761 if (s1 === peg$FAILED) {1762 if (input.substr(peg$currPos, 7) === peg$c61) {1763 s1 = peg$c61;1764 peg$currPos += 7;1765 } else {1766 s1 = peg$FAILED;1767 if (peg$silentFails === 0) { peg$fail(peg$c62); }1768 }1769 }1770 if (s1 !== peg$FAILED) {1771 s2 = [];1772 if (peg$c63.test(input.charAt(peg$currPos))) {1773 s3 = input.charAt(peg$currPos);1774 peg$currPos++;1775 } else {1776 s3 = peg$FAILED;1777 if (peg$silentFails === 0) { peg$fail(peg$c64); }1778 }1779 if (s3 !== peg$FAILED) {1780 while (s3 !== peg$FAILED) {1781 s2.push(s3);1782 if (peg$c63.test(input.charAt(peg$currPos))) {1783 s3 = input.charAt(peg$currPos);1784 peg$currPos++;1785 } else {1786 s3 = peg$FAILED;1787 if (peg$silentFails === 0) { peg$fail(peg$c64); }1788 }1789 }1790 } else {1791 s2 = peg$FAILED;1792 }1793 if (s2 !== peg$FAILED) {1794 if (input.charCodeAt(peg$currPos) === 59) {1795 s3 = peg$c45;1796 peg$currPos++;1797 } else {1798 s3 = peg$FAILED;1799 if (peg$silentFails === 0) { peg$fail(peg$c46); }1800 }1801 if (s3 === peg$FAILED) {1802 if (input.charCodeAt(peg$currPos) === 10) {1803 s3 = peg$c47;1804 peg$currPos++;1805 } else {1806 s3 = peg$FAILED;1807 if (peg$silentFails === 0) { peg$fail(peg$c48); }1808 }1809 }1810 if (s3 !== peg$FAILED) {1811 s1 = [s1, s2, s3];1812 s0 = s1;1813 } else {1814 peg$currPos = s0;1815 s0 = peg$FAILED;1816 }1817 } else {1818 peg$currPos = s0;1819 s0 = peg$FAILED;1820 }1821 } else {1822 peg$currPos = s0;1823 s0 = peg$FAILED;1824 }1825 peg$silentFails--;1826 if (s0 === peg$FAILED) {1827 s1 = peg$FAILED;1828 if (peg$silentFails === 0) { peg$fail(peg$c58); }1829 }1830 return s0;1831 }1832 function peg$parsevariableAssignment() {1833 var s0, s1, s2, s3;1834 peg$silentFails++;1835 s0 = peg$currPos;1836 s1 = peg$parsewritableVariableName();1837 if (s1 !== peg$FAILED) {1838 if (input.charCodeAt(peg$currPos) === 61) {1839 s2 = peg$c66;1840 peg$currPos++;1841 } else {1842 s2 = peg$FAILED;1843 if (peg$silentFails === 0) { peg$fail(peg$c67); }1844 }1845 if (s2 !== peg$FAILED) {1846 s3 = peg$parseargument();1847 if (s3 === peg$FAILED) {1848 s3 = null;1849 }1850 if (s3 !== peg$FAILED) {1851 peg$savedPos = s0;1852 s1 = peg$c68(s1, s3);1853 s0 = s1;1854 } else {1855 peg$currPos = s0;1856 s0 = peg$FAILED;1857 }1858 } else {1859 peg$currPos = s0;1860 s0 = peg$FAILED;1861 }1862 } else {1863 peg$currPos = s0;1864 s0 = peg$FAILED;1865 }1866 peg$silentFails--;1867 if (s0 === peg$FAILED) {1868 s1 = peg$FAILED;1869 if (peg$silentFails === 0) { peg$fail(peg$c65); }1870 }1871 return s0;1872 }1873 function peg$parsecommandName() {1874 var s0, s1, s2, s3, s4;1875 peg$silentFails++;1876 s0 = peg$currPos;1877 s1 = peg$currPos;1878 peg$silentFails++;1879 s2 = peg$parseredirect();1880 peg$silentFails--;1881 if (s2 === peg$FAILED) {1882 s1 = void 0;1883 } else {1884 peg$currPos = s1;1885 s1 = peg$FAILED;1886 }1887 if (s1 !== peg$FAILED) {1888 s2 = peg$currPos;1889 peg$silentFails++;1890 s3 = peg$parsekeyword();1891 peg$silentFails--;1892 if (s3 === peg$FAILED) {1893 s2 = void 0;1894 } else {1895 peg$currPos = s2;1896 s2 = peg$FAILED;1897 }1898 if (s2 !== peg$FAILED) {1899 s3 = peg$currPos;1900 peg$silentFails++;1901 s4 = peg$parsevariableAssignment();1902 peg$silentFails--;1903 if (s4 === peg$FAILED) {1904 s3 = void 0;1905 } else {1906 peg$currPos = s3;1907 s3 = peg$FAILED;1908 }1909 if (s3 !== peg$FAILED) {1910 s4 = peg$parseconcatenation();1911 if (s4 === peg$FAILED) {1912 s4 = peg$parsebuiltinCommandName();1913 }1914 if (s4 !== peg$FAILED) {1915 peg$savedPos = s0;1916 s1 = peg$c70(s4);1917 s0 = s1;1918 } else {1919 peg$currPos = s0;1920 s0 = peg$FAILED;1921 }1922 } else {1923 peg$currPos = s0;1924 s0 = peg$FAILED;1925 }1926 } else {1927 peg$currPos = s0;1928 s0 = peg$FAILED;1929 }1930 } else {1931 peg$currPos = s0;1932 s0 = peg$FAILED;1933 }1934 peg$silentFails--;1935 if (s0 === peg$FAILED) {1936 s1 = peg$FAILED;1937 if (peg$silentFails === 0) { peg$fail(peg$c69); }1938 }1939 return s0;1940 }1941 function peg$parsebuiltinCommandName() {1942 var s0;1943 if (input.substr(peg$currPos, 2) === peg$c71) {1944 s0 = peg$c71;1945 peg$currPos += 2;1946 } else {1947 s0 = peg$FAILED;1948 if (peg$silentFails === 0) { peg$fail(peg$c72); }1949 }1950 if (s0 === peg$FAILED) {1951 if (input.charCodeAt(peg$currPos) === 91) {1952 s0 = peg$c73;1953 peg$currPos++;1954 } else {1955 s0 = peg$FAILED;1956 if (peg$silentFails === 0) { peg$fail(peg$c74); }1957 }1958 }1959 return s0;1960 }1961 function peg$parseargument() {1962 var s0, s1;1963 peg$silentFails++;1964 s0 = peg$parsecommandName();1965 if (s0 === peg$FAILED) {1966 s0 = peg$parseprocessSubstitution();1967 }1968 peg$silentFails--;1969 if (s0 === peg$FAILED) {1970 s1 = peg$FAILED;1971 if (peg$silentFails === 0) { peg$fail(peg$c75); }1972 }1973 return s0;1974 }1975 function peg$parseconcatenation() {1976 var s0, s1, s2;1977 peg$silentFails++;1978 s0 = peg$currPos;1979 s1 = [];1980 s2 = peg$parseglob();1981 if (s2 === peg$FAILED) {1982 s2 = peg$parsebareword();1983 if (s2 === peg$FAILED) {1984 s2 = peg$parseenvironmentVariable();1985 if (s2 === peg$FAILED) {1986 s2 = peg$parsevariableSubstitution();1987 if (s2 === peg$FAILED) {1988 s2 = peg$parsecommandSubstitution();1989 if (s2 === peg$FAILED) {1990 s2 = peg$parsesingleQuote();1991 if (s2 === peg$FAILED) {1992 s2 = peg$parsedoubleQuote();1993 }1994 }1995 }1996 }1997 }1998 }1999 if (s2 !== peg$FAILED) {2000 while (s2 !== peg$FAILED) {2001 s1.push(s2);2002 s2 = peg$parseglob();2003 if (s2 === peg$FAILED) {2004 s2 = peg$parsebareword();2005 if (s2 === peg$FAILED) {2006 s2 = peg$parseenvironmentVariable();2007 if (s2 === peg$FAILED) {2008 s2 = peg$parsevariableSubstitution();2009 if (s2 === peg$FAILED) {2010 s2 = peg$parsecommandSubstitution();2011 if (s2 === peg$FAILED) {2012 s2 = peg$parsesingleQuote();2013 if (s2 === peg$FAILED) {2014 s2 = peg$parsedoubleQuote();2015 }2016 }2017 }2018 }2019 }2020 }2021 }2022 } else {2023 s1 = peg$FAILED;2024 }2025 if (s1 !== peg$FAILED) {2026 peg$savedPos = s0;2027 s1 = peg$c77(s1);2028 }2029 s0 = s1;2030 peg$silentFails--;2031 if (s0 === peg$FAILED) {2032 s1 = peg$FAILED;2033 if (peg$silentFails === 0) { peg$fail(peg$c76); }2034 }2035 return s0;2036 }2037 function peg$parsebareword() {2038 var s0, s1, s2, s3;2039 peg$silentFails++;2040 s0 = peg$currPos;2041 s1 = peg$currPos;2042 peg$silentFails++;2043 if (input.charCodeAt(peg$currPos) === 35) {2044 s2 = peg$c79;2045 peg$currPos++;2046 } else {2047 s2 = peg$FAILED;2048 if (peg$silentFails === 0) { peg$fail(peg$c80); }2049 }2050 peg$silentFails--;2051 if (s2 === peg$FAILED) {2052 s1 = void 0;2053 } else {2054 peg$currPos = s1;2055 s1 = peg$FAILED;2056 }2057 if (s1 !== peg$FAILED) {2058 s2 = [];2059 s3 = peg$parsebarewordChar();2060 if (s3 !== peg$FAILED) {2061 while (s3 !== peg$FAILED) {2062 s2.push(s3);2063 s3 = peg$parsebarewordChar();2064 }2065 } else {2066 s2 = peg$FAILED;2067 }2068 if (s2 !== peg$FAILED) {2069 peg$savedPos = s0;2070 s1 = peg$c81(s2);2071 s0 = s1;2072 } else {2073 peg$currPos = s0;2074 s0 = peg$FAILED;2075 }2076 } else {2077 peg$currPos = s0;2078 s0 = peg$FAILED;2079 }2080 peg$silentFails--;2081 if (s0 === peg$FAILED) {2082 s1 = peg$FAILED;2083 if (peg$silentFails === 0) { peg$fail(peg$c78); }2084 }2085 return s0;2086 }2087 function peg$parsebarewordChar() {2088 var s0, s1, s2;2089 s0 = peg$currPos;2090 if (input.charCodeAt(peg$currPos) === 92) {2091 s1 = peg$c82;2092 peg$currPos++;2093 } else {2094 s1 = peg$FAILED;2095 if (peg$silentFails === 0) { peg$fail(peg$c83); }2096 }2097 if (s1 !== peg$FAILED) {2098 s2 = peg$parsebarewordMeta();2099 if (s2 !== peg$FAILED) {2100 peg$savedPos = s0;2101 s1 = peg$c84(s2);2102 s0 = s1;2103 } else {2104 peg$currPos = s0;2105 s0 = peg$FAILED;2106 }2107 } else {2108 peg$currPos = s0;2109 s0 = peg$FAILED;2110 }2111 if (s0 === peg$FAILED) {2112 s0 = peg$currPos;2113 s1 = peg$currPos;2114 peg$silentFails++;2115 s2 = peg$parsebarewordMeta();2116 peg$silentFails--;2117 if (s2 === peg$FAILED) {2118 s1 = void 0;2119 } else {2120 peg$currPos = s1;2121 s1 = peg$FAILED;2122 }2123 if (s1 !== peg$FAILED) {2124 if (input.length > peg$currPos) {2125 s2 = input.charAt(peg$currPos);2126 peg$currPos++;2127 } else {2128 s2 = peg$FAILED;2129 if (peg$silentFails === 0) { peg$fail(peg$c85); }2130 }2131 if (s2 !== peg$FAILED) {2132 peg$savedPos = s0;2133 s1 = peg$c84(s2);2134 s0 = s1;2135 } else {2136 peg$currPos = s0;2137 s0 = peg$FAILED;2138 }2139 } else {2140 peg$currPos = s0;2141 s0 = peg$FAILED;2142 }2143 }2144 return s0;2145 }2146 function peg$parsebarewordMeta() {2147 var s0;2148 if (peg$c86.test(input.charAt(peg$currPos))) {2149 s0 = input.charAt(peg$currPos);2150 peg$currPos++;2151 } else {2152 s0 = peg$FAILED;2153 if (peg$silentFails === 0) { peg$fail(peg$c87); }2154 }2155 return s0;2156 }2157 function peg$parseglob() {2158 var s0, s1, s2, s3, s4;2159 s0 = peg$currPos;2160 s1 = [];2161 s2 = peg$parsebarewordChar();2162 while (s2 !== peg$FAILED) {2163 s1.push(s2);2164 s2 = peg$parsebarewordChar();2165 }2166 if (s1 !== peg$FAILED) {2167 s2 = [];2168 if (input.charCodeAt(peg$currPos) === 42) {2169 s3 = peg$c88;2170 peg$currPos++;2171 } else {2172 s3 = peg$FAILED;2173 if (peg$silentFails === 0) { peg$fail(peg$c89); }2174 }2175 if (s3 === peg$FAILED) {2176 if (input.charCodeAt(peg$currPos) === 63) {2177 s3 = peg$c90;2178 peg$currPos++;2179 } else {2180 s3 = peg$FAILED;2181 if (peg$silentFails === 0) { peg$fail(peg$c91); }2182 }2183 if (s3 === peg$FAILED) {2184 s3 = peg$parsecharacterRange();2185 if (s3 === peg$FAILED) {2186 s3 = peg$parsebraceExpansion();2187 }2188 }2189 }2190 if (s3 !== peg$FAILED) {2191 while (s3 !== peg$FAILED) {2192 s2.push(s3);2193 if (input.charCodeAt(peg$currPos) === 42) {2194 s3 = peg$c88;2195 peg$currPos++;2196 } else {2197 s3 = peg$FAILED;2198 if (peg$silentFails === 0) { peg$fail(peg$c89); }2199 }2200 if (s3 === peg$FAILED) {2201 if (input.charCodeAt(peg$currPos) === 63) {2202 s3 = peg$c90;2203 peg$currPos++;2204 } else {2205 s3 = peg$FAILED;2206 if (peg$silentFails === 0) { peg$fail(peg$c91); }2207 }2208 if (s3 === peg$FAILED) {2209 s3 = peg$parsecharacterRange();2210 if (s3 === peg$FAILED) {2211 s3 = peg$parsebraceExpansion();2212 }2213 }2214 }2215 }2216 } else {2217 s2 = peg$FAILED;2218 }2219 if (s2 !== peg$FAILED) {2220 s3 = [];2221 s4 = peg$parsebarewordChar();2222 while (s4 !== peg$FAILED) {2223 s3.push(s4);2224 s4 = peg$parsebarewordChar();2225 }2226 if (s3 !== peg$FAILED) {2227 peg$savedPos = s0;2228 s1 = peg$c92();2229 s0 = s1;2230 } else {2231 peg$currPos = s0;2232 s0 = peg$FAILED;2233 }2234 } else {2235 peg$currPos = s0;2236 s0 = peg$FAILED;2237 }2238 } else {2239 peg$currPos = s0;2240 s0 = peg$FAILED;2241 }2242 return s0;2243 }2244 function peg$parsecharacterRange() {2245 var s0, s1, s2, s3, s4, s5, s6, s7, s8;2246 s0 = peg$currPos;2247 s1 = peg$currPos;2248 if (input.charCodeAt(peg$currPos) === 91) {2249 s2 = peg$c73;2250 peg$currPos++;2251 } else {2252 s2 = peg$FAILED;2253 if (peg$silentFails === 0) { peg$fail(peg$c74); }2254 }2255 if (s2 !== peg$FAILED) {2256 s3 = peg$currPos;2257 peg$silentFails++;2258 if (input.charCodeAt(peg$currPos) === 45) {2259 s4 = peg$c53;2260 peg$currPos++;2261 } else {2262 s4 = peg$FAILED;2263 if (peg$silentFails === 0) { peg$fail(peg$c54); }2264 }2265 peg$silentFails--;2266 if (s4 === peg$FAILED) {2267 s3 = void 0;2268 } else {2269 peg$currPos = s3;2270 s3 = peg$FAILED;2271 }2272 if (s3 !== peg$FAILED) {2273 if (input.length > peg$currPos) {2274 s4 = input.charAt(peg$currPos);2275 peg$currPos++;2276 } else {2277 s4 = peg$FAILED;2278 if (peg$silentFails === 0) { peg$fail(peg$c85); }2279 }2280 if (s4 !== peg$FAILED) {2281 if (input.charCodeAt(peg$currPos) === 45) {2282 s5 = peg$c53;2283 peg$currPos++;2284 } else {2285 s5 = peg$FAILED;2286 if (peg$silentFails === 0) { peg$fail(peg$c54); }2287 }2288 if (s5 !== peg$FAILED) {2289 s6 = peg$currPos;2290 peg$silentFails++;2291 if (input.charCodeAt(peg$currPos) === 45) {2292 s7 = peg$c53;2293 peg$currPos++;2294 } else {2295 s7 = peg$FAILED;2296 if (peg$silentFails === 0) { peg$fail(peg$c54); }2297 }2298 peg$silentFails--;2299 if (s7 === peg$FAILED) {2300 s6 = void 0;2301 } else {2302 peg$currPos = s6;2303 s6 = peg$FAILED;2304 }2305 if (s6 !== peg$FAILED) {2306 if (input.length > peg$currPos) {2307 s7 = input.charAt(peg$currPos);2308 peg$currPos++;2309 } else {2310 s7 = peg$FAILED;2311 if (peg$silentFails === 0) { peg$fail(peg$c85); }2312 }2313 if (s7 !== peg$FAILED) {2314 if (input.charCodeAt(peg$currPos) === 93) {2315 s8 = peg$c93;2316 peg$currPos++;2317 } else {2318 s8 = peg$FAILED;2319 if (peg$silentFails === 0) { peg$fail(peg$c94); }2320 }2321 if (s8 !== peg$FAILED) {2322 s2 = [s2, s3, s4, s5, s6, s7, s8];2323 s1 = s2;2324 } else {2325 peg$currPos = s1;2326 s1 = peg$FAILED;2327 }2328 } else {2329 peg$currPos = s1;2330 s1 = peg$FAILED;2331 }2332 } else {2333 peg$currPos = s1;2334 s1 = peg$FAILED;2335 }2336 } else {2337 peg$currPos = s1;2338 s1 = peg$FAILED;2339 }2340 } else {2341 peg$currPos = s1;2342 s1 = peg$FAILED;2343 }2344 } else {2345 peg$currPos = s1;2346 s1 = peg$FAILED;2347 }2348 } else {2349 peg$currPos = s1;2350 s1 = peg$FAILED;2351 }2352 if (s1 !== peg$FAILED) {2353 s0 = input.substring(s0, peg$currPos);2354 } else {2355 s0 = s1;2356 }2357 return s0;2358 }2359 function peg$parsebraceExpansion() {2360 var s0, s1, s2, s3, s4;2361 s0 = peg$currPos;2362 s1 = peg$currPos;2363 if (input.length > peg$currPos) {2364 s2 = input.charAt(peg$currPos);2365 peg$currPos++;2366 } else {2367 s2 = peg$FAILED;2368 if (peg$silentFails === 0) { peg$fail(peg$c85); }2369 }2370 if (s2 === peg$FAILED) {2371 s2 = null;2372 }2373 if (s2 !== peg$FAILED) {2374 s3 = peg$currPos;2375 peg$silentFails++;2376 if (input.charCodeAt(peg$currPos) === 36) {2377 s4 = peg$c95;2378 peg$currPos++;2379 } else {2380 s4 = peg$FAILED;2381 if (peg$silentFails === 0) { peg$fail(peg$c96); }2382 }2383 peg$silentFails--;2384 if (s4 === peg$FAILED) {2385 s3 = void 0;2386 } else {2387 peg$currPos = s3;2388 s3 = peg$FAILED;2389 }2390 if (s3 !== peg$FAILED) {2391 s2 = [s2, s3];2392 s1 = s2;2393 } else {2394 peg$currPos = s1;2395 s1 = peg$FAILED;2396 }2397 } else {2398 peg$currPos = s1;2399 s1 = peg$FAILED;2400 }2401 if (s1 !== peg$FAILED) {2402 if (input.charCodeAt(peg$currPos) === 123) {2403 s2 = peg$c97;2404 peg$currPos++;2405 } else {2406 s2 = peg$FAILED;2407 if (peg$silentFails === 0) { peg$fail(peg$c98); }2408 }2409 if (s2 !== peg$FAILED) {2410 s3 = [];2411 s4 = peg$parsebarewordChar();2412 if (s4 !== peg$FAILED) {2413 while (s4 !== peg$FAILED) {2414 s3.push(s4);2415 s4 = peg$parsebarewordChar();2416 }2417 } else {2418 s3 = peg$FAILED;2419 }2420 if (s3 !== peg$FAILED) {2421 if (input.charCodeAt(peg$currPos) === 125) {2422 s4 = peg$c99;2423 peg$currPos++;2424 } else {2425 s4 = peg$FAILED;2426 if (peg$silentFails === 0) { peg$fail(peg$c100); }2427 }2428 if (s4 !== peg$FAILED) {2429 s1 = [s1, s2, s3, s4];2430 s0 = s1;2431 } else {2432 peg$currPos = s0;2433 s0 = peg$FAILED;2434 }2435 } else {2436 peg$currPos = s0;2437 s0 = peg$FAILED;2438 }2439 } else {2440 peg$currPos = s0;2441 s0 = peg$FAILED;2442 }2443 } else {2444 peg$currPos = s0;2445 s0 = peg$FAILED;2446 }2447 return s0;2448 }2449 function peg$parsesingleQuote() {2450 var s0, s1, s2, s3, s4;2451 s0 = peg$currPos;2452 if (input.charCodeAt(peg$currPos) === 39) {2453 s1 = peg$c101;2454 peg$currPos++;2455 } else {2456 s1 = peg$FAILED;2457 if (peg$silentFails === 0) { peg$fail(peg$c102); }2458 }2459 if (s1 !== peg$FAILED) {2460 s2 = peg$currPos;2461 s3 = [];2462 if (peg$c103.test(input.charAt(peg$currPos))) {2463 s4 = input.charAt(peg$currPos);2464 peg$currPos++;2465 } else {2466 s4 = peg$FAILED;2467 if (peg$silentFails === 0) { peg$fail(peg$c104); }2468 }2469 while (s4 !== peg$FAILED) {2470 s3.push(s4);2471 if (peg$c103.test(input.charAt(peg$currPos))) {2472 s4 = input.charAt(peg$currPos);2473 peg$currPos++;2474 } else {2475 s4 = peg$FAILED;2476 if (peg$silentFails === 0) { peg$fail(peg$c104); }2477 }2478 }2479 if (s3 !== peg$FAILED) {2480 s2 = input.substring(s2, peg$currPos);2481 } else {2482 s2 = s3;2483 }2484 if (s2 !== peg$FAILED) {2485 if (input.charCodeAt(peg$currPos) === 39) {2486 s3 = peg$c101;2487 peg$currPos++;2488 } else {2489 s3 = peg$FAILED;2490 if (peg$silentFails === 0) { peg$fail(peg$c102); }2491 }2492 if (s3 !== peg$FAILED) {2493 peg$savedPos = s0;2494 s1 = peg$c105(s2);2495 s0 = s1;2496 } else {2497 peg$currPos = s0;2498 s0 = peg$FAILED;2499 }2500 } else {2501 peg$currPos = s0;2502 s0 = peg$FAILED;2503 }2504 } else {2505 peg$currPos = s0;2506 s0 = peg$FAILED;2507 }2508 return s0;2509 }2510 function peg$parsedoubleQuote() {2511 var s0, s1, s2, s3, s4;2512 s0 = peg$currPos;2513 if (input.charCodeAt(peg$currPos) === 34) {2514 s1 = peg$c106;2515 peg$currPos++;2516 } else {2517 s1 = peg$FAILED;2518 if (peg$silentFails === 0) { peg$fail(peg$c107); }2519 }2520 if (s1 !== peg$FAILED) {2521 s2 = [];2522 s3 = peg$parseexpandsInQuotes();2523 if (s3 === peg$FAILED) {2524 s3 = [];2525 s4 = peg$parsedoubleQuoteChar();2526 if (s4 !== peg$FAILED) {2527 while (s4 !== peg$FAILED) {2528 s3.push(s4);2529 s4 = peg$parsedoubleQuoteChar();2530 }2531 } else {2532 s3 = peg$FAILED;2533 }2534 }2535 while (s3 !== peg$FAILED) {2536 s2.push(s3);2537 s3 = peg$parseexpandsInQuotes();2538 if (s3 === peg$FAILED) {2539 s3 = [];2540 s4 = peg$parsedoubleQuoteChar();2541 if (s4 !== peg$FAILED) {2542 while (s4 !== peg$FAILED) {2543 s3.push(s4);2544 s4 = peg$parsedoubleQuoteChar();2545 }2546 } else {2547 s3 = peg$FAILED;2548 }2549 }2550 }2551 if (s2 !== peg$FAILED) {2552 if (input.charCodeAt(peg$currPos) === 34) {2553 s3 = peg$c106;2554 peg$currPos++;2555 } else {2556 s3 = peg$FAILED;2557 if (peg$silentFails === 0) { peg$fail(peg$c107); }2558 }2559 if (s3 !== peg$FAILED) {2560 peg$savedPos = s0;2561 s1 = peg$c108(s2);2562 s0 = s1;2563 } else {2564 peg$currPos = s0;2565 s0 = peg$FAILED;2566 }2567 } else {2568 peg$currPos = s0;2569 s0 = peg$FAILED;2570 }2571 } else {2572 peg$currPos = s0;2573 s0 = peg$FAILED;2574 }2575 return s0;2576 }2577 function peg$parsedoubleQuoteChar() {2578 var s0, s1, s2;2579 s0 = peg$currPos;2580 if (input.charCodeAt(peg$currPos) === 92) {2581 s1 = peg$c82;2582 peg$currPos++;2583 } else {2584 s1 = peg$FAILED;2585 if (peg$silentFails === 0) { peg$fail(peg$c83); }2586 }2587 if (s1 !== peg$FAILED) {2588 s2 = peg$parsedoubleQuoteMeta();2589 if (s2 !== peg$FAILED) {2590 peg$savedPos = s0;2591 s1 = peg$c84(s2);2592 s0 = s1;2593 } else {2594 peg$currPos = s0;2595 s0 = peg$FAILED;2596 }2597 } else {2598 peg$currPos = s0;2599 s0 = peg$FAILED;2600 }2601 if (s0 === peg$FAILED) {2602 s0 = peg$currPos;2603 if (input.substr(peg$currPos, 2) === peg$c109) {2604 s1 = peg$c109;2605 peg$currPos += 2;2606 } else {2607 s1 = peg$FAILED;2608 if (peg$silentFails === 0) { peg$fail(peg$c110); }2609 }2610 if (s1 !== peg$FAILED) {2611 peg$savedPos = s0;2612 s1 = peg$c111();2613 }2614 s0 = s1;2615 if (s0 === peg$FAILED) {2616 s0 = peg$currPos;2617 s1 = peg$currPos;2618 peg$silentFails++;2619 s2 = peg$parsedoubleQuoteMeta();2620 peg$silentFails--;2621 if (s2 === peg$FAILED) {2622 s1 = void 0;2623 } else {2624 peg$currPos = s1;2625 s1 = peg$FAILED;2626 }2627 if (s1 !== peg$FAILED) {2628 if (input.length > peg$currPos) {2629 s2 = input.charAt(peg$currPos);2630 peg$currPos++;2631 } else {2632 s2 = peg$FAILED;2633 if (peg$silentFails === 0) { peg$fail(peg$c85); }2634 }2635 if (s2 !== peg$FAILED) {2636 peg$savedPos = s0;2637 s1 = peg$c84(s2);2638 s0 = s1;2639 } else {2640 peg$currPos = s0;2641 s0 = peg$FAILED;2642 }2643 } else {2644 peg$currPos = s0;2645 s0 = peg$FAILED;2646 }2647 }2648 }2649 return s0;2650 }2651 function peg$parsedoubleQuoteMeta() {2652 var s0;2653 if (input.charCodeAt(peg$currPos) === 34) {2654 s0 = peg$c106;2655 peg$currPos++;2656 } else {2657 s0 = peg$FAILED;2658 if (peg$silentFails === 0) { peg$fail(peg$c107); }2659 }2660 if (s0 === peg$FAILED) {2661 if (input.charCodeAt(peg$currPos) === 36) {2662 s0 = peg$c95;2663 peg$currPos++;2664 } else {2665 s0 = peg$FAILED;2666 if (peg$silentFails === 0) { peg$fail(peg$c96); }2667 }2668 if (s0 === peg$FAILED) {2669 if (input.charCodeAt(peg$currPos) === 96) {2670 s0 = peg$c112;2671 peg$currPos++;2672 } else {2673 s0 = peg$FAILED;2674 if (peg$silentFails === 0) { peg$fail(peg$c113); }2675 }2676 }2677 }2678 return s0;2679 }2680 function peg$parseexpandsInQuotes() {2681 var s0;2682 s0 = peg$parsecommandSubstitution();2683 if (s0 === peg$FAILED) {2684 s0 = peg$parseenvironmentVariable();2685 if (s0 === peg$FAILED) {2686 s0 = peg$parsevariableSubstitution();2687 }2688 }2689 return s0;2690 }2691 function peg$parseenvironmentVariable() {2692 var s0, s1, s2;2693 s0 = peg$currPos;2694 if (input.charCodeAt(peg$currPos) === 36) {2695 s1 = peg$c95;2696 peg$currPos++;2697 } else {2698 s1 = peg$FAILED;2699 if (peg$silentFails === 0) { peg$fail(peg$c96); }2700 }2701 if (s1 !== peg$FAILED) {2702 s2 = peg$parsereadableVariableName();2703 if (s2 !== peg$FAILED) {2704 peg$savedPos = s0;2705 s1 = peg$c114(s2);2706 s0 = s1;2707 } else {2708 peg$currPos = s0;2709 s0 = peg$FAILED;2710 }2711 } else {2712 peg$currPos = s0;2713 s0 = peg$FAILED;2714 }2715 return s0;2716 }2717 function peg$parsewritableVariableName() {2718 var s0, s1, s2;2719 s0 = peg$currPos;2720 s1 = [];2721 if (peg$c115.test(input.charAt(peg$currPos))) {2722 s2 = input.charAt(peg$currPos);2723 peg$currPos++;2724 } else {2725 s2 = peg$FAILED;2726 if (peg$silentFails === 0) { peg$fail(peg$c116); }2727 }2728 if (s2 !== peg$FAILED) {2729 while (s2 !== peg$FAILED) {2730 s1.push(s2);2731 if (peg$c115.test(input.charAt(peg$currPos))) {2732 s2 = input.charAt(peg$currPos);2733 peg$currPos++;2734 } else {2735 s2 = peg$FAILED;2736 if (peg$silentFails === 0) { peg$fail(peg$c116); }2737 }2738 }2739 } else {2740 s1 = peg$FAILED;2741 }2742 if (s1 !== peg$FAILED) {2743 peg$savedPos = s0;2744 s1 = peg$c117();2745 }2746 s0 = s1;2747 return s0;2748 }2749 function peg$parsereadableVariableName() {2750 var s0;2751 s0 = peg$parsewritableVariableName();2752 if (s0 === peg$FAILED) {2753 if (input.charCodeAt(peg$currPos) === 63) {2754 s0 = peg$c90;2755 peg$currPos++;2756 } else {2757 s0 = peg$FAILED;2758 if (peg$silentFails === 0) { peg$fail(peg$c91); }2759 }2760 }2761 return s0;2762 }2763 function peg$parsevariableSubstitution() {2764 var s0, s1, s2, s3;2765 s0 = peg$currPos;2766 if (input.substr(peg$currPos, 2) === peg$c118) {2767 s1 = peg$c118;2768 peg$currPos += 2;2769 } else {2770 s1 = peg$FAILED;2771 if (peg$silentFails === 0) { peg$fail(peg$c119); }2772 }2773 if (s1 !== peg$FAILED) {2774 s2 = [];2775 if (peg$c120.test(input.charAt(peg$currPos))) {2776 s3 = input.charAt(peg$currPos);2777 peg$currPos++;2778 } else {2779 s3 = peg$FAILED;2780 if (peg$silentFails === 0) { peg$fail(peg$c121); }2781 }2782 while (s3 !== peg$FAILED) {2783 s2.push(s3);2784 if (peg$c120.test(input.charAt(peg$currPos))) {2785 s3 = input.charAt(peg$currPos);2786 peg$currPos++;2787 } else {2788 s3 = peg$FAILED;2789 if (peg$silentFails === 0) { peg$fail(peg$c121); }2790 }2791 }2792 if (s2 !== peg$FAILED) {2793 if (input.charCodeAt(peg$currPos) === 125) {2794 s3 = peg$c99;2795 peg$currPos++;2796 } else {2797 s3 = peg$FAILED;2798 if (peg$silentFails === 0) { peg$fail(peg$c100); }2799 }2800 if (s3 !== peg$FAILED) {2801 peg$savedPos = s0;2802 s1 = peg$c122(s2);2803 s0 = s1;2804 } else {2805 peg$currPos = s0;2806 s0 = peg$FAILED;2807 }2808 } else {2809 peg$currPos = s0;2810 s0 = peg$FAILED;2811 }2812 } else {2813 peg$currPos = s0;2814 s0 = peg$FAILED;2815 }2816 return s0;2817 }2818 function peg$parsecommandSubstitution() {2819 var s0;2820 s0 = peg$parseparenCommandSubstitution();2821 if (s0 === peg$FAILED) {2822 s0 = peg$parsebackQuote();2823 }2824 return s0;2825 }2826 function peg$parseparenCommandSubstitution() {2827 var s0, s1, s2, s3;2828 s0 = peg$currPos;2829 if (input.substr(peg$currPos, 2) === peg$c123) {2830 s1 = peg$c123;2831 peg$currPos += 2;2832 } else {2833 s1 = peg$FAILED;2834 if (peg$silentFails === 0) { peg$fail(peg$c124); }2835 }2836 if (s1 !== peg$FAILED) {2837 s2 = peg$parsestatementList();2838 if (s2 !== peg$FAILED) {2839 if (input.charCodeAt(peg$currPos) === 41) {2840 s3 = peg$c11;2841 peg$currPos++;2842 } else {2843 s3 = peg$FAILED;2844 if (peg$silentFails === 0) { peg$fail(peg$c12); }2845 }2846 if (s3 !== peg$FAILED) {2847 peg$savedPos = s0;2848 s1 = peg$c125(s2);2849 s0 = s1;2850 } else {2851 peg$currPos = s0;2852 s0 = peg$FAILED;2853 }2854 } else {2855 peg$currPos = s0;2856 s0 = peg$FAILED;2857 }2858 } else {2859 peg$currPos = s0;2860 s0 = peg$FAILED;2861 }2862 return s0;2863 }2864 function peg$parsebackQuote() {2865 var s0, s1, s2, s3;2866 s0 = peg$currPos;2867 if (input.charCodeAt(peg$currPos) === 96) {2868 s1 = peg$c112;2869 peg$currPos++;2870 } else {2871 s1 = peg$FAILED;2872 if (peg$silentFails === 0) { peg$fail(peg$c113); }2873 }2874 if (s1 !== peg$FAILED) {2875 s2 = [];2876 s3 = peg$parsebackQuoteChar();2877 if (s3 !== peg$FAILED) {2878 while (s3 !== peg$FAILED) {2879 s2.push(s3);2880 s3 = peg$parsebackQuoteChar();2881 }2882 } else {2883 s2 = peg$FAILED;2884 }2885 if (s2 !== peg$FAILED) {2886 if (input.charCodeAt(peg$currPos) === 96) {2887 s3 = peg$c112;2888 peg$currPos++;2889 } else {2890 s3 = peg$FAILED;2891 if (peg$silentFails === 0) { peg$fail(peg$c113); }2892 }2893 if (s3 !== peg$FAILED) {2894 peg$savedPos = s0;2895 s1 = peg$c126(s2);2896 s0 = s1;2897 } else {2898 peg$currPos = s0;2899 s0 = peg$FAILED;2900 }2901 } else {2902 peg$currPos = s0;2903 s0 = peg$FAILED;2904 }2905 } else {2906 peg$currPos = s0;2907 s0 = peg$FAILED;2908 }2909 return s0;2910 }2911 function peg$parsebackQuoteChar() {2912 var s0, s1, s2;2913 s0 = peg$currPos;2914 if (input.substr(peg$currPos, 2) === peg$c127) {2915 s1 = peg$c127;2916 peg$currPos += 2;2917 } else {2918 s1 = peg$FAILED;2919 if (peg$silentFails === 0) { peg$fail(peg$c128); }2920 }2921 if (s1 !== peg$FAILED) {2922 peg$savedPos = s0;2923 s1 = peg$c129();2924 }2925 s0 = s1;2926 if (s0 === peg$FAILED) {2927 s0 = peg$currPos;2928 if (input.substr(peg$currPos, 2) === peg$c109) {2929 s1 = peg$c109;2930 peg$currPos += 2;2931 } else {2932 s1 = peg$FAILED;2933 if (peg$silentFails === 0) { peg$fail(peg$c110); }2934 }2935 if (s1 !== peg$FAILED) {2936 peg$savedPos = s0;2937 s1 = peg$c111();2938 }2939 s0 = s1;2940 if (s0 === peg$FAILED) {2941 s0 = peg$currPos;2942 s1 = peg$currPos;2943 peg$silentFails++;2944 if (input.charCodeAt(peg$currPos) === 96) {2945 s2 = peg$c112;2946 peg$currPos++;2947 } else {2948 s2 = peg$FAILED;2949 if (peg$silentFails === 0) { peg$fail(peg$c113); }2950 }2951 peg$silentFails--;2952 if (s2 === peg$FAILED) {2953 s1 = void 0;2954 } else {2955 peg$currPos = s1;2956 s1 = peg$FAILED;2957 }2958 if (s1 !== peg$FAILED) {2959 if (input.length > peg$currPos) {2960 s2 = input.charAt(peg$currPos);2961 peg$currPos++;2962 } else {2963 s2 = peg$FAILED;2964 if (peg$silentFails === 0) { peg$fail(peg$c85); }2965 }2966 if (s2 !== peg$FAILED) {2967 peg$savedPos = s0;2968 s1 = peg$c84(s2);2969 s0 = s1;2970 } else {2971 peg$currPos = s0;2972 s0 = peg$FAILED;2973 }2974 } else {2975 peg$currPos = s0;2976 s0 = peg$FAILED;2977 }2978 }2979 }2980 return s0;2981 }2982 function peg$parseprocessSubstitution() {2983 var s0, s1, s2, s3, s4;2984 s0 = peg$currPos;2985 if (peg$c130.test(input.charAt(peg$currPos))) {2986 s1 = input.charAt(peg$currPos);2987 peg$currPos++;2988 } else {2989 s1 = peg$FAILED;2990 if (peg$silentFails === 0) { peg$fail(peg$c131); }2991 }2992 if (s1 !== peg$FAILED) {2993 if (input.charCodeAt(peg$currPos) === 40) {2994 s2 = peg$c9;2995 peg$currPos++;2996 } else {2997 s2 = peg$FAILED;2998 if (peg$silentFails === 0) { peg$fail(peg$c10); }2999 }3000 if (s2 !== peg$FAILED) {3001 s3 = peg$parsestatementList();3002 if (s3 !== peg$FAILED) {3003 if (input.charCodeAt(peg$currPos) === 41) {3004 s4 = peg$c11;3005 peg$currPos++;3006 } else {3007 s4 = peg$FAILED;3008 if (peg$silentFails === 0) { peg$fail(peg$c12); }3009 }3010 if (s4 !== peg$FAILED) {3011 peg$savedPos = s0;3012 s1 = peg$c132(s1, s3);3013 s0 = s1;3014 } else {3015 peg$currPos = s0;3016 s0 = peg$FAILED;3017 }3018 } else {3019 peg$currPos = s0;3020 s0 = peg$FAILED;3021 }3022 } else {3023 peg$currPos = s0;3024 s0 = peg$FAILED;3025 }3026 } else {3027 peg$currPos = s0;3028 s0 = peg$FAILED;3029 }3030 return s0;3031 }3032 function peg$parseredirect() {3033 var s0;3034 s0 = peg$parsemoveFd();3035 if (s0 === peg$FAILED) {3036 s0 = peg$parseduplicateFd();3037 if (s0 === peg$FAILED) {3038 s0 = peg$parseredirectFd();3039 }3040 }3041 return s0;3042 }3043 function peg$parsemoveFd() {3044 var s0, s1, s2, s3, s4;3045 s0 = peg$currPos;3046 s1 = peg$parsefd();3047 if (s1 === peg$FAILED) {3048 s1 = null;3049 }3050 if (s1 !== peg$FAILED) {3051 if (input.substr(peg$currPos, 2) === peg$c133) {3052 s2 = peg$c133;3053 peg$currPos += 2;3054 } else {3055 s2 = peg$FAILED;3056 if (peg$silentFails === 0) { peg$fail(peg$c134); }3057 }3058 if (s2 === peg$FAILED) {3059 if (input.substr(peg$currPos, 2) === peg$c135) {3060 s2 = peg$c135;3061 peg$currPos += 2;3062 } else {3063 s2 = peg$FAILED;3064 if (peg$silentFails === 0) { peg$fail(peg$c136); }3065 }3066 }3067 if (s2 !== peg$FAILED) {3068 s3 = peg$parsefd();3069 if (s3 !== peg$FAILED) {3070 if (input.charCodeAt(peg$currPos) === 45) {3071 s4 = peg$c53;3072 peg$currPos++;3073 } else {3074 s4 = peg$FAILED;3075 if (peg$silentFails === 0) { peg$fail(peg$c54); }3076 }3077 if (s4 !== peg$FAILED) {3078 peg$savedPos = s0;3079 s1 = peg$c137(s1, s2, s3);3080 s0 = s1;3081 } else {3082 peg$currPos = s0;3083 s0 = peg$FAILED;3084 }3085 } else {3086 peg$currPos = s0;3087 s0 = peg$FAILED;3088 }3089 } else {3090 peg$currPos = s0;3091 s0 = peg$FAILED;3092 }3093 } else {3094 peg$currPos = s0;3095 s0 = peg$FAILED;3096 }3097 return s0;3098 }3099 function peg$parseduplicateFd() {3100 var s0, s1, s2, s3, s4;3101 s0 = peg$currPos;3102 s1 = peg$parsefd();3103 if (s1 === peg$FAILED) {3104 s1 = null;3105 }3106 if (s1 !== peg$FAILED) {3107 if (input.substr(peg$currPos, 2) === peg$c133) {3108 s2 = peg$c133;3109 peg$currPos += 2;3110 } else {3111 s2 = peg$FAILED;3112 if (peg$silentFails === 0) { peg$fail(peg$c134); }3113 }3114 if (s2 === peg$FAILED) {3115 if (input.substr(peg$currPos, 2) === peg$c135) {3116 s2 = peg$c135;3117 peg$currPos += 2;3118 } else {3119 s2 = peg$FAILED;3120 if (peg$silentFails === 0) { peg$fail(peg$c136); }3121 }3122 }3123 if (s2 !== peg$FAILED) {3124 s3 = [];3125 s4 = peg$parsespace();3126 while (s4 !== peg$FAILED) {3127 s3.push(s4);3128 s4 = peg$parsespace();3129 }3130 if (s3 !== peg$FAILED) {3131 s4 = peg$parsefd();3132 if (s4 !== peg$FAILED) {3133 peg$savedPos = s0;3134 s1 = peg$c138(s1, s2, s4);3135 s0 = s1;3136 } else {3137 peg$currPos = s0;3138 s0 = peg$FAILED;3139 }3140 } else {3141 peg$currPos = s0;3142 s0 = peg$FAILED;3143 }3144 } else {3145 peg$currPos = s0;3146 s0 = peg$FAILED;3147 }3148 } else {3149 peg$currPos = s0;3150 s0 = peg$FAILED;3151 }3152 return s0;3153 }3154 function peg$parseredirectFd() {3155 var s0, s1, s2, s3, s4;3156 s0 = peg$currPos;3157 s1 = peg$parsefd();3158 if (s1 === peg$FAILED) {3159 s1 = null;3160 }3161 if (s1 !== peg$FAILED) {3162 s2 = peg$parseredirectionOperator();3163 if (s2 !== peg$FAILED) {3164 s3 = [];3165 s4 = peg$parsespace();3166 while (s4 !== peg$FAILED) {3167 s3.push(s4);3168 s4 = peg$parsespace();3169 }3170 if (s3 !== peg$FAILED) {3171 s4 = peg$parseargument();3172 if (s4 !== peg$FAILED) {3173 peg$savedPos = s0;3174 s1 = peg$c139(s1, s2, s4);3175 s0 = s1;3176 } else {3177 peg$currPos = s0;3178 s0 = peg$FAILED;3179 }3180 } else {3181 peg$currPos = s0;3182 s0 = peg$FAILED;3183 }3184 } else {3185 peg$currPos = s0;3186 s0 = peg$FAILED;3187 }3188 } else {3189 peg$currPos = s0;3190 s0 = peg$FAILED;3191 }3192 return s0;3193 }3194 function peg$parseredirectionOperator() {3195 var s0;3196 if (input.substr(peg$currPos, 2) === peg$c140) {3197 s0 = peg$c140;3198 peg$currPos += 2;3199 } else {3200 s0 = peg$FAILED;3201 if (peg$silentFails === 0) { peg$fail(peg$c141); }3202 }3203 if (s0 === peg$FAILED) {3204 if (input.substr(peg$currPos, 2) === peg$c142) {3205 s0 = peg$c142;3206 peg$currPos += 2;3207 } else {3208 s0 = peg$FAILED;3209 if (peg$silentFails === 0) { peg$fail(peg$c143); }3210 }3211 if (s0 === peg$FAILED) {3212 if (input.substr(peg$currPos, 3) === peg$c144) {3213 s0 = peg$c144;3214 peg$currPos += 3;3215 } else {3216 s0 = peg$FAILED;3217 if (peg$silentFails === 0) { peg$fail(peg$c145); }3218 }3219 if (s0 === peg$FAILED) {3220 if (input.substr(peg$currPos, 2) === peg$c146) {3221 s0 = peg$c146;3222 peg$currPos += 2;3223 } else {3224 s0 = peg$FAILED;3225 if (peg$silentFails === 0) { peg$fail(peg$c147); }3226 }3227 if (s0 === peg$FAILED) {3228 if (input.charCodeAt(peg$currPos) === 60) {3229 s0 = peg$c148;3230 peg$currPos++;3231 } else {3232 s0 = peg$FAILED;3233 if (peg$silentFails === 0) { peg$fail(peg$c149); }3234 }3235 if (s0 === peg$FAILED) {3236 if (input.charCodeAt(peg$currPos) === 62) {3237 s0 = peg$c150;3238 peg$currPos++;3239 } else {3240 s0 = peg$FAILED;3241 if (peg$silentFails === 0) { peg$fail(peg$c151); }3242 }3243 }3244 }3245 }3246 }3247 }3248 return s0;3249 }3250 function peg$parsefd() {3251 var s0, s1, s2;3252 s0 = peg$currPos;3253 s1 = [];3254 if (peg$c152.test(input.charAt(peg$currPos))) {3255 s2 = input.charAt(peg$currPos);3256 peg$currPos++;3257 } else {3258 s2 = peg$FAILED;3259 if (peg$silentFails === 0) { peg$fail(peg$c153); }3260 }3261 if (s2 !== peg$FAILED) {3262 while (s2 !== peg$FAILED) {3263 s1.push(s2);3264 if (peg$c152.test(input.charAt(peg$currPos))) {3265 s2 = input.charAt(peg$currPos);3266 peg$currPos++;3267 } else {3268 s2 = peg$FAILED;3269 if (peg$silentFails === 0) { peg$fail(peg$c153); }3270 }3271 }3272 } else {3273 s1 = peg$FAILED;3274 }3275 if (s1 !== peg$FAILED) {3276 peg$savedPos = s0;3277 s1 = peg$c154(s1);3278 }3279 s0 = s1;3280 return s0;3281 }3282 function peg$parsecontrolOperator() {3283 var s0, s1, s2;3284 s0 = peg$currPos;3285 s1 = [];3286 s2 = peg$parsespace();3287 while (s2 !== peg$FAILED) {3288 s1.push(s2);3289 s2 = peg$parsespace();3290 }3291 if (s1 !== peg$FAILED) {3292 if (input.charCodeAt(peg$currPos) === 38) {3293 s2 = peg$c155;3294 peg$currPos++;3295 } else {3296 s2 = peg$FAILED;3297 if (peg$silentFails === 0) { peg$fail(peg$c156); }3298 }3299 if (s2 === peg$FAILED) {3300 if (input.charCodeAt(peg$currPos) === 59) {3301 s2 = peg$c45;3302 peg$currPos++;3303 } else {3304 s2 = peg$FAILED;3305 if (peg$silentFails === 0) { peg$fail(peg$c46); }3306 }3307 if (s2 === peg$FAILED) {3308 if (input.charCodeAt(peg$currPos) === 10) {3309 s2 = peg$c47;3310 peg$currPos++;3311 } else {3312 s2 = peg$FAILED;3313 if (peg$silentFails === 0) { peg$fail(peg$c48); }3314 }3315 }3316 }3317 if (s2 !== peg$FAILED) {3318 peg$savedPos = s0;3319 s1 = peg$c157(s2);3320 s0 = s1;3321 } else {3322 peg$currPos = s0;3323 s0 = peg$FAILED;3324 }3325 } else {3326 peg$currPos = s0;3327 s0 = peg$FAILED;3328 }3329 return s0;3330 }3331 function peg$parsepipe() {3332 var s0, s1, s2, s3;3333 s0 = peg$currPos;3334 if (input.charCodeAt(peg$currPos) === 124) {3335 s1 = peg$c158;3336 peg$currPos++;3337 } else {3338 s1 = peg$FAILED;3339 if (peg$silentFails === 0) { peg$fail(peg$c159); }3340 }3341 if (s1 !== peg$FAILED) {3342 s2 = [];3343 s3 = peg$parsespaceNL();3344 while (s3 !== peg$FAILED) {3345 s2.push(s3);3346 s3 = peg$parsespaceNL();3347 }3348 if (s2 !== peg$FAILED) {3349 s3 = peg$parsecommand();3350 if (s3 !== peg$FAILED) {3351 peg$savedPos = s0;3352 s1 = peg$c160(s3);3353 s0 = s1;3354 } else {3355 peg$currPos = s0;3356 s0 = peg$FAILED;3357 }3358 } else {3359 peg$currPos = s0;3360 s0 = peg$FAILED;3361 }3362 } else {3363 peg$currPos = s0;3364 s0 = peg$FAILED;3365 }3366 return s0;3367 }3368 function peg$parsespace() {3369 var s0, s1;3370 peg$silentFails++;3371 if (input.charCodeAt(peg$currPos) === 32) {3372 s0 = peg$c162;3373 peg$currPos++;3374 } else {3375 s0 = peg$FAILED;3376 if (peg$silentFails === 0) { peg$fail(peg$c163); }3377 }3378 if (s0 === peg$FAILED) {3379 if (input.charCodeAt(peg$currPos) === 9) {3380 s0 = peg$c164;3381 peg$currPos++;3382 } else {3383 s0 = peg$FAILED;3384 if (peg$silentFails === 0) { peg$fail(peg$c165); }3385 }3386 }3387 peg$silentFails--;3388 if (s0 === peg$FAILED) {3389 s1 = peg$FAILED;3390 if (peg$silentFails === 0) { peg$fail(peg$c161); }3391 }3392 return s0;3393 }3394 function peg$parsespaceNL() {3395 var s0;3396 s0 = peg$parsespace();3397 if (s0 === peg$FAILED) {3398 if (input.charCodeAt(peg$currPos) === 10) {3399 s0 = peg$c47;3400 peg$currPos++;3401 } else {3402 s0 = peg$FAILED;3403 if (peg$silentFails === 0) { peg$fail(peg$c48); }3404 }3405 if (s0 === peg$FAILED) {3406 s0 = peg$parsecomment();3407 }3408 }3409 return s0;3410 }3411 function peg$parsecomment() {3412 var s0, s1, s2, s3;3413 peg$silentFails++;3414 s0 = peg$currPos;3415 if (input.charCodeAt(peg$currPos) === 35) {3416 s1 = peg$c79;3417 peg$currPos++;3418 } else {3419 s1 = peg$FAILED;3420 if (peg$silentFails === 0) { peg$fail(peg$c80); }3421 }3422 if (s1 !== peg$FAILED) {3423 s2 = [];3424 if (peg$c63.test(input.charAt(peg$currPos))) {3425 s3 = input.charAt(peg$currPos);3426 peg$currPos++;3427 } else {3428 s3 = peg$FAILED;3429 if (peg$silentFails === 0) { peg$fail(peg$c64); }3430 }3431 while (s3 !== peg$FAILED) {3432 s2.push(s3);3433 if (peg$c63.test(input.charAt(peg$currPos))) {3434 s3 = input.charAt(peg$currPos);3435 peg$currPos++;3436 } else {3437 s3 = peg$FAILED;3438 if (peg$silentFails === 0) { peg$fail(peg$c64); }3439 }3440 }3441 if (s2 !== peg$FAILED) {3442 if (input.charCodeAt(peg$currPos) === 10) {3443 s3 = peg$c47;3444 peg$currPos++;3445 } else {3446 s3 = peg$FAILED;3447 if (peg$silentFails === 0) { peg$fail(peg$c48); }3448 }3449 if (s3 === peg$FAILED) {3450 s3 = peg$parseEOF();3451 }3452 if (s3 !== peg$FAILED) {3453 s1 = [s1, s2, s3];3454 s0 = s1;3455 } else {3456 peg$currPos = s0;3457 s0 = peg$FAILED;3458 }3459 } else {3460 peg$currPos = s0;3461 s0 = peg$FAILED;3462 }3463 } else {3464 peg$currPos = s0;3465 s0 = peg$FAILED;3466 }3467 peg$silentFails--;3468 if (s0 === peg$FAILED) {3469 s1 = peg$FAILED;3470 if (peg$silentFails === 0) { peg$fail(peg$c166); }3471 }3472 return s0;3473 }3474 function peg$parsekeyword() {3475 var s0, s1, s2, s3;3476 s0 = peg$currPos;3477 if (input.substr(peg$currPos, 5) === peg$c31) {3478 s1 = peg$c31;3479 peg$currPos += 5;3480 } else {3481 s1 = peg$FAILED;3482 if (peg$silentFails === 0) { peg$fail(peg$c32); }3483 }3484 if (s1 === peg$FAILED) {3485 if (input.substr(peg$currPos, 5) === peg$c33) {3486 s1 = peg$c33;3487 peg$currPos += 5;3488 } else {3489 s1 = peg$FAILED;3490 if (peg$silentFails === 0) { peg$fail(peg$c34); }3491 }3492 if (s1 === peg$FAILED) {3493 if (input.substr(peg$currPos, 3) === peg$c41) {3494 s1 = peg$c41;3495 peg$currPos += 3;3496 } else {3497 s1 = peg$FAILED;3498 if (peg$silentFails === 0) { peg$fail(peg$c42); }3499 }3500 if (s1 === peg$FAILED) {3501 if (input.substr(peg$currPos, 4) === peg$c37) {3502 s1 = peg$c37;3503 peg$currPos += 4;3504 } else {3505 s1 = peg$FAILED;3506 if (peg$silentFails === 0) { peg$fail(peg$c38); }3507 }3508 if (s1 === peg$FAILED) {3509 if (input.substr(peg$currPos, 2) === peg$c35) {3510 s1 = peg$c35;3511 peg$currPos += 2;3512 } else {3513 s1 = peg$FAILED;3514 if (peg$silentFails === 0) { peg$fail(peg$c36); }3515 }3516 if (s1 === peg$FAILED) {3517 if (input.substr(peg$currPos, 4) === peg$c167) {3518 s1 = peg$c167;3519 peg$currPos += 4;3520 } else {3521 s1 = peg$FAILED;3522 if (peg$silentFails === 0) { peg$fail(peg$c168); }3523 }3524 if (s1 === peg$FAILED) {3525 if (input.substr(peg$currPos, 4) === peg$c169) {3526 s1 = peg$c169;3527 peg$currPos += 4;3528 } else {3529 s1 = peg$FAILED;3530 if (peg$silentFails === 0) { peg$fail(peg$c170); }3531 }3532 if (s1 === peg$FAILED) {3533 if (input.substr(peg$currPos, 2) === peg$c18) {3534 s1 = peg$c18;3535 peg$currPos += 2;3536 } else {3537 s1 = peg$FAILED;3538 if (peg$silentFails === 0) { peg$fail(peg$c19); }3539 }3540 if (s1 === peg$FAILED) {3541 if (input.substr(peg$currPos, 4) === peg$c20) {3542 s1 = peg$c20;3543 peg$currPos += 4;3544 } else {3545 s1 = peg$FAILED;3546 if (peg$silentFails === 0) { peg$fail(peg$c21); }3547 }3548 if (s1 === peg$FAILED) {3549 if (input.substr(peg$currPos, 4) === peg$c22) {3550 s1 = peg$c22;3551 peg$currPos += 4;3552 } else {3553 s1 = peg$FAILED;3554 if (peg$silentFails === 0) { peg$fail(peg$c23); }3555 }3556 if (s1 === peg$FAILED) {3557 if (input.substr(peg$currPos, 4) === peg$c27) {3558 s1 = peg$c27;3559 peg$currPos += 4;3560 } else {3561 s1 = peg$FAILED;3562 if (peg$silentFails === 0) { peg$fail(peg$c28); }3563 }3564 if (s1 === peg$FAILED) {3565 if (input.substr(peg$currPos, 2) === peg$c24) {3566 s1 = peg$c24;3567 peg$currPos += 2;3568 } else {3569 s1 = peg$FAILED;3570 if (peg$silentFails === 0) { peg$fail(peg$c25); }3571 }3572 if (s1 === peg$FAILED) {3573 if (input.substr(peg$currPos, 2) === peg$c71) {3574 s1 = peg$c71;3575 peg$currPos += 2;3576 } else {3577 s1 = peg$FAILED;3578 if (peg$silentFails === 0) { peg$fail(peg$c72); }3579 }3580 }3581 }3582 }3583 }3584 }3585 }3586 }3587 }3588 }3589 }3590 }3591 }3592 if (s1 !== peg$FAILED) {3593 s2 = [];3594 s3 = peg$parsespaceNL();3595 if (s3 !== peg$FAILED) {3596 while (s3 !== peg$FAILED) {3597 s2.push(s3);3598 s3 = peg$parsespaceNL();3599 }3600 } else {3601 s2 = peg$FAILED;3602 }3603 if (s2 === peg$FAILED) {3604 s2 = peg$parseEOF();3605 }3606 if (s2 !== peg$FAILED) {3607 s1 = [s1, s2];3608 s0 = s1;3609 } else {3610 peg$currPos = s0;3611 s0 = peg$FAILED;3612 }3613 } else {3614 peg$currPos = s0;3615 s0 = peg$FAILED;3616 }3617 return s0;3618 }3619 function peg$parsecontinuationStart() {3620 var s0, s1, s2, s3;3621 s0 = peg$currPos;3622 s1 = peg$currPos;3623 peg$silentFails++;3624 s2 = peg$parsekeyword();3625 if (s2 === peg$FAILED) {3626 if (input.charCodeAt(peg$currPos) === 34) {3627 s2 = peg$c106;3628 peg$currPos++;3629 } else {3630 s2 = peg$FAILED;3631 if (peg$silentFails === 0) { peg$fail(peg$c107); }3632 }3633 if (s2 === peg$FAILED) {3634 if (input.charCodeAt(peg$currPos) === 39) {3635 s2 = peg$c101;3636 peg$currPos++;3637 } else {3638 s2 = peg$FAILED;3639 if (peg$silentFails === 0) { peg$fail(peg$c102); }3640 }3641 if (s2 === peg$FAILED) {3642 if (input.charCodeAt(peg$currPos) === 96) {3643 s2 = peg$c112;3644 peg$currPos++;3645 } else {3646 s2 = peg$FAILED;3647 if (peg$silentFails === 0) { peg$fail(peg$c113); }3648 }3649 if (s2 === peg$FAILED) {3650 if (input.substr(peg$currPos, 2) === peg$c123) {3651 s2 = peg$c123;3652 peg$currPos += 2;3653 } else {3654 s2 = peg$FAILED;3655 if (peg$silentFails === 0) { peg$fail(peg$c124); }3656 }3657 if (s2 === peg$FAILED) {3658 if (input.substr(peg$currPos, 2) === peg$c118) {3659 s2 = peg$c118;3660 peg$currPos += 2;3661 } else {3662 s2 = peg$FAILED;3663 if (peg$silentFails === 0) { peg$fail(peg$c119); }3664 }3665 }3666 }3667 }3668 }3669 }3670 peg$silentFails--;3671 if (s2 !== peg$FAILED) {3672 peg$currPos = s1;3673 s1 = void 0;3674 } else {3675 s1 = peg$FAILED;3676 }3677 if (s1 !== peg$FAILED) {3678 s2 = [];3679 if (input.length > peg$currPos) {3680 s3 = input.charAt(peg$currPos);3681 peg$currPos++;3682 } else {3683 s3 = peg$FAILED;3684 if (peg$silentFails === 0) { peg$fail(peg$c85); }3685 }3686 while (s3 !== peg$FAILED) {3687 s2.push(s3);3688 if (input.length > peg$currPos) {3689 s3 = input.charAt(peg$currPos);3690 peg$currPos++;3691 } else {3692 s3 = peg$FAILED;3693 if (peg$silentFails === 0) { peg$fail(peg$c85); }3694 }3695 }3696 if (s2 !== peg$FAILED) {3697 s1 = [s1, s2];3698 s0 = s1;3699 } else {3700 peg$currPos = s0;3701 s0 = peg$FAILED;3702 }3703 } else {3704 peg$currPos = s0;3705 s0 = peg$FAILED;3706 }3707 return s0;3708 }3709 function peg$parseEOF() {3710 var s0, s1;3711 s0 = peg$currPos;3712 peg$silentFails++;3713 if (input.length > peg$currPos) {3714 s1 = input.charAt(peg$currPos);3715 peg$currPos++;3716 } else {3717 s1 = peg$FAILED;3718 if (peg$silentFails === 0) { peg$fail(peg$c85); }3719 }3720 peg$silentFails--;3721 if (s1 === peg$FAILED) {3722 s0 = void 0;3723 } else {3724 peg$currPos = s0;3725 s0 = peg$FAILED;3726 }3727 return s0;3728 }3729 var isArray = require("isarray")3730 var map = require("array-map")3731 function join(arr) {3732 return arr.join("")3733 }3734 function literal(string) {3735 return {3736 type: 'literal',3737 value: isArray(string) ? string.join('') : string3738 }3739 }3740 function first(arr) {3741 return arr[0]3742 }3743 function second(arr) {3744 return arr[1]3745 }3746 function flattenConcatenation(pieces) {3747 // TODO - this algo sucks, it's probably on the order of n^43748 var result = [pieces[0]]3749 , len = pieces.length3750 , prev = pieces[0]3751 , current3752 for (var i = 1; i < len; i++) {3753 current = pieces[i]3754 if (current.type == 'concatenation') {3755 current = flattenConcatenation(current.pieces)3756 }3757 if (current.type == 'concatenation') {3758 // it's still a concatenation, append it's pieces to ours3759 result = result.concat(current.pieces)3760 }3761 else if ((current.type == 'literal' || current.type == 'glob')3762 && (prev.type == 'literal' || prev.type == 'glob')) {3763 // globs & literals can be merged3764 prev.value += current.value3765 if (prev.type != 'glob' && current.type == 'glob') {3766 // globs are infectious3767 prev.type = 'glob'3768 }3769 }3770 else {3771 result.push(current)3772 prev = current3773 }3774 }3775 return result.length == 1 ? result[0] : {3776 type: 'concatenation',3777 pieces: result3778 }3779 }3780 peg$result = peg$startRuleFunction();3781 if (peg$result !== peg$FAILED && peg$currPos === input.length) {3782 return peg$result;3783 } else {3784 if (peg$result !== peg$FAILED && peg$currPos < input.length) {3785 peg$fail({ type: "end", description: "end of input" });3786 }3787 throw peg$buildException(3788 null,3789 peg$maxFailExpected,3790 peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,3791 peg$maxFailPos < input.length3792 ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)3793 : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)3794 );3795 }3796 }3797 return {3798 SyntaxError: peg$SyntaxError,3799 parse: peg$parse3800 };3801})()...

Full Screen

Full Screen

calc2.js

Source:calc2.js Github

copy

Full Screen

1var total_square = 0, home_type = 1, num_rooms = 1, num_bathrooms = 0, height = 2.5, design = false, floors_alignment = false, electrics = false, electrics_work = 0, door_installation = false, num_doors = 1, balcony = false, balcony_square = 0;2var room_square = [], room_perimeter = [], roof_type = [], wall_covering = [], flooring = [], walls_alignment = [], fillets = [], plinth = [], plinth_type = [];3var bathroom_square = [], bathroom_perimeter = [], bathroom_roof_type = [], bathroom_flooring = [], toilet_type = [], bath_type = [], bathroom_water_system = [], bathroom_num_points = [], bathroom_warm_floor = [], bathroom_towel_dryer = [];45var TotalSum = 0, Price_work = 0, Price_mat = 0;6var step = 1;78function testKey(e)9{10 11 if (e.keyCode==13) return false;12 return !(/[А-Яа-яA-Za-z ,\/-]/.test(String.fromCharCode(e.charCode)));13 14}15function test(el)16{17 if (el.value.indexOf(".") != '-1') {18 el.value=el.value.substring(0, el.value.indexOf(".") + 2);19 }20}21function HideShowField(el)22{23 if (el.children[0].checked)24 $(el).parent().find('div').slideDown();25 else26 $(el).parent().find('div').slideUp();27}28function demontazh()29{30 /* if ($('#home_type option:selected').index()>0) $('#capremont').prop("disabled",false);31 else {32 $('#capremont').prop("disabled",true);33 $('#capremont').prop("checked",false);34 } */35 return;36}3738function ShowStage()39{4041 (step < 1) ? step = 1: step > 5 ? step = 5 : 0;42 (step == 1) ? $('#prev_button').hide(): $('#prev_button').show();43 (step == 5) ? $('#next_button').hide(): $('#next_button').show();44 if (step == 5) {45 $('#calc_button').show();46 $('#next_button').hide();47 $('#calc_button').show();48 } else $('#calc_button').hide();49 SetNavStatus();50 $('#main_param').hide();51 $('#rooms').hide();52 $('#kitchen').hide();53 $('#corridor').hide();54 $('#bathrooms').hide();5556//alert(step);57 switch(step)58 {59 case 1:60 $('#main_param').show();61 $('#steps li').eq(step-1).addClass("active");62 63 break;64 case 2:6566 // подсвечиваем меню Комнаты67 $('#steps li').eq(1).addClass("active");68 // определяем количество комнат в параметрах69 var num_rooms = $('#num_rooms option:selected').index()+1;70 // и количество существующих на данный момент71 var num_rooms_done = $('.rooms').length;72 // если количество комнат в параметрах больше, чем в данный момент73 if (num_rooms > num_rooms_done)74 {75 // добавляем комнаты76 for (var r=num_rooms_done;r<num_rooms;r++)77 {78 $('#rooms').append(v_rooms_innerHtml);79 $('.num_room').eq(r).html("Комната №"+(r+1));80 }81 }82 else83 {84 // иначе, удаляем лишние85 for (r=num_rooms_done;r>num_rooms;r--)86 {87 $('.rooms').eq(r-1).remove();88 }89 }90 // расставляем id 91 for (var r=0;r<num_rooms;r++)92 {93 $('.rooms').eq(r).attr("id", "room_"+(r+1));94 $('.rooms').eq(r).find('#room_square').attr("id", "room_square_"+(r+1));95 $('.rooms').eq(r).find('#room_perimeter').attr("id", "room_perimeter_"+(r+1));96 $('.rooms').eq(r).find('#roof_type').attr("id", "roof_type_"+(r+1));97 $('.rooms').eq(r).find('#wall_covering').attr("id", "wall_covering_"+(r+1));98 $('.rooms').eq(r).find('#flooring').attr("id", "flooring_"+(r+1));99 $('.rooms').eq(r).find('#walls_alignment').attr("id", "walls_alignment_"+(r+1));100 $('.rooms').eq(r).find('#fillets').attr("id", "fillets_"+(r+1));101 $('.rooms').eq(r).find('#plinth').attr("id", "plinth_"+(r+1)); 102 $('.rooms').eq(r).find('#plinth_type').attr("id", "plinth_type_"+(r+1)); 103 104 }105106 $('#rooms').show();107 break;108 case 3:109 $('#steps>li').eq(2).addClass("active");110 $('#kitchen').show();111 break;112 case 4:113 $('#steps>li').eq(3).addClass("active");114 $('#corridor').show();115 break;116 case 5:117 // подсвечиваем меню Санузлы118 $('#steps>li').eq(4).addClass("active");119 // определяем количество санузлов в параметрах120 var num_bathrooms = $('#num_bathrooms option:selected').val();121 // и количество существующих на данный момент122 var num_bathrooms_done = $('.bathrooms').length;123 // если количество санузлов в параметрах больше, чем в данный момент124 if (num_bathrooms > num_bathrooms_done)125 {126 // добавляем санузлы127 for (var r=num_bathrooms_done;r<num_bathrooms;r++)128 {129 $('#bathrooms').append(v_brooms_innerHtml);130 $('.num_bathroom').eq(r).html("Санузел №"+(r+1));131 }132 }133 else134 {135 // иначе, удаляем лишние136 for (r=num_bathrooms_done;r>num_bathrooms;r--)137 {138 $('.bathrooms').eq(r-1).remove();139 }140 }141 // расставляем id 142 for (var r=0;r<num_bathrooms;r++)143 {144 $('.bathrooms').eq(r).attr("id", "bathroom_"+(r+1));145 $('.bathrooms').eq(r).find('#bathroom_square').attr("id", "bathroom_square_"+(r+1));146 $('.bathrooms').eq(r).find('#bathroom_perimeter').attr("id", "bathroom_perimeter_"+(r+1));147 $('.bathrooms').eq(r).find('#bathroom_roof_type').attr("id", "bathroom_roof_type_"+(r+1));148 $('.bathrooms').eq(r).find('#bathroom_flooring').attr("id", "bathroom_flooring_"+(r+1));149 $('.bathrooms').eq(r).find('#toilet_type').attr("id", "toilet_type_"+(r+1));150 $('.bathrooms').eq(r).find('#bath_type').attr("id", "bath_type_"+(r+1));151 $('.bathrooms').eq(r).find('#bathroom_warm_floor').attr("id", "bathroom_warm_floor_"+(r+1)); 152 $('.bathrooms').eq(r).find('#bathroom_towel_dryer').attr("id", "bathroom_towel_dryer_"+(r+1)); 153 $('.bathrooms').eq(r).find('#bathroom_water_system').attr("id", "bathroom_water_system_"+(r+1)); 154 $('.bathrooms').eq(r).find('#bathroom_num_points').attr("id", "bathroom_num_points_"+(r+1)); 155 156 }157 $('#bathrooms').show();158 break;159 }160}161function SetNavStatus()162{163 for (var s=0;s<5;s++)164 {165 $('#steps li').eq(s).removeClass("active");166 }167}168function TestParam()169{170171 $('#myModalLabel').text("Внимание");172 switch(step)173 {174 case 1:175 // проверяем, указана ли площадь квартиры176 if (isNaN($('#total_square').val())||$('#total_square').val()=='')177 {178 $('#modal_body').text("Укажите общую площадь");179 $.magnificPopup.open({180 items: {181 src: '#error_message', // can be a HTML string, jQuery object, or CSS selector182 type: 'inline'183 }184 });185 step=1;186 return false;187 }188 if ($('#balcony').is(':checked')&&(isNaN($('#balcony_square').val())||$('#balcony_square').val()==''))189 {190 $('#modal_body').text("Укажите площадь балкона");191 $.magnificPopup.open({192 items: {193 src: '#error_message', // can be a HTML string, jQuery object, or CSS selector194 type: 'inline'195 }196 });197 step=1;198 return false;199 }200 $('#steps li').eq(0).addClass("done");201 return true;202 break;203 case 2:204 // для каждой комнаты проверяем, выбраны ли параметры205 for (r=0;r<=$('#num_rooms option:selected').index();r++)206 {207 if (isNaN($('#room_square_'+(r+1)).val())||$('#room_square_'+(r+1)).val()=='') 208 {209 $('#modal_body').text("Укажите площадь Комнаты №"+(r+1));210 $.magnificPopup.open({211 items: {212 src: '#error_message', // can be a HTML string, jQuery object, or CSS selector213 type: 'inline'214 }215 });216 step=2;217 return false;218 }219 if (isNaN($('#room_perimeter_'+(r+1)).val())||$('#room_perimeter_'+(r+1)).val()=='') 220 {221 $('#modal_body').text("Укажите периметр Комнаты №"+(r+1));222 $.magnificPopup.open({223 items: {224 src: '#error_message',225 type: 'inline'226 }227 });228 step=2;229 return false;230 }231 }232 $('#steps li').eq(1).addClass("done");233 return true;234 break; 235 case 3:236 if (isNaN($('#kitchen_square').val())||$('#kitchen_square').val()=='') 237 {238 $('#modal_body').text("Укажите площадь Кухни");239 $.magnificPopup.open({240 items: {241 src: '#error_message', // can be a HTML string, jQuery object, or CSS selector242 type: 'inline'243 }244 });245 step=3;246 return false;247 }248 if (isNaN($('#kitchen_perimeter').val())||$('#kitchen_perimeter').val()=='') 249 {250 $('#modal_body').text("Укажите периметр Кухни");251 $.magnificPopup.open({252 items: {253 src: '#error_message',254 type: 'inline'255 }256 });257 step=3;258 return false;259 }260 $('#steps li').eq(2).addClass("done");261 return true;262 break;263 case 4:264 if (isNaN($('#corridor_square').val())||$('#corridor_square').val()=='') 265 {266 $('#modal_body').text("Укажите площадь Коридора");267 $.magnificPopup.open({268 items: {269 src: '#error_message', // can be a HTML string, jQuery object, or CSS selector270 type: 'inline'271 }272 });273 step=4;274 return false;275 }276 if (isNaN($('#corridor_perimeter').val())||$('#corridor_perimeter').val()=='') 277 {278 $('#modal_body').text("Укажите периметр Коридора");279 $.magnificPopup.open({280 items: {281 src: '#error_message',282 type: 'inline'283 }284 });285 step=4;286 return false;287 }288 $('#steps li').eq(3).addClass("done");289 return true;290 break;291 case 5:292 for (r=0;r<=$('#num_bathrooms option:selected').index();r++)293 {294 if (isNaN($('#bathroom_square_'+(r+1)).val())||$('#bathroom_square_'+(r+1)).val()=='') 295 {296 $('#modal_body').text("Укажите площадь Санузла №"+(r+1));297 $.magnificPopup.open({298 items: {299 src: '#error_message',300 type: 'inline'301 }302 });303 step=5;304 return false;305 }306 if (isNaN($('#bathroom_perimeter_'+(r+1)).val())||$('#bathroom_perimeter_'+(r+1)).val()=='') 307 {308 $('#modal_body').text("Укажите периметр Санузла №"+(r+1));309 $.magnificPopup.open({310 items: {311 src: '#error_message',312 type: 'inline'313 }314 });315 step=5;316 return false;317 }318 if (isNaN($('#bathroom_num_points_'+(r+1)).val())||$('#bathroom_num_points_'+(r+1)).val()=='') 319 {320 $('#modal_body').text("Укажите Количество точек водоснабжения для Санузла №"+(r+1));321 $.magnificPopup.open({322 items: {323 src: '#error_message', // can be a HTML string, jQuery object, or CSS selector324 type: 'inline'325 }326 });327 step=5;328 return false;329 }330 }331 $('#steps li').eq(4).addClass("done");332 return true;333 break;334 }335 return true;336}337338function calculate()339{340 341 TotalSum=0;342 Price_work=0; 343 Price_mat=0; 344 total_square=Number($('#total_square').val());345 home_type=$('#home_type option:selected').val();346 num_rooms=$('#num_rooms').val();347 num_bathrooms=$('#num_bathrooms').val();348 height=Number($('#height').val());349 design=$('#design').is(':checked');350 design_type=$('#design_type :selected').index();351 walls_alignment=$('#walls_alignment').is(':checked');352 floors_alignment=$('#floors_alignment').is(':checked');353 electrics=$('#electrics').is(':checked');354 electrics_work=$('#electrics_work :selected').index();355 door_installation=$('#door_installation').is(':checked');356 (door_installation)?num_doors=$('#num_doors :selected').val():num_doors=0;357 balcony=$('#balcony').is(':checked');358 (balcony)?balcony_square=Number($('#balcony_square').val()):balcony_square=0;359360 var s=0,s1=0,s2=0;361 // Параметры Комнат362 for (var r=0;r<num_rooms;r++)363 {364 room_square[r] = Number($('#room_square_'+(r+1)).val());365 room_perimeter[r] = Number($('#room_perimeter_'+(r+1)).val());366 roof_type[r] = $('#roof_type_'+(r+1)+' :selected').index();367 wall_covering[r] = $('#wall_covering_'+(r+1)+' :selected').index();368 flooring[r] = $('#flooring_'+(r+1)+' :selected').index();369 fillets[r] = $('#fillets_'+(r+1)).is(':checked');370 plinth[r] = $('#plinth_'+(r+1)).is(':checked');371 (plinth[r])?plinth_type[r] = $('#plinth_type_'+(r+1)+' :selected').index():plinth_type[r] = 0;372 }373374 $('#smeta_rooms').empty();375 for (r=0;r<num_rooms;r++)376 {377 // Добавляем комнату в смету378 $('#smeta_rooms').append(v_sm_rooms_innerHtml);379 $('#smeta_room').attr("id", "smeta_room_"+(r+1));380 $('#smeta_num_room').attr("id", "smeta_num_room_"+(r+1)).text('Комната №'+(r+1)); // подписываем комнату381 // Стены382 s = Math.round(room_perimeter[r]*height);383 $('#smeta_room_grunt').attr("id", "smeta_room_grunt_"+(r+1)).empty();384 $('#smeta_room_profil').attr("id", "smeta_room_profil_"+(r+1)).empty();385 $('#smeta_room_alignment').attr("id", "smeta_room_alignment_"+(r+1)).empty();386 if (walls_alignment){387 s1 = Math.round(s*wprice_room_grunt);388 s2 = Math.round(s*0.15*price_room_grunt);389 TotalSum+=(s1+s2);390 Price_work+=s1; 391 Price_mat+=s2; 392 var html = '<td class="text-left" style="width: 40%;">Грунтование поверхности (2 слоя)/Грунтовка Тифенгрунд Кнауф</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+s+'</td><td style="width: 10%;">'+wprice_room_grunt+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+price_room_grunt+'</td><td style="width: 10%;">'+s2+'</td>';393 $('#smeta_room_grunt_'+(r+1)).append(html);394 s1 = Math.round(s*wprice_room_profil);395 s2 = Math.round((s/1.5)*price_room_profil);396 TotalSum+=(s1+s2);397 Price_work+=s1; 398 Price_mat+=s2; 399 html = '<td class="text-left">Установка профиля маячкового/Маяки - Стандарт 6-10 мм 3 м 0.50 мм</td><td>м2</td><td>'+s+'</td><td>'+wprice_room_profil+'</td><td>'+s1+'</td><td>'+price_room_profil+'</td><td>'+s2+'</td>';400 $('#smeta_room_profil_'+(r+1)).append(html);401 s1 = Math.round(s*wprice_room_alignment);402 s2 = Math.round((s/2.3)*price_room_alignment);403 TotalSum+=(s1+s2);404 Price_work+=s1; 405 Price_mat+=s2; 406 html = '<td class="text-left">Выравнивание штукатурной смесью слой до 20 мм (ручная)/Штукатурка Knauf Rotband</td><td>м2</td><td>'+s+'</td><td>'+wprice_room_alignment+'</td><td>'+s1+'</td><td>'+price_room_alignment+'</td><td>'+s2+'</td>';407 $('#smeta_room_alignment_'+(r+1)).append(html);408 }409 s1 = (wall_covering[r]==2)?Math.round(s*wprice_painting[1]):Math.round(s*wprice_painting[0]);410 mat1 = (wall_covering[r]==2)?wprice_painting[1]:wprice_painting[0];411 s2 = (wall_covering[r]==2)?Math.round(s*price_painting[1]):Math.round(s*price_painting[0]);412 mat2 = (wall_covering[r]==2)?price_painting[1]:price_painting[0];413 TotalSum+=(s1+s2);414 Price_work+=s1;415 Price_mat+=s2;416 $('#smeta_room_painting').attr("id", "smeta_room_painting_"+(r+1)).empty();417 html = '<td class="text-left" style="width: 40%;">Шпаклевание (2 слоя), шлифовка, грунтовка/Шпаклевка для сухих помещений weber.vetonit LR+</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+s+'</td><td style="width: 10%;">'+mat1+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+mat2+'</td><td style="width: 10%;">'+s2+'</td>';418 $('#smeta_room_painting_'+(r+1)).append(html);419 s1 = Math.round(s*wprice_wall_covering[1][wall_covering[r]]);420 s2 = (wall_covering[r]==2)?Math.round((s/4)*price_paint):((wall_covering[r]==3)?Math.round((s/1.5)*price_enetian_plaster):'');421 mat = (wall_covering[r]==2)?price_paint:((wall_covering[r]==3)?price_enetian_plaster:'');422 TotalSum=(s2=='')?TotalSum+s1:TotalSum+s1+s2;423 Price_work+=s1; 424 Price_mat=(s2=='')?Price_mat:Price_mat+s2;425 $('#smeta_room_wall_covering').attr("id", "smeta_room_wall_covering_"+(r+1)).empty();426 html = '<td class="text-left">'+wprice_wall_covering[0][wall_covering[r]]+'</td><td>м2</td><td>'+s+'</td><td>'+wprice_wall_covering[1][wall_covering[r]]+'</td><td>'+s1+'</td><td>'+mat+'</td><td>'+s2+'</td>';427 $('#smeta_room_wall_covering_'+(r+1)).append(html);428 TotalSum+=wprice_radiator;429 Price_work+=wprice_radiator; 430 // Полы431 s1 = Math.round(room_square[r]*wprice_room_dedusting);432 s2 = Math.round(room_square[r]*0.2*price_room_grunt);433 TotalSum+=(s1+s2);434 Price_work+=s1; 435 Price_mat+=s2; 436 $('#smeta_room_dedusting').attr("id", "smeta_room_dedusting_"+(r+1)).empty();437 html = '<td class="text-left">Обеспыливание пола (2 слоя)/Грунт универсальный Мультигрунд</td><td>м2</td><td>'+room_square[r]+'</td><td>'+wprice_room_dedusting+'</td><td>'+s1+'</td><td>'+price_room_grunt+'</td><td>'+s2+'</td>';438 $('#smeta_room_dedusting_'+(r+1)).append(html);439440 $('#smeta_room_floors_alignment').attr("id", "smeta_room_floors_alignment_"+(r+1)).empty();441 if (floors_alignment){442 s1 = Math.round(room_square[r]*wprice_room_floors_alignment);443 s2 = Math.round(((room_square[r]*8)/20)*price_floor_alignment);444 TotalSum+=(s1+s2);445 Price_work+=s1; 446 Price_mat+=s2; 447 html = '<td class="text-left">Выравнивание финишным ровнителем до 5 мм/Ровнитель для пола weber.vetonit 3000</td><td>м2</td><td>'+room_square[r]+'</td><td>'+wprice_room_floors_alignment+'</td><td>'+s1+'</td><td>'+price_floor_alignment+'</td><td>'+s2+'</td>';448 $('#smeta_room_floors_alignment_'+(r+1)).append(html);449 }450 $('#smeta_room_flooring').attr("id", "smeta_room_flooring_"+(r+1)).empty();451 if (flooring[r]>=0)452 {453 s1 = Math.round(room_square[r]*wprice_room_flooring[1][flooring[r]]);454 s2 = (flooring[r]==2)?Math.round((room_square[r]/3.5)*price_glue):'';455 mat = (flooring[r]==2)?price_glue:'';456 TotalSum=(s2=='')?TotalSum+s1:TotalSum+s1+s2;457 Price_work+=s1; 458 Price_mat=(s2=='')?Price_mat:Price_mat+s2;459 html = '<td class="text-left">'+wprice_room_flooring[0][flooring[r]]+'</td><td>м2</td><td>'+room_square[r]+'</td><td>'+wprice_room_flooring[1][flooring[r]]+'</td><td>'+s1+'</td><td>'+mat+'</td><td>'+s2+'</td>';460 $('#smeta_room_flooring_'+(r+1)).append(html);461 }462 $('#smeta_room_plinth').attr("id", "smeta_room_plinth_"+(r+1)).empty();463 if (plinth[r])464 {465 s1 = Math.round(room_perimeter[r]*wprice_room_plinth[1][plinth_type[r]]);466 TotalSum+=s1;467 Price_work+=s1; 468 html = '<td class="text-left">'+wprice_room_plinth[0][plinth_type[r]]+'</td><td>м.п.</td><td>'+room_perimeter[r]+'</td><td>'+wprice_room_plinth[1][plinth_type[r]]+'</td><td>'+s1+'</td><td></td><td></td>';469 $('#smeta_room_plinth_'+(r+1)).append(html);470 }471 // Потолки472 s1 = Math.round(room_square[r]*wprice_room_roof[1][roof_type[r]]);473 s2 = Math.round(room_square[r]*price_room_roof[roof_type[r]]);474 TotalSum+=(s1+s2);475 Price_work+=s1; 476 Price_mat+=s2;477 $('#smeta_room_roof').attr("id", "smeta_room_roof_"+(r+1)).empty();478 html = '<td class="text-left">'+wprice_room_roof[0][roof_type[r]]+'</td><td>м2</td><td>'+room_square[r]+'</td><td>'+wprice_room_roof[1][roof_type[r]]+'</td><td>'+s1+'</td><td>'+price_room_roof[roof_type[r]]+'</td><td>'+s2+'</td>';479 $('#smeta_room_roof_'+(r+1)).append(html);480 $('#smeta_room_fillets').attr("id", "smeta_room_fillets_"+(r+1)).empty();481 if (fillets[r])482 {483 s1 = Math.round(room_perimeter[r]*wprice_room_fillets);484 TotalSum+=s1;485 Price_work+=s1; 486 html = '<td class="text-left">Монтаж полиуретановых потолочных плинтусов/Карниз (Европласт)</td><td>п.м</td><td>'+room_perimeter[r]+'</td><td>'+wprice_room_fillets+'</td><td>'+s1+'</td><td></td><td></td>';487 $('#smeta_room_fillets_'+(r+1)).append(html);488 }489 }490491 // Параметры Кухни492 var kitchen_square = Number($('#kitchen_square').val());493 var kitchen_perimeter = Number($('#kitchen_perimeter').val());494 var kitchen_roof_type = $('#kitchen_roof_type :selected').index();495 var kitchen_wall_covering = $('#kitchen_wall_covering :selected').index();496 var kitchen_flooring = $('#kitchen_flooring :selected').index();497 var kitchen_apron = $('#kitchen_apron').is(':checked');498 var kitchen_fillets = $('#kitchen_fillets').is(':checked');499 var kitchen_plinth = $('#kitchen_plinth').is(':checked');500 var kitchen_plinth_type = $('#kitchen_plinth_type :selected').index();;501 // добавляем в смету502 // стены503 s = Math.round(kitchen_perimeter*height);504 $('#smeta_kitchen_grunt').empty();505 $('#smeta_kitchen_profil').empty();506 $('#smeta_kitchen_alignment').empty();507 if (walls_alignment){508 s1 = Math.round(s*wprice_room_grunt);509 s2 = Math.round((s*0.15*price_room_grunt));510 TotalSum+=(s1+s2);511 Price_work+=s1;512 Price_mat+=s2;513 html = '<td class="text-left" style="width: 40%;">Грунтование поверхности стен (2 слоя)/Грунт укрепляющий Тифенгрунд Кнауф</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+s+'</td><td style="width: 10%;">'+wprice_room_grunt+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+price_room_grunt+'</td><td style="width: 10%;">'+s2+'</td>';514 $('#smeta_kitchen_grunt').append(html);515 s1 = Math.round(s*wprice_room_profil);516 s2 = Math.round((s/1.5)*price_room_profil);517 TotalSum+=(s1+s2);518 Price_work+=s1; 519 Price_mat+=s2;520 html = '<td class="text-left">Установка профиля маячкового/Маяки - Стандарт 6-10 мм 3 м 0.50 мм</td><td>м2</td><td>'+s+'</td><td>'+wprice_room_profil+'</td><td>'+s1+'</td><td>'+price_room_profil+'</td><td>'+s2+'</td>';521 $('#smeta_kitchen_profil').append(html);522 s1 = Math.round(s*wprice_room_alignment);523 s2 = Math.round((s/1.5)*price_room_alignment);524 TotalSum+=(s1+s2);525 Price_work+=s1;526 Price_mat+=s2; 527 html = '<td class="text-left">Штукатурка стен по маякам до 20 мм/Штукатурка гипсовая Knauf Rotband</td><td>м2</td><td>'+s+'</td><td>'+wprice_room_alignment+'</td><td>'+s1+'</td><td>'+price_room_alignment+'</td><td>'+s2+'</td>';528 $('#smeta_kitchen_alignment').append(html);529 }530 s1 = (kitchen_wall_covering==2)?Math.round(s*wprice_painting[1]):Math.round(s*wprice_painting[0]);531 mat1 = (kitchen_wall_covering==2)?wprice_painting[1]:wprice_painting[0];532 s2 = (kitchen_wall_covering==2)?Math.round(s*price_painting[1]):Math.round(s*price_painting[0]);533 mat2 = (kitchen_wall_covering==2)?price_painting[1]:price_painting[0];534 TotalSum+=(s1+s2);535 Price_work+=s1;536 Price_mat+=s2;537 $('#smeta_kitchen_painting').empty();538 html = '<td class="text-left" style="width: 40%;">Шпаклевание (2 слоя), шлифовка, грунтовка/Шпаклевка для сухих помещений weber.vetonit LR Fine</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+s+'</td><td style="width: 10%;">'+mat1+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+mat2+'</td><td style="width: 10%;">'+s2+'</td>';539 $('#smeta_kitchen_painting').append(html);540 s1 = Math.round(s*wprice_kitchen_wall_covering[1][kitchen_wall_covering]);541 s2 = (kitchen_wall_covering==2)?Math.round((s/4)*price_paint):((kitchen_wall_covering==3)?Math.round((s/1.5)*price_enetian_plaster):'');542 mat = (kitchen_wall_covering==2)?price_paint:((kitchen_wall_covering==3)?price_enetian_plaster:'');543 TotalSum=(s2=='')?TotalSum+s1:TotalSum+s1+s2;544 Price_work+=s1; 545 Price_mat=(s2=='')?Price_mat:Price_mat+s2;546 $('#smeta_kitchen_wall_covering').empty();547 html = '<td class="text-left">'+wprice_kitchen_wall_covering[0][kitchen_wall_covering]+'</td><td>м2</td><td>'+s+'</td><td>'+wprice_kitchen_wall_covering[1][kitchen_wall_covering]+'</td><td>'+s1+'</td><td>'+mat+'</td><td>'+s2+'</td>';548 $('#smeta_kitchen_wall_covering').append(html);549 $('#smeta_kitchen_apron').empty();550 if (kitchen_apron) {551 TotalSum+=(wprice_kitchen_apron+price_glue_apron);552 Price_work+=wprice_kitchen_apron; 553 Price_mat+=price_glue_apron;554 html = '<td class="text-left">Облицовка кухонного фартука кафелем до 5 кв.м</td><td>шт.</td><td>1</td><td>'+wprice_kitchen_apron+'</td><td>'+wprice_kitchen_apron+'</td><td>'+price_glue_apron+'</td><td>'+price_glue_apron+'</td>';555 $('#smeta_kitchen_apron').append(html);556 }557 TotalSum+=wprice_radiator;558 Price_work+=wprice_radiator; 559 // пол560 s1 = Math.round(kitchen_square*wprice_room_dedusting);561 s2 = Math.round(kitchen_square*0.2*price_room_grunt);562 TotalSum+=(s1+s2);563 Price_work+=s1; 564 Price_mat+=s2;565 $('#smeta_kitchen_dedusting').empty();566 html = '<td class="text-left">Обеспыливание пола (2 слоя)/Грунт универсальный Мультигрунд Кнауф</td><td>м2</td><td>'+kitchen_square+'</td><td>'+wprice_room_dedusting+'</td><td>'+s1+'</td><td>'+price_room_grunt+'</td><td>'+s2+'</td>';567 $('#smeta_kitchen_dedusting').append(html);568 $('#smeta_kitchen_floors_alignment').empty();569 if (floors_alignment){570 s1 = Math.round(kitchen_square*wprice_room_floors_alignment);571 s2 = Math.round(((kitchen_square*8)/20)*price_floor_alignment);572 TotalSum+=(s1+s2);573 Price_work+=s1; 574 Price_mat+=s2;575 html = '<td class="text-left">Финишное выравнивание ровнителем до 5 мм/Ровнитель для пола weber.vetonit 3000 финишный</td><td>м2</td><td>'+kitchen_square+'</td><td>'+wprice_room_floors_alignment+'</td><td>'+s1+'</td><td>'+price_floor_alignment+'</td><td>'+s2+'</td>';576 $('#smeta_kitchen_floors_alignment').append(html);577 }578 s1 = Math.round(kitchen_square*wprice_room_flooring[1][kitchen_flooring]);579 s2 = (kitchen_flooring==2)?Math.round((kitchen_square/3.5)*price_glue):'';580 mat = (kitchen_flooring==2)?price_glue:'';581 TotalSum=(s2=='')?TotalSum+s1:TotalSum+s1+s2;582 Price_work+=s1; 583 Price_mat=(s2=='')?Price_mat:Price_mat+s2;584 $('#smeta_kitchen_flooring').empty();585 html = '<td class="text-left">'+wprice_room_flooring[0][kitchen_flooring]+'</td><td>м2</td><td>'+kitchen_square+'</td><td>'+wprice_room_flooring[1][kitchen_flooring]+'</td><td>'+s1+'</td><td>'+mat+'</td><td>'+s2+'</td>';586 $('#smeta_kitchen_flooring').append(html);587 $('#smeta_kitchen_plinth').empty();588 if (kitchen_plinth){589 s1 = Math.round(kitchen_perimeter*wprice_room_plinth[1][kitchen_plinth_type]);590 TotalSum+=s1;591 Price_work+=s1; 592 html = '<td class="text-left">'+wprice_room_plinth[0][kitchen_plinth_type]+'</td><td>п.м</td><td>'+kitchen_perimeter+'</td><td>'+wprice_room_plinth[1][kitchen_plinth_type]+'</td><td>'+s1+'</td><td></td><td></td>';593 $('#smeta_kitchen_plinth').append(html);594 }595 // потолок596 s1 = Math.round(kitchen_square*wprice_room_roof[1][kitchen_roof_type]);597 s2 = Math.round(kitchen_square*price_kitchen_roof[kitchen_roof_type]);598 TotalSum+=(s1+s2);599 Price_work+=s1; 600 Price_mat+=s2;601 $('#smeta_kitchen_roof').empty();602 html = '<td class="text-left">'+wprice_room_roof[0][kitchen_roof_type]+'</td><td>м2</td><td>'+kitchen_square+'</td><td>'+wprice_room_roof[1][kitchen_roof_type]+'</td><td>'+s1+'</td><td>'+price_kitchen_roof[kitchen_roof_type]+'</td><td>'+s2+'</td>';603 $('#smeta_kitchen_roof').append(html);604 $('#smeta_kitchen_fillets').empty();605 if (kitchen_fillets){606 s1 = Math.round(kitchen_perimeter*wprice_room_fillets);607 TotalSum+=s1;608 Price_work+=s1; 609 html = '<td class="text-left">Монтаж потолочных плинтусов (Европласт)</td><td>п.м</td><td>'+kitchen_perimeter+'</td><td>'+wprice_room_fillets+'</td><td>'+s1+'</td><td></td><td></td>';610 $('#smeta_kitchen_fillets').append(html);611 }612 // Параметры Коридора613 var corridor_square = Number($('#corridor_square').val());614 var corridor_perimeter = Number($('#corridor_perimeter').val());615 var corridor_roof_type = $('#corridor_roof_type :selected').index();616 var corridor_wall_covering = $('#corridor_wall_covering :selected').index();617 var corridor_flooring = $('#corridor_flooring :selected').index();618 var corridor_fillets = $('#corridor_fillets').is(':checked');619 var corridor_plinth = $('#corridor_plinth').is(':checked');620 var corridor_plinth_type = $('#corridor_plinth_type :selected').index();621 // добавляем в смету622 // стены623 s = Math.round(corridor_perimeter*height);624 $('#smeta_corridor_alignment').empty();625 if (walls_alignment){626 s1 = Math.round(s*wprice_corridor_alignment);627 s2 = Math.round(s*price_corridor_alignment);628 TotalSum+=(s1+s2);629 Price_work+=s1; 630 Price_mat+=s2;631 html = '<td class="text-left" style="width: 40%;">Штукатурка стен по маякам до 20 мм/Knauf Rotband</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+s+'</td><td style="width: 10%;">'+wprice_corridor_alignment+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+price_corridor_alignment+'</td><td style="width: 10%;">'+s2+'</td>';632 $('#smeta_corridor_alignment').append(html);633 }634 s1 = (corridor_wall_covering==2)?Math.round(s*wprice_painting[1]):Math.round(s*wprice_painting[0]);635 mat1 = (corridor_wall_covering==2)?wprice_painting[1]:wprice_painting[0];636 s2 = (corridor_wall_covering==2)?Math.round(s*price_painting[1]):Math.round(s*price_painting[0]);637 mat2 = (corridor_wall_covering==2)?price_painting[1]:price_painting[0];638 TotalSum+=(s1+s2);639 Price_work+=s1;640 Price_mat+=s2;641 $('#smeta_corridor_painting').empty();642 html = '<td class="text-left" style="width: 40%;">Шпаклевание (2 слоя), шлифовка, грунтовка/Шпаклевка Vetonit LR Fine</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+s+'</td><td style="width: 10%;">'+mat1+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+mat2+'</td><td style="width: 10%;">'+s2+'</td>';643 $('#smeta_corridor_painting').append(html);644 s1 = Math.round(s*wprice_corridor_wall_covering[1][corridor_wall_covering]);645 s2 = (corridor_wall_covering==2)?Math.round((s/4)*price_paint):((corridor_wall_covering==3)?Math.round((s/1.5)*price_enetian_plaster):'');646 mat = (corridor_wall_covering==2)?price_paint:((corridor_wall_covering==3)?price_enetian_plaster:'');647 TotalSum=(s2=='')?TotalSum+s1:TotalSum+s1+s2;648 Price_work+=s1; 649 Price_mat=(s2=='')?Price_mat:Price_mat+s2;650 $('#smeta_corridor_wall_covering').empty();651 html = '<td class="text-left" style="width: 40%;">'+wprice_corridor_wall_covering[0][corridor_wall_covering]+'</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+s+'</td><td style="width: 10%;">'+wprice_corridor_wall_covering[1][corridor_wall_covering]+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+mat+'</td><td style="width: 10%;">'+s2+'</td>';652 $('#smeta_corridor_wall_covering').append(html);653 // пол654 $('#smeta_corridor_floors_alignment').empty();655 if (floors_alignment){656 s1 = Math.round(corridor_square*wprice_room_floors_alignment);657 s2 = Math.round(((corridor_square*8)/20)*price_floor_alignment+800);658 TotalSum+=(s1+s2);659 Price_work+=s1; 660 Price_mat+=s2;661 html = '<td class="text-left">Выравнивание финишным ровнителем до 5 мм/Vetonit 3000</td><td>м2</td><td>'+corridor_square+'</td><td>'+wprice_room_floors_alignment+'</td><td>'+s1+'</td><td>'+price_floor_alignment+'</td><td>'+s2+'</td>';662 $('#smeta_corridor_floors_alignment').append(html);663 }664 s1 = Math.round(corridor_square*wprice_room_flooring[1][corridor_flooring]);665 s2 = (corridor_flooring==2)?Math.round((corridor_square/3.5)*price_glue):'';666 mat = (corridor_flooring==2)?price_glue:'';667 TotalSum=(s2=='')?TotalSum+s1:TotalSum+s1+s2;668 Price_work+=s1; 669 Price_mat=(s2=='')?Price_mat:Price_mat+s2;670 $('#smeta_corridor_flooring').empty();671 html = '<td class="text-left">'+wprice_room_flooring[0][corridor_flooring]+'</td><td>м2</td><td>'+corridor_square+'</td><td>'+wprice_room_flooring[1][corridor_flooring]+'</td><td>'+s1+'</td><td>'+mat+'</td><td>'+s2+'</td>';672 $('#smeta_corridor_flooring').append(html);673 $('#smeta_corridor_plinth').empty();674 if (corridor_plinth){675 s1 = Math.round(corridor_perimeter*wprice_room_plinth[1][corridor_plinth_type]);676 TotalSum+=s1;677 Price_work+=s1; 678 html = '<td class="text-left">'+wprice_room_plinth[0][corridor_plinth_type]+'</td><td>п.м</td><td>'+corridor_perimeter+'</td><td>'+wprice_room_plinth[1][corridor_plinth_type]+'</td><td>'+s1+'</td><td></td><td></td>';679 $('#smeta_corridor_plinth').append(html);680 }681 // потолок682 s1 = Math.round(corridor_square*wprice_room_roof[1][corridor_roof_type]);683 s2 = Math.round(kitchen_square*price_kitchen_roof[corridor_roof_type]);684 TotalSum+=(s1+s2);685 Price_work+=s1; 686 Price_mat+=s2;687 $('#smeta_corridor_roof').empty();688 html = '<td class="text-left">'+wprice_room_roof[0][corridor_roof_type]+'</td><td>м2</td><td>'+corridor_square+'</td><td>'+wprice_room_roof[1][corridor_roof_type]+'</td><td>'+s1+'</td><td>'+price_kitchen_roof[corridor_roof_type]+'</td><td>'+s2+'</td>';689 $('#smeta_corridor_roof').append(html);690 $('#smeta_corridor_fillets').empty();691 if (corridor_fillets){692 s1 = Math.round(corridor_perimeter*wprice_room_fillets);693 TotalSum+=s1;694 Price_work+=s1; 695 html = '<td class="text-left">Монтаж потолочных плинтусов (Европласт)</td><td>п.м</td><td>'+corridor_perimeter+'</td><td>'+wprice_room_fillets+'</td><td>'+s1+'</td><td></td><td></td>';696 $('#smeta_corridor_fillets').append(html);697 }698 // Параметры Санузлов699 for (r=0;r<num_bathrooms;r++)700 {701 bathroom_square[r] = Number($('#bathroom_square_'+(r+1)).val());702 bathroom_perimeter[r] = Number($('#bathroom_perimeter_'+(r+1)).val());703 bathroom_roof_type[r] = $('#bathroom_roof_type_'+(r+1)+' :selected').index();704 bathroom_flooring[r] = $('#bathroom_flooring_'+(r+1)+' :selected').index();705 toilet_type[r] = Number($('#toilet_type_'+(r+1)+' :selected').val());706 bath_type[r] = Number($('#bath_type_'+(r+1)+' :selected').val());707 bathroom_water_system[r] = $('#bathroom_water_system_'+(r+1)+' :selected').index();708 bathroom_num_points[r] = Number($('#bathroom_num_points_'+(r+1)).val());709 bathroom_warm_floor[r] = $('#bathroom_warm_floor_'+(r+1)).is(':checked');710 bathroom_towel_dryer[r] = $('#bathroom_towel_dryer_'+(r+1)).is(':checked');711 }712 $('#smeta_bathrooms').empty();713 for (r=0;r<num_bathrooms;r++)714 {715 // Добавляем санузел в смету716 $('#smeta_bathrooms').append(v_sm_brooms_innerHtml);717 $('#smeta_bathroom').attr("id", "smeta_bathroom_"+(r+1));718 $('#smeta_num_bathroom').attr("id", "smeta_num_bathroom_"+(r+1)).text('Санузел №'+(r+1)); // подписываем санузел719 // стены720 s = Math.round(bathroom_perimeter[r]*height);721 s1 = Math.round(s*wprice_bathroom_alignment);722 s2 = Math.round(s*price_bathroom_alignment);723 TotalSum+=(s1+s2);724 Price_work+=s1; 725 Price_mat+=s2;726 $('#smeta_bathroom_alignment').attr("id", "smeta_bathroom_alignment_"+(r+1)).empty();727 var html = '<td class="text-left" style="width: 40%;">Выравнивание стен (комплекс работ)/Штукатурка weber.vetonit TT</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+s+'</td><td style="width: 10%;">'+wprice_bathroom_alignment+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+price_bathroom_alignment+'</td><td style="width: 10%;">'+s2+'</td>';728 $('#smeta_bathroom_alignment_'+(r+1)).append(html);729 s1 = Math.round((s*wprice_bathroom_wall_covering));730 s2 = Math.round((s/3)*price_bathroom_wall_covering);731 TotalSum+=(s1+s2);732 Price_work+=s1; 733 Price_mat+=s2;734 $('#smeta_bathroom_wall_covering').attr("id", "smeta_bathroom_wall_covering_"+(r+1)).empty();735 var html = '<td class="text-left">Облицовка кафельной плиткой</td><td>м2</td><td>'+s+'</td><td>'+wprice_bathroom_wall_covering+'</td><td>'+s1+'</td><td>'+price_bathroom_wall_covering+'</td><td>'+s2+'</td>';736 $('#smeta_bathroom_wall_covering_'+(r+1)).append(html);737 s1 = Math.round(s*wprice_bathroom_grouting);738 TotalSum+=s1;739 Price_work+=s1; 740 $('#smeta_bathroom_wall_grouting').attr("id", "smeta_bathroom_wall_grouting_"+(r+1)).empty();741 var html = '<td class="text-left">Затирка швов</td><td>м2</td><td>'+s+'</td><td>'+wprice_bathroom_grouting+'</td><td>'+s1+'</td><td></td><td></td>';742 $('#smeta_bathroom_wall_grouting_'+(r+1)).append(html);743 // полы744 $('#smeta_bathroom_warm_floor').attr("id", "smeta_bathroom_warm_floor_"+(r+1)).empty();745 if (bathroom_warm_floor[r]){746 s1 = Math.round(bathroom_square[r]*0.5*wprice_bathroom_warm_floor);747 s2 = price_bathroom_warm_floor;748 TotalSum+=(s1+s2);749 Price_work+=s1; 750 Price_mat+=s2;751 var html = '<td class="text-left">Устройство электрического теплого пола</td><td>м2</td><td>'+(bathroom_square[r]*0.5)+'</td><td>'+wprice_bathroom_warm_floor+'</td><td>'+s1+'</td><td>'+s2+'</td><td>'+s2+'</td>';752 $('#smeta_bathroom_warm_floor_'+(r+1)).append(html);753 }754 $('#smeta_bathroom_floors_alignment').attr("id", "smeta_bathroom_floors_alignment_"+(r+1)).empty();755 if (floors_alignment){756 s1 = Math.round(bathroom_square[r]*wprice_room_floors_alignment);757 s2 = Math.round(((bathroom_square[r]*8)/20)*price_floor_alignment);758 TotalSum+=(s1+s2);759 Price_work+=s1; 760 Price_mat+=s2;761 html = '<td class="text-left">Финишное выравнивание ровнителем до 5 мм/Vetonit 3000</td><td>м2</td><td>'+bathroom_square[r]+'</td><td>'+wprice_room_floors_alignment+'</td><td>'+s1+'</td><td>'+price_floor_alignment+'</td><td>'+s2+'</td>';762 $('#smeta_bathroom_floors_alignment_'+(r+1)).append(html);763 }764 s1 = Math.round((bathroom_square[r]*wprice_bathroom_flooring[1][bathroom_flooring[r]]));765 s2 = (bathroom_flooring[r]==0)?Math.round(bathroom_square[r]/3*price_bathroom_wall_covering):'';766 TotalSum = (s2=='')?TotalSum+s1:TotalSum+s1+s2;767 Price_work+=s1; 768 Price_mat = (s2=='')?Price_mat:Price_mat+s2;769 mat = (s2=='')?'':price_bathroom_wall_covering;770 $('#smeta_bathroom_flooring').attr("id", "smeta_bathroom_flooring_"+(r+1)).empty();771 html = '<td class="text-left">'+wprice_bathroom_flooring[0][bathroom_flooring[r]]+'</td><td>м2</td><td>'+bathroom_square[r]+'</td><td>'+wprice_bathroom_flooring[1][bathroom_flooring[r]]+'</td><td>'+s1+'</td><td>'+mat+'</td><td>'+s2+'</td>';772 $('#smeta_bathroom_flooring_'+(r+1)).append(html);773 $('#smeta_bathroom_floor_grouting').attr("id", "smeta_bathroom_floor_grouting_"+(r+1)).empty();774 if (bathroom_flooring[r]==0){775 s1 = Math.round(bathroom_square[r]*wprice_bathroom_grouting);776 TotalSum+=s1;777 Price_work+=s1; 778 html = '<td class="text-left">Затирка швов</td><td>м2</td><td>'+bathroom_square[r]+'</td><td>'+wprice_bathroom_grouting+'</td><td>'+s1+'</td><td></td><td></td>';779 $('#smeta_bathroom_floor_grouting_'+(r+1)).append(html);780 }781 // потолки782 s1 = Math.round(bathroom_square[r]*wprice_bathroom_roof[1][bathroom_roof_type[r]]);783 s2 = Math.round(bathroom_square[r]*price_bathroom_roof[bathroom_roof_type[r]]);784 TotalSum+=(s1+s2);785 Price_work+=s1; 786 Price_mat+=s2;787 $('#smeta_bathroom_roof').attr("id", "smeta_bathroom_roof_"+(r+1)).empty();788 html = '<td class="text-left">'+wprice_bathroom_roof[0][bathroom_roof_type[r]]+'</td><td>м2</td><td>'+bathroom_square[r]+'</td><td>'+wprice_bathroom_roof[1][bathroom_roof_type[r]]+'</td><td>'+s1+'</td><td>'+price_bathroom_roof[bathroom_roof_type[r]]+'</td><td>'+s2+'</td>';789 $('#smeta_bathroom_roof_'+(r+1)).append(html);790 // водопровод и канализация791 s1 = Math.round(bathroom_num_points[r]*wprice_bathroom_water_system[1][bathroom_water_system[r]]);792 TotalSum+=s1;793 Price_work+=s1; 794 $('#smeta_bathroom_water_system').attr("id", "smeta_bathroom_water_system_"+(r+1)).empty();795 html = '<td class="text-left">'+wprice_bathroom_water_system[0][bathroom_water_system[r]]+'</td><td>точка</td><td>'+bathroom_num_points[r]+'</td><td>'+wprice_bathroom_water_system[1][bathroom_water_system[r]]+'</td><td>'+s1+'</td><td></td><td></td>';796 $('#smeta_bathroom_water_system_'+(r+1)).append(html);797 $('#smeta_bathroom_towel_dryer').attr("id", "smeta_bathroom_towel_dryer_"+(r+1)).empty();798 if (bathroom_towel_dryer[r]){799 TotalSum+=wprice_bathroom_towel_dryer;800 Price_work+=wprice_bathroom_towel_dryer; 801 html = '<td class="text-left">Монтаж водяного полотенцесушителя</td><td>шт.</td><td>1</td><td>'+wprice_bathroom_towel_dryer+'</td><td>'+wprice_bathroom_towel_dryer+'</td><td></td><td></td>';802 $('#smeta_bathroom_towel_dryer_'+(r+1)).append(html);803 }804 $('#smeta_toilet').attr("id", "smeta_toilet_"+(r+1)).empty();805 if (toilet_type[r]>=0){806 s1 = wprice_toilet[1][toilet_type[r]];807 TotalSum+=s1;808 Price_work+=s1; 809 html = '<td class="text-left">'+wprice_toilet[0][toilet_type[r]]+'</td><td>шт</td><td>1</td><td>'+s1+'</td><td>'+s1+'</td><td></td><td></td>';810 $('#smeta_toilet_'+(r+1)).append(html);811 }812 $('#smeta_bathroom_bath').attr("id", "smeta_bathroom_bath_"+(r+1)).empty();813 if (bath_type[r]>=0){814 html = '<td class="text-left">'+wprice_bath[0][bath_type[r]]+'</td><td>шт</td><td>1</td><td>'+wprice_bath[1][bath_type[r]]+'</td><td>'+wprice_bath[1][bath_type[r]]+'</td><td></td><td></td>';815 $('#smeta_bathroom_bath_'+(r+1)).append(html);816 }817 TotalSum+=price_bathroom_mat;818 Price_mat+=price_bathroom_mat;819 $('#smeta_bathroom_mat').attr("id", "smeta_bathroom_mat_"+(r+1)).empty();820 html = '<td class="text-left">Материалы</td><td>шт</td><td>1</td><td></td><td></td><td></td><td>'+price_bathroom_mat+'</td>';821 $('#smeta_bathroom_mat_'+(r+1)).append(html);822 }823 // Электромонтаж824 if (electrics)825 {826 $('#smeta_electrics_work').show();827 $('#smeta_electrics_type').empty();828 s1 = Math.round(total_square*wprice_electrics[1][electrics_work]);829 s2 = Math.round(total_square*price_electrics[electrics_work]);830 TotalSum+=(s1+s2);831 Price_work+=s1; 832 Price_mat+=s2;833 html = '<td class="text-left" style="width: 40%;">'+wprice_electrics[0][electrics_work]+'</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+total_square+'</td><td style="width: 10%;">'+wprice_electrics[1][electrics_work]+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;">'+price_electrics[electrics_work]+'</td><td style="width: 10%;">'+s2+'</td>';834 $('#smeta_electrics_type').append(html);835 }836 else $('#smeta_electrics_work').hide();837 // Дополнительные работы838 $('#smeta_balcony').empty();839 if (balcony)840 {841 s1 = Math.round(balcony_square*wprice_balcony);842 TotalSum+=s1;843 Price_work+=s1; 844 html = '<td class="text-left" style="width: 40%;">Отделка балкона под ключ</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+balcony_square+'</td><td style="width: 10%;">'+wprice_balcony+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;"></td><td style="width: 10%;"></td>';845 $('#smeta_balcony').append(html);846 }847 $('#smeta_door_installation').empty();848 if (door_installation)849 {850 s1 = Math.round(num_doors*wprice_door_installation);851 TotalSum+=s1;852 Price_work+=s1; 853 html = '<td class="text-left" style="width: 40%;">Установка межкомнатной двери</td><td style="width: 10%;">шт.</td><td style="width: 10%;">'+num_doors+'</td><td style="width: 10%;">'+wprice_door_installation+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;"></td><td style="width: 10%;"></td>';854 $('#smeta_door_installation').append(html);855 }856 $('#smeta_cleaning').empty();857 s1 = Math.round(total_square*wprice_cleaning);858 TotalSum+=s1;859 Price_work+=s1; 860 html = '<td class="text-left" style="width: 40%;">Уборка помещений, вынос строительного мусора (за весь рабочий процесс)</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+total_square+'</td><td style="width: 10%;">'+wprice_cleaning+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;"></td><td style="width: 10%;"></td>';861 $('#smeta_cleaning').append(html);862 $('#smeta_demontazh').empty();863 if ($('#capremont').is(':checked'))864 {865 s1 = Math.round(total_square*wprice_demontazh);866 TotalSum+=s1;867 Price_work+=s1; 868 html = '<td class="text-left" style="width: 40%;">Демонтажные работы</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+total_square+'</td><td style="width: 10%;">'+wprice_demontazh+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;"></td><td style="width: 10%;"></td>';869 $('#smeta_demontazh').append(html);870 }871 $('#smeta_design').empty();872 if (design)873 {874 s1 = Math.round(total_square*wprice_design[design_type]);875 TotalSum+=s1;876 Price_work+=s1; 877 html = '<td class="text-left" style="width: 40%;">Услуги дизайнера</td><td style="width: 10%;">м2</td><td style="width: 10%;">'+total_square+'</td><td style="width: 10%;">'+wprice_design[design_type]+'</td><td style="width: 10%;">'+s1+'</td><td style="width: 10%;"></td><td style="width: 10%;"></td>';878 $('#smeta_design').append(html);879 }880 home_type = $('#home_type option:selected').val();881 Price_work = Math.round(Price_work * home_type);882 883 $('#res_tbl').slideDown();884 $('#res_square').text(total_square);885 $('#res_price_pm').text(Math.round(Price_work / total_square));886 $('#res_price_work').text(Price_work);887 $('#res_price_mat').text(Price_mat);888 889}890891892893894895896897898899900901902903904905906907 ...

Full Screen

Full Screen

sha1.js

Source:sha1.js Github

copy

Full Screen

1(function () {2 /*global CryptoJS:true */34 'use strict';56 // Shortcuts7 var C = CryptoJS;8 var C_LIB = C.lib;9 var WordArray = C_LIB.WordArray;10 var Hasher = C_LIB.Hasher;1112 // Constants13 var ROUND_CONSTANT_0 = 0x5a827999;14 var ROUND_CONSTANT_1 = 0x6ed9eba1;15 var ROUND_CONSTANT_2 = 0x8f1bbcdc;16 var ROUND_CONSTANT_3 = 0xca62c1d6;1718 /**19 * SHA-1 hash algorithm.20 */21 var SHA1 = C.SHA1 = Hasher.extend({22 _doInit: function () {23 },2425 _doReset: function () {26 this._state = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];27 },2829 _doProcessBlock: function (m) {30 // Shortcuts31 var s = this._state;32 var s0 = s[0];33 var s1 = s[1];34 var s2 = s[2];35 var s3 = s[3];36 var s4 = s[4];37 var _s0 = s0;38 var _s1 = s1;39 var _s2 = s2;40 var _s3 = s3;41 var _s4 = s4;4243 // Expand message44 var m0 = m[0] | 0;45 var m1 = m[1] | 0;46 var m2 = m[2] | 0;47 var m3 = m[3] | 0;48 var m4 = m[4] | 0;49 var m5 = m[5] | 0;50 var m6 = m[6] | 0;51 var m7 = m[7] | 0;52 var m8 = m[8] | 0;53 var m9 = m[9] | 0;54 var m10 = m[10] | 0;55 var m11 = m[11] | 0;56 var m12 = m[12] | 0;57 var m13 = m[13] | 0;58 var m14 = m[14] | 0;59 var m15 = m[15] | 0;60 var m16 = m13 ^ m8 ^ m2 ^ m0;61 m16 = (m16 << 1) | (m16 >>> 31);62 var m17 = m14 ^ m9 ^ m3 ^ m1;63 m17 = (m17 << 1) | (m17 >>> 31);64 var m18 = m15 ^ m10 ^ m4 ^ m2;65 m18 = (m18 << 1) | (m18 >>> 31);66 var m19 = m16 ^ m11 ^ m5 ^ m3;67 m19 = (m19 << 1) | (m19 >>> 31);68 var m20 = m17 ^ m12 ^ m6 ^ m4;69 m20 = (m20 << 1) | (m20 >>> 31);70 var m21 = m18 ^ m13 ^ m7 ^ m5;71 m21 = (m21 << 1) | (m21 >>> 31);72 var m22 = m19 ^ m14 ^ m8 ^ m6;73 m22 = (m22 << 1) | (m22 >>> 31);74 var m23 = m20 ^ m15 ^ m9 ^ m7;75 m23 = (m23 << 1) | (m23 >>> 31);76 var m24 = m21 ^ m16 ^ m10 ^ m8;77 m24 = (m24 << 1) | (m24 >>> 31);78 var m25 = m22 ^ m17 ^ m11 ^ m9;79 m25 = (m25 << 1) | (m25 >>> 31);80 var m26 = m23 ^ m18 ^ m12 ^ m10;81 m26 = (m26 << 1) | (m26 >>> 31);82 var m27 = m24 ^ m19 ^ m13 ^ m11;83 m27 = (m27 << 1) | (m27 >>> 31);84 var m28 = m25 ^ m20 ^ m14 ^ m12;85 m28 = (m28 << 1) | (m28 >>> 31);86 var m29 = m26 ^ m21 ^ m15 ^ m13;87 m29 = (m29 << 1) | (m29 >>> 31);88 var m30 = m27 ^ m22 ^ m16 ^ m14;89 m30 = (m30 << 1) | (m30 >>> 31);90 var m31 = m28 ^ m23 ^ m17 ^ m15;91 m31 = (m31 << 1) | (m31 >>> 31);92 var m32 = m29 ^ m24 ^ m18 ^ m16;93 m32 = (m32 << 1) | (m32 >>> 31);94 var m33 = m30 ^ m25 ^ m19 ^ m17;95 m33 = (m33 << 1) | (m33 >>> 31);96 var m34 = m31 ^ m26 ^ m20 ^ m18;97 m34 = (m34 << 1) | (m34 >>> 31);98 var m35 = m32 ^ m27 ^ m21 ^ m19;99 m35 = (m35 << 1) | (m35 >>> 31);100 var m36 = m33 ^ m28 ^ m22 ^ m20;101 m36 = (m36 << 1) | (m36 >>> 31);102 var m37 = m34 ^ m29 ^ m23 ^ m21;103 m37 = (m37 << 1) | (m37 >>> 31);104 var m38 = m35 ^ m30 ^ m24 ^ m22;105 m38 = (m38 << 1) | (m38 >>> 31);106 var m39 = m36 ^ m31 ^ m25 ^ m23;107 m39 = (m39 << 1) | (m39 >>> 31);108 var m40 = m37 ^ m32 ^ m26 ^ m24;109 m40 = (m40 << 1) | (m40 >>> 31);110 var m41 = m38 ^ m33 ^ m27 ^ m25;111 m41 = (m41 << 1) | (m41 >>> 31);112 var m42 = m39 ^ m34 ^ m28 ^ m26;113 m42 = (m42 << 1) | (m42 >>> 31);114 var m43 = m40 ^ m35 ^ m29 ^ m27;115 m43 = (m43 << 1) | (m43 >>> 31);116 var m44 = m41 ^ m36 ^ m30 ^ m28;117 m44 = (m44 << 1) | (m44 >>> 31);118 var m45 = m42 ^ m37 ^ m31 ^ m29;119 m45 = (m45 << 1) | (m45 >>> 31);120 var m46 = m43 ^ m38 ^ m32 ^ m30;121 m46 = (m46 << 1) | (m46 >>> 31);122 var m47 = m44 ^ m39 ^ m33 ^ m31;123 m47 = (m47 << 1) | (m47 >>> 31);124 var m48 = m45 ^ m40 ^ m34 ^ m32;125 m48 = (m48 << 1) | (m48 >>> 31);126 var m49 = m46 ^ m41 ^ m35 ^ m33;127 m49 = (m49 << 1) | (m49 >>> 31);128 var m50 = m47 ^ m42 ^ m36 ^ m34;129 m50 = (m50 << 1) | (m50 >>> 31);130 var m51 = m48 ^ m43 ^ m37 ^ m35;131 m51 = (m51 << 1) | (m51 >>> 31);132 var m52 = m49 ^ m44 ^ m38 ^ m36;133 m52 = (m52 << 1) | (m52 >>> 31);134 var m53 = m50 ^ m45 ^ m39 ^ m37;135 m53 = (m53 << 1) | (m53 >>> 31);136 var m54 = m51 ^ m46 ^ m40 ^ m38;137 m54 = (m54 << 1) | (m54 >>> 31);138 var m55 = m52 ^ m47 ^ m41 ^ m39;139 m55 = (m55 << 1) | (m55 >>> 31);140 var m56 = m53 ^ m48 ^ m42 ^ m40;141 m56 = (m56 << 1) | (m56 >>> 31);142 var m57 = m54 ^ m49 ^ m43 ^ m41;143 m57 = (m57 << 1) | (m57 >>> 31);144 var m58 = m55 ^ m50 ^ m44 ^ m42;145 m58 = (m58 << 1) | (m58 >>> 31);146 var m59 = m56 ^ m51 ^ m45 ^ m43;147 m59 = (m59 << 1) | (m59 >>> 31);148 var m60 = m57 ^ m52 ^ m46 ^ m44;149 m60 = (m60 << 1) | (m60 >>> 31);150 var m61 = m58 ^ m53 ^ m47 ^ m45;151 m61 = (m61 << 1) | (m61 >>> 31);152 var m62 = m59 ^ m54 ^ m48 ^ m46;153 m62 = (m62 << 1) | (m62 >>> 31);154 var m63 = m60 ^ m55 ^ m49 ^ m47;155 m63 = (m63 << 1) | (m63 >>> 31);156 var m64 = m61 ^ m56 ^ m50 ^ m48;157 m64 = (m64 << 1) | (m64 >>> 31);158 var m65 = m62 ^ m57 ^ m51 ^ m49;159 m65 = (m65 << 1) | (m65 >>> 31);160 var m66 = m63 ^ m58 ^ m52 ^ m50;161 m66 = (m66 << 1) | (m66 >>> 31);162 var m67 = m64 ^ m59 ^ m53 ^ m51;163 m67 = (m67 << 1) | (m67 >>> 31);164 var m68 = m65 ^ m60 ^ m54 ^ m52;165 m68 = (m68 << 1) | (m68 >>> 31);166 var m69 = m66 ^ m61 ^ m55 ^ m53;167 m69 = (m69 << 1) | (m69 >>> 31);168 var m70 = m67 ^ m62 ^ m56 ^ m54;169 m70 = (m70 << 1) | (m70 >>> 31);170 var m71 = m68 ^ m63 ^ m57 ^ m55;171 m71 = (m71 << 1) | (m71 >>> 31);172 var m72 = m69 ^ m64 ^ m58 ^ m56;173 m72 = (m72 << 1) | (m72 >>> 31);174 var m73 = m70 ^ m65 ^ m59 ^ m57;175 m73 = (m73 << 1) | (m73 >>> 31);176 var m74 = m71 ^ m66 ^ m60 ^ m58;177 m74 = (m74 << 1) | (m74 >>> 31);178 var m75 = m72 ^ m67 ^ m61 ^ m59;179 m75 = (m75 << 1) | (m75 >>> 31);180 var m76 = m73 ^ m68 ^ m62 ^ m60;181 m76 = (m76 << 1) | (m76 >>> 31);182 var m77 = m74 ^ m69 ^ m63 ^ m61;183 m77 = (m77 << 1) | (m77 >>> 31);184 var m78 = m75 ^ m70 ^ m64 ^ m62;185 m78 = (m78 << 1) | (m78 >>> 31);186 var m79 = m76 ^ m71 ^ m65 ^ m63;187 m79 = (m79 << 1) | (m79 >>> 31);188189 // Inline round 1190 var f = (s1 & s2) | (~s1 & s3);191 s1 = (s1 << 30) | (s1 >>> 2);192 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m0 + ROUND_CONSTANT_0;193194 // Inline round 2195 var f = (s0 & s1) | (~s0 & s2);196 s0 = (s0 << 30) | (s0 >>> 2);197 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m1 + ROUND_CONSTANT_0;198199 // Inline round 3200 var f = (s4 & s0) | (~s4 & s1);201 s4 = (s4 << 30) | (s4 >>> 2);202 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m2 + ROUND_CONSTANT_0;203204 // Inline round 4205 var f = (s3 & s4) | (~s3 & s0);206 s3 = (s3 << 30) | (s3 >>> 2);207 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m3 + ROUND_CONSTANT_0;208209 // Inline round 5210 var f = (s2 & s3) | (~s2 & s4);211 s2 = (s2 << 30) | (s2 >>> 2);212 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m4 + ROUND_CONSTANT_0;213214 // Inline round 6215 var f = (s1 & s2) | (~s1 & s3);216 s1 = (s1 << 30) | (s1 >>> 2);217 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m5 + ROUND_CONSTANT_0;218219 // Inline round 7220 var f = (s0 & s1) | (~s0 & s2);221 s0 = (s0 << 30) | (s0 >>> 2);222 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m6 + ROUND_CONSTANT_0;223224 // Inline round 8225 var f = (s4 & s0) | (~s4 & s1);226 s4 = (s4 << 30) | (s4 >>> 2);227 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m7 + ROUND_CONSTANT_0;228229 // Inline round 9230 var f = (s3 & s4) | (~s3 & s0);231 s3 = (s3 << 30) | (s3 >>> 2);232 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m8 + ROUND_CONSTANT_0;233234 // Inline round 10235 var f = (s2 & s3) | (~s2 & s4);236 s2 = (s2 << 30) | (s2 >>> 2);237 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m9 + ROUND_CONSTANT_0;238239 // Inline round 11240 var f = (s1 & s2) | (~s1 & s3);241 s1 = (s1 << 30) | (s1 >>> 2);242 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m10 + ROUND_CONSTANT_0;243244 // Inline round 12245 var f = (s0 & s1) | (~s0 & s2);246 s0 = (s0 << 30) | (s0 >>> 2);247 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m11 + ROUND_CONSTANT_0;248249 // Inline round 13250 var f = (s4 & s0) | (~s4 & s1);251 s4 = (s4 << 30) | (s4 >>> 2);252 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m12 + ROUND_CONSTANT_0;253254 // Inline round 14255 var f = (s3 & s4) | (~s3 & s0);256 s3 = (s3 << 30) | (s3 >>> 2);257 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m13 + ROUND_CONSTANT_0;258259 // Inline round 15260 var f = (s2 & s3) | (~s2 & s4);261 s2 = (s2 << 30) | (s2 >>> 2);262 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m14 + ROUND_CONSTANT_0;263264 // Inline round 16265 var f = (s1 & s2) | (~s1 & s3);266 s1 = (s1 << 30) | (s1 >>> 2);267 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m15 + ROUND_CONSTANT_0;268269 // Inline round 17270 var f = (s0 & s1) | (~s0 & s2);271 s0 = (s0 << 30) | (s0 >>> 2);272 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m16 + ROUND_CONSTANT_0;273274 // Inline round 18275 var f = (s4 & s0) | (~s4 & s1);276 s4 = (s4 << 30) | (s4 >>> 2);277 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m17 + ROUND_CONSTANT_0;278279 // Inline round 19280 var f = (s3 & s4) | (~s3 & s0);281 s3 = (s3 << 30) | (s3 >>> 2);282 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m18 + ROUND_CONSTANT_0;283284 // Inline round 20285 var f = (s2 & s3) | (~s2 & s4);286 s2 = (s2 << 30) | (s2 >>> 2);287 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m19 + ROUND_CONSTANT_0;288289 // Inline round 21290 var f = s1 ^ s2 ^ s3;291 s1 = (s1 << 30) | (s1 >>> 2);292 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m20 + ROUND_CONSTANT_1;293294 // Inline round 22295 var f = s0 ^ s1 ^ s2;296 s0 = (s0 << 30) | (s0 >>> 2);297 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m21 + ROUND_CONSTANT_1;298299 // Inline round 23300 var f = s4 ^ s0 ^ s1;301 s4 = (s4 << 30) | (s4 >>> 2);302 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m22 + ROUND_CONSTANT_1;303304 // Inline round 24305 var f = s3 ^ s4 ^ s0;306 s3 = (s3 << 30) | (s3 >>> 2);307 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m23 + ROUND_CONSTANT_1;308309 // Inline round 25310 var f = s2 ^ s3 ^ s4;311 s2 = (s2 << 30) | (s2 >>> 2);312 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m24 + ROUND_CONSTANT_1;313314 // Inline round 26315 var f = s1 ^ s2 ^ s3;316 s1 = (s1 << 30) | (s1 >>> 2);317 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m25 + ROUND_CONSTANT_1;318319 // Inline round 27320 var f = s0 ^ s1 ^ s2;321 s0 = (s0 << 30) | (s0 >>> 2);322 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m26 + ROUND_CONSTANT_1;323324 // Inline round 28325 var f = s4 ^ s0 ^ s1;326 s4 = (s4 << 30) | (s4 >>> 2);327 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m27 + ROUND_CONSTANT_1;328329 // Inline round 29330 var f = s3 ^ s4 ^ s0;331 s3 = (s3 << 30) | (s3 >>> 2);332 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m28 + ROUND_CONSTANT_1;333334 // Inline round 30335 var f = s2 ^ s3 ^ s4;336 s2 = (s2 << 30) | (s2 >>> 2);337 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m29 + ROUND_CONSTANT_1;338339 // Inline round 31340 var f = s1 ^ s2 ^ s3;341 s1 = (s1 << 30) | (s1 >>> 2);342 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m30 + ROUND_CONSTANT_1;343344 // Inline round 32345 var f = s0 ^ s1 ^ s2;346 s0 = (s0 << 30) | (s0 >>> 2);347 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m31 + ROUND_CONSTANT_1;348349 // Inline round 33350 var f = s4 ^ s0 ^ s1;351 s4 = (s4 << 30) | (s4 >>> 2);352 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m32 + ROUND_CONSTANT_1;353354 // Inline round 34355 var f = s3 ^ s4 ^ s0;356 s3 = (s3 << 30) | (s3 >>> 2);357 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m33 + ROUND_CONSTANT_1;358359 // Inline round 35360 var f = s2 ^ s3 ^ s4;361 s2 = (s2 << 30) | (s2 >>> 2);362 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m34 + ROUND_CONSTANT_1;363364 // Inline round 36365 var f = s1 ^ s2 ^ s3;366 s1 = (s1 << 30) | (s1 >>> 2);367 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m35 + ROUND_CONSTANT_1;368369 // Inline round 37370 var f = s0 ^ s1 ^ s2;371 s0 = (s0 << 30) | (s0 >>> 2);372 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m36 + ROUND_CONSTANT_1;373374 // Inline round 38375 var f = s4 ^ s0 ^ s1;376 s4 = (s4 << 30) | (s4 >>> 2);377 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m37 + ROUND_CONSTANT_1;378379 // Inline round 39380 var f = s3 ^ s4 ^ s0;381 s3 = (s3 << 30) | (s3 >>> 2);382 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m38 + ROUND_CONSTANT_1;383384 // Inline round 40385 var f = s2 ^ s3 ^ s4;386 s2 = (s2 << 30) | (s2 >>> 2);387 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m39 + ROUND_CONSTANT_1;388389 // Inline round 41390 var f = (s1 & s2) | (s1 & s3) | (s2 & s3);391 s1 = (s1 << 30) | (s1 >>> 2);392 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m40 + ROUND_CONSTANT_2;393394 // Inline round 42395 var f = (s0 & s1) | (s0 & s2) | (s1 & s2);396 s0 = (s0 << 30) | (s0 >>> 2);397 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m41 + ROUND_CONSTANT_2;398399 // Inline round 43400 var f = (s4 & s0) | (s4 & s1) | (s0 & s1);401 s4 = (s4 << 30) | (s4 >>> 2);402 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m42 + ROUND_CONSTANT_2;403404 // Inline round 44405 var f = (s3 & s4) | (s3 & s0) | (s4 & s0);406 s3 = (s3 << 30) | (s3 >>> 2);407 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m43 + ROUND_CONSTANT_2;408409 // Inline round 45410 var f = (s2 & s3) | (s2 & s4) | (s3 & s4);411 s2 = (s2 << 30) | (s2 >>> 2);412 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m44 + ROUND_CONSTANT_2;413414 // Inline round 46415 var f = (s1 & s2) | (s1 & s3) | (s2 & s3);416 s1 = (s1 << 30) | (s1 >>> 2);417 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m45 + ROUND_CONSTANT_2;418419 // Inline round 47420 var f = (s0 & s1) | (s0 & s2) | (s1 & s2);421 s0 = (s0 << 30) | (s0 >>> 2);422 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m46 + ROUND_CONSTANT_2;423424 // Inline round 48425 var f = (s4 & s0) | (s4 & s1) | (s0 & s1);426 s4 = (s4 << 30) | (s4 >>> 2);427 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m47 + ROUND_CONSTANT_2;428429 // Inline round 49430 var f = (s3 & s4) | (s3 & s0) | (s4 & s0);431 s3 = (s3 << 30) | (s3 >>> 2);432 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m48 + ROUND_CONSTANT_2;433434 // Inline round 50435 var f = (s2 & s3) | (s2 & s4) | (s3 & s4);436 s2 = (s2 << 30) | (s2 >>> 2);437 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m49 + ROUND_CONSTANT_2;438439 // Inline round 51440 var f = (s1 & s2) | (s1 & s3) | (s2 & s3);441 s1 = (s1 << 30) | (s1 >>> 2);442 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m50 + ROUND_CONSTANT_2;443444 // Inline round 52445 var f = (s0 & s1) | (s0 & s2) | (s1 & s2);446 s0 = (s0 << 30) | (s0 >>> 2);447 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m51 + ROUND_CONSTANT_2;448449 // Inline round 53450 var f = (s4 & s0) | (s4 & s1) | (s0 & s1);451 s4 = (s4 << 30) | (s4 >>> 2);452 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m52 + ROUND_CONSTANT_2;453454 // Inline round 54455 var f = (s3 & s4) | (s3 & s0) | (s4 & s0);456 s3 = (s3 << 30) | (s3 >>> 2);457 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m53 + ROUND_CONSTANT_2;458459 // Inline round 55460 var f = (s2 & s3) | (s2 & s4) | (s3 & s4);461 s2 = (s2 << 30) | (s2 >>> 2);462 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m54 + ROUND_CONSTANT_2;463464 // Inline round 56465 var f = (s1 & s2) | (s1 & s3) | (s2 & s3);466 s1 = (s1 << 30) | (s1 >>> 2);467 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m55 + ROUND_CONSTANT_2;468469 // Inline round 57470 var f = (s0 & s1) | (s0 & s2) | (s1 & s2);471 s0 = (s0 << 30) | (s0 >>> 2);472 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m56 + ROUND_CONSTANT_2;473474 // Inline round 58475 var f = (s4 & s0) | (s4 & s1) | (s0 & s1);476 s4 = (s4 << 30) | (s4 >>> 2);477 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m57 + ROUND_CONSTANT_2;478479 // Inline round 59480 var f = (s3 & s4) | (s3 & s0) | (s4 & s0);481 s3 = (s3 << 30) | (s3 >>> 2);482 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m58 + ROUND_CONSTANT_2;483484 // Inline round 60485 var f = (s2 & s3) | (s2 & s4) | (s3 & s4);486 s2 = (s2 << 30) | (s2 >>> 2);487 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m59 + ROUND_CONSTANT_2;488489 // Inline round 61490 var f = s1 ^ s2 ^ s3;491 s1 = (s1 << 30) | (s1 >>> 2);492 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m60 + ROUND_CONSTANT_3;493494 // Inline round 62495 var f = s0 ^ s1 ^ s2;496 s0 = (s0 << 30) | (s0 >>> 2);497 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m61 + ROUND_CONSTANT_3;498499 // Inline round 63500 var f = s4 ^ s0 ^ s1;501 s4 = (s4 << 30) | (s4 >>> 2);502 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m62 + ROUND_CONSTANT_3;503504 // Inline round 64505 var f = s3 ^ s4 ^ s0;506 s3 = (s3 << 30) | (s3 >>> 2);507 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m63 + ROUND_CONSTANT_3;508509 // Inline round 65510 var f = s2 ^ s3 ^ s4;511 s2 = (s2 << 30) | (s2 >>> 2);512 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m64 + ROUND_CONSTANT_3;513514 // Inline round 66515 var f = s1 ^ s2 ^ s3;516 s1 = (s1 << 30) | (s1 >>> 2);517 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m65 + ROUND_CONSTANT_3;518519 // Inline round 67520 var f = s0 ^ s1 ^ s2;521 s0 = (s0 << 30) | (s0 >>> 2);522 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m66 + ROUND_CONSTANT_3;523524 // Inline round 68525 var f = s4 ^ s0 ^ s1;526 s4 = (s4 << 30) | (s4 >>> 2);527 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m67 + ROUND_CONSTANT_3;528529 // Inline round 69530 var f = s3 ^ s4 ^ s0;531 s3 = (s3 << 30) | (s3 >>> 2);532 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m68 + ROUND_CONSTANT_3;533534 // Inline round 70535 var f = s2 ^ s3 ^ s4;536 s2 = (s2 << 30) | (s2 >>> 2);537 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m69 + ROUND_CONSTANT_3;538539 // Inline round 71540 var f = s1 ^ s2 ^ s3;541 s1 = (s1 << 30) | (s1 >>> 2);542 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m70 + ROUND_CONSTANT_3;543544 // Inline round 72545 var f = s0 ^ s1 ^ s2;546 s0 = (s0 << 30) | (s0 >>> 2);547 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m71 + ROUND_CONSTANT_3;548549 // Inline round 73550 var f = s4 ^ s0 ^ s1;551 s4 = (s4 << 30) | (s4 >>> 2);552 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m72 + ROUND_CONSTANT_3;553554 // Inline round 74555 var f = s3 ^ s4 ^ s0;556 s3 = (s3 << 30) | (s3 >>> 2);557 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m73 + ROUND_CONSTANT_3;558559 // Inline round 75560 var f = s2 ^ s3 ^ s4;561 s2 = (s2 << 30) | (s2 >>> 2);562 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m74 + ROUND_CONSTANT_3;563564 // Inline round 76565 var f = s1 ^ s2 ^ s3;566 s1 = (s1 << 30) | (s1 >>> 2);567 s4 = f + s4 + ((s0 << 5) | (s0 >>> 27)) + m75 + ROUND_CONSTANT_3;568569 // Inline round 77570 var f = s0 ^ s1 ^ s2;571 s0 = (s0 << 30) | (s0 >>> 2);572 s3 = f + s3 + ((s4 << 5) | (s4 >>> 27)) + m76 + ROUND_CONSTANT_3;573574 // Inline round 78575 var f = s4 ^ s0 ^ s1;576 s4 = (s4 << 30) | (s4 >>> 2);577 s2 = f + s2 + ((s3 << 5) | (s3 >>> 27)) + m77 + ROUND_CONSTANT_3;578579 // Inline round 79580 var f = s3 ^ s4 ^ s0;581 s3 = (s3 << 30) | (s3 >>> 2);582 s1 = f + s1 + ((s2 << 5) | (s2 >>> 27)) + m78 + ROUND_CONSTANT_3;583584 // Inline round 80585 var f = s2 ^ s3 ^ s4;586 s2 = (s2 << 30) | (s2 >>> 2);587 s0 = f + s0 + ((s1 << 5) | (s1 >>> 27)) + m79 + ROUND_CONSTANT_3;588589 // Update state590 s[0] = (_s0 + s0) | 0;591 s[1] = (_s1 + s1) | 0;592 s[2] = (_s2 + s2) | 0;593 s[3] = (_s3 + s3) | 0;594 s[4] = (_s4 + s4) | 0;595 },596597 _doFinalize: function () {598 // Shortcuts599 var data = this._data;600 var dataWords = data.words;601 var nBitsLeft = data.sigBytes * 8;602 var nBitsTotalLsw = this._nDataBitsLsw;603 var nBitsTotalMsw = this._nDataBitsMsw;604605 // Add padding606 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);607608 var lengthStartIndex = (((nBitsLeft + 64) >>> 9) << 4) + 14;609 dataWords[lengthStartIndex] = nBitsTotalMsw;610 dataWords[lengthStartIndex + 1] = nBitsTotalLsw;611612 data.sigBytes = dataWords.length * 4;613614 // Hash final blocks615 this._process();616617 // Return final hash618 return new WordArray(this._state);619 },620621 clone: function () {622 var clone = SHA1.$super.prototype.clone.call(this);623 clone._state = clone._state.slice(0);624625 return clone;626 }627 }); ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { s1 } from 'ng-mocks';2import { s2 } from 'ng-mocks';3import { s3 } from 'ng-mocks';4import { s4 } from 'ng-mocks';5import { s5 } from 'ng-mocks';6import { s6 } from 'ng-mocks';7import { s7 } from 'ng-mocks';8import { s8 } from 'ng-mocks';9import { s9 } from 'ng-mocks';10import { s10 } from 'ng-mocks';11import { s11 } from 'ng-mocks';12import { s12 } from 'ng-mocks';13import { s13 } from 'ng-mocks';14import { s14 } from 'ng-mocks';15import { s15 } from 'ng-mocks';16import { s16 } from 'ng-mocks';17import { s17 } from 'ng-mocks';18import { s18 } from 'ng-mocks';19import { s19 } from 'ng-mocks';20import { s20 } from 'ng-mocks';21import { s21 } from 'ng-mocks';22import { s22 } from 'ng-mocks';

Full Screen

Using AI Code Generation

copy

Full Screen

1var s1 = require('ng-mocks').s1;2var s2 = require('ng-mocks').s2;3var s3 = require('ng-mocks').s3;4var s4 = require('ng-mocks').s4;5var s5 = require('ng-mocks').s5;6var s6 = require('ng-mocks').s6;7var s7 = require('ng-mocks').s7;8var s8 = require('ng-mocks').s8;9var s9 = require('ng-mocks').s9;10var s10 = require('ng-mocks').s10;11var s11 = require('ng-mocks').s11;12var s12 = require('ng-mocks').s12;13var s13 = require('ng-mocks').s13;14var s14 = require('ng-mocks').s14;15var s15 = require('ng-mocks').s15;16var s16 = require('ng-mocks').s16;17var s17 = require('ng-mocks').s17;18var s18 = require('ng-mocks').s18;19var s19 = require('ng-mocks').s19;20var s20 = require('ng-mocks').s20;

Full Screen

Using AI Code Generation

copy

Full Screen

1import { s1 } from 'ng-mocks';2import { s2 } from 'ng-mocks';3import { s1 } from 'ng-mocks/s1';4import { s2 } from 'ng-mocks/s2';5import { s1 } from 'ng-mocks';6import { s2 } from 'ng-mocks';7import { s1 } from 'ng-mocks/s1';8import { s2 } from 'ng-mocks/s2';9import { s1 } from 'ng-mocks';10import { s2 } from 'ng-mocks';11import { s1 } from 'ng-mocks/s1';12import { s2 } from 'ng-mocks/s2';13import { s1 } from 'ng-mocks';14import { s2 } from 'ng-mocks';15import { s1 } from 'ng-mocks/s1';16import { s2 } from 'ng-mocks/s2';17import { s1 } from 'ng-mocks';18import { s2 } from 'ng-mocks';19import { s1 } from 'ng-mocks/s1';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { s1 } from 'ng-mocks';2import { MyComponent } from './my.component';3describe('MyComponent', () => {4 it('should work', () => {5 const fixture = MockRender(MyComponent);6 const component = s1(MyComponent);7 expect(component).toBeDefined();8 });9});10import { Component } from '@angular/core';11@Component({12})13export class MyComponent {}14import { s1 } from 'ng-mocks';15import { MyComponent } from './my.component';16describe('MyComponent', () => {17 it('should work', () => {18 const fixture = MockRender(MyComponent);19 const component = s1(MyComponent);20 expect(component).toBeDefined();21 });22});23import { s1 } from 'ng-mocks';24import { MyComponent } from './my.component';25describe('MyComponent', () => {26 it('should work', () => {27 const fixture = MockRender(MyComponent);28 const component = s1(MyComponent);29 expect(component).toBeDefined();30 });31});32import { s1 } from 'ng-mocks';33import { MyComponent } from './my.component';34describe('MyComponent', () => {35 it('should work', () => {36 const fixture = MockRender(MyComponent);37 const component = s1(MyComponent);38 expect(component).toBeDefined();39 });40});41import { s1 } from 'ng-mocks';42import { MyComponent } from './my.component';43describe('MyComponent', () => {44 it('should work', () => {45 const fixture = MockRender(MyComponent);46 const component = s1(MyComponent);47 expect(component).toBeDefined();48 });49});50import { s1 } from 'ng-mocks';51import { MyComponent } from './my.component';52describe('MyComponent', () => {53 it('should work', () => {54 const fixture = MockRender(MyComponent);55 const component = s1(MyComponent);56 expect(component).toBeDefined();57 });58});59import { s1 } from 'ng-mocks';60import { MyComponent } from './my.component';61describe('MyComponent

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('test s1', () => {2 it('should use s1', () => {3 expect(s1()).toEqual('s1');4 });5});6describe('test s2', () => {7 it('should use s2', () => {8 expect(s2()).toEqual('s2');9 });10});11describe('test s3', () => {12 it('should use s3', () => {13 expect(s3()).toEqual('s3');14 });15});16describe('test s4', () => {17 it('should use s4', () => {18 expect(s4()).toEqual('s4');19 });20});21describe('test s5', () => {22 it('should use s5', () => {23 expect(s5()).toEqual('s5');24 });25});26describe('test s6', () => {27 it('should use s6', () => {28 expect(s6()).toEqual('s6');29 });30});31describe('test s7', () => {32 it('should use s7', () => {33 expect(s7()).toEqual('s7');34 });35});36describe('test s8', () => {37 it('should use s8', () => {38 expect(s8()).toEqual('s8');39 });40});41describe('test s9', () => {42 it('should use s9', () => {43 expect(s9()).toEqual('s9');44 });45});46describe('test s10', () => {47 it('should use s10', () => {48 expect(s10()).toEqual('s10');49 });50});

Full Screen

Using AI Code Generation

copy

Full Screen

1"jest": {2 "transform": {3 ".*\\.(vue)$": "vue-jest",4 },5 "moduleNameMapper": {6 "^@/(.*)$": "<rootDir>/src/$1",7 "^~/(.*)$": "<rootDir>/src/$1"8 },9 "node_modules/(?!vue-echarts|resize-detector)"10 },11module.exports = {12 globals: {13 'vue-jest': {14 pug: {15 },16 },17 },18};19import { s1, s2, s3 } from 'ng-mocks';

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ng-mocks automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful