Exemplo n.º 1
0
Arquivo: parser.go Projeto: 8l/leaf
func New(in io.Reader, filename string) *Parser {
	ret := new(Parser)
	ret.filename = filename
	ret.lx = lexer.New(in, filename)
	ret.s = lexin.NewScanner(ret.lx, isComment)

	return ret
}
Exemplo n.º 2
0
Arquivo: parser.go Projeto: 8l/leaf
// New creates a new parser that parses a file into an AST.
func New(in io.Reader, filename string) *Parser {
	ret := new(Parser)
	ret.filename = filename
	ret.lx = lexer.New(in, filename)
	ret.s = lexin.NewScanner(ret.lx, func(t *tok.Token) bool {
		return t.Is(tt.Comment)
	})

	return ret
}