siffiejoe/lua-luaepnf — pull request #1 by mnemnion (2014-12-08 18:53:18+00:00)
Title: Adds syntax for suppressing nodes in AST

Demonstration code:

```lua
epnf = require "lua-luaepnf/src/epnf"

lisp = epnf.define ( function (_ENV)
START "form"
SUPPRESS ("element", "form", "atom")
local WS = P' '^0 + P'\n'^0 + P',' + P'\07'
symbol = C(R'az'^1)
number = C(R'09'^1) / tonumber
atom = WS * V"symbol" * WS + WS * V"number" * WS
list = WS * P'(' * V"element"^0 * P')'
element = V"atom" + V"form" * WS
form = V"list"
end)

list = epnf.parsestring(lisp,"(foo bar)")
epnf.dumpast(list)
```
With this output:
```text
{
id = list, pos = 1
1 = {
id = symbol, pos = 2
1 = "foo"
}
2 = {
id = symbol, pos = 6
1 = "bar"
}
}
```

Compare:
```lua
epnf = require "lua-luaepnf/src/epnf"

lisp = epnf.define ( function (_ENV)
START "form"
--SUPPRESS ("element", "form", "atom")
local WS = P' '^0 + P'\n'^0 + P',' + P'\07'
symbol = C(R'az'^1)
number = C(R'09'^1) / tonumber
atom = WS * V"symbol" * WS + WS * V"number" * WS
list = WS * P'(' * V"element"^0 * P')'
element = V"atom" + V"form" * WS
form = V"list"
end)

list = epnf.parsestring(lisp,"(foo bar)")
epnf.dumpast(list)
```

Which produces this:
```text
{
id = form, pos = 1
1 = {
id = list, pos = 1
1 = {
id = element, pos = 2
1 = {
id = atom, pos = 2
1 = {
id = symbol, pos = 2
1 = "foo"
}
}
}
2 = {
id = element, pos = 6
1 = {
id = atom, pos = 6
1 = {
id = symbol, pos = 6
1 = "bar"
}
}
}
}
}
```

This is generally useful when constructing real syntax trees.