Skip to content

Commit

Permalink
feat: log parser errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Bikossor committed Jul 19, 2022
1 parent c5e200a commit 5451ac3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Codestain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { NodeType } from "./enums";
export const Codestain = (language: InputLanguage, input: string) => {
const parser = createParser(language);
// TODO: remove type cast in the future
const ast = parser.parse(input).result as unknown as Array<
[NodeType, string]
>;
const parsedInput = parser.parse(input);

if (parsedInput.isError) console.error(parsedInput.errorMessage);

const transformer = createTransformer("HTML");
const output = transformer.transform(ast);
const output = transformer.transform(
parsedInput.result as unknown as Array<[NodeType, string]>,
);

return output;
};

0 comments on commit 5451ac3

Please sign in to comment.