sway-parse 0.71.0

Sway's parser
Documentation
1
2
3
4
5
6
7
8
9
use sway_ast::{attribute::Annotated, Module};
use sway_features::ExperimentalFeatures;
use sway_parse::parse_file as sway_parse_parse_file;

pub fn parse_file(src: &str) -> Option<Annotated<Module>> {
    let handler = <_>::default();
    let path = None;
    sway_parse_parse_file(&handler, src.into(), path, ExperimentalFeatures::default()).ok()
}