0.0.1 • Published 2 years ago
parse-makefile v0.0.1
makefile-parser
Parse a Makefile into an abstract syntax tree
Installation
npm install parse-parser
API
const parseMakefile = require('parse-makefile');
const { ast } = parseMakefile(
`# Comment on VAR.
VAR = 23
# Comment on foo
foo: fizz\\ buzz bar
step 1 $@
step 2 $<`);
console.log(ast)
Output:
[ { variable: 'VAR', value: '23', comment: [ 'Comment on VAR.' ] },
{ target: 'foo',
deps: [ 'fizz\\ buzz', 'bar' ],
recipe: [ 'step 1 $@', 'step 2 $<' ],
comment: [ 'Comment on foo' ] } ]
0.0.1
2 years ago