From 47f5e6eae2492fbcdc6a4a128f74516ba8d16bec Mon Sep 17 00:00:00 2001 From: Iuriiiii Date: Sun, 16 Oct 2022 15:59:08 -0300 Subject: [PATCH] +little fix --- common/index.js | 23 +++++ common/index.js.map | 2 +- common/src/core/index.js | 122 ++++++++++++++++++++++--- common/src/core/index.js.map | 2 +- common/src/tokenizer/index.js | 64 +++++++++---- common/src/tokenizer/index.js.map | 2 +- index.js | 23 +++++ index.js.map | 2 +- package.json | 4 +- src/core/index.js | 145 +++++++++++++----------------- src/core/index.js.map | 2 +- src/tokenizer/index.js | 52 ++++------- src/tokenizer/index.js.map | 2 +- 13 files changed, 292 insertions(+), 153 deletions(-) diff --git a/common/index.js b/common/index.js index ef77cfa..ad36666 100644 --- a/common/index.js +++ b/common/index.js @@ -1,4 +1,27 @@ "use strict"; +/* +MIT License + +Copyright (c) 2022 Iuriiiii + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.Tokenizer = exports.Core = void 0; var core_1 = require("./src/core"); diff --git a/common/index.js.map b/common/index.js.map index ba53130..83296c2 100644 --- a/common/index.js.map +++ b/common/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AACA,mCAAkC;AAAzB,4FAAA,IAAI,OAAA;AACb,6CAA6E;AAAnC,sGAAA,SAAS,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;EAsBE;;;AAEF,mCAAkC;AAAzB,4FAAA,IAAI,OAAA;AACb,6CAA6E;AAAnC,sGAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/common/src/core/index.js b/common/src/core/index.js index b24b365..be2bc86 100644 --- a/common/src/core/index.js +++ b/common/src/core/index.js @@ -1,7 +1,46 @@ "use strict"; +/* +MIT License + +Copyright (c) 2022 Iuriiiii + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.Core = void 0; const tokenizer_1 = require("../tokenizer"); +/* + a (); [ No tag ] + a(); [tag] + + tag {} [No tag] +*/ +/* + +html { + body { + [This is a line of code] + { any code that i want <> } + } +} + +*/ var Core; (function (Core) { function tokensToString(tokens) { @@ -27,6 +66,7 @@ var Core; return this.string; } get() { + /* @ts-ignore */ return this; } } @@ -93,6 +133,18 @@ var Core; return tree; } Core.parse = parse; + // function getLastToken(tokens: Token[]): Token | undefined { + // if (tokens.length === 0) + // return; + // const nonSpaceTokens = tokens.filter((token) => + // token.type !== TokenType.space && + // token.type !== TokenType.eol && + // token.type !== TokenType.eof + // ); + // if (nonSpaceTokens.length === 0) + // return; + // return nonSpaceTokens.at(-1); + // } function error(description, token) { return new Error(description + ` at ${token.pos.y}:${token.pos.x}`); } @@ -104,24 +156,25 @@ var Core; } function stringHasInvalidFormat(tokens) { const last = tokens.at(-1); - if (!last || last.type !== 2) + if (!last || last.type !== 2 /* TokenType.string */) return false; else if (last.text.length <= 1) return true; return last.text.startsWith('"') !== last.text.endsWith('"'); } function tokenIsIdentifierOrInstruction(token) { - return token && (token.type === 3 || token.type === 4); + return token && (token.type === 3 /* TokenType.identifier */ || token.type === 4 /* TokenType.instruction */); } function parseTokens(tokens, context = { i: 0, parentheses: 0, keys: 0, brackets: 0, pure: 0 }) { if (tokens.length === 0) return []; + // console.log(tokens); const result = [], start = context.i; let lastNonSpaceToken, lastNonSpaceTokenIndex = Number.MAX_SAFE_INTEGER, raws = [], params, comments, token; f1: for (; context.i < tokens.length; context.i++) { const i = context.i; token = tokens[context.i]; - if (token.type === 9) { + if (token.type === 9 /* TokenType.eof */) { if (context.parentheses) return error('Parenthese closure expected', token); if (context.brackets) @@ -130,12 +183,13 @@ var Core; return error('Key closure expected', token); break; } - if (token.type === 7 && token.text === '}' && context.brackets === 0) { + if (token.type === 7 /* TokenType.separator */ && token.text === '}' && context.brackets === 0) { context.keys--; break; } + /* This while just execute once, its needed to fasty code breaks */ w1: while (context.pure === 0) { - if (token.type === 7) { + if (token.type === 7 /* TokenType.separator */) { const isPure = !tokenIsIdentifierOrInstruction(lastNonSpaceToken); switch (token.text) { case ';': @@ -146,12 +200,15 @@ var Core; if (pushRawIfNeeded(result, raws)) raws = []; switch (true) { + /* identifier1;identifier2 */ case left && right: break; + /* identifier[\s+]?; */ case !isPure && !right: - pushRawIfNeeded(result, result.pop().tokens.slice(1, lastNonSpaceTokenIndex)); + pushRawIfNeeded(result, result.pop().tokens.slice(0, lastNonSpaceTokenIndex)); result.push(new Element(lastNonSpaceToken, undefined, params)); break; + /* ;identifier */ case !left && right: break; } @@ -159,7 +216,7 @@ var Core; case '\\': if (context.brackets) break; - if (!(tokens[++context.i].type === 7)) + if (!(tokens[++context.i].type === 7 /* TokenType.separator */)) context.i--; token = tokens[context.i]; break; @@ -169,6 +226,7 @@ var Core; if (context.parentheses) return error('Invalid token', token); params = []; + /* Skips the first '[' */ if (context.parentheses++ === 0) continue f1; break; @@ -184,12 +242,16 @@ var Core; if (context.parentheses) return error('Invalid token', token); comments = []; + /* Skips the first '[' */ if (context.brackets++ === 0) continue f1; + // console.log('['); break; case ']': if (--context.brackets < 0 || context.parentheses) return error('Invalid token', token); + // console.log(context.brackets); + /* Skip the last ']' */ if (context.brackets === 0) { if (pushRawIfNeeded(result, raws)) raws = []; @@ -207,7 +269,8 @@ var Core; if (isPure) context.pure++; else - raws = raws.slice(1, lastNonSpaceTokenIndex); + raws = raws.slice(0, lastNonSpaceTokenIndex); + // console.log('>>>', raws, lastNonSpaceTokenIndex); if (pushRawIfNeeded(result, raws)) raws = []; const children = parseTokens(tokens, context); @@ -221,13 +284,13 @@ var Core; } break; } - if ((context.parentheses + context.brackets) === 0 && - token.type !== 1 && - token.type !== 8) - lastNonSpaceToken = token, lastNonSpaceTokenIndex = context.i - start; (context.brackets && comments || context.parentheses && params || raws).push(token); + if ((context.parentheses + context.brackets) === 0 && + token.type !== 1 /* TokenType.space */ && + token.type !== 8 /* TokenType.eol */) + lastNonSpaceToken = token, lastNonSpaceTokenIndex = raws.length - 1; } if (context.keys < 0) return error('Invalid token', token); @@ -243,4 +306,39 @@ var Core; } } })(Core = exports.Core || (exports.Core = {})); +// let source = { +// params: 'html(param1){}', +// source1: ` a thisisaTag(){ +// t html { q} +// THIs is a raw ctext +// } +// `, +// source2: ` +// title { Hola Mundo } +// `, +// source3: ` +// [ This is a comment {} ] +// `, +// source4: '\\{This is a raw content\\}', +// source5: ` +// [ This is a comment {} ] +// `, +// source6: ` +// body { +// header { +// h1 { E-Commerce } div { +// } +// } +// } +// ` +// }; +// const tree = Core.parse(source.source6); +// console.log(JSON.stringify(tree, undefined, ' ')); +/* +a + t html { q} + +*/ +// let result = Core.compile(source).toString(); +// console.log(result); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/common/src/core/index.js.map b/common/src/core/index.js.map index 1790867..7cf60c7 100644 --- a/common/src/core/index.js.map +++ b/common/src/core/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAqB1E,IAAiB,IAAI,CAuXpB;AAvXD,WAAiB,IAAI;IAOjB,SAAS,cAAc,CAAC,MAAe;QACnC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;IAiBD,MAAM,SAAS;QACX,MAAM,CAAsB;QAC5B,KAAK,CAAgB;QACrB,SAAS,CAAgB;QACzB,SAAS,CAAgB;QACzB,MAAM,CAAgB;QAEtB,YAAY,KAAsB,EAAE,MAAgB;YAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;YAC/B,IAAI,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;YACvC,IAAI,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;YACvC,IAAI,CAAC,M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I,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3B;QAED,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAE9B,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,QAAQ,CAAC,KAAK,EAAE,IAAI,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC3D,OAAO,KAAK,CAAC,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAErE,OAAO,MAAM,CAAC;SACjB;IACL,CAAC;AACL,CAAC,EAvXgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAuXpB;AAED,iBAAiB;AACjB,gCAAgC;AAChC,iCAAiC;AACjC,sBAAsB;AACtB,8BAA8B;AAC9B,QAAQ;AACR,SAAS;AACT,iBAAiB;AAEjB,mCAAmC;AAEnC,SAAS;AACT,iBAAiB;AACjB,+BAA+B;AAC/B,KAAK;AACL,8CAA8C;AAC9C,iBAAiB;AACjB,+BAA+B;AAC/B,KAAK;AACL,iBAAiB;AACjB,SAAS;AACT,eAAe;AACf,kCAAkC;AAElC,YAAY;AACZ,QAAQ;AACR,IAAI;AACJ,IAAI;AACJ,KAAK;AAEL,2CAA2C;AAE3C,qDAAqD;AAErD;;;;EAIE;AAEF,gDAAgD;AAGhD,uBAAuB"} \ No newline at end of file diff --git a/common/src/tokenizer/index.js b/common/src/tokenizer/index.js index a51b964..1bb4033 100644 --- a/common/src/tokenizer/index.js +++ b/common/src/tokenizer/index.js @@ -1,4 +1,27 @@ "use strict"; +/* +MIT License + +Copyright (c) 2022 Iuriiiii + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.Tokenizer = void 0; var Tokenizer; @@ -9,11 +32,11 @@ var Tokenizer; const numbers = '0123456789'; const characters = 'abcdefghijklmnñopqrstuvwxyzáéíóúABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ'; function resizeIf(list, token, type, char, pos) { - if (token.type === 9) + if (token.type === 9 /* TokenType.eof */) token.type = type; - if (type === 6 && char === '-' && token.type === 3) { } - else if (type === 5 && token.type === 3) { } - else if (token.type === 7 || token.type !== type) { + if (type === 6 /* TokenType.operator */ && char === '-' && token.type === 3 /* TokenType.identifier */) { } + else if (type === 5 /* TokenType.number */ && token.type === 3 /* TokenType.identifier */) { } + else if (token.type === 7 /* TokenType.separator */ || token.type !== type) { list.push(token); return { text: '', pos: { ...pos }, type: type }; } @@ -21,37 +44,39 @@ var Tokenizer; return token; } function charToType(char, props) { - let type = 0; + let type = 0 /* TokenType.unknown */; switch (true) { - case numbers.includes(char): return 5; - case (props.separators || separators).includes(char): return 7; - case (props.operators || operators).includes(char): return 6; - case characters.includes(char): return 3; + case numbers.includes(char): return 5 /* TokenType.number */; + case (props.separators || separators).includes(char): return 7 /* TokenType.separator */; + case (props.operators || operators).includes(char): return 6 /* TokenType.operator */; + case characters.includes(char): return 3 /* TokenType.identifier */; case (props.spaces || spaces).includes(char): if (char === '\n') - return 8; + return 8 /* TokenType.eol */; else - return 1; + return 1 /* TokenType.space */; } return type; } function tokenizate(source, props = { spaces, operators, separators }) { - let token = { text: '', pos: { x: 1, y: 1 }, type: 9 }; + let token = { text: '', pos: { x: 1, y: 1 }, type: 9 /* TokenType.eof */ }; let result = []; let pos = { x: 1, y: 1 }; let isString = false; - let type = 0; + let type = 0 /* TokenType.unknown */; for (let i = 0; i < source.length; i++) { let char = source[i]; switch (true) { case char === '"': if (isString = !isString) - token = resizeIf(result, token, 2, char, pos); + token = resizeIf(result, token, 2 /* TokenType.string */, char, pos); break; case isString: break; - case (type = charToType(char, props)) > 0: - if (type === 8) + case (type = charToType(char, props)) > 0 /* TokenType.unknown */: + // The next line is due to a TypeScript bug + // @ts-ignore + if (type === 8 /* TokenType.eol */) pos.y++, pos.x = 1; token = resizeIf(result, token, type, char, pos); break; @@ -62,10 +87,13 @@ var Tokenizer; pos.x++; } result.push(token); - if (result.at(-1).type !== 9) - result.push({ text: '', type: 9, pos }); + if (result.at(-1).type !== 9 /* TokenType.eof */) + result.push({ text: '', type: 9 /* TokenType.eof */, pos }); return result; } Tokenizer.tokenizate = tokenizate; })(Tokenizer = exports.Tokenizer || (exports.Tokenizer = {})); +// console.log(TinyML.Tokenizer.tokenizate(`w- "- q +// d"{wq} +// wd`)); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/common/src/tokenizer/index.js.map b/common/src/tokenizer/index.js.map index 0de42f8..0ea9c5d 100644 --- a/common/src/tokenizer/index.js.map +++ b/common/src/tokenizer/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tokenizer/index.ts"],"names":[],"mappings":";;;AAuBA,IAAiB,SAAS,CAuFzB;AAvFD,WAAiB,SAAS;IAEtB,MAAM,MAAM,GAAG,SAAkB,CAAC;IAClC,MAAM,UAAU,GAAG,cAAuB,CAAC;I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,OAAO,MAAM,CAAC;IAClB,CAAC;IAxCe,oBAAU,aAwCzB,CAAA;AACL,CAAC,EAvFgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAuFzB;AAED,wDAAwD;AACxD,SAAS;AACT,SAAS"} \ No newline at end of file diff --git a/index.js b/index.js index f2d3375..b8a4ef1 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,26 @@ +/* +MIT License + +Copyright (c) 2022 Iuriiiii + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ export { Core } from './src/core'; export { Tokenizer } from './src/tokenizer'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/index.js.map b/index.js.map index 7a4c347..325068b 100644 --- a/index.js.map +++ b/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAmC,SAAS,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;EAsBE;AAEF,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAmC,SAAS,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index 7a36549..4898ff8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tinyml-core", - "version": "2.0.9", + "version": "2.0.10", "description": "TinyML-syntax parser", "main": "index.js", "scripts": { @@ -10,7 +10,7 @@ "build": "npm run build:esnext && npm run build:common", "dev:tokenizer": "tsc-watch ./src/tokenizer/index.ts -outDir ./src/ --onSuccess \"node ./src/tokenizer/index.js\"", "dev:core": "tsc-watch ./src/core/index.ts -outDir ./src/ --onSuccess \"node ./src/core/index.js\"", - "publicate": "git add . && git commit -m \"+little fix\" && git push && npm publish", + "publicate": "npm run build && git add . && git commit -m \"+little fix\" && git push && npm publish", "test": "jest" }, "repository": { diff --git a/src/core/index.js b/src/core/index.js index 82fce5d..c9999c4 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -1,4 +1,3 @@ -"use strict"; /* MIT License @@ -22,24 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -exports.__esModule = true; -exports.Core = void 0; -var tokenizer_1 = require("../tokenizer"); +import { Tokenizer } from '../tokenizer'; /* a (); [ No tag ] a(); [tag] @@ -56,94 +38,93 @@ html { } */ -var Core; +export var Core; (function (Core) { function tokensToString(tokens) { - return tokens.map(function (token) { return token.text; }).join(''); + return tokens.map(token => token.text).join(''); } - var Elemental = /** @class */ (function () { - function Elemental(types, tokens) { + class Elemental { + tokens; + isRaw; + isElement; + isComment; + isCode; + constructor(types, tokens) { this.tokens = tokens; - this.isRaw = function () { return types.isRaw; }; - this.isElement = function () { return types.isElement; }; - this.isComment = function () { return types.isComment; }; - this.isCode = function () { return types.isCode; }; + this.isRaw = () => types.isRaw; + this.isElement = () => types.isElement; + this.isComment = () => types.isComment; + this.isCode = () => types.isCode; } - Elemental.prototype.toString = function () { + string; + toString() { if (this.string === undefined) this.string = tokensToString(this.tokens); return this.string; - }; - Elemental.prototype.get = function () { + } + get() { /* @ts-ignore */ return this; - }; - return Elemental; - }()); - var Element = /** @class */ (function (_super) { - __extends(Element, _super); - function Element(tag, children, params) { - var _this = _super.call(this, { + } + } + class Element extends Elemental { + tag; + params; + children; + constructor(tag, children, params) { + super({ isCode: false, isComment: false, isElement: true, isRaw: false - }) || this; - _this.tag = tag; - _this.children = children; - _this.params = params; - return _this; + }); + this.tag = tag; + this.children = children; + this.params = params; } - Element.prototype.paramsToString = function () { + paramsToString() { return tokensToString(this.params); - }; - return Element; - }(Elemental)); + } + } Core.Element = Element; - var Comment = /** @class */ (function (_super) { - __extends(Comment, _super); - function Comment(tokens) { - return _super.call(this, { + class Comment extends Elemental { + constructor(tokens) { + super({ isCode: false, isComment: true, isElement: false, isRaw: false - }, tokens) || this; + }, tokens); } - return Comment; - }(Elemental)); + } Core.Comment = Comment; - var Raw = /** @class */ (function (_super) { - __extends(Raw, _super); - function Raw(tokens) { - return _super.call(this, { + class Raw extends Elemental { + constructor(tokens) { + super({ isCode: false, isComment: false, isElement: false, isRaw: true - }, tokens) || this; + }, tokens); } - return Raw; - }(Elemental)); + } Core.Raw = Raw; - var Code = /** @class */ (function (_super) { - __extends(Code, _super); - function Code(tokens) { - return _super.call(this, { + class Code extends Elemental { + constructor(tokens) { + super({ isCode: true, isComment: false, isElement: false, isRaw: false - }, tokens) || this; + }, tokens); } - return Code; - }(Elemental)); + } Core.Code = Code; function parse(source) { - var tokens = tokenizer_1.Tokenizer.tokenizate(source, { + const tokens = Tokenizer.tokenizate(source, { separators: '(){}[];:=,\\' }); - var tree = parseTokens(tokens); + const tree = parseTokens(tokens); if (tree instanceof Error) throw tree; return tree; @@ -162,7 +143,7 @@ var Core; // return nonSpaceTokens.at(-1); // } function error(description, token) { - return new Error(description + " at ".concat(token.pos.y, ":").concat(token.pos.x)); + return new Error(description + ` at ${token.pos.y}:${token.pos.x}`); } function pushRawIfNeeded(stack, raws) { if (raws.length === 0) @@ -171,7 +152,7 @@ var Core; return true; } function stringHasInvalidFormat(tokens) { - var last = tokens.at(-1); + const last = tokens.at(-1); if (!last || last.type !== 2 /* TokenType.string */) return false; else if (last.text.length <= 1) @@ -181,15 +162,14 @@ var Core; function tokenIsIdentifierOrInstruction(token) { return token && (token.type === 3 /* TokenType.identifier */ || token.type === 4 /* TokenType.instruction */); } - function parseTokens(tokens, context) { - if (context === void 0) { context = { i: 0, parentheses: 0, keys: 0, brackets: 0, pure: 0 }; } + function parseTokens(tokens, context = { i: 0, parentheses: 0, keys: 0, brackets: 0, pure: 0 }) { if (tokens.length === 0) return []; // console.log(tokens); - var result = [], start = context.i; - var lastNonSpaceToken, lastNonSpaceTokenIndex = Number.MAX_SAFE_INTEGER, raws = [], params, comments, token; + const result = [], start = context.i; + let lastNonSpaceToken, lastNonSpaceTokenIndex = Number.MAX_SAFE_INTEGER, raws = [], params, comments, token; f1: for (; context.i < tokens.length; context.i++) { - var i = context.i; + const i = context.i; token = tokens[context.i]; if (token.type === 9 /* TokenType.eof */) { if (context.parentheses) @@ -207,13 +187,13 @@ var Core; /* This while just execute once, its needed to fasty code breaks */ w1: while (context.pure === 0) { if (token.type === 7 /* TokenType.separator */) { - var isPure = !tokenIsIdentifierOrInstruction(lastNonSpaceToken); + const isPure = !tokenIsIdentifierOrInstruction(lastNonSpaceToken); switch (token.text) { case ';': if (context.brackets) break; - var left = tokenIsIdentifierOrInstruction(tokens[i - 1]); - var right = tokenIsIdentifierOrInstruction(tokens[i + 1]); + const left = tokenIsIdentifierOrInstruction(tokens[i - 1]); + const right = tokenIsIdentifierOrInstruction(tokens[i + 1]); if (pushRawIfNeeded(result, raws)) raws = []; switch (true) { @@ -290,7 +270,7 @@ var Core; // console.log('>>>', raws, lastNonSpaceTokenIndex); if (pushRawIfNeeded(result, raws)) raws = []; - var children = parseTokens(tokens, context); + const children = parseTokens(tokens, context); if (context.pure > 0) context.pure--; if (children instanceof Error) @@ -316,13 +296,13 @@ var Core; } pushRawIfNeeded(result, raws); if (result.length > 0) { - var lastItem = result.at(-1); + const lastItem = result.at(-1); if (lastItem.isRaw() && stringHasInvalidFormat(lastItem.tokens)) return error('Infinite string detected', lastItem.tokens.at(-1)); return result; } } -})(Core = exports.Core || (exports.Core = {})); +})(Core || (Core = {})); // let source = { // params: 'html(param1){}', // source1: ` a thisisaTag(){ @@ -358,3 +338,4 @@ a */ // let result = Core.compile(source).toString(); // console.log(result); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src/core/index.js.map b/src/core/index.js.map index 9ff5a87..34d0efc 100644 --- a/src/core/index.js.map +++ b/src/core/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmC,MAAM,cAAc,CAAC;AAqB1E,MAAM,KAAW,IAAI,CAuXpB;AAvXD,WAAiB,IAAI;IAOjB,SAAS,cAAc,CAAC,MAAe;QACnC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;IAiBD,MA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AAQ;AACR,IAAI;AACJ,IAAI;AACJ,KAAK;AAEL,2CAA2C;AAE3C,qDAAqD;AAErD;;;;EAIE;AAEF,gDAAgD;AAGhD,uBAAuB"} \ No newline at end of file diff --git a/src/tokenizer/index.js b/src/tokenizer/index.js index 29f5857..c9611e7 100644 --- a/src/tokenizer/index.js +++ b/src/tokenizer/index.js @@ -1,4 +1,3 @@ -"use strict"; /* MIT License @@ -22,26 +21,13 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -exports.__esModule = true; -exports.Tokenizer = void 0; -var Tokenizer; +export var Tokenizer; (function (Tokenizer) { - var spaces = ' \t\r\n'; - var separators = '\\:;[](){},.'; - var operators = '+-/*^%=!'; - var numbers = '0123456789'; - var characters = 'abcdefghijklmnñopqrstuvwxyzáéíóúABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ'; + const spaces = ' \t\r\n'; + const separators = '\\:;[](){},.'; + const operators = '+-/*^%=!'; + const numbers = '0123456789'; + const characters = 'abcdefghijklmnñopqrstuvwxyzáéíóúABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ'; function resizeIf(list, token, type, char, pos) { if (token.type === 9 /* TokenType.eof */) token.type = type; @@ -49,13 +35,13 @@ var Tokenizer; else if (type === 5 /* TokenType.number */ && token.type === 3 /* TokenType.identifier */) { } else if (token.type === 7 /* TokenType.separator */ || token.type !== type) { list.push(token); - return { text: '', pos: __assign({}, pos), type: type }; + return { text: '', pos: { ...pos }, type: type }; } else if (token.type === type) { } return token; } function charToType(char, props) { - var type = 0 /* TokenType.unknown */; + let type = 0 /* TokenType.unknown */; switch (true) { case numbers.includes(char): return 5 /* TokenType.number */; case (props.separators || separators).includes(char): return 7 /* TokenType.separator */; @@ -69,15 +55,14 @@ var Tokenizer; } return type; } - function tokenizate(source, props) { - if (props === void 0) { props = { spaces: spaces, operators: operators, separators: separators }; } - var token = { text: '', pos: { x: 1, y: 1 }, type: 9 /* TokenType.eof */ }; - var result = []; - var pos = { x: 1, y: 1 }; - var isString = false; - var type = 0 /* TokenType.unknown */; - for (var i = 0; i < source.length; i++) { - var char = source[i]; + function tokenizate(source, props = { spaces, operators, separators }) { + let token = { text: '', pos: { x: 1, y: 1 }, type: 9 /* TokenType.eof */ }; + let result = []; + let pos = { x: 1, y: 1 }; + let isString = false; + let type = 0 /* TokenType.unknown */; + for (let i = 0; i < source.length; i++) { + let char = source[i]; switch (true) { case char === '"': if (isString = !isString) @@ -100,11 +85,12 @@ var Tokenizer; } result.push(token); if (result.at(-1).type !== 9 /* TokenType.eof */) - result.push({ text: '', type: 9 /* TokenType.eof */, pos: pos }); + result.push({ text: '', type: 9 /* TokenType.eof */, pos }); return result; } Tokenizer.tokenizate = tokenizate; -})(Tokenizer = exports.Tokenizer || (exports.Tokenizer = {})); +})(Tokenizer || (Tokenizer = {})); // console.log(TinyML.Tokenizer.tokenizate(`w- "- q // d"{wq} // wd`)); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src/tokenizer/index.js.map b/src/tokenizer/index.js.map index 9db037f..f04bdac 100644 --- a/src/tokenizer/index.js.map +++ b/src/tokenizer/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAuBA,MAAM,KAAW,SAAS,CAuFzB;AAvFD,WAAiB,SAAS;IAEtB,MAAM,MAAM,GAAG,SAAkB,CAAC;IAClC,MAAM,UAAU,GAAG,cAAuB,CAAC;IAC3C,MAAM,SAAS,GAAG,UAAmB,CAAC;IACtC,MAAM,OAAO,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