Expand description
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);Structs§
- Archive
Member - An AST node for $ast
- Archive
Members - An AST node for $ast
- Conditional
- An AST node for $ast
- Error
Info - Information about a specific parsing error
- Identifier
- An AST node for $ast
- Include
- An AST node for $ast
- Makefile
- An AST node for $ast
- Parse
- The result of parsing: a syntax tree and a collection of errors.
- Parse
Error - An error that occurred while parsing a makefile
- Positioned
Parse Error - A positioned parse error containing location information.
- Rule
- An AST node for $ast
- Text
Edit - A text edit applied to the source, as typically received from an LSP.
- Text
Range - A range in text, represented as a pair of
TextSize. - Variable
Definition - An AST node for $ast
- Variable
Reference - A reference to a variable in the makefile, e.g.
$(FOO)or${BAR}.
Enums§
- Error
- An error that can occur when parsing a makefile
- Lang
- these two SyntaxKind types, allowing for a nicer SyntaxNode API where
“kinds” are values from our
enum SyntaxKind, instead of plain u16 values. - Makefile
Item - Represents different types of items that can appear in a Makefile
- Makefile
Variant - The variant of makefile being parsed
- Rule
Item - Represents different types of items that can appear in a Rule’s body
- Syntax
Kind
Functions§
- apply_
edit_ to_ text - Apply a text edit to the old source, producing the new source text.
- is_
in_ prerequisites - Determine if the given byte offset is in the prerequisites area of a rule line
(i.e. after the first
:on a non-recipe line). - variable_
at_ offset - Extract a variable name from
$(VAR)or${VAR}surrounding the given byte offset. - word_
at_ offset - Extract the word (identifier) at the given byte offset.