3 releases

0.1.2 Nov 27, 2023
0.1.1 Nov 27, 2023
0.1.0 Nov 27, 2023

#225 in Build Utils

Download history 36/week @ 2024-01-01 40/week @ 2024-01-08 36/week @ 2024-01-15 267/week @ 2024-01-22 58/week @ 2024-01-29 266/week @ 2024-02-05 97/week @ 2024-02-12 89/week @ 2024-02-19 188/week @ 2024-02-26 429/week @ 2024-03-04 132/week @ 2024-03-11 203/week @ 2024-03-18 608/week @ 2024-03-25 1360/week @ 2024-04-01 452/week @ 2024-04-08 373/week @ 2024-04-15

2,826 downloads per month

Apache-2.0

26KB
728 lines

Lossless parser for Makefiles

This crate provides a lossless parser for makefiles, creating a modifiable CST.

Example:


let mf = Makefile::read("Makefile").unwrap();

println!("Rules in the makefile: {:?}", mf.rules().map(|r| r.targets().join(" ")).collect::<Vec<_>>());

lib.rs:

A lossless parser for Makefiles

Example:

use std::io::Read;
let contents = r#"PYTHON = python3

.PHONY: all

all: build

build:
	$(PYTHON) setup.py build
"#;
let makefile: makefile_lossless::Makefile = contents.parse().unwrap();

assert_eq!(makefile.rules().count(), 3);

Dependencies

~1MB
~15K SLoC