datetime

package
v0.0.0-...-4c43aeb Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Example
package main

import (
	"bramp.net/antlr4/datetime"

	"fmt"
	"github.com/antlr/antlr4/runtime/Go/antlr"
)

type exampleListener struct {
	*datetime.BasedatetimeListener
}

func (l *exampleListener) EnterEveryRule(ctx antlr.ParserRuleContext) {
	fmt.Println(ctx.GetText())
}
func main() {
	// Setup the input
	is := antlr.NewInputStream("...some text to parse...")

	// Create the Lexer
	lexer := datetime.NewdatetimeLexer(is)
	stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)

	// Create the Parser
	p := datetime.NewdatetimeParser(stream)
	p.BuildParseTrees = true
	p.AddErrorListener(antlr.NewDiagnosticErrorListener(true))

	// Finally walk the tree
	tree := p.Date_time()
	antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewdatetimeLexer

func NewdatetimeLexer(input antlr.CharStream) *datetimeLexer

func NewdatetimeParser

func NewdatetimeParser(input antlr.TokenStream) *datetimeParser

Types

type AlphanumericContext

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

func NewAlphanumericContext

func NewAlphanumericContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlphanumericContext

func NewEmptyAlphanumericContext

func NewEmptyAlphanumericContext() *AlphanumericContext

func (*AlphanumericContext) ALPHA

func (*AlphanumericContext) DIGIT

func (*AlphanumericContext) EnterRule

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

func (*AlphanumericContext) ExitRule

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

func (*AlphanumericContext) GetParser

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

func (*AlphanumericContext) GetRuleContext

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

func (*AlphanumericContext) IsAlphanumericContext

func (*AlphanumericContext) IsAlphanumericContext()

func (*AlphanumericContext) ToStringTree

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

type BasedatetimeListener

type BasedatetimeListener struct{}

BasedatetimeListener is a complete listener for a parse tree produced by datetimeParser.

func (*BasedatetimeListener) EnterAlphanumeric

func (s *BasedatetimeListener) EnterAlphanumeric(ctx *AlphanumericContext)

EnterAlphanumeric is called when production alphanumeric is entered.

func (*BasedatetimeListener) EnterDate

func (s *BasedatetimeListener) EnterDate(ctx *DateContext)

EnterDate is called when production date is entered.

func (*BasedatetimeListener) EnterDate_time

func (s *BasedatetimeListener) EnterDate_time(ctx *Date_timeContext)

EnterDate_time is called when production date_time is entered.

func (*BasedatetimeListener) EnterDay

func (s *BasedatetimeListener) EnterDay(ctx *DayContext)

EnterDay is called when production day is entered.

func (*BasedatetimeListener) EnterEveryRule

func (s *BasedatetimeListener) EnterEveryRule(ctx antlr.ParserRuleContext)

EnterEveryRule is called when any rule is entered.

func (*BasedatetimeListener) EnterFour_digit

func (s *BasedatetimeListener) EnterFour_digit(ctx *Four_digitContext)

EnterFour_digit is called when production four_digit is entered.

func (*BasedatetimeListener) EnterHour

func (s *BasedatetimeListener) EnterHour(ctx *HourContext)

EnterHour is called when production hour is entered.

func (*BasedatetimeListener) EnterMonth

func (s *BasedatetimeListener) EnterMonth(ctx *MonthContext)

EnterMonth is called when production month is entered.

func (*BasedatetimeListener) EnterTime

func (s *BasedatetimeListener) EnterTime(ctx *TimeContext)

EnterTime is called when production time is entered.

func (*BasedatetimeListener) EnterTwo_digit

func (s *BasedatetimeListener) EnterTwo_digit(ctx *Two_digitContext)

EnterTwo_digit is called when production two_digit is entered.

func (*BasedatetimeListener) EnterZone

func (s *BasedatetimeListener) EnterZone(ctx *ZoneContext)

EnterZone is called when production zone is entered.

func (*BasedatetimeListener) ExitAlphanumeric

func (s *BasedatetimeListener) ExitAlphanumeric(ctx *AlphanumericContext)

ExitAlphanumeric is called when production alphanumeric is exited.

func (*BasedatetimeListener) ExitDate

func (s *BasedatetimeListener) ExitDate(ctx *DateContext)

ExitDate is called when production date is exited.

func (*BasedatetimeListener) ExitDate_time

func (s *BasedatetimeListener) ExitDate_time(ctx *Date_timeContext)

ExitDate_time is called when production date_time is exited.

func (*BasedatetimeListener) ExitDay

func (s *BasedatetimeListener) ExitDay(ctx *DayContext)

ExitDay is called when production day is exited.

