rawparser

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RawLexerT__0           = 1
	RawLexerT__1           = 2
	RawLexerT__2           = 3
	RawLexerIDENTIFIER     = 4
	RawLexerSTRING_LITERAL = 5
	RawLexerNUMBER         = 6
	RawLexerINT            = 7
	RawLexerINLINE_STRING  = 8
	RawLexerNEWLINE        = 9
	RawLexerWS             = 10
)

RawLexer tokens.

View Source
const (
	RawParserEOF            = antlr.TokenEOF
	RawParserT__0           = 1
	RawParserT__1           = 2
	RawParserT__2           = 3
	RawParserIDENTIFIER     = 4
	RawParserSTRING_LITERAL = 5
	RawParserNUMBER         = 6
	RawParserINT            = 7
	RawParserINLINE_STRING  = 8
	RawParserNEWLINE        = 9
	RawParserWS             = 10
)

RawParser tokens.

View Source
const (
	RawParserRULE_set     = 0
	RawParserRULE_eoc     = 1
	RawParserRULE_line    = 2
	RawParserRULE_value   = 3
	RawParserRULE_boolean = 4
)

RawParser rules.

Variables

This section is empty.

Functions

func Parse

func Parse(lin, col int, data string, storage TokenStorage) (errors []error)

Parse shortcut for parsing raw config format

Types

type BooleanContext

type BooleanContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewBooleanContext

func NewBooleanContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BooleanContext

func NewEmptyBooleanContext

func NewEmptyBooleanContext() *BooleanContext

func (*BooleanContext) EnterRule

func (s *BooleanContext) EnterRule(listener antlr.ParseTreeListener)

func (*BooleanContext) ExitRule

func (s *BooleanContext) ExitRule(listener antlr.ParseTreeListener)

func (*BooleanContext) GetParser

func (s *BooleanContext) GetParser() antlr.Parser

func (*BooleanContext) GetRuleContext

func (s *BooleanContext) GetRuleContext() antlr.RuleContext

func (*BooleanContext) IsBooleanContext

func (*BooleanContext) IsBooleanContext()

func (*BooleanContext) ToStringTree

func (s *BooleanContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type EocContext

type EocContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyEocContext

func NewEmptyEocContext() *EocContext

func NewEocContext

func NewEocContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EocContext

func (*EocContext) AllNEWLINE

func (s *EocContext) AllNEWLINE() []antlr.TerminalNode

func (*EocContext) EnterRule

func (s *EocContext) EnterRule(listener antlr.ParseTreeListener)

func (*EocContext) ExitRule

func (s *EocContext) ExitRule(listener antlr.ParseTreeListener)

func (*EocContext) GetParser

func (s *EocContext) GetParser() antlr.Parser

func (*EocContext) GetRuleContext

func (s *EocContext) GetRuleContext() antlr.RuleContext

func (*EocContext) IsEocContext

func (*EocContext) IsEocContext()

func (*EocContext) NEWLINE

func (s *EocContext) NEWLINE(i int) antlr.TerminalNode

func (*EocContext) ToStringTree

func (s *EocContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Error

type Error struct {
	Lin int
	Col int
	Err error
}

Error ...

type ErrorHandler

type ErrorHandler struct {
	// contains filtered or unexported fields
}

ErrorHandler handle errors of generated parser

func NewErrorHandler

func NewErrorHandler(lin, col int) *ErrorHandler

NewErrorHandler constructor

func (*ErrorHandler) ReportAmbiguity

func (eh *ErrorHandler) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs antlr.ATNConfigSet)

ReportAmbiguity ...

func (*ErrorHandler) ReportAttemptingFullContext

func (eh *ErrorHandler) ReportAttemptingFullContext(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, conflictingAlts *antlr.BitSet, configs antlr.ATNConfigSet)

ReportAttemptingFullContext dubious

func (*ErrorHandler) ReportContextSensitivity

func (eh *ErrorHandler) ReportContextSensitivity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex, prediction int, configs antlr.ATNConfigSet)

ReportContextSensitivity ...

func (*ErrorHandler) SyntaxError

