mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-07 17:46:44 +02:00
22 lines
654 B
JavaScript
22 lines
654 B
JavaScript
// Test the actual lexer to see what tokens are generated
|
|
import { FlowchartLexer } from './packages/mermaid/src/diagrams/flowchart/parser/flowLexer.ts';
|
|
|
|
const testInputs = ['A', 'A-->B', 'graph TD;A-->B;', '-->', 'A-', '>B'];
|
|
|
|
console.log('Testing actual lexer:');
|
|
testInputs.forEach((input) => {
|
|
console.log(`\nInput: "${input}"`);
|
|
try {
|
|
const result = FlowchartLexer.tokenize(input);
|
|
if (result.errors.length > 0) {
|
|
console.log('Errors:', result.errors);
|
|
}
|
|
console.log(
|
|
'Tokens:',
|
|
result.tokens.map((t) => [t.image, t.tokenType.name])
|
|
);
|
|
} catch (error) {
|
|
console.log('Error:', error.message);
|
|
}
|
|
});
|