func (*BasedatetimeListener) ExitEveryRule

func (s *BasedatetimeListener) ExitEveryRule(ctx antlr.ParserRuleContext)

ExitEveryRule is called when any rule is exited.

func (*BasedatetimeListener) ExitFour_digit

func (s *BasedatetimeListener) ExitFour_digit(ctx *Four_digitContext)

ExitFour_digit is called when production four_digit is exited.

func (*BasedatetimeListener) ExitHour

func (s *BasedatetimeListener) ExitHour(ctx *HourContext)

ExitHour is called when production hour is exited.

func (*BasedatetimeListener) ExitMonth

func (s *BasedatetimeListener) ExitMonth(ctx *MonthContext)

ExitMonth is called when production month is exited.

func (*BasedatetimeListener) ExitTime

func (s *BasedatetimeListener) ExitTime(ctx *TimeContext)

ExitTime is called when production time is exited.

func (*BasedatetimeListener) ExitTwo_digit

func (s *BasedatetimeListener) ExitTwo_digit(ctx *Two_digitContext)

ExitTwo_digit is called when production two_digit is exited.

func (*BasedatetimeListener) ExitZone

func (s *BasedatetimeListener) ExitZone(ctx *ZoneContext)

ExitZone is called when production zone is exited.

func (*BasedatetimeListener) VisitErrorNode

func (s *BasedatetimeListener) VisitErrorNode(node antlr.ErrorNode)

VisitErrorNode is called when an error node is visited.

func (*BasedatetimeListener) VisitTerminal

func (s *BasedatetimeListener) VisitTerminal(node antlr.TerminalNode)

VisitTerminal is called when a terminal node is visited.

type DateContext

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

func NewDateContext

func NewDateContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DateContext

func NewEmptyDateContext

func NewEmptyDateContext() *DateContext

func (*DateContext) AllTwo_digit

func (s *DateContext) AllTwo_digit() []ITwo_digitContext

func (*DateContext) EnterRule

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

func (*DateContext) ExitRule

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

func (*DateContext) GetParser

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

func (*DateContext) GetRuleContext

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

func (*DateContext) IsDateContext

func (*DateContext) IsDateContext()

func (*DateContext) Month

func (s *DateContext) Month() IMonthContext

func (*DateContext) ToStringTree

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

func (*DateContext) Two_digit

func (s *DateContext) Two_digit(i int) ITwo_digitContext

type Date_timeContext

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

func NewDate_timeContext

func NewDate_timeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Date_timeContext

func NewEmptyDate_timeContext

func NewEmptyDate_timeContext() *Date_timeContext

func (*Date_timeContext) Date

func (s *Date_timeContext) Date() IDateContext

func (*Date_timeContext) Day

func (s *Date_timeContext) Day() IDayContext

func (*Date_timeContext) EnterRule

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

func (*Date_timeContext) ExitRule

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

func (*Date_timeContext) GetParser

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

func (*Date_timeContext) GetRuleContext

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

func (*Date_timeContext) IsDate_timeContext

func (*Date_timeContext) IsDate_timeContext()

func (*Date_timeContext) Time

func (s *Date_timeContext) Time() ITimeContext

func (*Date_timeContext) ToStringTree

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

type DayContext

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

func NewDayContext

func NewDayContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DayContext

func NewEmptyDayContext

func NewEmptyDayContext() *DayContext

func (*DayContext) EnterRule

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

func (*DayContext) ExitRule

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

func (*DayContext) GetParser

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

func (*DayContext) GetRuleContext

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

func (*DayContext) IsDayContext

func (*DayContext) IsDayContext()

func (*DayContext) ToStringTree

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

type Four_digitContext

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

func NewEmptyFour_digitContext

func NewEmptyFour_digitContext() *Four_digitContext

func NewFour_digitContext

func NewFour_digitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Four_digitContext

func (*Four_digitContext) AllAlphanumeric

func (s *Four_digitContext) AllAlphanumeric() []IAlphanumericContext

func (*Four_digitContext) Alphanumeric

func (s *Four_digitContext) Alphanumeric(i int) IAlphanumericContext

func (*Four_digitContext) EnterRule

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

func (*Four_digitContext) ExitRule

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

func (*Four_digitContext) GetParser

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

func (*Four_digitContext) GetRuleContext

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

func (*Four_digitContext) IsFour_digitContext

func (*Four_digitContext) IsFour_digitContext()

func (*Four_digitContext) ToStringTree

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

type HourContext

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

func NewEmptyHourContext

func NewEmptyHourContext() *HourContext

func NewHourContext

func NewHourContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *HourContext

func (*HourContext) AllTwo_digit

