-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic Lemon parser generator support.
- Loading branch information
1 parent
b128fd6
commit 0d4b127
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- lemon.lua - Support for the Lemon parser generator | ||
|
||
module(..., package.seeall) | ||
|
||
local path = require "tundra.path" | ||
|
||
DefRule { | ||
Name = "Lemon", | ||
Command = "lemon $(<)", | ||
ConfigInvariant = true, | ||
|
||
Blueprint = { | ||
Source = { Required = true, Type = "string" }, | ||
}, | ||
|
||
Setup = function (env, data) | ||
local src = data.Source | ||
local base_name = path.drop_suffix(src) | ||
local gen_c = base_name .. '.c' | ||
local gen_h = base_name .. '.h' | ||
local gen_out = base_name .. '.out' | ||
return { | ||
InputFiles = { src }, | ||
OutputFiles = { gen_c, gen_h, gen_out }, | ||
} | ||
end, | ||
} |