diff --git a/dist/main/index.js b/dist/main/index.js index 4712361..00b9ace 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -230,7 +230,7 @@ let U=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;let j=/^[+- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function sliceAndTrimEndOf(r,i,s,a){let l=r.slice(i,s);let c=l.indexOf("#");if(c>-1){skipComment(r,c);l=l.slice(0,c)}let p=l.trimEnd();if(!a){let s=l.indexOf("\n",p.length);if(s>-1){throw new TomlError("newlines are not allowed in inline tables",{toml:r,ptr:i+s})}}return[p,c]}function extractValue(r,i,s){let a=r[i];if(a==="["||a==="{"){let[l,c]=a==="["?parseArray(r,i):parseInlineTable(r,i);let p=skipUntil(r,c,",",s);if(s==="}"){let i=indexOfNewline(r,c,p);if(i>-1){throw new TomlError("newlines are not allowed in inline tables",{toml:r,ptr:i})}}return[l,p]}let l;if(a==='"'||a==="'"){l=getStringEnd(r,i);let a=parseString(r,i,l);if(s){l=skipVoid(r,l,s!=="]");if(r[l]&&r[l]!==","&&r[l]!==s&&r[l]!=="\n"&&r[l]!=="\r"){throw new TomlError("unexpected character encountered",{toml:r,ptr:l})}l+=+(r[l]===",")}return[a,l]}l=skipUntil(r,i,",",s);let c=sliceAndTrimEndOf(r,i,l-+(r[l-1]===","),s==="]");if(!c[0]){throw new TomlError("incomplete key-value declaration: no value specified",{toml:r,ptr:i})}if(s&&c[1]>-1){l=skipVoid(r,i+c[1]);l+=+(r[l]===",")}return[parseValue(c[0],r,i),l]} +function sliceAndTrimEndOf(r,i,s,a){let l=r.slice(i,s);let c=l.indexOf("#");if(c>-1){skipComment(r,c);l=l.slice(0,c)}let p=l.trimEnd();if(!a){let s=l.indexOf("\n",p.length);if(s>-1){throw new TomlError("newlines are not allowed in inline tables",{toml:r,ptr:i+s})}}return[p,c]}function extractValue(r,i,s,a){if(a===0){throw new TomlError("document contains excessively nested structures. aborting.",{toml:r,ptr:i})}let l=r[i];if(l==="["||l==="{"){let[c,p]=l==="["?parseArray(r,i,a):parseInlineTable(r,i,a);let u=skipUntil(r,p,",",s);if(s==="}"){let i=indexOfNewline(r,p,u);if(i>-1){throw new TomlError("newlines are not allowed in inline tables",{toml:r,ptr:i})}}return[c,u]}let c;if(l==='"'||l==="'"){c=getStringEnd(r,i);let a=parseString(r,i,c);if(s){c=skipVoid(r,c,s!=="]");if(r[c]&&r[c]!==","&&r[c]!==s&&r[c]!=="\n"&&r[c]!=="\r"){throw new TomlError("unexpected character encountered",{toml:r,ptr:c})}c+=+(r[c]===",")}return[a,c]}c=skipUntil(r,i,",",s);let p=sliceAndTrimEndOf(r,i,c-+(r[c-1]===","),s==="]");if(!p[0]){throw new TomlError("incomplete key-value declaration: no value specified",{toml:r,ptr:i})}if(s&&p[1]>-1){c=skipVoid(r,i+p[1]);c+=+(r[c]===",")}return[parseValue(p[0],r,i),c]} /*! * Copyright (c) Squirrel Chat et al., All rights reserved. * SPDX-License-Identifier: BSD-3-Clause @@ -258,7 +258,7 @@ function sliceAndTrimEndOf(r,i,s,a){let l=r.slice(i,s);let c=l.indexOf("#");if(c * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -let z=/^[a-zA-Z0-9-_]+[ \t]*$/;function parseKey(r,i,s="="){let a=i-1;let l=[];let c=r.indexOf(s,i);if(c<0){throw new TomlError("incomplete key-value: cannot find end of key",{toml:r,ptr:i})}do{let p=r[i=++a];if(p!==" "&&p!=="\t"){if(p==='"'||p==="'"){if(p===r[i+1]&&p===r[i+2]){throw new TomlError("multiline strings are not allowed in keys",{toml:r,ptr:i})}let u=getStringEnd(r,i);if(u<0){throw new TomlError("unfinished string encountered",{toml:r,ptr:i})}a=r.indexOf(".",u);let d=r.slice(u,a<0||a>c?c:a);let A=indexOfNewline(d);if(A>-1){throw new TomlError("newlines are not allowed in keys",{toml:r,ptr:i+a+A})}if(d.trimStart()){throw new TomlError("found extra tokens after the string part",{toml:r,ptr:u})}if(cc?c:a);if(!z.test(s)){throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys",{toml:r,ptr:i})}l.push(s.trimEnd())}}}while(a+1&&ac?c:a);let A=indexOfNewline(d);if(A>-1){throw new TomlError("newlines are not allowed in keys",{toml:r,ptr:i+a+A})}if(d.trimStart()){throw new TomlError("found extra tokens after the string part",{toml:r,ptr:u})}if(cc?c:a);if(!z.test(s)){throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys",{toml:r,ptr:i})}l.push(s.trimEnd())}}}while(a+1&&a