mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
flow-chev-edges.spec.js going through
This commit is contained in:
21
test-lexer.mjs
Normal file
21
test-lexer.mjs
Normal file
@@ -0,0 +1,21 @@
|
||||
// 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);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user