Documentation
¶
Overview ¶
Package parser implements the ClassAd lexer and parser.
Package parser provides the ClassAd parser implementation. The parser is generated from classad.y using goyacc.
Index ¶
Constants ¶
const AND = 57354
const BOOLEAN_LITERAL = 57350
const EQ = 57355
const ERROR = 57352
const GE = 57360
const IDENTIFIER = 57346
const INTEGER_LITERAL = 57348
const IS = 57357
const ISNT = 57358
const LE = 57359
const LSHIFT = 57361
const NE = 57356
const OR = 57353
const REAL_LITERAL = 57349
const RSHIFT = 57362
const STRING_LITERAL = 57347
const UNARY = 57364
const UNDEFINED = 57351
const URSHIFT = 57363
Variables ¶
This section is empty.
Functions ¶
func ParseClassAd ¶
ParseClassAd parses a ClassAd and returns a ClassAd AST node.
func ParseOldClassAd ¶
ParseOldClassAd parses a ClassAd in the "old" HTCondor format. Old ClassAds have attributes separated by newlines without surrounding brackets. Example:
Foo = 3 Bar = "hello" Moo = Foo =!= Undefined
This implementation converts the old format to new format and reuses the existing parser.
func ParseScopedIdentifier ¶
func ParseScopedIdentifier(identifier string) (string, ast.AttributeScope)
ParseScopedIdentifier parses an identifier that may have a scope prefix. Returns the attribute name and scope.
Types ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer wraps the streaming lexer for string inputs while retaining the input and position fields used in existing tests.
type ReaderParser ¶
type ReaderParser struct {
// contains filtered or unexported fields
}
ReaderParser parses consecutive ClassAds from a buffered reader without requiring delimiters between ads. It reuses a single streaming lexer instance for efficiency.
func NewReaderParser ¶
func NewReaderParser(r io.Reader) *ReaderParser
NewReaderParser creates a reusable parser that pulls consecutive ClassAds from the provided reader without requiring delimiters. Non-buffered readers are wrapped internally for efficiency.
func (*ReaderParser) ParseClassAd ¶
func (p *ReaderParser) ParseClassAd() (*ast.ClassAd, error)
ParseClassAd parses the next ClassAd from the underlying reader. It reuses the same streaming lexer instance to avoid per-call allocations. It returns io.EOF when there is no more data to parse.
type StreamingLexer ¶
type StreamingLexer struct {
// contains filtered or unexported fields
}
StreamingLexer tokenizes ClassAds directly from an io.Reader. It stops producing tokens after the first complete ClassAd so the caller can parse multiple ads from a single stream.
func NewStreamingLexer ¶
func NewStreamingLexer(r io.Reader) *StreamingLexer
NewStreamingLexer creates a lexer that consumes tokens directly from a reader. It wraps non-buffered readers in a bufio.Reader for efficiency.
func (*StreamingLexer) Error ¶
func (l *StreamingLexer) Error(s string)
Error implements the goyacc Lexer interface.
func (*StreamingLexer) Lex ¶
func (l *StreamingLexer) Lex(lval *yySymType) int
Lex implements the goyacc Lexer interface.
func (*StreamingLexer) Result ¶
func (l *StreamingLexer) Result() (ast.Node, error)
Result returns the parsed result and any error.
func (*StreamingLexer) SetResult ¶
func (l *StreamingLexer) SetResult(node ast.Node)
SetResult sets the parse result.