diff --git a/Makefile b/Makefile index 7b9da5c..aa4dd65 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,11 @@ all: \ $(LOGICS_PY): logics.par unicc -swo $(patsubst %.py,%,$@) -l python $? + cd logics-py; pipenv install --dev; pipenv run fmt $(LOGICS_JS): logics.par unicc -swo $(patsubst %.js,%,$@) -l javascript $? + cd logics-js; npm i; npm run fmt clean: rm $(LOGICS_JS) $(LOGICS_PY) diff --git a/README.md b/README.md index 4bcd44f..e386a8f 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Previous uses of Logics included Since Logics is used on both the client and server side, the language has been implemented in two separate implementations: - [logics-js](https://www.npmjs.com/package/logics-js) is a pure (vanilla) JavaScript implementation of Logics provided as npm-package. -- [logics-py](https://pypi.org/project/logics-py/) is a pure Python 3.10 implementation of Logics provided as PyPI-package, with no other dependencies. +- [logics-py](https://pypi.org/project/logics-py/) is a pure Python 3.11 implementation of Logics provided as PyPI-package, with no other dependencies. Both packages are under recent development and not stable right now. They are maintained in separate version numbers, which is planned to be changed soon, when they become almost feature-complete. @@ -131,6 +131,15 @@ x * x ### logics-js +#### Formatting + +To format the source code, use [prettier](https://www.npmjs.com/package/prettier) as follows: + +```bash +cd logics-js +npm run fmt +``` + #### Tests Tests are implemented using [Mocha](https://mochajs.org/): @@ -151,6 +160,15 @@ npm publish ### logics-py +#### Formatting + +To format the source code, use [Black](https://github.com/psf/black) as follows: + +``` +cd logics-py +pipenv run fmt +``` + #### Tests Tests are implemented using [pytest](https://pytest.org): diff --git a/logics-js/logics.js b/logics-js/logics.js index c1762be..58ce5ab 100644 --- a/logics-js/logics.js +++ b/logics-js/logics.js @@ -9,20 +9,19 @@ function unescape(s) { if ("xuU".includes(seq[0])) { try { return String.fromCodePoint(parseInt(seq.slice(1), 16)); - } - catch (error) { + } catch (error) { return seq; } } const mapping = { - "a": "\x07", - "b": "\x08", - "f": "\x0C", - "n": "\x0A", - "r": "\x0D", - "t": "\x09", - "v": "\x0B" + a: "\x07", + b: "\x08", + f: "\x0C", + n: "\x0A", + r: "\x0D", + t: "\x09", + v: "\x0B", }; return mapping[seq] || seq; @@ -37,9 +36,7 @@ export default class Logics { static maxForIterations = 4 * 1024; /** Create a new VM with a given piece of code. */ - constructor(src, { - debug = false, - }={}) { + constructor(src, { debug = false } = {}) { this.ast = this.constructor.#parser.parse(src); this.debug = Boolean(debug); @@ -48,22 +45,34 @@ export default class Logics { } this.functions = { - "bool": (val) => val.toBool(), - "currency": (value, decimalDelimiter, thousandsDelimiter, currencySign) => "#todo", // todo - "float": (val) => val.toFloat(), - "int": (val) => val.toInt(), - "join": (array, delimiter, lastDelimiter) => { + bool: (val) => val.toBool(), + currency: (value, decimalDelimiter, thousandsDelimiter, currencySign) => "#todo", // todo + float: (val) => val.toFloat(), + int: (val) => val.toInt(), + join: (array, delimiter, lastDelimiter) => { // fixme: Missing lastDelimiter implementation? - return array.toList().join((delimiter && delimiter.toString()) || ", ") + return array.toList().join((delimiter && delimiter.toString()) || ", "); }, - "keys": (val) => Object.keys(val.toDict().valueOf()), - "len": (val) => val.__len__(), - "lfill": (str, len, fill) => str.toString().padStart(len, fill), - "lower": (str) => str.toString().toLowerCase(), - "lstrip": (str) => str.toString().trimStart(), - "max": (array) => Math.max(...array.toList().valueOf().map((i) => parseFloat(i) || 0)), - "min": (array) => Math.min(...array.toList().valueOf().map((i) => parseFloat(i) || 0)), - "range": (start, end, step) => { + keys: (val) => Object.keys(val.toDict().valueOf()), + len: (val) => val.__len__(), + lfill: (str, len, fill) => str.toString().padStart(len, fill), + lower: (str) => str.toString().toLowerCase(), + lstrip: (str) => str.toString().trimStart(), + max: (array) => + Math.max( + ...array + .toList() + .valueOf() + .map((i) => parseFloat(i) || 0), + ), + min: (array) => + Math.min( + ...array + .toList() + .valueOf() + .map((i) => parseFloat(i) || 0), + ), + range: (start, end, step) => { // Only allow for numeric parameters start = start.toInt() || 0; @@ -71,8 +80,7 @@ export default class Logics { if (end === undefined) { end = start || 0; start = 0; - } - else { + } else { end = end.toInt() || 0; } @@ -82,30 +90,35 @@ export default class Logics { } // step defaults to 1 - step = step && step.toInt() || 1; + step = (step && step.toInt()) || 1; if (step <= 0) { return []; } - return [...Array(Math.ceil((end - start) / step)).keys()].map(i => start + i * step); + return [...Array(Math.ceil((end - start) / step)).keys()].map((i) => start + i * step); }, - "replace": (str, find, replace) => { - return str.toString().replaceAll( - (find && find.toString()) || " ", (replace && replace.toString()) || ""); + replace: (str, find, replace) => { + return str + .toString() + .replaceAll((find && find.toString()) || " ", (replace && replace.toString()) || ""); }, - "rfill": (str, len, fill) => str.toString().padEnd(len, fill), - "round": (float, precision) => { + rfill: (str, len, fill) => str.toString().padEnd(len, fill), + round: (float, precision) => { return parseFloat(float.toFloat().toFixed((precision && precision.toInt()) || 0)); }, - "rstrip": (str) => str.toString().trimEnd(), - "split": (str, delimiter) => str.toString().split((delimiter && delimiter.toString()) || " "), - "str": (val) => val.toString(), - "strip": (str) => str.toString().trim(), - "sum": (array) => { - return array.toList().valueOf().map((i) => parseFloat(i) || 0).reduce((total, i) => total + i, 0); + rstrip: (str) => str.toString().trimEnd(), + split: (str, delimiter) => str.toString().split((delimiter && delimiter.toString()) || " "), + str: (val) => val.toString(), + strip: (str) => str.toString().trim(), + sum: (array) => { + return array + .toList() + .valueOf() + .map((i) => parseFloat(i) || 0) + .reduce((total, i) => total + i, 0); }, - "upper": (str) => str.toString().toUpperCase(), - "values": (val) => Object.values(val.toDict().valueOf()), + upper: (str) => str.toString().toUpperCase(), + values: (val) => Object.values(val.toDict().valueOf()), }; } @@ -115,31 +128,31 @@ export default class Logics { let stack = []; // Push a guaranteed Value - stack.op0 = function(value) { - if( !( value instanceof Value ) ){ + stack.op0 = function (value) { + if (!(value instanceof Value)) { value = new Value(value); } this.push(value); - } + }; // Perform stack operation with one operand - stack.op1 = function(fn) { + stack.op1 = function (fn) { this.op0(fn(this.pop())); - } + }; // Perform stack operation with two operands - stack.op2 = function(fn) { + stack.op2 = function (fn) { let b = this.pop(); this.op0(fn(this.pop(), b)); - } + }; // Perform stack operation with three operands - stack.op3 = function(fn) { + stack.op3 = function (fn) { let c = this.pop(); let b = this.pop(); this.op0(fn(this.pop(), b, c)); - } + }; this.traverse(this.ast, stack, Object.assign({}, values || {})); return stack.pop(); @@ -171,20 +184,20 @@ export default class Logics { } // Flow operations - if (!action(node.emit, { - "and": () => { + if ( + !action(node.emit, { + and: () => { console.assert(node.children.length === 2); this.traverse(node.children[0], stack, values); let check = stack.pop(); if (check.toBool()) { this.traverse(node.children[1], stack, values); - } - else { + } else { stack.push(check); } }, - "call": () => { + call: () => { let args = []; if (node.children.length === 2) { @@ -202,13 +215,12 @@ export default class Logics { // todo: Handle invalid parameters stack.op0(fn(...args)); - } - else { + } else { // todo: should this return a string? throw new Error(`Call to unknown function: ${node.children[0].match}`); } }, - "comprehension": () => { + comprehension: () => { console.assert(node.children.length === 3 || node.children.length === 4); // Obtain iterable @@ -246,7 +258,7 @@ export default class Logics { // push result list stack.op0(ret); }, - "if": () => { + if: () => { console.assert(node.children.length === 3); // Evaluate condition @@ -255,19 +267,18 @@ export default class Logics { // Evaluate specific branch this.traverse(node.children[stack.pop().toBool() ? 0 : 2], stack, values); }, - "or": () => { + or: () => { console.assert(node.children.length === 2); this.traverse(node.children[0], stack, values); let check = stack.pop(); if (!check.toBool()) { this.traverse(node.children[1], stack, values); - } - else { + } else { stack.push(check); } }, - "cmp": () => { + cmp: () => { for (let i = 0; i < node.children.length; i++) { this.traverse(node.children[i], stack, values); @@ -279,28 +290,28 @@ export default class Logics { let a = stack.pop(); let res = action(node.children[i].emit, { - "eq": () => a.__cmp__(b) === 0, - "gteq": () => a.__cmp__(b) >= 0, - "gt": () => a.__cmp__(b) > 0, - "lteq": () => a.__cmp__(b) <= 0, - "lt": () => a.__cmp__(b) < 0, - "neq": () => a.__cmp__(b) !== 0, - "in": () => a.__contains__(b), - "outer": () => !a.__contains__(b), - - "_": () => console.log("unreachable"), + eq: () => a.__cmp__(b) === 0, + gteq: () => a.__cmp__(b) >= 0, + gt: () => a.__cmp__(b) > 0, + lteq: () => a.__cmp__(b) <= 0, + lt: () => a.__cmp__(b) < 0, + neq: () => a.__cmp__(b) !== 0, + in: () => a.__contains__(b), + outer: () => !a.__contains__(b), + + _: () => console.log("unreachable"), }); // Either push false and break or push b - stack.op0(res ? i === node.children.length - 1 ? true : b : false); + stack.op0(res ? (i === node.children.length - 1 ? true : b) : false); if (!res) { break; } } - } - })) { - + }, + }) + ) { if (node.children ?? false) { // Iterate over children for (let child of node.children) { @@ -312,32 +323,32 @@ export default class Logics { // Stack operations return action(node.emit, { // Pushing values - "False": () => stack.op0(false), - "Identifier": () => stack.op0(node.match), - "None": () => stack.op0(null), - "Number": () => stack.op0(parseFloat(node.match)), - "String": () => stack.op0(unescape(node.match.substring(1, node.match.length - 1))), // cut "..." from string. - "True": () => stack.op0(true), + False: () => stack.op0(false), + Identifier: () => stack.op0(node.match), + None: () => stack.op0(null), + Number: () => stack.op0(parseFloat(node.match)), + String: () => stack.op0(unescape(node.match.substring(1, node.match.length - 1))), // cut "..." from string. + True: () => stack.op0(true), // Operations - "add": () => stack.op2((a, b) => a.__add__(b)), - "attr": () => stack.op2((name, attr) => name.toDict()[attr]), - "div": () => stack.op2((a, b) => a.__truediv__(b)), - "idiv": () => stack.op2((a, b) => a.__floordiv__(b)), - "invert": () => stack.op1((a) => a.__invert__()), - "list": () => stack.op0(stack.splice(-node.children.length).map(item => item.valueOf())), - "mod": () => stack.op2((a, b) => a.__mod__(b)), - "mul": () => stack.op2((a, b) => a.__mul__(b)), - "neg": () => stack.op1((a) => a.__neg__()), - "not": () => stack.op1((a) => !a.toBool()), - "pos": () => stack.op1((a) => a.__pos__()), - "pow": () => stack.op2((a, b) => a.__pow__(b)), - "index": () => stack.op2( (value, idx) => value.__getitem__(idx)), - "load": () => stack.op1((name) => values[name.toString()]), - "slice": () => stack.op3( (value, from, to) => value.__getitem__(from, to)), - "strings": () => stack.op0(stack.splice(-node.children.length).join("")), - "sub": () => stack.op2((a, b) => a.__sub__(b)), - "vars": () => stack.op0(values), + add: () => stack.op2((a, b) => a.__add__(b)), + attr: () => stack.op2((name, attr) => name.toDict()[attr]), + div: () => stack.op2((a, b) => a.__truediv__(b)), + idiv: () => stack.op2((a, b) => a.__floordiv__(b)), + invert: () => stack.op1((a) => a.__invert__()), + list: () => stack.op0(stack.splice(-node.children.length).map((item) => item.valueOf())), + mod: () => stack.op2((a, b) => a.__mod__(b)), + mul: () => stack.op2((a, b) => a.__mul__(b)), + neg: () => stack.op1((a) => a.__neg__()), + not: () => stack.op1((a) => !a.toBool()), + pos: () => stack.op1((a) => a.__pos__()), + pow: () => stack.op2((a, b) => a.__pow__(b)), + index: () => stack.op2((value, idx) => value.__getitem__(idx)), + load: () => stack.op1((name) => values[name.toString()]), + slice: () => stack.op3((value, from, to) => value.__getitem__(from, to)), + strings: () => stack.op0(stack.splice(-node.children.length).join("")), + sub: () => stack.op2((a, b) => a.__sub__(b)), + vars: () => stack.op0(values), }); } } @@ -345,8 +356,7 @@ export default class Logics { // Register Logics in the browser if (typeof window !== "undefined") { window.logics = { - "Logics": Logics, - "Value": Value + Logics: Logics, + Value: Value, }; } - diff --git a/logics-js/package-lock.json b/logics-js/package-lock.json index 7ec11e3..5f64055 100644 --- a/logics-js/package-lock.json +++ b/logics-js/package-lock.json @@ -1,15 +1,16 @@ { "name": "logics-js", - "version": "0.3.8", + "version": "0.3.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "logics-js", - "version": "0.3.8", + "version": "0.3.9", "license": "MIT", "devDependencies": { - "mocha": "^10.2.0" + "mocha": "^10.2.0", + "prettier": "^3.0.3" } }, "node_modules/ansi-colors": { @@ -322,20 +323,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -696,6 +683,21 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", diff --git a/logics-js/package.json b/logics-js/package.json index 22deb55..e3701f6 100644 --- a/logics-js/package.json +++ b/logics-js/package.json @@ -7,10 +7,12 @@ "author": "Jan Max Meyer ", "license": "MIT", "devDependencies": { - "mocha": "^10.2.0" + "mocha": "^10.2.0", + "prettier": "^3.0.3" }, "scripts": { "test": "mocha", + "fmt": "prettier -w *.js **/*.js", "prepack": "cp ../README.md README.md", "postpack": "rm README.md" } diff --git a/logics-js/parser.js b/logics-js/parser.js index ece9d2e..80fb808 100644 --- a/logics-js/parser.js +++ b/logics-js/parser.js @@ -1,7 +1,6 @@ // Parser module generated by unicc from logics.par. // DO NOT EDIT THIS FILE MANUALLY, IT WILL GO AWAY! - class LogicsNode { constructor(emit, match, children) { this.emit = emit; @@ -10,26 +9,21 @@ class LogicsNode { } dump(level) { - if( level === undefined ) - level = 0; + if (level === undefined) level = 0; - if( this.emit !== undefined ) { + if (this.emit !== undefined) { let txt = this.emit; - for( let i = 0; i < level; i++ ) - txt = " " + txt; + for (let i = 0; i < level; i++) txt = " " + txt; - if( this.match && this.match !== this.emit ) - txt += " (" + this.match + ")"; + if (this.match && this.match !== this.emit) txt += " (" + this.match + ")"; console.log(txt); level++; } - if( this.children ) { - for( let child of this.children ) - if( Boolean( child ) ) - child.dump(level); + if (this.children) { + for (let child of this.children) if (Boolean(child)) child.dump(level); } } } @@ -42,7 +36,7 @@ class LogicsParserToken { this.node = null; - value: null + value: null; } } @@ -94,351 +88,1267 @@ class LogicsParserControlBlock { this.column = 1; // User-defined - } get top() { - return this.stack[ this.stack.length - ( 0 + 1 ) ].value; + return this.stack[this.stack.length - (0 + 1)].value; } set top(value) { - this.stack[ this.stack.length - ( 0 + 1 ) ].value = value; + this.stack[this.stack.length - (0 + 1)].value = value; } // Parsing actions - - - } // Parser export default class LogicsParser { static #grammar = { - "symbols": [ - { "symbol": "&eof", "emit": "", "is-terminal": 3, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "for", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "$", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "None", "emit": "None", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "False", "emit": "False", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "True", "emit": "True", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "**", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "//", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "in", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "<>", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "!=", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "<=", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "<", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": ">=", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": ">", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "==", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "not", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "and", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "or", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "else", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "if", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "String", "emit": "String", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": false }, - { "symbol": "Number", "emit": "Number", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "Identifier", "emit": "Identifier", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "whitespace", "emit": "", "is-terminal": 2, "is-lexem": false, "is-whitespace": true, "is-greedy": true }, - { "symbol": ",", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": ".", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": ":", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "]", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "[", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": ")", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "(", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "~", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "%", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "/", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "*", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "-", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "+", "emit": "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "expression'", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": ",?", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "internal_list", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "&embedded_2?", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "&embedded_2", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "String+", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "opt_expression", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "list?", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "list", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "trailer+", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "trailer", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "atom", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "factor", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "pow", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "unary", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "mul_div", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "&embedded_1+", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "&embedded_1", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "&embedded_0", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "add_sub", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "cmp", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "not", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "and", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "or", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, - { "symbol": "expression", "emit": "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true } + symbols: [ + { + symbol: "&eof", + emit: "", + "is-terminal": 3, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { symbol: "for", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "$", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { + symbol: "None", + emit: "None", + "is-terminal": 2, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "False", + emit: "False", + "is-terminal": 2, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "True", + emit: "True", + "is-terminal": 2, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { symbol: "**", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "//", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "in", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "<>", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "!=", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "<=", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "<", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: ">=", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: ">", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "==", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "not", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "and", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "or", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { + symbol: "else", + emit: "", + "is-terminal": 2, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { symbol: "if", emit: "", "is-terminal": 2, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { + symbol: "String", + emit: "String", + "is-terminal": 2, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": false, + }, + { + symbol: "Number", + emit: "Number", + "is-terminal": 2, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "Identifier", + emit: "Identifier", + "is-terminal": 2, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "whitespace", + emit: "", + "is-terminal": 2, + "is-lexem": false, + "is-whitespace": true, + "is-greedy": true, + }, + { symbol: ",", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: ".", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: ":", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "]", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "[", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: ")", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "(", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "~", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "%", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "/", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "*", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "-", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "+", emit: "", "is-terminal": 1, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { + symbol: "expression'", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { symbol: ",?", emit: "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { + symbol: "internal_list", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "&embedded_2?", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "&embedded_2", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "String+", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "opt_expression", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "list?", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "list", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "trailer+", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "trailer", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "atom", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "factor", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { symbol: "pow", emit: "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { + symbol: "unary", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "mul_div", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "&embedded_1+", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "&embedded_1", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "&embedded_0", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { + symbol: "add_sub", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, + { symbol: "cmp", emit: "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "not", emit: "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "and", emit: "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { symbol: "or", emit: "", "is-terminal": 0, "is-lexem": false, "is-whitespace": false, "is-greedy": true }, + { + symbol: "expression", + emit: "", + "is-terminal": 0, + "is-lexem": false, + "is-whitespace": false, + "is-greedy": true, + }, ], - "productions": [ - { "production": "expression : or \"if\" expression \"else\" expression", "emit": "if", "length": 5, "left-hand-side": 62 }, - { "production": "expression : or", "emit": "", "length": 1, "left-hand-side": 62 }, - { "production": "or : or \"or\" and", "emit": "or", "length": 3, "left-hand-side": 61 }, - { "production": "or : and", "emit": "", "length": 1, "left-hand-side": 61 }, - { "production": "and : and \"and\" not", "emit": "and", "length": 3, "left-hand-side": 60 }, - { "production": "and : not", "emit": "", "length": 1, "left-hand-side": 60 }, - { "production": "not : \"not\" not", "emit": "not", "length": 2, "left-hand-side": 59 }, - { "production": "not : cmp", "emit": "", "length": 1, "left-hand-side": 59 }, - { "production": "cmp : add_sub &embedded_1+", "emit": "cmp", "length": 2, "left-hand-side": 58 }, - { "production": "&embedded_1 : \"==\" add_sub", "emit": "eq", "length": 2, "left-hand-side": 55 }, - { "production": "&embedded_1 : \">\" add_sub", "emit": "gt", "length": 2, "left-hand-side": 55 }, - { "production": "&embedded_1 : \">=\" add_sub", "emit": "gteq", "length": 2, "left-hand-side": 55 }, - { "production": "&embedded_1 : \"<\" add_sub", "emit": "lt", "length": 2, "left-hand-side": 55 }, - { "production": "&embedded_1 : \"<=\" add_sub", "emit": "lteq", "length": 2, "left-hand-side": 55 }, - { "production": "&embedded_0 : \"!=\"", "emit": "", "length": 1, "left-hand-side": 56 }, - { "production": "&embedded_0 : \"<>\"", "emit": "", "length": 1, "left-hand-side": 56 }, - { "production": "&embedded_1 : &embedded_0 add_sub", "emit": "neq", "length": 2, "left-hand-side": 55 }, - { "production": "&embedded_1 : \"in\" add_sub", "emit": "in", "length": 2, "left-hand-side": 55 }, - { "production": "&embedded_1 : \"not\" \"in\" add_sub", "emit": "outer", "length": 3, "left-hand-side": 55 }, - { "production": "&embedded_1+ : &embedded_1+ &embedded_1", "emit": "", "length": 2, "left-hand-side": 54 }, - { "production": "&embedded_1+ : &embedded_1", "emit": "", "length": 1, "left-hand-side": 54 }, - { "production": "cmp : add_sub", "emit": "", "length": 1, "left-hand-side": 58 }, - { "production": "add_sub : add_sub '+' mul_div", "emit": "add", "length": 3, "left-hand-side": 57 }, - { "production": "add_sub : add_sub '-' mul_div", "emit": "sub", "length": 3, "left-hand-side": 57 }, - { "production": "add_sub : mul_div", "emit": "", "length": 1, "left-hand-side": 57 }, - { "production": "mul_div : mul_div '*' unary", "emit": "mul", "length": 3, "left-hand-side": 53 }, - { "production": "mul_div : mul_div '/' unary", "emit": "div", "length": 3, "left-hand-side": 53 }, - { "production": "mul_div : mul_div \"//\" unary", "emit": "idiv", "length": 3, "left-hand-side": 53 }, - { "production": "mul_div : mul_div '%' unary", "emit": "mod", "length": 3, "left-hand-side": 53 }, - { "production": "mul_div : pow", "emit": "", "length": 1, "left-hand-side": 53 }, - { "production": "pow : pow \"**\" unary", "emit": "pow", "length": 3, "left-hand-side": 51 }, - { "production": "pow : unary", "emit": "", "length": 1, "left-hand-side": 51 }, - { "production": "unary : '+' unary", "emit": "pos", "length": 2, "left-hand-side": 52 }, - { "production": "unary : '-' unary", "emit": "neg", "length": 2, "left-hand-side": 52 }, - { "production": "unary : '~' unary", "emit": "invert", "length": 2, "left-hand-side": 52 }, - { "production": "unary : factor", "emit": "", "length": 1, "left-hand-side": 52 }, - { "production": "factor : atom", "emit": "", "length": 1, "left-hand-side": 50 }, - { "production": "factor : atom trailer+", "emit": "entity", "length": 2, "left-hand-side": 50 }, - { "production": "trailer+ : trailer+ trailer", "emit": "", "length": 2, "left-hand-side": 47 }, - { "production": "trailer+ : trailer", "emit": "", "length": 1, "left-hand-side": 47 }, - { "production": "factor : @Identifier '(' list? ')'", "emit": "call", "length": 4, "left-hand-side": 50 }, - { "production": "list? : list", "emit": "", "length": 1, "left-hand-side": 45 }, - { "production": "list? : ", "emit": "", "length": 0, "left-hand-side": 45 }, - { "production": "opt_expression : expression", "emit": "", "length": 1, "left-hand-side": 44 }, - { "production": "opt_expression : ", "emit": "None", "length": 0, "left-hand-side": 44 }, - { "production": "trailer : '[' expression ']'", "emit": "index", "length": 3, "left-hand-side": 48 }, - { "production": "trailer : '[' opt_expression ':' opt_expression ']'", "emit": "slice", "length": 5, "left-hand-side": 48 }, - { "production": "trailer : '.' @Identifier", "emit": "attr", "length": 2, "left-hand-side": 48 }, - { "production": "atom : \"True\"", "emit": "", "length": 1, "left-hand-side": 49 }, - { "production": "atom : \"False\"", "emit": "", "length": 1, "left-hand-side": 49 }, - { "production": "atom : \"None\"", "emit": "", "length": 1, "left-hand-side": 49 }, - { "production": "atom : \"$\"", "emit": "vars", "length": 1, "left-hand-side": 49 }, - { "production": "atom : @Number", "emit": "", "length": 1, "left-hand-side": 49 }, - { "production": "atom : @Identifier", "emit": "load", "length": 1, "left-hand-side": 49 }, - { "production": "atom : @String", "emit": "", "length": 1, "left-hand-side": 49 }, - { "production": "String+ : String+ @String", "emit": "", "length": 2, "left-hand-side": 43 }, - { "production": "String+ : @String", "emit": "", "length": 1, "left-hand-side": 43 }, - { "production": "atom : String+", "emit": "strings", "length": 1, "left-hand-side": 49 }, - { "production": "atom : '[' expression \"for\" @Identifier \"in\" or &embedded_2? ']'", "emit": "comprehension", "length": 8, "left-hand-side": 49 }, - { "production": "&embedded_2 : \"if\" expression", "emit": "", "length": 2, "left-hand-side": 42 }, - { "production": "&embedded_2? : &embedded_2", "emit": "", "length": 1, "left-hand-side": 41 }, - { "production": "&embedded_2? : ", "emit": "", "length": 0, "left-hand-side": 41 }, - { "production": "atom : '[' list ']'", "emit": "", "length": 3, "left-hand-side": 49 }, - { "production": "atom : '(' expression ',' ')'", "emit": "list", "length": 4, "left-hand-side": 49 }, - { "production": "atom : '(' expression ',' internal_list ,? ')'", "emit": "list", "length": 6, "left-hand-side": 49 }, - { "production": ",? : ','", "emit": "", "length": 1, "left-hand-side": 39 }, - { "production": ",? : ", "emit": "", "length": 0, "left-hand-side": 39 }, - { "production": "atom : '(' expression ')'", "emit": "", "length": 3, "left-hand-side": 49 }, - { "production": "internal_list : expression", "emit": "", "length": 1, "left-hand-side": 40 }, - { "production": "internal_list : internal_list ',' expression", "emit": "", "length": 3, "left-hand-side": 40 }, - { "production": "list : internal_list ,?", "emit": "list", "length": 2, "left-hand-side": 46 }, - { "production": "expression' : expression ~&eof", "emit": "", "length": 2, "left-hand-side": 38 } + productions: [ + { + production: 'expression : or "if" expression "else" expression', + emit: "if", + length: 5, + "left-hand-side": 62, + }, + { production: "expression : or", emit: "", length: 1, "left-hand-side": 62 }, + { production: 'or : or "or" and', emit: "or", length: 3, "left-hand-side": 61 }, + { production: "or : and", emit: "", length: 1, "left-hand-side": 61 }, + { production: 'and : and "and" not', emit: "and", length: 3, "left-hand-side": 60 }, + { production: "and : not", emit: "", length: 1, "left-hand-side": 60 }, + { production: 'not : "not" not', emit: "not", length: 2, "left-hand-side": 59 }, + { production: "not : cmp", emit: "", length: 1, "left-hand-side": 59 }, + { production: "cmp : add_sub &embedded_1+", emit: "cmp", length: 2, "left-hand-side": 58 }, + { production: '&embedded_1 : "==" add_sub', emit: "eq", length: 2, "left-hand-side": 55 }, + { production: '&embedded_1 : ">" add_sub', emit: "gt", length: 2, "left-hand-side": 55 }, + { production: '&embedded_1 : ">=" add_sub', emit: "gteq", length: 2, "left-hand-side": 55 }, + { production: '&embedded_1 : "<" add_sub', emit: "lt", length: 2, "left-hand-side": 55 }, + { production: '&embedded_1 : "<=" add_sub', emit: "lteq", length: 2, "left-hand-side": 55 }, + { production: '&embedded_0 : "!="', emit: "", length: 1, "left-hand-side": 56 }, + { production: '&embedded_0 : "<>"', emit: "", length: 1, "left-hand-side": 56 }, + { production: "&embedded_1 : &embedded_0 add_sub", emit: "neq", length: 2, "left-hand-side": 55 }, + { production: '&embedded_1 : "in" add_sub', emit: "in", length: 2, "left-hand-side": 55 }, + { production: '&embedded_1 : "not" "in" add_sub', emit: "outer", length: 3, "left-hand-side": 55 }, + { production: "&embedded_1+ : &embedded_1+ &embedded_1", emit: "", length: 2, "left-hand-side": 54 }, + { production: "&embedded_1+ : &embedded_1", emit: "", length: 1, "left-hand-side": 54 }, + { production: "cmp : add_sub", emit: "", length: 1, "left-hand-side": 58 }, + { production: "add_sub : add_sub '+' mul_div", emit: "add", length: 3, "left-hand-side": 57 }, + { production: "add_sub : add_sub '-' mul_div", emit: "sub", length: 3, "left-hand-side": 57 }, + { production: "add_sub : mul_div", emit: "", length: 1, "left-hand-side": 57 }, + { production: "mul_div : mul_div '*' unary", emit: "mul", length: 3, "left-hand-side": 53 }, + { production: "mul_div : mul_div '/' unary", emit: "div", length: 3, "left-hand-side": 53 }, + { production: 'mul_div : mul_div "//" unary', emit: "idiv", length: 3, "left-hand-side": 53 }, + { production: "mul_div : mul_div '%' unary", emit: "mod", length: 3, "left-hand-side": 53 }, + { production: "mul_div : pow", emit: "", length: 1, "left-hand-side": 53 }, + { production: 'pow : pow "**" unary', emit: "pow", length: 3, "left-hand-side": 51 }, + { production: "pow : unary", emit: "", length: 1, "left-hand-side": 51 }, + { production: "unary : '+' unary", emit: "pos", length: 2, "left-hand-side": 52 }, + { production: "unary : '-' unary", emit: "neg", length: 2, "left-hand-side": 52 }, + { production: "unary : '~' unary", emit: "invert", length: 2, "left-hand-side": 52 }, + { production: "unary : factor", emit: "", length: 1, "left-hand-side": 52 }, + { production: "factor : atom", emit: "", length: 1, "left-hand-side": 50 }, + { production: "factor : atom trailer+", emit: "entity", length: 2, "left-hand-side": 50 }, + { production: "trailer+ : trailer+ trailer", emit: "", length: 2, "left-hand-side": 47 }, + { production: "trailer+ : trailer", emit: "", length: 1, "left-hand-side": 47 }, + { production: "factor : @Identifier '(' list? ')'", emit: "call", length: 4, "left-hand-side": 50 }, + { production: "list? : list", emit: "", length: 1, "left-hand-side": 45 }, + { production: "list? : ", emit: "", length: 0, "left-hand-side": 45 }, + { production: "opt_expression : expression", emit: "", length: 1, "left-hand-side": 44 }, + { production: "opt_expression : ", emit: "None", length: 0, "left-hand-side": 44 }, + { production: "trailer : '[' expression ']'", emit: "index", length: 3, "left-hand-side": 48 }, + { + production: "trailer : '[' opt_expression ':' opt_expression ']'", + emit: "slice", + length: 5, + "left-hand-side": 48, + }, + { production: "trailer : '.' @Identifier", emit: "attr", length: 2, "left-hand-side": 48 }, + { production: 'atom : "True"', emit: "", length: 1, "left-hand-side": 49 }, + { production: 'atom : "False"', emit: "", length: 1, "left-hand-side": 49 }, + { production: 'atom : "None"', emit: "", length: 1, "left-hand-side": 49 }, + { production: 'atom : "$"', emit: "vars", length: 1, "left-hand-side": 49 }, + { production: "atom : @Number", emit: "", length: 1, "left-hand-side": 49 }, + { production: "atom : @Identifier", emit: "load", length: 1, "left-hand-side": 49 }, + { production: "atom : @String", emit: "", length: 1, "left-hand-side": 49 }, + { production: "String+ : String+ @String", emit: "", length: 2, "left-hand-side": 43 }, + { production: "String+ : @String", emit: "", length: 1, "left-hand-side": 43 }, + { production: "atom : String+", emit: "strings", length: 1, "left-hand-side": 49 }, + { + production: "atom : '[' expression \"for\" @Identifier \"in\" or &embedded_2? ']'", + emit: "comprehension", + length: 8, + "left-hand-side": 49, + }, + { production: '&embedded_2 : "if" expression', emit: "", length: 2, "left-hand-side": 42 }, + { production: "&embedded_2? : &embedded_2", emit: "", length: 1, "left-hand-side": 41 }, + { production: "&embedded_2? : ", emit: "", length: 0, "left-hand-side": 41 }, + { production: "atom : '[' list ']'", emit: "", length: 3, "left-hand-side": 49 }, + { production: "atom : '(' expression ',' ')'", emit: "list", length: 4, "left-hand-side": 49 }, + { + production: "atom : '(' expression ',' internal_list ,? ')'", + emit: "list", + length: 6, + "left-hand-side": 49, + }, + { production: ",? : ','", emit: "", length: 1, "left-hand-side": 39 }, + { production: ",? : ", emit: "", length: 0, "left-hand-side": 39 }, + { production: "atom : '(' expression ')'", emit: "", length: 3, "left-hand-side": 49 }, + { production: "internal_list : expression", emit: "", length: 1, "left-hand-side": 40 }, + { production: "internal_list : internal_list ',' expression", emit: "", length: 3, "left-hand-side": 40 }, + { production: "list : internal_list ,?", emit: "list", length: 2, "left-hand-side": 46 }, + { production: "expression' : expression ~&eof", emit: "", length: 2, "left-hand-side": 38 }, ], - "goal": 38 + goal: 38, }; static #lexer = { - "select": [ - + select: [], + index: [ + [ + 0, 44, 53, 54, 58, 59, 60, 62, 65, 66, 69, 71, 73, 74, 75, 76, 78, 79, 80, 81, 82, 87, 92, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 110, 115, 120, 125, 130, 135, 140, 142, 149, 150, 152, 158, 165, 169, 174, + 180, 187, 189, 196, 198, 205, 209, 215, 217, 224, 231, 238, 245, 252, 259, 266, 273, 280, 287, 294, 301, + 308, + ], ], - "index": [ - [ 0, 44, 53, 54, 58, 59, 60, 62, 65, 66, 69, 71, 73, 74, 75, 76, 78, 79, 80, 81, 82, 87, 92, 97, 98, 99, 100, 101, 102, 103, 104, 105, 110, 115, 120, 125, 130, 135, 140, 142, 149, 150, 152, 158, 165, 169, 174, 180, 187, 189, 196, 198, 205, 209, 215, 217, 224, 231, 238, 245, 252, 259, 266, 273, 280, 287, 294, 301, 308 ] + chars: [ + 111, 111, 126, 126, 9, 10, 13, 13, 32, 32, 65, 69, 71, 77, 79, 83, 85, 90, 95, 95, 98, 100, 103, 104, 106, + 109, 112, 122, 110, 110, 105, 105, 102, 102, 101, 101, 97, 97, 93, 93, 91, 91, 84, 84, 78, 78, 70, 70, 62, + 62, 61, 61, 60, 60, 58, 58, 48, 57, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, + 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, -1, -1, 48, 57, 65, 90, 95, 95, 97, 101, 103, 109, 111, 122, 110, + 110, 102, 102, -1, -1, -1, -1, 9, 10, 13, 13, 32, 32, -1, -1, -1, -1, -1, -1, 61, 61, -1, -1, 62, 62, 61, + 61, -1, -1, -1, -1, 48, 57, 46, 46, -1, -1, 47, 47, -1, -1, 48, 57, -1, -1, -1, -1, -1, -1, -1, -1, 42, 42, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, + 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, + 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, + -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 61, 61, -1, -1, 48, + 57, 65, 90, 95, 95, 97, 110, 112, 122, 111, 111, -1, -1, -1, -1, 48, 57, -1, -1, 92, 92, 39, 39, 0, 38, 40, + 91, 93, 65535, -1, -1, 48, 57, 65, 90, 95, 95, 97, 113, 115, 122, 114, 114, -1, -1, 10, 10, 0, 9, 11, 65535, + -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 92, 92, 34, 34, 0, 33, 35, 91, 93, 65535, -1, -1, 48, 57, + 65, 90, 95, 95, 97, 107, 109, 122, 108, 108, -1, -1, 61, 61, -1, -1, 48, 57, 65, 90, 95, 95, 97, 109, 111, + 122, 110, 110, -1, -1, 0, 65535, -1, -1, 48, 57, 65, 90, 95, 95, 97, 113, 115, 122, 114, 114, -1, -1, 0, 9, + 11, 65535, 10, 10, -1, -1, 48, 57, 65, 90, 95, 95, 98, 122, 97, 97, -1, -1, 0, 65535, -1, -1, 48, 57, 65, + 90, 95, 95, 97, 115, 117, 122, 116, 116, -1, -1, 48, 57, 65, 90, 95, 95, 97, 113, 115, 122, 114, 114, -1, + -1, 48, 57, 65, 90, 95, 95, 97, 114, 116, 122, 115, 115, -1, -1, 48, 57, 65, 90, 95, 95, 97, 99, 101, 122, + 100, 100, -1, -1, 48, 57, 65, 90, 95, 95, 97, 116, 118, 122, 117, 117, -1, -1, 48, 57, 65, 90, 95, 95, 97, + 100, 102, 122, 101, 101, -1, -1, 48, 57, 65, 90, 95, 95, 97, 100, 102, 122, 101, 101, -1, -1, 48, 57, 65, + 90, 95, 95, 97, 100, 102, 122, 101, 101, -1, -1, 48, 57, 65, 90, 95, 95, 97, 100, 102, 122, 101, 101, -1, + -1, 48, 57, 65, 90, 95, 95, 97, 110, 112, 122, 111, 111, -1, -1, 48, 57, 65, 90, 95, 95, 97, 109, 111, 122, + 110, 110, -1, -1, 48, 57, 65, 90, 95, 95, 97, 114, 116, 122, 115, 115, -1, -1, 48, 57, 65, 90, 95, 95, 97, + 110, 112, 122, 111, 111, -1, -1, 48, 57, 65, 90, 95, 95, 97, 107, 109, 122, 108, 108, -1, -1, ], - "chars": [ -111, 111, 126, 126, 9, 10, 13, 13, 32, 32, 65, 69, 71, 77, 79, 83, 85, 90, 95, 95, 98, 100, 103, 104, 106, 109, 112, 122, 110, 110, 105, 105, 102, 102, 101, 101, 97, 97, 93, 93, 91, 91, 84, 84, 78, 78, 70, 70, 62, 62, 61, 61, 60, 60, 58, 58, 48, 57, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, -1, -1, 48, 57, 65, 90, 95, 95, 97, 101, 103, 109, 111, 122, 110, 110, 102, 102, -1, -1, -1, -1, 9, 10, 13, 13, 32, 32, -1, -1, -1, -1, -1, -1, 61, 61, -1, -1, 62, 62, 61, 61, -1, -1, -1, -1, 48, 57, 46, 46, -1, -1, 47, 47, -1, -1, 48, 57, -1, -1, -1, -1, -1, -1, -1, -1, 42, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 61, 61, -1, -1, 48, 57, 65, 90, 95, 95, 97, 110, 112, 122, 111, 111, -1, -1, -1, -1, 48, 57, -1, -1, 92, 92, 39, 39, 0, 38, 40, 91, 93, 65535, -1, -1, 48, 57, 65, 90, 95, 95, 97, 113, 115, 122, 114, 114, -1, -1, 10, 10, 0, 9, 11, 65535, -1, -1, 48, 57, 65, 90, 95, 95, 97, 122, -1, -1, 92, 92, 34, 34, 0, 33, 35, 91, 93, 65535, -1, -1, 48, 57, 65, 90, 95, 95, 97, 107, 109, 122, 108, 108, -1, -1, 61, 61, -1, -1, 48, 57, 65, 90, 95, 95, 97, 109, 111, 122, 110, 110, -1, -1, 0, 65535, -1, -1, 48, 57, 65, 90, 95, 95, 97, 113, 115, 122, 114, 114, -1, -1, 0, 9, 11, 65535, 10, 10, -1, -1, 48, 57, 65, 90, 95, 95, 98, 122, 97, 97, -1, -1, 0, 65535, -1, -1, 48, 57, 65, 90, 95, 95, 97, 115, 117, 122, 116, 116, -1, -1, 48, 57, 65, 90, 95, 95, 97, 113, 115, 122, 114, 114, -1, -1, 48, 57, 65, 90, 95, 95, 97, 114, 116, 122, 115, 115, -1, -1, 48, 57, 65, 90, 95, 95, 97, 99, 101, 122, 100, 100, -1, -1, 48, 57, 65, 90, 95, 95, 97, 116, 118, 122, 117, 117, -1, -1, 48, 57, 65, 90, 95, 95, 97, 100, 102, 122, 101, 101, -1, -1, 48, 57, 65, 90, 95, 95, 97, 100, 102, 122, 101, 101, -1, -1, 48, 57, 65, 90, 95, 95, 97, 100, 102, 122, 101, 101, -1, -1, 48, 57, 65, 90, 95, 95, 97, 100, 102, 122, 101, 101, -1, -1, 48, 57, 65, 90, 95, 95, 97, 110, 112, 122, 111, 111, -1, -1, 48, 57, 65, 90, 95, 95, 97, 109, 111, 122, 110, 110, -1, -1, 48, 57, 65, 90, 95, 95, 97, 114, 116, 122, 115, 115, -1, -1, 48, 57, 65, 90, 95, 95, 97, 110, 112, 122, 111, 111, -1, -1, 48, 57, 65, 90, 95, 95, 97, 107, 109, 122, 108, 108, -1, -1 + transitions: [ + 43, 2, 3, 3, 3, 45, 45, 45, 45, 45, 45, 45, 45, 45, 39, 1, 64, 47, 49, 4, 5, 51, 67, 53, 6, 38, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 42, 18, 19, 44, 46, 48, -1, 45, 45, 45, 45, 45, 45, 20, 21, -1, -1, 3, 3, 3, -1, + -1, -1, 23, -1, 25, 26, -1, -1, 9, 41, -1, 27, -1, 41, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, 45, 45, 45, + 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 45, 45, 45, 45, -1, 45, 45, + 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, + -1, 24, -1, 45, 45, 45, 45, 45, 55, -1, -1, 41, -1, 50, 29, 42, 42, 42, -1, 45, 45, 45, 45, 45, 22, -1, 40, + 52, 52, -1, 45, 45, 45, 45, -1, 54, 29, 46, 46, 46, -1, 45, 45, 45, 45, 45, 57, -1, 30, -1, 45, 45, 45, 45, + 45, 58, -1, 42, -1, 45, 45, 45, 45, 45, 59, -1, 52, 52, 40, -1, 45, 45, 45, 45, 68, -1, 46, -1, 45, 45, 45, + 45, 45, 31, -1, 45, 45, 45, 45, 45, 32, -1, 45, 45, 45, 45, 45, 60, -1, 45, 45, 45, 45, 45, 33, -1, 45, 45, + 45, 45, 45, 61, -1, 45, 45, 45, 45, 45, 34, -1, 45, 45, 45, 45, 45, 35, -1, 45, 45, 45, 45, 45, 36, -1, 45, + 45, 45, 45, 45, 37, -1, 45, 45, 45, 45, 45, 56, -1, 45, 45, 45, 45, 45, 62, -1, 45, 45, 45, 45, 45, 63, -1, + 45, 45, 45, 45, 45, 65, -1, 45, 45, 45, 45, 45, 66, -1, ], - "transitions": [ -43, 2, 3, 3, 3, 45, 45, 45, 45, 45, 45, 45, 45, 45, 39, 1, 64, 47, 49, 4, 5, 51, 67, 53, 6, 38, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 42, 18, 19, 44, 46, 48, -1, 45, 45, 45, 45, 45, 45, 20, 21, -1, -1, 3, 3, 3, -1, -1, -1, 23, -1, 25, 26, -1, -1, 9, 41, -1, 27, -1, 41, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 24, -1, 45, 45, 45, 45, 45, 55, -1, -1, 41, -1, 50, 29, 42, 42, 42, -1, 45, 45, 45, 45, 45, 22, -1, 40, 52, 52, -1, 45, 45, 45, 45, -1, 54, 29, 46, 46, 46, -1, 45, 45, 45, 45, 45, 57, -1, 30, -1, 45, 45, 45, 45, 45, 58, -1, 42, -1, 45, 45, 45, 45, 45, 59, -1, 52, 52, 40, -1, 45, 45, 45, 45, 68, -1, 46, -1, 45, 45, 45, 45, 45, 31, -1, 45, 45, 45, 45, 45, 32, -1, 45, 45, 45, 45, 45, 60, -1, 45, 45, 45, 45, 45, 33, -1, 45, 45, 45, 45, 45, 61, -1, 45, 45, 45, 45, 45, 34, -1, 45, 45, 45, 45, 45, 35, -1, 45, 45, 45, 45, 45, 36, -1, 45, 45, 45, 45, 45, 37, -1, 45, 45, 45, 45, 45, 56, -1, 45, 45, 45, 45, 45, 62, -1, 45, 45, 45, 45, 45, 63, -1, 45, 45, 45, 45, 45, 65, -1, 45, 45, 45, 45, 45, 66, -1 + accept: [ + [ + 0, 24, 33, 25, 29, 30, 15, 13, 28, 23, 35, 27, 37, 26, 38, 36, 31, 32, 34, 3, 9, 21, 19, 14, 16, 10, 12, + 8, 7, 22, 11, 17, 2, 18, 20, 6, 4, 5, 0, 24, 25, 23, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + ], ], - "accept": [ - [ 0, 24, 33, 25, 29, 30, 15, 13, 28, 23, 35, 27, 37, 26, 38, 36, 31, 32, 34, 3, 9, 21, 19, 14, 16, 10, 12, 8, 7, 22, 11, 17, 2, 18, 20, 6, 4, 5, 0, 24, 25, 23, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 ] - ] }; static #parser = { - "action": [ - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 31: [ 2,17 ] }, - { 21: [ 1,56 ] }, - { 0: [ 3,71 ] }, - { 20: [ 2,18 ], 18: [ 2,19 ] }, - { 17: [ 2,20 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 16: [ 2,21 ], 15: [ 2,22 ], 14: [ 2,23 ], 13: [ 2,24 ], 12: [ 2,25 ], 11: [ 2,26 ], 10: [ 3,14 ], 9: [ 3,15 ], 8: [ 2,28 ], 37: [ 2,30 ], 36: [ 2,31 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 35: [ 2,32 ], 34: [ 2,33 ], 7: [ 2,34 ], 33: [ 2,35 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 6: [ 2,36 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 29: [ 2,38 ], 26: [ 2,39 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 21: [ 3,55 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 8: [ 2,47 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 16: [ 2,21 ], 15: [ 2,22 ], 14: [ 2,23 ], 13: [ 2,24 ], 12: [ 2,25 ], 11: [ 2,26 ], 10: [ 3,14 ], 9: [ 3,15 ], 8: [ 2,28 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 29: [ 2,38 ], 26: [ 2,39 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 3,47 ] }, - { 30: [ 3,67 ], 25: [ 2,59 ] }, - { 1: [ 2,60 ] }, - { 28: [ 3,62 ] }, - { 25: [ 2,61 ] }, - { 30: [ 3,40 ] }, - { 19: [ 2,62 ] }, - { 17: [ 2,20 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 37: [ 2,30 ], 36: [ 2,31 ] }, - { 37: [ 2,30 ], 36: [ 2,31 ] }, - { 37: [ 2,30 ], 36: [ 2,31 ] }, - { 37: [ 2,30 ], 36: [ 2,31 ] }, - { 37: [ 2,30 ], 36: [ 2,31 ] }, - { 37: [ 2,30 ], 36: [ 2,31 ] }, - { 37: [ 2,30 ], 36: [ 2,31 ] }, - { 35: [ 2,32 ], 34: [ 2,33 ], 7: [ 2,34 ], 33: [ 2,35 ] }, - { 35: [ 2,32 ], 34: [ 2,33 ], 7: [ 2,34 ], 33: [ 2,35 ] }, - { 28: [ 3,45 ] }, - { 27: [ 2,64 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 30: [ 3,63 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,66 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 37: [ 2,30 ], 36: [ 2,31 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 25: [ 2,61 ] }, - { 8: [ 2,69 ] }, - { 28: [ 3,46 ] }, - { 30: [ 3,64 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 20: [ 2,71 ], 18: [ 2,19 ] }, - { 23: [ 2,1 ], 22: [ 3,52 ], 21: [ 2,2 ], 16: [ 2,6 ], 37: [ 2,8 ], 36: [ 2,10 ], 32: [ 2,12 ], 31: [ 2,14 ], 29: [ 2,15 ], 5: [ 3,48 ], 4: [ 3,49 ], 3: [ 3,50 ], 2: [ 3,51 ] }, - { 28: [ 3,58 ] } + action: [ + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 31: [2, 17] }, + { 21: [1, 56] }, + { 0: [3, 71] }, + { 20: [2, 18], 18: [2, 19] }, + { 17: [2, 20] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 16: [2, 21], + 15: [2, 22], + 14: [2, 23], + 13: [2, 24], + 12: [2, 25], + 11: [2, 26], + 10: [3, 14], + 9: [3, 15], + 8: [2, 28], + 37: [2, 30], + 36: [2, 31], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 35: [2, 32], 34: [2, 33], 7: [2, 34], 33: [2, 35] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 6: [2, 36] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 29: [2, 38], 26: [2, 39] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 21: [3, 55] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 8: [2, 47] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 16: [2, 21], + 15: [2, 22], + 14: [2, 23], + 13: [2, 24], + 12: [2, 25], + 11: [2, 26], + 10: [3, 14], + 9: [3, 15], + 8: [2, 28], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 29: [2, 38], 26: [2, 39] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 23: [3, 47] }, + { 30: [3, 67], 25: [2, 59] }, + { 1: [2, 60] }, + { 28: [3, 62] }, + { 25: [2, 61] }, + { 30: [3, 40] }, + { 19: [2, 62] }, + { 17: [2, 20] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 37: [2, 30], 36: [2, 31] }, + { 37: [2, 30], 36: [2, 31] }, + { 37: [2, 30], 36: [2, 31] }, + { 37: [2, 30], 36: [2, 31] }, + { 37: [2, 30], 36: [2, 31] }, + { 37: [2, 30], 36: [2, 31] }, + { 37: [2, 30], 36: [2, 31] }, + { 35: [2, 32], 34: [2, 33], 7: [2, 34], 33: [2, 35] }, + { 35: [2, 32], 34: [2, 33], 7: [2, 34], 33: [2, 35] }, + { 28: [3, 45] }, + { 27: [2, 64] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 30: [3, 63], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 23: [2, 66] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 37: [2, 30], 36: [2, 31] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 25: [2, 61] }, + { 8: [2, 69] }, + { 28: [3, 46] }, + { 30: [3, 64] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 20: [2, 71], 18: [2, 19] }, + { + 23: [2, 1], + 22: [3, 52], + 21: [2, 2], + 16: [2, 6], + 37: [2, 8], + 36: [2, 10], + 32: [2, 12], + 31: [2, 14], + 29: [2, 15], + 5: [3, 48], + 4: [3, 49], + 3: [3, 50], + 2: [3, 51], + }, + { 28: [3, 58] }, ], - "goto": [ - { 62: [ 2,3 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { }, - { }, - { }, - { }, - { }, - { 59: [ 3,6 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 56: [ 2,27 ], 55: [ 3,20 ], 54: [ 2,29 ] }, - { 52: [ 3,32 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { }, - { 52: [ 3,33 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { }, - { 52: [ 3,34 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 48: [ 3,39 ], 47: [ 2,37 ] }, - { 62: [ 2,40 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 62: [ 2,41 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 46: [ 2,42 ], 43: [ 2,16 ], 40: [ 2,43 ] }, - { }, - { 62: [ 3,68 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 46: [ 3,41 ], 45: [ 2,44 ], 43: [ 2,16 ], 40: [ 2,43 ] }, - { 62: [ 2,45 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 60: [ 2,46 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 59: [ 3,4 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { }, - { 57: [ 2,48 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 57: [ 2,49 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 57: [ 2,50 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 57: [ 2,51 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 57: [ 2,52 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 57: [ 2,53 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 57: [ 2,54 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 56: [ 2,27 ], 55: [ 3,19 ] }, - { 53: [ 2,55 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 53: [ 2,56 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 52: [ 3,25 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 52: [ 3,26 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 52: [ 3,27 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 52: [ 3,28 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 52: [ 3,30 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 48: [ 3,38 ] }, - { 62: [ 2,57 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 44: [ 2,58 ], 43: [ 2,16 ] }, - { }, - { }, - { }, - { }, - { 39: [ 3,70 ] }, - { }, - { }, - { }, - { 57: [ 2,63 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { }, - { }, - { }, - { }, - { }, - { }, - { }, - { }, - { }, - { }, - { }, - { 62: [ 3,68 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ], 40: [ 2,65 ] }, - { }, - { 62: [ 3,69 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 62: [ 3,0 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { }, - { 62: [ 3,43 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 44: [ 2,67 ], 43: [ 2,16 ] }, - { 39: [ 2,68 ] }, - { }, - { }, - { }, - { 61: [ 2,70 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { 42: [ 3,60 ], 41: [ 2,72 ] }, - { 62: [ 3,59 ], 61: [ 2,4 ], 60: [ 2,5 ], 59: [ 3,5 ], 58: [ 3,7 ], 57: [ 2,7 ], 53: [ 2,9 ], 52: [ 3,31 ], 51: [ 2,11 ], 50: [ 3,35 ], 49: [ 2,13 ], 43: [ 2,16 ] }, - { } + goto: [ + { + 62: [2, 3], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + {}, + {}, + {}, + {}, + {}, + { + 59: [3, 6], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + { 56: [2, 27], 55: [3, 20], 54: [2, 29] }, + { 52: [3, 32], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + {}, + { 52: [3, 33], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + {}, + { 52: [3, 34], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 48: [3, 39], 47: [2, 37] }, + { + 62: [2, 40], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + { + 62: [2, 41], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 46: [2, 42], + 43: [2, 16], + 40: [2, 43], + }, + {}, + { + 62: [3, 68], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 46: [3, 41], + 45: [2, 44], + 43: [2, 16], + 40: [2, 43], + }, + { + 62: [2, 45], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + { + 60: [2, 46], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + { + 59: [3, 4], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + {}, + { 57: [2, 48], 53: [2, 9], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 57: [2, 49], 53: [2, 9], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 57: [2, 50], 53: [2, 9], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 57: [2, 51], 53: [2, 9], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 57: [2, 52], 53: [2, 9], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 57: [2, 53], 53: [2, 9], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 57: [2, 54], 53: [2, 9], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 56: [2, 27], 55: [3, 19] }, + { 53: [2, 55], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 53: [2, 56], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 52: [3, 25], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 52: [3, 26], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 52: [3, 27], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 52: [3, 28], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 52: [3, 30], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + { 48: [3, 38] }, + { + 62: [2, 57], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 44: [2, 58], + 43: [2, 16], + }, + {}, + {}, + {}, + {}, + { 39: [3, 70] }, + {}, + {}, + {}, + { 57: [2, 63], 53: [2, 9], 52: [3, 31], 51: [2, 11], 50: [3, 35], 49: [2, 13], 43: [2, 16] }, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + { + 62: [3, 68], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + 40: [2, 65], + }, + {}, + { + 62: [3, 69], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + { + 62: [3, 0], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + {}, + { + 62: [3, 43], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 44: [2, 67], + 43: [2, 16], + }, + { 39: [2, 68] }, + {}, + {}, + {}, + { + 61: [2, 70], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + { 42: [3, 60], 41: [2, 72] }, + { + 62: [3, 59], + 61: [2, 4], + 60: [2, 5], + 59: [3, 5], + 58: [3, 7], + 57: [2, 7], + 53: [2, 9], + 52: [3, 31], + 51: [2, 11], + 50: [3, 35], + 49: [2, 13], + 43: [2, 16], + }, + {}, ], "default-production": [ - -1, 53, 54, -1, 1, 3, -1, 21, -1, 24, -1, 29, -1, 36, -1, -1, 57, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 37, 44, -1, -1, 68, -1, 66, -1, -1, 2, -1, 9, 10, 11, 12, 13, 16, 17, 22, 23, 43, -1, -1, -1, 65, -1, 18, 44, 66, -1, -1, -1, -1, 61, -1, -1 - ] + -1, 53, 54, -1, 1, 3, -1, 21, -1, 24, -1, 29, -1, 36, -1, -1, 57, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 37, 44, -1, -1, 68, -1, 66, -1, -1, 2, -1, 9, 10, 11, 12, 13, 16, 17, + 22, 23, 43, -1, -1, -1, 65, -1, 18, 44, 66, -1, -1, -1, -1, 61, -1, -1, + ], }; // Get character static #get_char(pcb) { // Get next character from input stream - if( typeof pcb.input === "function" ) - return pcb.input(); + if (typeof pcb.input === "function") return pcb.input(); let ch = pcb.eof; - if( pcb.input.length > 0 ) { + if (pcb.input.length > 0) { ch = pcb.input[0]; pcb.input = pcb.input.slice(1); } @@ -448,12 +1358,11 @@ export default class LogicsParser { static #get_input(pcb, offset) { // Input buffering - while( offset >= pcb.buf.length ) { - if( pcb.is_eof ) - return pcb.eof; + while (offset >= pcb.buf.length) { + if (pcb.is_eof) return pcb.eof; let ch = this.#get_char(pcb); - if( ch === pcb.eof ) { + if (ch === pcb.eof) { pcb.is_eof = true; return pcb.eof; } @@ -469,18 +1378,16 @@ export default class LogicsParser { static #clear_input(pcb) { // Purge input from buffer that is not necessary anymore - if( pcb.buf.length ) { + if (pcb.buf.length) { // Perform position counting. - for( let pos = 0; pos <= pcb.len; pos++ ) { - if( pcb.buf[pos] === '\n' ) { + for (let pos = 0; pos <= pcb.len; pos++) { + if (pcb.buf[pos] === "\n") { pcb.line++; pcb.column = 0; - } - else - pcb.column++; + } else pcb.column++; } - pcb.buf = pcb.buf.slice( pcb.len ); + pcb.buf = pcb.buf.slice(pcb.len); } pcb.len = 0; @@ -489,39 +1396,38 @@ export default class LogicsParser { static #lex(pcb) { // Perform lexical analysis - let state = 0, length = 0; + let state = 0, + length = 0; let machine = Boolean(1) ? 0 : this.#lexer["select"][pcb.tos.state]; let next = this.#get_input(pcb, length); - if( next === pcb.eof ) { + if (next === pcb.eof) { pcb.sym = 0; return; } - while( state > -1 && next !== pcb.eof ) { + while (state > -1 && next !== pcb.eof) { let idx = this.#lexer["index"][machine][state]; state = -1; - while( this.#lexer["chars"][idx * 2] > -1 ) { - if( next >= this.#lexer["chars"][idx * 2] - && next <= this.#lexer["chars"][idx * 2 + 1] ) { - + while (this.#lexer["chars"][idx * 2] > -1) { + if (next >= this.#lexer["chars"][idx * 2] && next <= this.#lexer["chars"][idx * 2 + 1]) { length++; state = this.#lexer["transitions"][idx]; - if( this.#lexer["accept"][machine][state] > 0 ) { + if (this.#lexer["accept"][machine][state] > 0) { pcb.sym = this.#lexer["accept"][machine][state] - 1; pcb.len = length; // Test! (??) - if( pcb.sym === 0 ) { + if (pcb.sym === 0) { state = -1; break; } // Stop if matched symbol should be parsed nongreedy - if( !Boolean(this.#grammar["symbols"][pcb.sym]["is-greedy"]) ) { + if (!Boolean(this.#grammar["symbols"][pcb.sym]["is-greedy"])) { state = -1; break; } @@ -546,52 +1452,47 @@ export default class LogicsParser { pcb.len = 0; // insensitive mode - if( Boolean(1) ) - while( true ) - { + if (Boolean(1)) + while (true) { this.#lex(pcb); // check for whitespace - if( pcb.sym > -1 && Boolean(this.#grammar["symbols"][pcb.sym]["is-whitespace"]) ) { + if (pcb.sym > -1 && Boolean(this.#grammar["symbols"][pcb.sym]["is-whitespace"])) { this.#clear_input(pcb); continue; } break; } - // sensitive mode - else if( this.#lexer["select"][pcb.tos.state] > -1 ) - this.#lex(pcb); - + else if (this.#lexer["select"][pcb.tos.state] > -1) this.#lex(pcb); // If there is no matching DFA state machine, try to identify the // end-of-file symbol. If this also fails, a parse error will raise. - else if( this.constructor.#get_input(pcb, 0) === pcb.eof ) - pcb.sym = 0; + else if (this.constructor.#get_input(pcb, 0) === pcb.eof) pcb.sym = 0; return Boolean(pcb.sym > -1); } parse(s) { // Constants - const ERROR = 0; - const REDUCE = 1; - const SHIFT = 2; - const SUCCESS = 4; + const ERROR = 0; + const REDUCE = 1; + const SHIFT = 2; + const SUCCESS = 4; // Start of parse function - let pcb = new LogicsParserControlBlock() - pcb.input = s + let pcb = new LogicsParserControlBlock(); + pcb.input = s; pcb.act = SHIFT; - pcb.tos = new LogicsParserToken() - pcb.stack.push(pcb.tos) + pcb.tos = new LogicsParserToken(); + pcb.stack.push(pcb.tos); - while( true ) { + while (true) { //console.log("state = %d", pcb.tos.state); // Reduce - while( pcb.act & REDUCE ) { + while (pcb.act & REDUCE) { // Set default left-hand side pcb.lhs = this.constructor.#grammar["productions"][pcb.idx]["left-hand-side"]; @@ -601,24 +1502,20 @@ export default class LogicsParser { // Call reduce function //console.log("CALL", "_reduce_action_%d" % pcb.idx) - if( ( "parse_" + pcb.idx ) in pcb ) - pcb[ "parse_" + pcb.idx ](); + if ("parse_" + pcb.idx in pcb) pcb["parse_" + pcb.idx](); // Drop right-hand side - let cnodes = null, node = null; + let cnodes = null, + node = null; - for( let i = 0; i < this.constructor.#grammar["productions"][pcb.idx]["length"]; i++ ) { + for (let i = 0; i < this.constructor.#grammar["productions"][pcb.idx]["length"]; i++) { let item = pcb.stack.pop(); - if( item.node ) - { - if( cnodes === null ) - cnodes = []; + if (item.node) { + if (cnodes === null) cnodes = []; - if( Array.isArray( item.node ) ) - cnodes = item.node.concat(cnodes); - else - cnodes.unshift(item.node); + if (Array.isArray(item.node)) cnodes = item.node.concat(cnodes); + else cnodes.unshift(item.node); } } @@ -626,13 +1523,13 @@ export default class LogicsParser { pcb.tos.value = pcb.ret; // Handle AST nodes - if( Boolean( this.constructor.#grammar["productions"][pcb.idx]["emit"] ) ) { + if (Boolean(this.constructor.#grammar["productions"][pcb.idx]["emit"])) { //console.log("%s = %s", this.constructor.#grammar["productions"][pcb.idx]["production"], this.#grammar["productions"][pcb.idx]["emit"]); node = new LogicsNode(this.constructor.#grammar["productions"][pcb.idx]["emit"], null, cnodes); } // Goal symbol reduced, and stack is empty? - if( pcb.lhs === 38 && pcb.stack.length === 1 ) { + if (pcb.lhs === 38 && pcb.stack.length === 1) { pcb.tos.node = node ? node : cnodes; this.constructor.#clear_input(pcb); pcb.act = SUCCESS; @@ -644,7 +1541,7 @@ export default class LogicsParser { pcb.idx = this.constructor.#parser["goto"][pcb.tos.state][pcb.lhs][1]; pcb.tos = new LogicsParserToken(); - pcb.stack.push(pcb.tos) + pcb.stack.push(pcb.tos); pcb.tos.symbol = this.constructor.#grammar["symbols"][pcb.lhs]; pcb.tos.state = pcb.act & REDUCE ? -1 : pcb.idx; @@ -657,8 +1554,7 @@ export default class LogicsParser { pcb.tos.column = pcb.column; } - if( pcb.act === SUCCESS || pcb.act === ERROR ) - break; + if (pcb.act === SUCCESS || pcb.act === ERROR) break; // Get next input symbol this.constructor.#get_sym(pcb); @@ -667,41 +1563,39 @@ export default class LogicsParser { //console.log("pcb.len = %d", pcb.len); // Get action table entry - if( pcb.sym in this.constructor.#parser["action"][pcb.tos.state] ) { + if (pcb.sym in this.constructor.#parser["action"][pcb.tos.state]) { pcb.act = this.constructor.#parser["action"][pcb.tos.state][pcb.sym][0]; pcb.idx = this.constructor.#parser["action"][pcb.tos.state][pcb.sym][1]; } else { // Otherwise, apply default production pcb.idx = this.constructor.#parser["default-production"][pcb.tos.state]; - if( pcb.idx > -1 ) { + if (pcb.idx > -1) { pcb.act = REDUCE; - } - else { + } else { pcb.act = 0; } } - if( !pcb.act ) { + if (!pcb.act) { throw new LogicsParseError( pcb.line, pcb.column, - Object.keys( - this.constructor.#parser["action"][pcb.tos.state] - ).map(sym => this.constructor.#grammar.symbols[sym].symbol).sort() + Object.keys(this.constructor.#parser["action"][pcb.tos.state]) + .map((sym) => this.constructor.#grammar.symbols[sym].symbol) + .sort(), ); } // Shift - if( pcb.act & SHIFT ) { + if (pcb.act & SHIFT) { //console.log("SHIFT sym = %d (%s)", pcb.sym, this.constructor.#grammar["symbols"][pcb.sym]["symbol"]); pcb.tos = new LogicsParserToken(); pcb.stack.push(pcb.tos); // Execute scanner actions, if existing. - if( ( "scan_" + pcb.idx ) in pcb ) - pcb[ "parse_" + pcb.idx ](); + if ("scan_" + pcb.idx in pcb) pcb["parse_" + pcb.idx](); pcb.tos.state = pcb.act & REDUCE ? -1 : pcb.idx; pcb.tos.symbol = this.constructor.#grammar["symbols"][pcb.sym]; @@ -710,22 +1604,19 @@ export default class LogicsParser { pcb.tos.column = pcb.column; pcb.top = pcb.buf.slice(0, pcb.len); - if( Boolean( pcb.tos.symbol["emit"] ) ) - pcb.tos.node = new LogicsNode(pcb.tos.symbol["emit"], pcb.top); + if (Boolean(pcb.tos.symbol["emit"])) pcb.tos.node = new LogicsNode(pcb.tos.symbol["emit"], pcb.top); - if( pcb.sym !== 0 && pcb.sym !== -1 ) { + if (pcb.sym !== 0 && pcb.sym !== -1) { this.constructor.#clear_input(pcb); - pcb.old_sym = -1 + pcb.old_sym = -1; } } } - if( !pcb.ret && pcb.tos.node ) { - if( Array.isArray( pcb.tos.node ) ) { - if( pcb.tos.node.length > 1 ) - return new LogicsNode(null, null, pcb.tos.node); - else - return pcb.tos.node.pop(); + if (!pcb.ret && pcb.tos.node) { + if (Array.isArray(pcb.tos.node)) { + if (pcb.tos.node.length > 1) return new LogicsNode(null, null, pcb.tos.node); + else return pcb.tos.node.pop(); } return pcb.tos.node; @@ -734,5 +1625,3 @@ export default class LogicsParser { return pcb.ret; } } - - diff --git a/logics-js/test/logics.js b/logics-js/test/logics.js index 8e75f7d..a952075 100644 --- a/logics-js/test/logics.js +++ b/logics-js/test/logics.js @@ -1,84 +1,69 @@ // Import necessary Node.js modules and the Logics class. -import fs from "fs"; // For reading files. -import glob from "glob"; // For searching files using a pattern. +import fs from "fs"; // For reading files. +import glob from "glob"; // For searching files using a pattern. import assert from "assert"; // For assertion tests. import Logics from "../logics.js"; // Assuming the Logics class is defined in "../logics.js". - // This function performs the testing process. function testcase(code) { - let variables = {}; // Initialize an empty object for variables. - let lastResult = undefined; // Store the last result. - - - // Iterate through each line in the given code. - for (let line of code.split("\n")) { - line = line.trim(); // Remove leading and trailing whitespace. - - - if (!line) { - continue; // Skip empty lines. - } - - - if (line[0] === "#") { - // Process lines starting with "#" (comments and instructions). - let cmd = line.substr(1).split(":", 3); - switch (cmd[0].toLowerCase()) { - case "expect": - // Verify the expected result. - let expect = cmd[1]; - - - // Ensure that the previous result is not undefined. - assert.notStrictEqual(lastResult, undefined); - - - // Compare the expected result with the last result. - assert.strictEqual(lastResult.repr(), expect); - - - // Reset the last result. - lastResult = undefined; - break; - - - case "set": - // Set a variable. - let name = cmd[1]; - let value = cmd[2]; - - - // Calculate the variable's value and store it in the variables object. - variables[name] = new Logics(value).run(variables); - break; - } - } else { - // Process lines with expressions. - lastResult = new Logics(line).run(variables); - } - } - - - // Ensure that the last result is undefined (all expected results verified). - assert.strictEqual(lastResult, undefined, `lastResult=${lastResult} unverified`); + let variables = {}; // Initialize an empty object for variables. + let lastResult = undefined; // Store the last result. + + // Iterate through each line in the given code. + for (let line of code.split("\n")) { + line = line.trim(); // Remove leading and trailing whitespace. + + if (!line) { + continue; // Skip empty lines. + } + + if (line[0] === "#") { + // Process lines starting with "#" (comments and instructions). + let cmd = line.substr(1).split(":", 3); + switch (cmd[0].toLowerCase()) { + case "expect": + // Verify the expected result. + let expect = cmd[1]; + + // Ensure that the previous result is not undefined. + assert.notStrictEqual(lastResult, undefined); + + // Compare the expected result with the last result. + assert.strictEqual(lastResult.repr(), expect); + + // Reset the last result. + lastResult = undefined; + break; + + case "set": + // Set a variable. + let name = cmd[1]; + let value = cmd[2]; + + // Calculate the variable's value and store it in the variables object. + variables[name] = new Logics(value).run(variables); + break; + } + } else { + // Process lines with expressions. + lastResult = new Logics(line).run(variables); + } + } + + // Ensure that the last result is undefined (all expected results verified). + assert.strictEqual(lastResult, undefined, `lastResult=${lastResult} unverified`); } - // Mocha test description: "Logics" is the name of the test suite. describe("Logics", () => { - // Use "glob.sync" to find all .lgx files in the "../tests/" directory. - const tests = glob.sync("../tests/*.lgx"); - - - // Create a Mocha test case for each found test file. - tests.forEach((filename) => it(filename, () => { - // Read the content of the test file and execute the test. - testcase(fs.readFileSync(filename, "utf-8")); - })); + // Use "glob.sync" to find all .lgx files in the "../tests/" directory. + const tests = glob.sync("../tests/*.lgx"); + + // Create a Mocha test case for each found test file. + tests.forEach((filename) => + it(filename, () => { + // Read the content of the test file and execute the test. + testcase(fs.readFileSync(filename, "utf-8")); + }), + ); }); - - - - - diff --git a/logics-js/test/value.js b/logics-js/test/value.js index 9b807f4..6fbb109 100644 --- a/logics-js/test/value.js +++ b/logics-js/test/value.js @@ -2,8 +2,6 @@ import assert from "assert"; import Value from "../value.js"; describe("Value", () => { - - it("None", () => { let none = new Value(null); @@ -19,7 +17,7 @@ describe("Value", () => { it("bool", () => { let value_true = new Value(true); let value_false = new Value(false); - + assert.ok(value_true.__cmp__(value_true) == 0); assert.ok(value_false.__cmp__(value_false) == 0); assert.ok(value_true.__cmp__(new Value(1)) == 0); @@ -30,9 +28,8 @@ describe("Value", () => { assert.strictEqual(value_false.repr(), "False"); }); - it("conversion", () => { - - assert.ok(new Value({"a": 1}).__cmp__(new Value({"a": 1})) == 0); + it("conversion", () => { + assert.ok(new Value({ a: 1 }).__cmp__(new Value({ a: 1 })) == 0); assert.ok(new Value(4).__cmp__(new Value(4)) == 0); assert.ok(new Value(4).__neg__(2)); // assert.ok(new Value(4).__add__(4).__cmp__(8)); @@ -48,31 +45,27 @@ describe("Value", () => { // assert.strictEqual(new Value(4).__add__(4), 8); // assert.strictEqual(new Value('4112', { optimize: true }).repr(), '4112'); }); - - it("int", () => { + + it("int", () => { const _123 = new Value(123); - + assert.strictEqual(_123.toInt(), 123); assert.strictEqual(_123.__neg__().toInt(), -123); - assert.strictEqual(new Value(' 123 xix').toInt(), 123); - assert.strictEqual(new Value(' -123 xix').toInt(), -123); - assert.strictEqual(_123.repr(), '123'); - assert.strictEqual(_123.__neg__().repr(), '-123'); + assert.strictEqual(new Value(" 123 xix").toInt(), 123); + assert.strictEqual(new Value(" -123 xix").toInt(), -123); + assert.strictEqual(_123.repr(), "123"); + assert.strictEqual(_123.__neg__().repr(), "-123"); }); - + it("float", () => { const _1234 = new Value(123.4); - + assert.strictEqual(_1234.toFloat(), 123.4); assert.strictEqual(_1234.__neg__().toFloat(), -123.4); - assert.strictEqual(new Value(' 123.4 xfx').toFloat(), 123.4); - assert.strictEqual(new Value(' 123.4 xfx').toFloat(), 123.4); - assert.strictEqual(new Value(' -123.4 xfx').toFloat(), -123.4); - assert.strictEqual(_1234.repr(), '123.4'); - assert.strictEqual(_1234.__neg__().repr(), '-123.4'); + assert.strictEqual(new Value(" 123.4 xfx").toFloat(), 123.4); + assert.strictEqual(new Value(" 123.4 xfx").toFloat(), 123.4); + assert.strictEqual(new Value(" -123.4 xfx").toFloat(), -123.4); + assert.strictEqual(_1234.repr(), "123.4"); + assert.strictEqual(_1234.__neg__().repr(), "-123.4"); }); - }); - - - diff --git a/logics-js/value.js b/logics-js/value.js index b0f4877..fbf3d3f 100644 --- a/logics-js/value.js +++ b/logics-js/value.js @@ -2,8 +2,8 @@ export default class Value { static maxStringLength = 32 * 1024; - #value; // private property: The native value in JavaScript - #type; // private property: Logics type name + #value; // private property: The native value in JavaScript + #type; // private property: Logics type name /** Constructs a Logics value from a native JS-value, or clones an existing Logics value. In case the native value is not JSON-serializable, an Exception is thrown. */ @@ -11,8 +11,7 @@ export default class Value { if (value instanceof Value) { this.#value = value.valueOf(); this.#type = value.type(); - } - else { + } else { this.#value = value; this.#type = this.constructor.type(value); } @@ -25,7 +24,7 @@ export default class Value { /// Returns the Logics value type; The type is cached in this.#type, for further usage. type() { - return this.#type || (this.#type = this.constructor.type(this.#value)) + return this.#type || (this.#type = this.constructor.type(this.#value)); } /// Determine Logics value type from a JavaScript native value @@ -57,8 +56,7 @@ export default class Value { } return "list"; - } - else if (value === null) { + } else if (value === null) { return "NoneType"; } @@ -87,25 +85,29 @@ export default class Value { return this.#value.toString(); case "str": - return "\"" + this.#value.toString().replace(/([\\"])/, "\\$1") + "\""; + return '"' + this.#value.toString().replace(/([\\"])/, "\\$1") + '"'; case "list": - return "[" + - this.#value.map( - item => { - if (!( item instanceof Value )) { + return ( + "[" + + this.#value + .map((item) => { + if (!(item instanceof Value)) { item = new Value(item); } - return item.repr() - } - ).join(", ") + "]"; + return item.repr(); + }) + .join(", ") + + "]" + ); case "dict": - return "{" + - Object.keys(this.#value).map( - key => { - if (!( key instanceof Value)) { + return ( + "{" + + Object.keys(this.#value) + .map((key) => { + if (!(key instanceof Value)) { key = new Value(key); } @@ -114,9 +116,11 @@ export default class Value { value = new Value(value); } - return key + ": " + value.repr() - } - ).join(", ") + "}"; + return key + ": " + value.repr(); + }) + .join(", ") + + "}" + ); default: throw new Error("Unimplemented repr for " + this.type()); @@ -167,8 +171,7 @@ export default class Value { if (type === "list") { return this.#value; - } - else if (type) { + } else if (type) { return [this.#value]; } @@ -181,8 +184,7 @@ export default class Value { if (type === "dict") { return this.#value; - } - else if (type) { + } else if (type) { let dict = {}; dict[this.#value] = this.#value; return dict; @@ -206,13 +208,12 @@ export default class Value { // Checks if a given value is part of another value __contains__(value) { if (value.type() === "dict") { - return value.valueOf()[this.toString()] !== undefined; // fixme: toString() conversion falsifies data - } - else if (value.type() === "list") { + return value.valueOf()[this.toString()] !== undefined; // fixme: toString() conversion falsifies data + } else if (value.type() === "list") { // We need to compare every item using __cmp__() - for(let item of value.valueOf()) { + for (let item of value.valueOf()) { item = new Value(item); - if(item.__cmp__(this) === 0) { + if (item.__cmp__(this) === 0) { return true; } } @@ -225,7 +226,8 @@ export default class Value { } // Index into value - __getitem__(key, until) { // todo: provide and use a Slice() class similar to Python (not an until value) + __getitem__(key, until) { + // todo: provide and use a Slice() class similar to Python (not an until value) if (this.type() === "dict") { console.assert(until === undefined, "Cannot slice into a dict"); return this.toDict()[key.toString()]; @@ -271,13 +273,12 @@ export default class Value { if (ak.length < bk.length) { return -1; - } - else if (ak.length > bk.length) { + } else if (ak.length > bk.length) { return 1; } - for( let k of ak ) { - if( typeof b[k] === "undefined" ) { + for (let k of ak) { + if (typeof b[k] === "undefined") { return 1; } @@ -299,12 +300,11 @@ export default class Value { if (a.length < b.length) { return -1; - } - else if (a.length > b.length) { + } else if (a.length > b.length) { return 1; } - for(let i = 0; i < a.length; i++) { + for (let i = 0; i < a.length; i++) { let av = new Value(a[i]); let bv = new Value(b[i]); @@ -320,12 +320,10 @@ export default class Value { else if (this.type() === "str" || other.type() === "str") { a = this.toString(); b = other.toString(); - } - else if (this.type() === "float" || other.type() === "float") { + } else if (this.type() === "float" || other.type() === "float") { a = this.toFloat(); b = other.toFloat(); - } - else { + } else { a = this.toInt(); b = other.toInt(); } @@ -333,8 +331,7 @@ export default class Value { // Perform final comparison if (a < b) { return -1; - } - else if (a > b) { + } else if (a > b) { return 1; } @@ -343,11 +340,11 @@ export default class Value { // Performs an add-operation with another Value object. __add__(op) { - if( this.type() === "str" || op.type() === "str" ) { + if (this.type() === "str" || op.type() === "str") { return new Value(this.toString() + op.toString()); } - if( this.type() === "float" || op.type() === "float" ) { + if (this.type() === "float" || op.type() === "float") { return new Value(this.toFloat() + op.toFloat()); } @@ -356,7 +353,7 @@ export default class Value { // Performs a sub-operation with another Value object. __sub__(op) { - if( this.type() === "float" || op.type() === "float" ) { + if (this.type() === "float" || op.type() === "float") { return new Value(this.toFloat() - op.toFloat()); } @@ -372,8 +369,7 @@ export default class Value { if (this.type() === "str") { repeat = this.toString(); count = op.toInt(); - } - else { + } else { repeat = op.toString(); count = this.toInt(); } @@ -386,7 +382,7 @@ export default class Value { return new Value(repeat.repeat(count)); } - if( this.type() === "float" || op.type() === "float" ) { + if (this.type() === "float" || op.type() === "float") { return new Value(this.toFloat() * op.toFloat()); } @@ -395,10 +391,10 @@ export default class Value { // Performs a div-operation with another Value object. __truediv__(op) { - if( this.type() === "float" || op.type() === "float" ) { + if (this.type() === "float" || op.type() === "float") { let divisor = op.toFloat(); if (divisor === 0.0) { - return new Value("#ERR:division by zero") + return new Value("#ERR:division by zero"); } return new Value(this.toFloat() / divisor); @@ -406,7 +402,7 @@ export default class Value { let divisor = op.toInt(); if (divisor === 0) { - return new Value("#ERR:division by zero") + return new Value("#ERR:division by zero"); } return new Value(this.toInt() / divisor); @@ -415,7 +411,7 @@ export default class Value { __floordiv__(op) { let divisor = op.toInt(); if (divisor === 0) { - return new Value("#ERR:division by zero") + return new Value("#ERR:division by zero"); } return new Value(Math.floor(this.toInt() / divisor)); @@ -423,17 +419,17 @@ export default class Value { // Performs a mod-operation with another Value object. __mod__(op) { - if( this.type() === "float" || op.type() === "float" ) { + if (this.type() === "float" || op.type() === "float") { let divisor = op.toFloat(); if (divisor === 0.0) { - return new Value("#ERR:modulo by zero") + return new Value("#ERR:modulo by zero"); } return new Value(this.toFloat() % divisor); } let divisor = op.toInt(); if (divisor === 0) { - return new Value("#ERR:modulo by zero") + return new Value("#ERR:modulo by zero"); } return new Value(this.toInt() % divisor); @@ -441,7 +437,7 @@ export default class Value { // Performs a mod-operation with another Value object. __pow__(op) { - if( this.type() === "float" || op.type() === "float" ) { + if (this.type() === "float" || op.type() === "float") { return new Value(this.toFloat() ** op.toFloat()); } @@ -450,24 +446,24 @@ export default class Value { // Performs unary plus __pos__() { - if (this.type() === "float") { - return new Value(+this.toFloat()); - } + if (this.type() === "float") { + return new Value(+this.toFloat()); + } - return new Value(+this.toInt()); + return new Value(+this.toInt()); } // Performs unary minus __neg__() { - if (this.type() === "float") { - return new Value(-this.toFloat()); - } + if (this.type() === "float") { + return new Value(-this.toFloat()); + } - return new Value(-this.toInt()); + return new Value(-this.toInt()); } // Performs unary complement __invert__() { - return new Value(~this.toInt()); + return new Value(~this.toInt()); } } diff --git a/logics-py/Pipfile b/logics-py/Pipfile index 9613ce3..995edf3 100644 --- a/logics-py/Pipfile +++ b/logics-py/Pipfile @@ -9,11 +9,13 @@ name = "pypi" twine = "*" build = "*" pytest = "*" +black = "*" [requires] python_version = "3.11" [scripts] +fmt = "bash -c 'python -m black **/*.py'" test = "python -m pytest -vvv" clean = "rm -rf dist build logics_py.egg-info" build = "bash -c 'cp ../README.md README.md; python -m build --wheel; rm README.md'" diff --git a/logics-py/Pipfile.lock b/logics-py/Pipfile.lock index 5a356a7..33f29af 100644 --- a/logics-py/Pipfile.lock +++ b/logics-py/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "92d7ffce5a2c7607ea649c36c4e4820d531192ef0041b6dfc99e9898ea39a7fc" + "sha256": "a4d0b102f90be1a328b4568d39aebbf9d4d875530e9138b9a6be4cb558c00e98" }, "pipfile-spec": 6, "requires": { @@ -17,6 +17,31 @@ }, "default": {}, "develop": { + "black": { + "hashes": [ + "sha256:0e232f24a337fed7a82c1185ae46c56c4a6167fb0fe37411b43e876892c76699", + "sha256:30b78ac9b54cf87bcb9910ee3d499d2bc893afd52495066c49d9ee6b21eee06e", + "sha256:31946ec6f9c54ed7ba431c38bc81d758970dd734b96b8e8c2b17a367d7908171", + "sha256:31b9f87b277a68d0e99d2905edae08807c007973eaa609da5f0c62def6b7c0bd", + "sha256:47c4510f70ec2e8f9135ba490811c071419c115e46f143e4dce2ac45afdcf4c9", + "sha256:481167c60cd3e6b1cb8ef2aac0f76165843a374346aeeaa9d86765fe0dd0318b", + "sha256:6901631b937acbee93c75537e74f69463adaf34379a04eef32425b88aca88a23", + "sha256:76baba9281e5e5b230c9b7f83a96daf67a95e919c2dfc240d9e6295eab7b9204", + "sha256:7fb5fc36bb65160df21498d5a3dd330af8b6401be3f25af60c6ebfe23753f747", + "sha256:960c21555be135c4b37b7018d63d6248bdae8514e5c55b71e994ad37407f45b8", + "sha256:a3c2ddb35f71976a4cfeca558848c2f2f89abc86b06e8dd89b5a65c1e6c0f22a", + "sha256:c870bee76ad5f7a5ea7bd01dc646028d05568d33b0b09b7ecfc8ec0da3f3f39c", + "sha256:d3d9129ce05b0829730323bdcb00f928a448a124af5acf90aa94d9aba6969604", + "sha256:db451a3363b1e765c172c3fd86213a4ce63fb8524c938ebd82919bf2a6e28c6a", + "sha256:e223b731a0e025f8ef427dd79d8cd69c167da807f5710add30cdf131f13dd62e", + "sha256:f20ff03f3fdd2fd4460b4f631663813e57dc277e37fb216463f3b907aa5a9bdd", + "sha256:f74892b4b836e5162aa0452393112a574dac85e13902c57dfbaaf388e4eda37c", + "sha256:f8dc7d50d94063cdfd13c82368afd8588bac4ce360e4224ac399e769d6704e98" + ], + "index": "pypi", + "markers": "python_version >= '3.8'", + "version": "==23.10.0" + }, "build": { "hashes": [ "sha256:538aab1b64f9828977f84bc63ae570b060a8ed1be419e7870b8b4fc5e6ea553b", @@ -188,6 +213,14 @@ "markers": "python_full_version >= '3.7.0'", "version": "==3.3.0" }, + "click": { + "hashes": [ + "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", + "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de" + ], + "markers": "python_version >= '3.7'", + "version": "==8.1.7" + }, "cryptography": { "hashes": [ "sha256:004b6ccc95943f6a9ad3142cfabcc769d7ee38a3f60fb0dddbfb431f818c3a67", @@ -297,6 +330,14 @@ "markers": "python_version >= '3.8'", "version": "==10.1.0" }, + "mypy-extensions": { + "hashes": [ + "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d", + "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.0" + }, "nh3": { "hashes": [ "sha256:116c9515937f94f0057ef50ebcbcc10600860065953ba56f14473ff706371873", @@ -326,6 +367,14 @@ "markers": "python_version >= '3.7'", "version": "==23.2" }, + "pathspec": { + "hashes": [ + "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20", + "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3" + ], + "markers": "python_version >= '3.7'", + "version": "==0.11.2" + }, "pkginfo": { "hashes": [ "sha256:4b7a555a6d5a22169fcc9cf7bfd78d296b0361adad412a346c1226849af5e546", @@ -334,6 +383,14 @@ "markers": "python_version >= '3.6'", "version": "==1.9.6" }, + "platformdirs": { + "hashes": [ + "sha256:cf8ee52a3afdb965072dcc652433e0c7e3e40cf5ea1477cd4b3b1d2eb75495b3", + "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e" + ], + "markers": "python_version >= '3.7'", + "version": "==3.11.0" + }, "pluggy": { "hashes": [ "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12", diff --git a/logics-py/logics/logics.py b/logics-py/logics/logics.py index 9bf97be..454347d 100644 --- a/logics-py/logics/logics.py +++ b/logics-py/logics/logics.py @@ -62,11 +62,7 @@ def __init__(self, src: str, debug: bool = False): self.ast.dump() @staticmethod - def lgx_range( - start: int, - end: int | None = None, - step: int | None = None - ) -> range: + def lgx_range(start: int, end: int | None = None, step: int | None = None) -> range: if step is not None: return tuple(range(int(start), int(end), int(step))) if end is not None: @@ -101,11 +97,7 @@ def lgx_currency( return ret.strip() @staticmethod - def lgx_replace( - value: str, - find: str | list[str] = " ", - replace: str = "" - ) -> str: + def lgx_replace(value: str, find: str | list[str] = " ", replace: str = "") -> str: # handle a list when passed to replace multiple strings if isinstance(find, list): for item in find: @@ -298,7 +290,7 @@ def _run(self, node: LogicsNode, stack: _Stack, values: dict): case "pos": stack.op1(lambda a: +a) case "pow": - stack.op2(lambda a, b: a ** b) + stack.op2(lambda a, b: a**b) case "index": stack.op2(lambda value, idx: value[idx]) case "load": diff --git a/logics-py/logics/parser.py b/logics-py/logics/parser.py index 7ce3aec..6c7283b 100644 --- a/logics-py/logics/parser.py +++ b/logics-py/logics/parser.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#-*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # Parser module generated by unicc from logics.par. # DO NOT EDIT THIS FILE MANUALLY, IT WILL GO AWAY! @@ -10,7 +10,7 @@ class LogicsNode(object): This is an AST node. """ - def __init__(self, emit = None, match = None, children = None): + def __init__(self, emit=None, match=None, children=None): self.emit = emit self.match = match self.children = children or [] @@ -34,12 +34,14 @@ class LogicsParseException(Exception): Exception to be raised on a parse error. """ - def __init__(self, row, col, txt = None): + def __init__(self, row, col, txt=None): if isinstance(txt, list): expecting = txt - txt = ("Line %d, column %d: Parse error, expecting %s" % - (row, col, ", ".join([("%r" % symbol[0]) - for symbol in txt]))) + txt = "Line %d, column %d: Parse error, expecting %s" % ( + row, + col, + ", ".join([("%r" % symbol[0]) for symbol in txt]), + ) else: expecting = None @@ -62,7 +64,6 @@ class LogicsParserToken(object): class LogicsParserControlBlock(object): def __init__(self, input): - # Stack self.stack = [] self.tos = None @@ -98,10 +99,7 @@ def __init__(self, input): self.column = 1 - - class LogicsParser(object): - # Actions _ERROR = 0 _REDUCE = 1 @@ -172,28 +170,28 @@ class LogicsParser(object): ("not", "", 0, False, False, True), ("and", "", 0, False, False, True), ("or", "", 0, False, False, True), - ("expression", "", 0, False, False, True) + ("expression", "", 0, False, False, True), ) _productions = ( - ("expression : or \"if\" expression \"else\" expression", "if", 5, 62), + ('expression : or "if" expression "else" expression', "if", 5, 62), ("expression : or", "", 1, 62), - ("or : or \"or\" and", "or", 3, 61), + ('or : or "or" and', "or", 3, 61), ("or : and", "", 1, 61), - ("and : and \"and\" not", "and", 3, 60), + ('and : and "and" not', "and", 3, 60), ("and : not", "", 1, 60), - ("not : \"not\" not", "not", 2, 59), + ('not : "not" not', "not", 2, 59), ("not : cmp", "", 1, 59), ("cmp : add_sub &embedded_1+", "cmp", 2, 58), - ("&embedded_1 : \"==\" add_sub", "eq", 2, 55), - ("&embedded_1 : \">\" add_sub", "gt", 2, 55), - ("&embedded_1 : \">=\" add_sub", "gteq", 2, 55), - ("&embedded_1 : \"<\" add_sub", "lt", 2, 55), - ("&embedded_1 : \"<=\" add_sub", "lteq", 2, 55), - ("&embedded_0 : \"!=\"", "", 1, 56), - ("&embedded_0 : \"<>\"", "", 1, 56), + ('&embedded_1 : "==" add_sub', "eq", 2, 55), + ('&embedded_1 : ">" add_sub', "gt", 2, 55), + ('&embedded_1 : ">=" add_sub', "gteq", 2, 55), + ('&embedded_1 : "<" add_sub', "lt", 2, 55), + ('&embedded_1 : "<=" add_sub', "lteq", 2, 55), + ('&embedded_0 : "!="', "", 1, 56), + ('&embedded_0 : "<>"', "", 1, 56), ("&embedded_1 : &embedded_0 add_sub", "neq", 2, 55), - ("&embedded_1 : \"in\" add_sub", "in", 2, 55), - ("&embedded_1 : \"not\" \"in\" add_sub", "outer", 3, 55), + ('&embedded_1 : "in" add_sub', "in", 2, 55), + ('&embedded_1 : "not" "in" add_sub', "outer", 3, 55), ("&embedded_1+ : &embedded_1+ &embedded_1", "", 2, 54), ("&embedded_1+ : &embedded_1", "", 1, 54), ("cmp : add_sub", "", 1, 58), @@ -202,10 +200,10 @@ class LogicsParser(object): ("add_sub : mul_div", "", 1, 57), ("mul_div : mul_div '*' unary", "mul", 3, 53), ("mul_div : mul_div '/' unary", "div", 3, 53), - ("mul_div : mul_div \"//\" unary", "idiv", 3, 53), + ('mul_div : mul_div "//" unary', "idiv", 3, 53), ("mul_div : mul_div '%' unary", "mod", 3, 53), ("mul_div : pow", "", 1, 53), - ("pow : pow \"**\" unary", "pow", 3, 51), + ('pow : pow "**" unary', "pow", 3, 51), ("pow : unary", "", 1, 51), ("unary : '+' unary", "pos", 2, 52), ("unary : '-' unary", "neg", 2, 52), @@ -223,10 +221,10 @@ class LogicsParser(object): ("trailer : '[' expression ']'", "index", 3, 48), ("trailer : '[' opt_expression ':' opt_expression ']'", "slice", 5, 48), ("trailer : '.' @Identifier", "attr", 2, 48), - ("atom : \"True\"", "", 1, 49), - ("atom : \"False\"", "", 1, 49), - ("atom : \"None\"", "", 1, 49), - ("atom : \"$\"", "vars", 1, 49), + ('atom : "True"', "", 1, 49), + ('atom : "False"', "", 1, 49), + ('atom : "None"', "", 1, 49), + ('atom : "$"', "vars", 1, 49), ("atom : @Number", "", 1, 49), ("atom : @Identifier", "load", 1, 49), ("atom : @String", "", 1, 49), @@ -234,7 +232,7 @@ class LogicsParser(object): ("String+ : @String", "", 1, 43), ("atom : String+", "strings", 1, 49), ("atom : '[' expression \"for\" @Identifier \"in\" or &embedded_2? ']'", "comprehension", 8, 49), - ("&embedded_2 : \"if\" expression", "", 2, 42), + ('&embedded_2 : "if" expression', "", 2, 42), ("&embedded_2? : &embedded_2", "", 1, 41), ("&embedded_2? : ", "", 0, 41), ("atom : '[' list ']'", "", 3, 49), @@ -246,132 +244,896 @@ class LogicsParser(object): ("internal_list : expression", "", 1, 40), ("internal_list : internal_list ',' expression", "", 3, 40), ("list : internal_list ,?", "list", 2, 46), - ("expression' : expression ~&eof", "", 2, 38) + ("expression' : expression ~&eof", "", 2, 38), ) _act = ( - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((31, 2, 17), ), - ((21, 1, 56), ), - ((0, 3, 71), ), - ((20, 2, 18), (18, 2, 19), ), - ((17, 2, 20), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((16, 2, 21), (15, 2, 22), (14, 2, 23), (13, 2, 24), (12, 2, 25), (11, 2, 26), (10, 3, 14), (9, 3, 15), (8, 2, 28), (37, 2, 30), (36, 2, 31), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((35, 2, 32), (34, 2, 33), (7, 2, 34), (33, 2, 35), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((6, 2, 36), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((29, 2, 38), (26, 2, 39), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((21, 3, 55), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((8, 2, 47), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((16, 2, 21), (15, 2, 22), (14, 2, 23), (13, 2, 24), (12, 2, 25), (11, 2, 26), (10, 3, 14), (9, 3, 15), (8, 2, 28), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((29, 2, 38), (26, 2, 39), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 3, 47), ), - ((30, 3, 67), (25, 2, 59), ), - ((1, 2, 60), ), - ((28, 3, 62), ), - ((25, 2, 61), ), - ((30, 3, 40), ), - ((19, 2, 62), ), - ((17, 2, 20), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((37, 2, 30), (36, 2, 31), ), - ((37, 2, 30), (36, 2, 31), ), - ((37, 2, 30), (36, 2, 31), ), - ((37, 2, 30), (36, 2, 31), ), - ((37, 2, 30), (36, 2, 31), ), - ((37, 2, 30), (36, 2, 31), ), - ((37, 2, 30), (36, 2, 31), ), - ((35, 2, 32), (34, 2, 33), (7, 2, 34), (33, 2, 35), ), - ((35, 2, 32), (34, 2, 33), (7, 2, 34), (33, 2, 35), ), - ((28, 3, 45), ), - ((27, 2, 64), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (30, 3, 63), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 66), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((37, 2, 30), (36, 2, 31), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((25, 2, 61), ), - ((8, 2, 69), ), - ((28, 3, 46), ), - ((30, 3, 64), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((20, 2, 71), (18, 2, 19), ), - ((23, 2, 1), (22, 3, 52), (21, 2, 2), (16, 2, 6), (37, 2, 8), (36, 2, 10), (32, 2, 12), (31, 2, 14), (29, 2, 15), (5, 3, 48), (4, 3, 49), (3, 3, 50), (2, 3, 51), ), - ((28, 3, 58), ) + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ((31, 2, 17),), + ((21, 1, 56),), + ((0, 3, 71),), + ( + (20, 2, 18), + (18, 2, 19), + ), + ((17, 2, 20),), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (16, 2, 21), + (15, 2, 22), + (14, 2, 23), + (13, 2, 24), + (12, 2, 25), + (11, 2, 26), + (10, 3, 14), + (9, 3, 15), + (8, 2, 28), + (37, 2, 30), + (36, 2, 31), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (35, 2, 32), + (34, 2, 33), + (7, 2, 34), + (33, 2, 35), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ((6, 2, 36),), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (29, 2, 38), + (26, 2, 39), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ((21, 3, 55),), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ((8, 2, 47),), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (16, 2, 21), + (15, 2, 22), + (14, 2, 23), + (13, 2, 24), + (12, 2, 25), + (11, 2, 26), + (10, 3, 14), + (9, 3, 15), + (8, 2, 28), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (29, 2, 38), + (26, 2, 39), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ((23, 3, 47),), + ( + (30, 3, 67), + (25, 2, 59), + ), + ((1, 2, 60),), + ((28, 3, 62),), + ((25, 2, 61),), + ((30, 3, 40),), + ((19, 2, 62),), + ((17, 2, 20),), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (37, 2, 30), + (36, 2, 31), + ), + ( + (37, 2, 30), + (36, 2, 31), + ), + ( + (37, 2, 30), + (36, 2, 31), + ), + ( + (37, 2, 30), + (36, 2, 31), + ), + ( + (37, 2, 30), + (36, 2, 31), + ), + ( + (37, 2, 30), + (36, 2, 31), + ), + ( + (37, 2, 30), + (36, 2, 31), + ), + ( + (35, 2, 32), + (34, 2, 33), + (7, 2, 34), + (33, 2, 35), + ), + ( + (35, 2, 32), + (34, 2, 33), + (7, 2, 34), + (33, 2, 35), + ), + ((28, 3, 45),), + ((27, 2, 64),), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (30, 3, 63), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ((23, 2, 66),), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (37, 2, 30), + (36, 2, 31), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ((25, 2, 61),), + ((8, 2, 69),), + ((28, 3, 46),), + ((30, 3, 64),), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ( + (20, 2, 71), + (18, 2, 19), + ), + ( + (23, 2, 1), + (22, 3, 52), + (21, 2, 2), + (16, 2, 6), + (37, 2, 8), + (36, 2, 10), + (32, 2, 12), + (31, 2, 14), + (29, 2, 15), + (5, 3, 48), + (4, 3, 49), + (3, 3, 50), + (2, 3, 51), + ), + ((28, 3, 58),), ) _go = ( - ((62, 2, 3), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), + ( + (62, 2, 3), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), (), (), (), (), (), - ((59, 3, 6), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((56, 2, 27), (55, 3, 20), (54, 2, 29), ), - ((52, 3, 32), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), + ( + (59, 3, 6), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (56, 2, 27), + (55, 3, 20), + (54, 2, 29), + ), + ( + (52, 3, 32), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), (), - ((52, 3, 33), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), + ( + (52, 3, 33), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), (), - ((52, 3, 34), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((48, 3, 39), (47, 2, 37), ), - ((62, 2, 40), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((62, 2, 41), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (46, 2, 42), (43, 2, 16), (40, 2, 43), ), + ( + (52, 3, 34), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (48, 3, 39), + (47, 2, 37), + ), + ( + (62, 2, 40), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (62, 2, 41), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (46, 2, 42), + (43, 2, 16), + (40, 2, 43), + ), (), - ((62, 3, 68), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (46, 3, 41), (45, 2, 44), (43, 2, 16), (40, 2, 43), ), - ((62, 2, 45), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((60, 2, 46), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((59, 3, 4), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), + ( + (62, 3, 68), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (46, 3, 41), + (45, 2, 44), + (43, 2, 16), + (40, 2, 43), + ), + ( + (62, 2, 45), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (60, 2, 46), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (59, 3, 4), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), (), - ((57, 2, 48), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((57, 2, 49), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((57, 2, 50), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((57, 2, 51), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((57, 2, 52), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((57, 2, 53), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((57, 2, 54), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((56, 2, 27), (55, 3, 19), ), - ((53, 2, 55), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((53, 2, 56), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((52, 3, 25), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((52, 3, 26), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((52, 3, 27), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((52, 3, 28), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((52, 3, 30), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((48, 3, 38), ), - ((62, 2, 57), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (44, 2, 58), (43, 2, 16), ), + ( + (57, 2, 48), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (57, 2, 49), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (57, 2, 50), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (57, 2, 51), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (57, 2, 52), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (57, 2, 53), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (57, 2, 54), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (56, 2, 27), + (55, 3, 19), + ), + ( + (53, 2, 55), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (53, 2, 56), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (52, 3, 25), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (52, 3, 26), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (52, 3, 27), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (52, 3, 28), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (52, 3, 30), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ((48, 3, 38),), + ( + (62, 2, 57), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (44, 2, 58), + (43, 2, 16), + ), (), (), (), (), - ((39, 3, 70), ), + ((39, 3, 70),), (), (), (), - ((57, 2, 63), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), + ( + (57, 2, 63), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), (), (), (), @@ -383,48 +1145,974 @@ class LogicsParser(object): (), (), (), - ((62, 3, 68), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), (40, 2, 65), ), + ( + (62, 3, 68), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + (40, 2, 65), + ), (), - ((62, 3, 69), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((62, 3, 0), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), + ( + (62, 3, 69), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (62, 3, 0), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), (), - ((62, 3, 43), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (44, 2, 67), (43, 2, 16), ), - ((39, 2, 68), ), + ( + (62, 3, 43), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (44, 2, 67), + (43, 2, 16), + ), + ((39, 2, 68),), (), (), (), - ((61, 2, 70), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - ((42, 3, 60), (41, 2, 72), ), - ((62, 3, 59), (61, 2, 4), (60, 2, 5), (59, 3, 5), (58, 3, 7), (57, 2, 7), (53, 2, 9), (52, 3, 31), (51, 2, 11), (50, 3, 35), (49, 2, 13), (43, 2, 16), ), - () + ( + (61, 2, 70), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + ( + (42, 3, 60), + (41, 2, 72), + ), + ( + (62, 3, 59), + (61, 2, 4), + (60, 2, 5), + (59, 3, 5), + (58, 3, 7), + (57, 2, 7), + (53, 2, 9), + (52, 3, 31), + (51, 2, 11), + (50, 3, 35), + (49, 2, 13), + (43, 2, 16), + ), + (), ) - _def_prod = (-1, 53, 54, -1, 1, 3, -1, 21, -1, 24, -1, 29, -1, 36, -1, -1, 57, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 37, 44, -1, -1, 68, -1, 66, -1, -1, 2, -1, 9, 10, 11, 12, 13, 16, 17, 22, 23, 43, -1, -1, -1, 65, -1, 18, 44, 66, -1, -1, -1, -1, 61, -1, -1) + _def_prod = ( + -1, + 53, + 54, + -1, + 1, + 3, + -1, + 21, + -1, + 24, + -1, + 29, + -1, + 36, + -1, + -1, + 57, + 42, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 8, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 37, + 44, + -1, + -1, + 68, + -1, + 66, + -1, + -1, + 2, + -1, + 9, + 10, + 11, + 12, + 13, + 16, + 17, + 22, + 23, + 43, + -1, + -1, + -1, + 65, + -1, + 18, + 44, + 66, + -1, + -1, + -1, + -1, + 61, + -1, + -1, + ) # Lexical analysis _dfa_select = () _dfa_index = ( - (0, 44, 53, 54, 58, 59, 60, 62, 65, 66, 69, 71, 73, 74, 75, 76, 78, 79, 80, 81, 82, 87, 92, 97, 98, 99, 100, 101, 102, 103, 104, 105, 110, 115, 120, 125, 130, 135, 140, 142, 149, 150, 152, 158, 165, 169, 174, 180, 187, 189, 196, 198, 205, 209, 215, 217, 224, 231, 238, 245, 252, 259, 266, 273, 280, 287, 294, 301, 308), + ( + 0, + 44, + 53, + 54, + 58, + 59, + 60, + 62, + 65, + 66, + 69, + 71, + 73, + 74, + 75, + 76, + 78, + 79, + 80, + 81, + 82, + 87, + 92, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 110, + 115, + 120, + 125, + 130, + 135, + 140, + 142, + 149, + 150, + 152, + 158, + 165, + 169, + 174, + 180, + 187, + 189, + 196, + 198, + 205, + 209, + 215, + 217, + 224, + 231, + 238, + 245, + 252, + 259, + 266, + 273, + 280, + 287, + 294, + 301, + 308, + ), + ) + _dfa_chars = ( + (111, 111), + (126, 126), + (9, 10), + (13, 13), + (32, 32), + (65, 69), + (71, 77), + (79, 83), + (85, 90), + (95, 95), + (98, 100), + (103, 104), + (106, 109), + (112, 122), + (110, 110), + (105, 105), + (102, 102), + (101, 101), + (97, 97), + (93, 93), + (91, 91), + (84, 84), + (78, 78), + (70, 70), + (62, 62), + (61, 61), + (60, 60), + (58, 58), + (48, 57), + (47, 47), + (46, 46), + (45, 45), + (44, 44), + (43, 43), + (42, 42), + (41, 41), + (40, 40), + (39, 39), + (37, 37), + (36, 36), + (35, 35), + (34, 34), + (33, 33), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 101), + (103, 109), + (111, 122), + (110, 110), + (102, 102), + (-1, -1), + (-1, -1), + (9, 10), + (13, 13), + (32, 32), + (-1, -1), + (-1, -1), + (-1, -1), + (61, 61), + (-1, -1), + (62, 62), + (61, 61), + (-1, -1), + (-1, -1), + (48, 57), + (46, 46), + (-1, -1), + (47, 47), + (-1, -1), + (48, 57), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (42, 42), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (61, 61), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 110), + (112, 122), + (111, 111), + (-1, -1), + (-1, -1), + (48, 57), + (-1, -1), + (92, 92), + (39, 39), + (0, 38), + (40, 91), + (93, 65535), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 113), + (115, 122), + (114, 114), + (-1, -1), + (10, 10), + (0, 9), + (11, 65535), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 122), + (-1, -1), + (92, 92), + (34, 34), + (0, 33), + (35, 91), + (93, 65535), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 107), + (109, 122), + (108, 108), + (-1, -1), + (61, 61), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 109), + (111, 122), + (110, 110), + (-1, -1), + (0, 65535), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 113), + (115, 122), + (114, 114), + (-1, -1), + (0, 9), + (11, 65535), + (10, 10), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (98, 122), + (97, 97), + (-1, -1), + (0, 65535), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 115), + (117, 122), + (116, 116), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 113), + (115, 122), + (114, 114), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 114), + (116, 122), + (115, 115), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 99), + (101, 122), + (100, 100), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 116), + (118, 122), + (117, 117), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 100), + (102, 122), + (101, 101), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 100), + (102, 122), + (101, 101), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 100), + (102, 122), + (101, 101), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 100), + (102, 122), + (101, 101), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 110), + (112, 122), + (111, 111), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 109), + (111, 122), + (110, 110), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 114), + (116, 122), + (115, 115), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 110), + (112, 122), + (111, 111), + (-1, -1), + (48, 57), + (65, 90), + (95, 95), + (97, 107), + (109, 122), + (108, 108), + (-1, -1), + ) + _dfa_trans = ( + 43, + 2, + 3, + 3, + 3, + 45, + 45, + 45, + 45, + 45, + 45, + 45, + 45, + 45, + 39, + 1, + 64, + 47, + 49, + 4, + 5, + 51, + 67, + 53, + 6, + 38, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 42, + 18, + 19, + 44, + 46, + 48, + -1, + 45, + 45, + 45, + 45, + 45, + 45, + 20, + 21, + -1, + -1, + 3, + 3, + 3, + -1, + -1, + -1, + 23, + -1, + 25, + 26, + -1, + -1, + 9, + 41, + -1, + 27, + -1, + 41, + -1, + -1, + -1, + -1, + 28, + -1, + -1, + -1, + -1, + -1, + 45, + 45, + 45, + 45, + -1, + 45, + 45, + 45, + 45, + -1, + 45, + 45, + 45, + 45, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 45, + 45, + 45, + 45, + -1, + 45, + 45, + 45, + 45, + -1, + 45, + 45, + 45, + 45, + -1, + 45, + 45, + 45, + 45, + -1, + 45, + 45, + 45, + 45, + -1, + 45, + 45, + 45, + 45, + -1, + 45, + 45, + 45, + 45, + -1, + 24, + -1, + 45, + 45, + 45, + 45, + 45, + 55, + -1, + -1, + 41, + -1, + 50, + 29, + 42, + 42, + 42, + -1, + 45, + 45, + 45, + 45, + 45, + 22, + -1, + 40, + 52, + 52, + -1, + 45, + 45, + 45, + 45, + -1, + 54, + 29, + 46, + 46, + 46, + -1, + 45, + 45, + 45, + 45, + 45, + 57, + -1, + 30, + -1, + 45, + 45, + 45, + 45, + 45, + 58, + -1, + 42, + -1, + 45, + 45, + 45, + 45, + 45, + 59, + -1, + 52, + 52, + 40, + -1, + 45, + 45, + 45, + 45, + 68, + -1, + 46, + -1, + 45, + 45, + 45, + 45, + 45, + 31, + -1, + 45, + 45, + 45, + 45, + 45, + 32, + -1, + 45, + 45, + 45, + 45, + 45, + 60, + -1, + 45, + 45, + 45, + 45, + 45, + 33, + -1, + 45, + 45, + 45, + 45, + 45, + 61, + -1, + 45, + 45, + 45, + 45, + 45, + 34, + -1, + 45, + 45, + 45, + 45, + 45, + 35, + -1, + 45, + 45, + 45, + 45, + 45, + 36, + -1, + 45, + 45, + 45, + 45, + 45, + 37, + -1, + 45, + 45, + 45, + 45, + 45, + 56, + -1, + 45, + 45, + 45, + 45, + 45, + 62, + -1, + 45, + 45, + 45, + 45, + 45, + 63, + -1, + 45, + 45, + 45, + 45, + 45, + 65, + -1, + 45, + 45, + 45, + 45, + 45, + 66, + -1, ) - _dfa_chars = ((111, 111), (126, 126), (9, 10), (13, 13), (32, 32), (65, 69), (71, 77), (79, 83), (85, 90), (95, 95), (98, 100), (103, 104), (106, 109), (112, 122), (110, 110), (105, 105), (102, 102), (101, 101), (97, 97), (93, 93), (91, 91), (84, 84), (78, 78), (70, 70), (62, 62), (61, 61), (60, 60), (58, 58), (48, 57), (47, 47), (46, 46), (45, 45), (44, 44), (43, 43), (42, 42), (41, 41), (40, 40), (39, 39), (37, 37), (36, 36), (35, 35), (34, 34), (33, 33), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 101), (103, 109), (111, 122), (110, 110), (102, 102), (-1, -1), (-1, -1), (9, 10), (13, 13), (32, 32), (-1, -1), (-1, -1), (-1, -1), (61, 61), (-1, -1), (62, 62), (61, 61), (-1, -1), (-1, -1), (48, 57), (46, 46), (-1, -1), (47, 47), (-1, -1), (48, 57), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (42, 42), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (61, 61), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 110), (112, 122), (111, 111), (-1, -1), (-1, -1), (48, 57), (-1, -1), (92, 92), (39, 39), (0, 38), (40, 91), (93, 65535), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 113), (115, 122), (114, 114), (-1, -1), (10, 10), (0, 9), (11, 65535), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 122), (-1, -1), (92, 92), (34, 34), (0, 33), (35, 91), (93, 65535), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 107), (109, 122), (108, 108), (-1, -1), (61, 61), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 109), (111, 122), (110, 110), (-1, -1), (0, 65535), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 113), (115, 122), (114, 114), (-1, -1), (0, 9), (11, 65535), (10, 10), (-1, -1), (48, 57), (65, 90), (95, 95), (98, 122), (97, 97), (-1, -1), (0, 65535), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 115), (117, 122), (116, 116), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 113), (115, 122), (114, 114), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 114), (116, 122), (115, 115), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 99), (101, 122), (100, 100), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 116), (118, 122), (117, 117), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 100), (102, 122), (101, 101), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 100), (102, 122), (101, 101), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 100), (102, 122), (101, 101), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 100), (102, 122), (101, 101), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 110), (112, 122), (111, 111), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 109), (111, 122), (110, 110), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 114), (116, 122), (115, 115), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 110), (112, 122), (111, 111), (-1, -1), (48, 57), (65, 90), (95, 95), (97, 107), (109, 122), (108, 108), (-1, -1)) - _dfa_trans = (43, 2, 3, 3, 3, 45, 45, 45, 45, 45, 45, 45, 45, 45, 39, 1, 64, 47, 49, 4, 5, 51, 67, 53, 6, 38, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 42, 18, 19, 44, 46, 48, -1, 45, 45, 45, 45, 45, 45, 20, 21, -1, -1, 3, 3, 3, -1, -1, -1, 23, -1, 25, 26, -1, -1, 9, 41, -1, 27, -1, 41, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 45, 45, 45, 45, -1, 24, -1, 45, 45, 45, 45, 45, 55, -1, -1, 41, -1, 50, 29, 42, 42, 42, -1, 45, 45, 45, 45, 45, 22, -1, 40, 52, 52, -1, 45, 45, 45, 45, -1, 54, 29, 46, 46, 46, -1, 45, 45, 45, 45, 45, 57, -1, 30, -1, 45, 45, 45, 45, 45, 58, -1, 42, -1, 45, 45, 45, 45, 45, 59, -1, 52, 52, 40, -1, 45, 45, 45, 45, 68, -1, 46, -1, 45, 45, 45, 45, 45, 31, -1, 45, 45, 45, 45, 45, 32, -1, 45, 45, 45, 45, 45, 60, -1, 45, 45, 45, 45, 45, 33, -1, 45, 45, 45, 45, 45, 61, -1, 45, 45, 45, 45, 45, 34, -1, 45, 45, 45, 45, 45, 35, -1, 45, 45, 45, 45, 45, 36, -1, 45, 45, 45, 45, 45, 37, -1, 45, 45, 45, 45, 45, 56, -1, 45, 45, 45, 45, 45, 62, -1, 45, 45, 45, 45, 45, 63, -1, 45, 45, 45, 45, 45, 65, -1, 45, 45, 45, 45, 45, 66, -1) _dfa_accept = ( - (0, 24, 33, 25, 29, 30, 15, 13, 28, 23, 35, 27, 37, 26, 38, 36, 31, 32, 34, 3, 9, 21, 19, 14, 16, 10, 12, 8, 7, 22, 11, 17, 2, 18, 20, 6, 4, 5, 0, 24, 25, 23, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24), + ( + 0, + 24, + 33, + 25, + 29, + 30, + 15, + 13, + 28, + 23, + 35, + 27, + 37, + 26, + 38, + 36, + 31, + 32, + 34, + 3, + 9, + 21, + 19, + 14, + 16, + 10, + 12, + 8, + 7, + 22, + 11, + 17, + 2, + 18, + 20, + 6, + 4, + 5, + 0, + 24, + 25, + 23, + 0, + 24, + 0, + 24, + 0, + 24, + 0, + 24, + 0, + 24, + 0, + 24, + 0, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + ), ) # Parsing actions - - # Parsing algorithm def _get_act(self, pcb): # Get action table entry # Check action table first - for (sym, pcb.act, pcb.idx) in self._act[pcb.tos.state]: + for sym, pcb.act, pcb.idx in self._act[pcb.tos.state]: if sym == pcb.sym: - return True if pcb.act else False #enforced parse error + return True if pcb.act else False # enforced parse error # Otherwise, apply default production pcb.idx = self._def_prod[pcb.tos.state] @@ -437,7 +2125,7 @@ def _get_act(self, pcb): def _get_go(self, pcb): # Get goto table entry - for (sym, pcb.act, pcb.idx) in self._go[pcb.tos.state]: + for sym, pcb.act, pcb.idx in self._go[pcb.tos.state]: if sym == pcb.lhs: return True @@ -471,7 +2159,7 @@ def _get_input(self, pcb, offset): pcb.buf += ch - #print("_get_input", pcb.buf, offset, pcb.buf[offset], ord(pcb.buf[offset])) + # print("_get_input", pcb.buf, offset, pcb.buf[offset], ord(pcb.buf[offset])) return ord(pcb.buf[offset]) @@ -479,16 +2167,15 @@ def _clear_input(self, pcb): # Purge input from buffer that is not necessary anymore if pcb.buf: - # Perform position counting. - for ch in pcb.buf[0: pcb.len]: - if ch == '\n': + for ch in pcb.buf[0 : pcb.len]: + if ch == "\n": pcb.line += 1 pcb.column = 0 else: pcb.column += 1 - pcb.buf = pcb.buf[pcb.len:] + pcb.buf = pcb.buf[pcb.len :] pcb.len = 0 pcb.sym = -1 @@ -509,9 +2196,7 @@ def _lex(self, pcb): state = -1 while self._dfa_chars[idx][0] > -1: - if (next >= self._dfa_chars[idx][0] - and next <= self._dfa_chars[idx][1]): - + if next >= self._dfa_chars[idx][0] and next <= self._dfa_chars[idx][1]: length += 1 state = self._dfa_trans[idx] @@ -536,7 +2221,7 @@ def _lex(self, pcb): # TODO: Semantic Terminal Selection? - #print("_lex", pcb.sym, pcb.len) + # print("_lex", pcb.sym, pcb.len) def _get_sym(self, pcb): # Get lookahead symbol @@ -568,7 +2253,7 @@ def _get_sym(self, pcb): return pcb.sym > -1 - def parse(self, s = None): + def parse(self, s=None): if s is None: try: s = raw_input(">") @@ -582,19 +2267,18 @@ def parse(self, s = None): pcb.stack.append(pcb.tos) while True: - #print("state = %d" % pcb.tos.state) + # print("state = %d" % pcb.tos.state) # Reduce while pcb.act & self._REDUCE: - # Set default left-hand side pcb.lhs = self._productions[pcb.idx][3] - #print("REDUCE", pcb.idx, self._productions[pcb.idx][0]) - #print("state", pcb.tos.state) + # print("REDUCE", pcb.idx, self._productions[pcb.idx][0]) + # print("state", pcb.tos.state) # Call reduce function - #print("CALL", "_reduce_action_%d" % pcb.idx) + # print("CALL", "_reduce_action_%d" % pcb.idx) reduce_fn = getattr(self, "_reduce_action_%d" % pcb.idx, None) if reduce_fn: reduce_fn(pcb) @@ -618,9 +2302,8 @@ def parse(self, s = None): # Handle AST nodes if self._productions[pcb.idx][1]: - #print("%s = %s" % (self._productions[pcb.idx][0], self._productions[pcb.idx][1])) - node = LogicsNode(self._productions[pcb.idx][1], - children=cnodes) + # print("%s = %s" % (self._productions[pcb.idx][0], self._productions[pcb.idx][1])) + node = LogicsNode(self._productions[pcb.idx][1], children=cnodes) else: node = None @@ -633,7 +2316,7 @@ def parse(self, s = None): if pcb.lhs == 38 and len(pcb.stack) == 1: pcb.tos.node = node or cnodes self._clear_input(pcb) - pcb.act = self._SUCCESS; + pcb.act = self._SUCCESS break self._get_go(pcb) @@ -654,22 +2337,21 @@ def parse(self, s = None): # Get next input symbol self._get_sym(pcb) - #print("pcb.sym = %d (%s)" % (pcb.sym, self._symbols[pcb.sym][0])) - #print("pcb.len = %d" % pcb.len) + # print("pcb.sym = %d (%s)" % (pcb.sym, self._symbols[pcb.sym][0])) + # print("pcb.len = %d" % pcb.len) # Get action table entry if not self._get_act(pcb): # TODO: Error Recovery - raise LogicsParseException(pcb.line, pcb.column, - [self._symbols[sym] - for (sym, pcb.act, pcb.idx) - in self._act[pcb.tos.state]]) + raise LogicsParseException( + pcb.line, pcb.column, [self._symbols[sym] for (sym, pcb.act, pcb.idx) in self._act[pcb.tos.state]] + ) - #print("pcb.act = %d" % pcb.act) + # print("pcb.act = %d" % pcb.act) # Shift if pcb.act & self._SHIFT: - #print("SHIFT", pcb.sym, self._symbols[pcb.sym]) + # print("SHIFT", pcb.sym, self._symbols[pcb.sym]) pcb.tos = LogicsParserToken() pcb.stack.append(pcb.tos) @@ -686,7 +2368,7 @@ def parse(self, s = None): pcb.tos.column = pcb.column if pcb.stack[-1 - 0].value is None: - pcb.stack[-1 - 0].value = pcb.buf[:pcb.len] + pcb.stack[-1 - 0].value = pcb.buf[: pcb.len] if pcb.tos.symbol[1]: pcb.tos.node = LogicsNode(pcb.tos.symbol[1], pcb.stack[-1 - 0].value) @@ -709,7 +2391,6 @@ def parse(self, s = None): return pcb.ret or node - if __name__ == "__main__": import sys diff --git a/logics-py/logics/value.py b/logics-py/logics/value.py index e4ddc16..f15c4e5 100644 --- a/logics-py/logics/value.py +++ b/logics-py/logics/value.py @@ -106,13 +106,7 @@ def replace_escape(m): class Value: - def __init__( - self, - value=None, - allow=(int, bool, float, list, tuple, dict, str), - default=None, - optimize=True - ): + def __init__(self, value=None, allow=(int, bool, float, list, tuple, dict, str), default=None, optimize=True): if value is None: self.value = None elif isinstance(value, Value): @@ -124,12 +118,7 @@ def __init__( self.value = _ERR_MAX_STRING_LENGTH @staticmethod - def align( - value, - allow=(int, bool, float, list, tuple, dict, str), - default=None, - optimize=True - ): + def align(value, allow=(int, bool, float, list, tuple, dict, str), default=None, optimize=True): assert allow # allow must not be empty! if optimize: diff --git a/logics-py/pyproject.toml b/logics-py/pyproject.toml index eeb23eb..8bfcf5b 100644 --- a/logics-py/pyproject.toml +++ b/logics-py/pyproject.toml @@ -6,3 +6,6 @@ requires = [ [tool.pytest.ini_options] pythonpath = "." + +[tool.black] +line-length = 120 diff --git a/logics-py/tests/test_logics.py b/logics-py/tests/test_logics.py index bbfbff6..baf657b 100644 --- a/logics-py/tests/test_logics.py +++ b/logics-py/tests/test_logics.py @@ -34,5 +34,3 @@ def test_testcase(input): last_result = Logics(line).run(variables) assert last_result is None, f"{last_result=} unverified" - -