func (s *HourContext) AllTwo_digit() []ITwo_digitContext

func (*HourContext) EnterRule

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

func (*HourContext) ExitRule

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

func (*HourContext) GetParser

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

func (*HourContext) GetRuleContext

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

func (*HourContext) IsHourContext

func (*HourContext) IsHourContext()

func (*HourContext) ToStringTree

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

func (*HourContext) Two_digit

func (s *HourContext) Two_digit(i int) ITwo_digitContext

type IAlphanumericContext

type IAlphanumericContext interface {
	antlr.ParserRuleContext

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

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

IAlphanumericContext is an interface to support dynamic dispatch.

type IDateContext

type IDateContext interface {
	antlr.ParserRuleContext

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

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

IDateContext is an interface to support dynamic dispatch.

type IDate_timeContext

type IDate_timeContext interface {
	antlr.ParserRuleContext

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

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

IDate_timeContext is an interface to support dynamic dispatch.

type IDayContext

type IDayContext interface {
	antlr.ParserRuleContext

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

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

IDayContext is an interface to support dynamic dispatch.

type IFour_digitContext

type IFour_digitContext interface {
	antlr.ParserRuleContext

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

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

IFour_digitContext is an interface to support dynamic dispatch.

type IHourContext

type IHourContext interface {
	antlr.ParserRuleContext

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

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

IHourContext is an interface to support dynamic dispatch.

type IMonthContext

type IMonthContext interface {
	antlr.ParserRuleContext

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

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

IMonthContext is an interface to support dynamic dispatch.

type ITimeContext

type ITimeContext interface {
	antlr.ParserRuleContext

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

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

ITimeContext is an interface to support dynamic dispatch.

type ITwo_digitContext

type ITwo_digitContext interface {
	antlr.ParserRuleContext

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

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

ITwo_digitContext is an interface to support dynamic dispatch.

type IZoneContext

type IZoneContext interface {
	antlr.ParserRuleContext

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

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

IZoneContext is an interface to support dynamic dispatch.

type MonthContext

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

func NewEmptyMonthContext

func NewEmptyMonthContext() *MonthContext

func NewMonthContext

func NewMonthContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MonthContext

func (*MonthContext) EnterRule

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

func (*MonthContext) ExitRule

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

func (*MonthContext) GetParser

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

func (*MonthContext) GetRuleContext

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

func (*MonthContext) IsMonthContext

func (*MonthContext) IsMonthContext()

func (*MonthContext) ToStringTree

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

type TimeContext

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

func NewEmptyTimeContext

func NewEmptyTimeContext() *TimeContext

func NewTimeContext

func NewTimeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TimeContext

func (*TimeContext) EnterRule

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

func (*TimeContext) ExitRule

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

func (*TimeContext) GetParser

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

func (*TimeContext) GetRuleContext

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

func (*TimeContext) Hour

func (s *TimeContext) Hour() IHourContext

func (*TimeContext) IsTimeContext

func (*TimeContext) IsTimeContext()

func (*TimeContext) ToStringTree

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

func (*TimeContext) Zone

func (s *TimeContext) Zone() IZoneContext

type Two_digitContext

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

func NewEmptyTwo_digitContext

func NewEmptyTwo_digitContext() *Two_digitContext

func NewTwo_digitContext

func NewTwo_digitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Two_digitContext

func (*Two_digitContext) AllAlphanumeric

func (s *Two_digitContext) AllAlphanumeric() []IAlphanumericContext

func (*Two_digitContext) Alphanumeric

func (s *Two_digitContext) Alphanumeric(i int) IAlphanumericContext

func (*Two_digitContext) EnterRule

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

func (*Two_digitContext) ExitRule

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

func (*Two_digitContext) GetParser

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

func (*Two_digitContext) GetRuleContext

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

func (*Two_digitContext) IsTwo_digitContext

func (*Two_digitContext) IsTwo_digitContext()

func (*Two_digitContext) ToStringTree

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

type ZoneContext

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

func NewEmptyZoneContext

func NewEmptyZoneContext() *ZoneContext

func NewZoneContext

func NewZoneContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ZoneContext

func (*ZoneContext) ALPHA

func (s *ZoneContext) ALPHA() antlr.TerminalNode

func (*ZoneContext) EnterRule

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

func (*ZoneContext) ExitRule

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

func (*ZoneContext) Four_digit

func (s *ZoneContext) Four_digit() IFour_digitContext

func (*ZoneContext) GetParser

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

func (*ZoneContext) GetRuleContext

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

func (*ZoneContext) IsZoneContext

func (*ZoneContext) IsZoneContext()

func (*ZoneContext) ToStringTree

func (s *ZoneContext) 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