func (eh *ErrorHandler) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)

SyntaxError ...

type IBooleanContext

type IBooleanContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsBooleanContext differentiates from other interfaces.
	IsBooleanContext()
}

IBooleanContext is an interface to support dynamic dispatch.

type IEocContext

type IEocContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsEocContext differentiates from other interfaces.
	IsEocContext()
}

IEocContext is an interface to support dynamic dispatch.

type ILineContext

type ILineContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsLineContext differentiates from other interfaces.
	IsLineContext()
}

ILineContext is an interface to support dynamic dispatch.

type ISetContext

type ISetContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsSetContext differentiates from other interfaces.
	IsSetContext()
}

ISetContext is an interface to support dynamic dispatch.

type IValueContext

type IValueContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsValueContext differentiates from other interfaces.
	IsValueContext()
}

IValueContext is an interface to support dynamic dispatch.

type LineContext

type LineContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyLineContext

func NewEmptyLineContext() *LineContext

func NewLineContext

func NewLineContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LineContext

func (*LineContext) EnterRule

func (s *LineContext) EnterRule(listener antlr.ParseTreeListener)

func (*LineContext) ExitRule

func (s *LineContext) ExitRule(listener antlr.ParseTreeListener)

func (*LineContext) GetParser

func (s *LineContext) GetParser() antlr.Parser

func (*LineContext) GetRuleContext

func (s *LineContext) GetRuleContext() antlr.RuleContext

func (*LineContext) IDENTIFIER

func (s *LineContext) IDENTIFIER() antlr.TerminalNode

func (*LineContext) IsLineContext

func (*LineContext) IsLineContext()

func (*LineContext) ToStringTree

func (s *LineContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*LineContext) Value

func (s *LineContext) Value() IValueContext

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener implementation of RawListener to scan over raw fenced code blocks

func NewListener

func NewListener(lin, col int, storage TokenStorage) *Listener

NewListener constructor

func (*Listener) EnterBoolean

func (l *Listener) EnterBoolean(c *BooleanContext)

EnterBoolean ...

func (*Listener) EnterEoc

func (l *Listener) EnterEoc(c *EocContext)

EnterEoc ...

func (*Listener) EnterEveryRule

func (l *Listener) EnterEveryRule(ctx antlr.ParserRuleContext)

EnterEveryRule ...

func (*Listener) EnterLine

func (l *Listener) EnterLine(c *LineContext)

EnterLine adds identifier as a header

func (*Listener) EnterSet

func (l *Listener) EnterSet(c *SetContext)

EnterSet ...

func (*Listener) EnterValue

func (l *Listener) EnterValue(c *ValueContext)

EnterValue ...

func (*Listener) ExitBoolean

func (l *Listener) ExitBoolean(c *BooleanContext)

ExitBoolean ...

func (*Listener) ExitEoc

func (l *Listener) ExitEoc(c *EocContext)

ExitEoc ...

func (*Listener) ExitEveryRule

func (l *Listener) ExitEveryRule(ctx antlr.ParserRuleContext)

ExitEveryRule ...

func (*Listener) ExitLine

func (l *Listener) ExitLine(c *LineContext)

ExitLine ...

func (*Listener) ExitSet

func (l *Listener) ExitSet(c *SetContext)

ExitSet ...

func (*Listener) ExitValue

func (l *Listener) ExitValue(c *ValueContext)

ExitValue ...

func (*Listener) VisitErrorNode

func (l *Listener) VisitErrorNode(node antlr.ErrorNode)

VisitErrorNode ...

func (*Listener) VisitTerminal

func (l *Listener) VisitTerminal(node antlr.TerminalNode)

VisitTerminal ...

type RawLexer

type RawLexer struct {
	*antlr.BaseLexer
	// contains filtered or unexported fields
}

func NewRawLexer

func NewRawLexer(input antlr.CharStream) *RawLexer

type RawListener

