Skip to content

Commit

Permalink
Tools(extract): log tokenizer error (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Feb 1, 2024
1 parent 9d16c3c commit 5427ac7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/qwik-speak/tools/core/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,18 @@ export function parseSequenceExpressions(code: string, alias: string): CallExpre

const indexes = findIndexes(code, alias);

let tokens: Token[] = [];
for (const i of indexes) {
const tokens = tokenize(code, i);
try {
tokens = tokenize(code, i);
} catch (ex: any) {
// Report tokenizer
console.error(ex);
console.error('\n\x1b[31mQwik Speak Tokenizer error\x1b[0m\n%s',
code.substring(i, i + 100) + ' [...]' +
'\n');
}

if (tokens.length > 0) {
try {
const callExpression = parse(tokens, code, alias);
Expand Down

0 comments on commit 5427ac7

Please sign in to comment.