Parse parsed the given text and return a node Parser. If an error is encountered, parsing stops and an empty Parser is returned with the error
(name, text string)
| 53 | // If an error is encountered, parsing stops and an empty |
| 54 | // Parser is returned with the error |
| 55 | func Parse(name, text string) (*Parser, error) { |
| 56 | p := NewParser(name) |
| 57 | err := p.Parse(text) |
| 58 | if err != nil { |
| 59 | p = nil |
| 60 | } |
| 61 | return p, err |
| 62 | } |
| 63 | |
| 64 | func NewParser(name string) *Parser { |
| 65 | return &Parser{ |