lexer_builder 0.1.1 copy "lexer_builder: ^0.1.1" to clipboard
lexer_builder: ^0.1.1 copied to clipboard

Generate lexer code from regular expression rules.

lexer_builder #

A lexer generator for dart.

Features #

  • Match tokens using RegExp syntax.
  • Rules dependent on lexer state.
  • Generates lexer code automatically.

Caveats #

  • Generated lexers using regex are likely slower than handwritten ones.

Getting started #

Include lexer_builder and build_runner as dev_dependencies and lexer_builder_runtime in your pubspec.yml.

Usage #

Annotate a class with Lexer() and methods in it with Rule() to define a lexer. See the example for detailed instructions.

TODO #

  • Eventually generate custom code for the rules instead of using RegExp internally.
  • Support async lexing with that by accurately measuring partly-matched subgroups, dispatching a rule if the next character doesn't make any match longer.

Additional information #

For more information about lexers in general, see the flex lexer generator and its documentation.

1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Generate lexer code from regular expression rules.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

analyzer, build, collection, lexer_builder_runtime, source_gen

More

Packages that depend on lexer_builder