type RawListener interface {
	antlr.ParseTreeListener

	// EnterSet is called when entering the set production.
	EnterSet(c *SetContext)

	// EnterEoc is called when entering the eoc production.
	EnterEoc(c *EocContext)

	// EnterLine is called when entering the line production.
	EnterLine(c *LineContext)

	// EnterValue is called when entering the value production.
	EnterValue(c *ValueContext)

	// EnterBoolean is called when entering the boolean production.
	EnterBoolean(c *BooleanContext)

	// ExitSet is called when exiting the set production.
	ExitSet(c *SetContext)

	// ExitEoc is called when exiting the eoc production.
	ExitEoc(c *EocContext)

	// ExitLine is called when exiting the line production.
	ExitLine(c *LineContext)

	// ExitValue is called when exiting the value production.
	ExitValue(c *ValueContext)

	// ExitBoolean is called when exiting the boolean production.
	ExitBoolean(c *BooleanContext)
}

RawListener is a complete listener for a parse tree produced by RawParser.

type RawParser

type RawParser struct {
	*antlr.BaseParser
}

func NewRawParser

func NewRawParser(input antlr.TokenStream) *RawParser

func (*RawParser) Boolean

func (p *RawParser) Boolean() (localctx IBooleanContext)

func (*RawParser) Eoc

func (p *RawParser) Eoc() (localctx IEocContext)

func (*RawParser) Line

func (p *RawParser) Line() (localctx ILineContext)

func (*RawParser) Set

func (p *RawParser) Set() (localctx ISetContext)

func (*RawParser) Value

func (p *RawParser) Value() (localctx IValueContext)

type SetContext

type SetContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptySetContext

func NewEmptySetContext() *SetContext

func NewSetContext

func NewSetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SetContext

func (*SetContext) AllEoc

func (s *SetContext) AllEoc() []IEocContext

func (*SetContext) AllLine

func (s *SetContext) AllLine() []ILineContext

func (*SetContext) EOF

func (s *SetContext) EOF() antlr.TerminalNode

func (*SetContext) EnterRule

func (s *SetContext) EnterRule(listener antlr.ParseTreeListener)

func (*SetContext) Eoc

func (s *SetContext) Eoc(i int) IEocContext

func (*SetContext) ExitRule

func (s *SetContext) ExitRule(listener antlr.ParseTreeListener)

func (*SetContext) GetParser

func (s *SetContext) GetParser() antlr.Parser

func (*SetContext) GetRuleContext

func (s *SetContext) GetRuleContext() antlr.RuleContext

func (*SetContext) IsSetContext

func (*SetContext) IsSetContext()

func (*SetContext) Line

func (s *SetContext) Line(i int) ILineContext

func (*SetContext) ToStringTree

func (s *SetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type TokenStorage

type TokenStorage interface {
	Header(lin, col, xcol int, value string)
	ValueNumber(lin, col, xcol int, value string)
	ValueString(lin, col, xcol int, value string)
	Boolean(lin, col, xcol int, value string)
}

TokenStorage is an abstraction over token storage

type ValueContext

type ValueContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyValueContext

func NewEmptyValueContext() *ValueContext

func NewValueContext

func NewValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ValueContext

func (*ValueContext) Boolean

func (s *ValueContext) Boolean() IBooleanContext

func (*ValueContext) EnterRule

func (s *ValueContext) EnterRule(listener antlr.ParseTreeListener)

func (*ValueContext) ExitRule

func (s *ValueContext) ExitRule(listener antlr.ParseTreeListener)

func (*ValueContext) GetParser

func (s *ValueContext) GetParser() antlr.Parser

func (*ValueContext) GetRuleContext

func (s *ValueContext) GetRuleContext() antlr.RuleContext

func (*ValueContext) IDENTIFIER

func (s *ValueContext) IDENTIFIER() antlr.TerminalNode

func (*ValueContext) INLINE_STRING

func (s *ValueContext) INLINE_STRING() antlr.TerminalNode

func (*ValueContext) IsValueContext

func (*ValueContext) IsValueContext()

func (*ValueContext) NUMBER

func (s *ValueContext) NUMBER() antlr.TerminalNode

func (*ValueContext) STRING_LITERAL

func (s *ValueContext) STRING_LITERAL() antlr.TerminalNode

func (*ValueContext) ToStringTree

func (s *ValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL