go-parser 0.1.5

The parser of the Goscript project.
Documentation
  • Coverage
  • 0.89%
    5 out of 564 items documented1 out of 163 items with examples
  • Size
  • Source code size: 208.52 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 29.48 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • oxfeeefeee/goscript
    1547 60 2
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • oxfeeefeee

This crate is part of the Goscript project. Please refer to https://goscript.dev for more information.

It's a port of the the parser from the Go standard library https://github.com/golang/go/tree/release-branch.go1.12/src/go/parser

Usage:

fn parse_file() {
    let source = "package main ...";
    let mut fs = go_parser::FileSet::new();
    let o = &mut go_parser::AstObjects::new();
    let el = &mut go_parser::ErrorList::new();
    let (p, _) = go_parser::parse_file(o, &mut fs, el, "./main.go", source, false);
    print!("{}", p.get_errors());
}

Feature

  • btree_map: Make it use BTreeMap instead of HashMap