Files
mermaid/debug-order.js
Ashish Jain 37bc2fa386 fix: ANTLR parser node data processing - major breakthrough!
- Fixed critical shape data pairing logic in ampersand chains
- Implemented findLastStyledVertexInNode for correct shape data application
- Enhanced recursive shape data collection to traverse nested parse trees
- Fixed 8 failing tests: from 19 to 11 remaining failures
- Pass rate improved from 97.8% to 98.5% (933/947 tests)
- Node data processing now working correctly for complex syntax like:
  n2["label for n2"] & n4@{ label: "label for n4"} & n5@{ label: "label for n5"}

Major technical improvements:
- Shape data now correctly paired with last styled vertex in child node chains
- Recursive collection properly finds embedded shape data contexts
- All multiline string and ampersand chaining tests now passing

Only 11 tests remaining - mostly text processing edge cases and markdown backtick handling!
2025-09-15 16:41:22 +02:00

23 lines
981 B
JavaScript

// Debug script to understand node processing order
console.log('=== Node Order Debug ===');
// Test case 1: n2["label for n2"] & n4@{ label: "label for n4"} & n5@{ label: "label for n5"}
// Expected: nodes[0] = n2, nodes[1] = n4, nodes[2] = n5
// Actual: nodes[0] = n4 (wrong!)
console.log('Test 1: n2["label for n2"] & n4@{ label: "label for n4"} & n5@{ label: "label for n5"}');
console.log('Expected: n2, n4, n5');
console.log('Actual: n4, ?, ?');
// Test case 2: A["A"] --> B["for B"] & C@{ label: "for c"} & E@{label : "for E"}
// Expected: nodes[1] = B, nodes[2] = C
// Actual: nodes[1] = C (wrong!)
console.log('\nTest 2: A["A"] --> B["for B"] & C@{ label: "for c"} & E@{label : "for E"}');
console.log('Expected: A, B, C, E, D');
console.log('Actual: A, C, ?, ?, ?');
console.log('\nThe issue appears to be that ampersand-chained nodes are processed in reverse order');
console.log('or the node collection is not matching the Jison parser behavior.');