2014-08-05 16:17:40 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2015-10-26 16:09:07 -04:00
|
|
|
"github.com/docker/docker/builder/dockerfile/parser"
|
2014-08-05 16:17:40 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var f *os.File
|
|
|
|
var err error
|
|
|
|
|
|
|
|
if len(os.Args) < 2 {
|
|
|
|
fmt.Println("please supply filename(s)")
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, fn := range os.Args[1:] {
|
|
|
|
f, err = os.Open(fn)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2016-06-24 23:57:21 -04:00
|
|
|
defer f.Close()
|
2014-08-05 16:17:40 -04:00
|
|
|
|
2017-04-12 13:47:19 -04:00
|
|
|
result, err := parser.Parse(f)
|
2014-08-05 16:17:40 -04:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2017-04-12 13:47:19 -04:00
|
|
|
fmt.Println(result.AST.Dump())
|
2014-08-05 16:17:40 -04:00
|
|
|
}
|
|
|
|
}
|