source_parser

This is an API designed to parse dart code and generate an intuitive tree for editing dart source code directly. It will open a text file (typically a .dart file) and parse it according to the dart grammar (v2.2).

NOTE: The format the parser outputs is syntactically the same as as any code parsed, but it will almost certainly change the format. It is not recommended to use this this parser to overwrite any files you may have written by hand (it will remove all comments).

Getting Started

The project is written in Dart, and can be imported as a standard Dart library. Thus, simply add it to your pubspec.yaml like so:

dependencies:
  source_parser: ^1.1.2

Then import it into whatever code you are using by importing:

import 'package:source_parser/source_parser.dart';

Prerequisites

The only prerequisite should be Dart version >=2.2.0

License

This project is licensed under the BSD 3-Clause "New" or "Revised" License - see the LICENSE.md file for details

Libraries

lexer
source_parser