diff --git a/src/lib/Playground/PlaygroundSyntax.svelte b/src/lib/Playground/PlaygroundSyntax.svelte index 6e0b6e2d..85cfd2bf 100644 --- a/src/lib/Playground/PlaygroundSyntax.svelte +++ b/src/lib/Playground/PlaygroundSyntax.svelte @@ -3,10 +3,12 @@ import TextAreaInput from "../UI/GUI/TextAreaInput.svelte"; import { risuChatParser } from 'src/ts/parser'; import { language } from 'src/lang'; + import { sleep } from 'src/ts/util'; let input = ""; let output = ""; const onInput = async () => { try { + await sleep(1) output = risuChatParser(input, { consistantChar: true, }) diff --git a/src/ts/parser.ts b/src/ts/parser.ts index 25f9df0d..d08d4c61 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -956,7 +956,11 @@ const matcher = (p1:string,matcherArg:matcherArg) => { const agmts = arra.slice(2) let current = arra[1] for(const arg of agmts){ - current = JSON.parse(current)[arg] + const parsed = JSON.parse(current) + if(parsed === null || (typeof(parsed) !== 'object' && !Array.isArray(parsed))){ + return 'null' + } + current = parsed[arg] if(!current){ return 'null' }