lezer 0.1.0 copy "lezer: ^0.1.0" to clipboard
lezer: ^0.1.0 copied to clipboard

Dart port of Lezer - an incremental GLR parser system for CodeMirror.

Lezer for Dart #

pub package melos

A pure Dart port of Lezer - the incremental GLR parser system that powers CodeMirror 6.

Features #

  • Incremental parsing - Only re-parses changed portions of the document
  • Error recovery - Produces meaningful parse trees even for invalid input
  • Efficient - Optimized for real-time editing scenarios
  • Tree structure - Provides a concrete syntax tree for syntax highlighting and code analysis

Usage #

import 'package:lezer/lezer.dart';

// Parse source code using a language parser
final tree = parser.parse('const x = 42;');

// Traverse the tree
tree.iterate(
  enter: (node) {
    print('${node.name}: ${source.substring(node.from, node.to)}');
    return true;
  },
);

Language Support #

This package provides the core parsing infrastructure. Language-specific parsers are provided by the codemirror package which includes:

  • JavaScript/TypeScript/JSX/TSX
  • JSON
  • Markdown
  • HTML/CSS
  • And more...

License #

MIT License - see LICENSE for details.

Based on Lezer by Marijn Haverbeke.

0
likes
150
points
57
downloads

Publisher

unverified uploader

Weekly Downloads

Dart port of Lezer - an incremental GLR parser system for CodeMirror.

Repository (GitHub)
View/report issues

Topics

#parser #syntax-highlighting #incremental-parsing #codemirror

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on lezer