package parsekit // Expects is used to let a ParseHandler function describe what input it is expecting. // This expectation is used in error messages to make them more descriptive. // // When defining an expectation inside a ParseHandler, you do not need to // handle unexpected input yourself. When the end of the function is reached // without setting the next state, an automatic error will be emitted. // This error can differentiate between the following issues: // // 1) there is valid data on input, but it was not accepted by the function // // 2) there is an invalid UTF8 character on input // // 3) the end of the file was reached. func (p *ParseAPI) Expects(description string) { // TODO make this into some debugging tool? // fmt.Printf("Expecting %s @ line %d, col %d\n", description, p.cursorLine, p.cursorColumn) if p.err != nil || p.stopped { return } p.expecting = description }