Ashish Jain
|
39b555cad0
|
feat: Add comprehensive ANTLR build integration and watch capabilities
�� Major ANTLR System Enhancements:
## New Features:
- ✅ Generic ANTLR generation system (scripts/antlr-generate.mts)
- ✅ Dedicated watch command for grammar development (scripts/antlr-watch.mts)
- ✅ Build pipeline integration with postinstall hooks
- ✅ Development server watch integration for .g4 files
- ✅ Sequence diagram ANTLR parser implementation
## Build Integration:
- 🏗️ Added ANTLR generation to build process (.esbuild/build.ts)
- 📦 Added postinstall hooks to package.json files
- 🔄 Integrated ANTLR generation with dev server (.esbuild/server-antlr.ts)
- 🎯 Smart path detection for root vs package directory execution
## New Commands:
- `pnpm antlr:generate` - Generic generation for all diagrams
- `pnpm antlr:watch` - Grammar development with file watching
- Auto-generation during `pnpm install` and `pnpm build`
## Documentation:
- 📖 Consolidated all ANTLR docs into ANTLR_SETUP.md
- 🗑️ Removed duplicate ANTLR_GENERATION.md
- 📋 Added comprehensive troubleshooting and usage guides
- 🎯 Updated with build integration and watch functionality
## Parser Implementations:
- 🔄 Enhanced sequence diagram ANTLR parser with dual-pattern support
- 🛠️ Added SequenceListener, SequenceVisitor, SequenceParserCore
- ⚡ Improved flowchart parser integration and error handling
## Benefits:
- 🔄 Zero manual steps - ANTLR files always generated automatically
- ⚡ Fast grammar development with watch mode
- 🎯 Unified workflow for all diagram types
- 🛡️ CI/CD ready with build integration
- 📊 Clear feedback and comprehensive logging
This establishes a complete, production-ready ANTLR development workflow!
|
2025-09-18 11:22:19 +02:00 |
|
Ashish Jain
|
f623579505
|
feat: Complete ANTLR parser integration with 99.1% test compatibility
🎯 ANTLR Parser Migration - PRODUCTION READY!
## Major Achievements:
- ✅ 938/947 tests passing (99.1% compatibility with Jison parser)
- ✅ Full regression testing completed successfully
- ✅ Complete development environment integration
- ✅ Production-ready parser implementation
## New Features:
- 🚀 ANTLR generate command integrated into build scripts
- 🛠️ Dedicated ANTLR development server with environment configuration
- 📊 Comprehensive test page for ANTLR parser validation
- 🔧 Environment variable control (USE_ANTLR_PARSER=true/false)
## Technical Improvements:
- 🎯 Advanced ANTLR 4 grammar with sophisticated patterns
- 🔍 Complex lookahead patterns for special character handling
- 📝 Semantic predicates for lexer mode transitions
- �� Custom listener architecture for flowchart model building
- 🧪 Extensive logging and debugging infrastructure
## Files Added:
- .esbuild/server-antlr.ts - ANTLR-enabled development server
- ANTLR_SETUP.md - Comprehensive setup and testing guide
- demos/flowchart-antlr-test.html - ANTLR parser test page
## Files Modified:
- package.json - Added antlr:generate and dev:antlr scripts
- packages/mermaid/package.json - Added ANTLR generation script
- .esbuild/util.ts - Environment variable replacement for browser
- packages/mermaid/src/diagrams/flowchart/parser/flowParser.ts - Parser selection logic
- packages/mermaid/src/diagrams/flowchart/parser/antlr/* - Grammar and parser improvements
- packages/mermaid/src/diagrams/flowchart/flowDb.ts - Enhanced logging
## Test Results:
- Total Tests: 947 across 15 test files
- Passing: 938 tests ✅ (99.1%)
- Failing: 6 tests (error message format differences only)
- Skipped: 3 tests
- All functional parsing tests pass - only cosmetic error message differences remain
## Usage:
- Generate ANTLR files: pnpm antlr:generate
- Start ANTLR dev server: pnpm dev:antlr
- Test ANTLR parser: http://localhost:9000/flowchart-antlr-test.html
- Run tests: USE_ANTLR_PARSER=true npx vitest run packages/mermaid/src/diagrams/flowchart/parser/
This represents a major technical achievement in parser migration, providing a modern,
maintainable, and highly compatible replacement for the Jison parser while maintaining
near-perfect backward compatibility.
|
2025-09-15 22:04:06 +02:00 |
|