Documentation ¶
Overview ¶
Package parser contains logic for parsing Herd-style observations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoImpl occurs if the parser's impl is nil. ErrNoImpl = errors.New("parser not supplied with valid implementation") // ErrBadState occurs if the parser somehow gets into an unknown state. ErrBadState = errors.New("unknown state") // ErrBadTransition occurs if the parser somehow performs a bad transition. ErrBadTransition = errors.New("invalid state transition") // ErrBadStateCount occurs if the number of states is invalid. ErrBadStateCount = errors.New("bad state count") // ErrInputEmpty occurs if the input to the parser runs out before anything is parsed. ErrInputEmpty = errors.New("input was empty") // ErrNoTest occurs if the input to the parser runs out before the start of a test is parsed. ErrNoTest = errors.New("input ended before reaching test") // ErrNoStates occurs if the input to the parser runs out before any states are parsed. ErrNoStates = errors.New("input ended with no state block") // ErrNotEnoughStates occurs if the input to the parser runs out midway through the expected number of states. ErrNotEnoughStates = errors.New("input ended while expecting more states") // ErrNoSummary occurs if the input to the parser runs out before the summary is parsed. ErrNoSummary = errors.New("input ended while expecting summary") // ErrBadTestType occurs if the test-type line is badly formed. ErrBadTestType = errors.New("malformed test-type line") // ErrBadSummary occurs if the summary line is badly formed. ErrBadSummary = errors.New("malformed summary line") // ErrBadStateLine occurs if the state line is badly formed. // It may be used by BackendImpl implementations. ErrBadStateLine = errors.New("malformed state line") )
Functions ¶
Types ¶
type Impl ¶
type Impl interface { // ParseStateCount parses a potential state-count line whose raw fields are fields. // If the line is a state count, it returns (k, true, nil) where k is the state count; // if the line is to be skipped, it returns (_, false, nil); else, an error. ParseStateCount(fields []string) (k uint64, ok bool, err error) // ParseStateLine parses the state line whose raw fields are fields. ParseStateLine(tt TestType, fields []string) (*StateLine, error) // ParsePreTestLine extracts any flags implied by the pre-'Test' line whose raw fields are fields. // // Most implementations can safely pull this to (0, nil). // An example of an exception is Rmem, where the presence of the phrase 'PARTIAL RESULTS' before the 'Test' line // implies the 'partial' flag. ParsePreTestLine(fields []string) (obs.Flag, error) }
Impl describes the parser functionality that differs between Herdtools-style backends.
type StateLine ¶
type StateLine struct { // State is the state parsed, less the valuation. State obs.State // Rest is the remaining fields of the state line, which should be of the form 'x=y;'. Rest []string }
StateLine is the struct that an implementation of the Herdtools parser must return when parsing a state line.
Click to show internal directories.
Click to hide internal directories.