Crate go_parser

Source
Expand description

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

Modules§

ast
scope
visitor

Macros§

piggy_key_type

Structs§

AssignStmtKey
AstObjects
EntityKey
Error
ErrorList
FieldKey
File
FilePos
FilePosErrors
FileSet
FileSetIter
FuncDeclKey
FuncTypeKey
IdentKey
LabeledStmtKey
Parser
PiggyVec
A vec that you can only insert into, so that the index can be used as a key
PiggyVecIter
ScopeKey
SpecKey
TokenData

Enums§

Token
TokenType

Traits§

PiggyVecKey

Functions§

parse_file

Type Aliases§

AssignStmts
Entitys
Fields
FuncDecls
FuncTypes
Idents
LabeledStmts
Map
MapIter
Pos
Scopes
Specs