ast

package
v0.0.0-...-510b38a Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LineBreakDelimiter represents a CRLF sequence in a byte representation.
	LineBreakDelimiter string = "\r\n"
	// WhitespaceDelimiter represents a single whitespace character in a byte representation.
	WhitespaceDelimiter string = " "
	// MaxLineSizeBytes denotes how long a content line should be before it is folded up with line breaks.
	MaxLineSizeBytes int = 75
)

Variables

This section is empty.

Functions

func BinaryDecoderError

func BinaryDecoderError(msg string) error

func InvalidBoolError

func InvalidBoolError(value string) error

func InvalidCalendarUserAddress

func InvalidCalendarUserAddress(address string) error

func InvalidCharacter

func InvalidCharacter(value uint8) error

func InvalidDateLength

func InvalidDateLength(length int) error

func InvalidDateTimeLength

func InvalidDateTimeLength(length int) error

func InvalidDay

func InvalidDay(msg string) error

func InvalidDurationFormat

func InvalidDurationFormat(value string) error

func InvalidDurationInteger

func InvalidDurationInteger(msg string) error

func InvalidEndDateTime

func InvalidEndDateTime(msg string) error

func InvalidEndDuration

func InvalidEndDuration(msg string) error

func InvalidEscapeSequence

func InvalidEscapeSequence(value string) error

func InvalidFrequency

func InvalidFrequency(value string) error

func InvalidHours

func InvalidHours(msg string) error

func InvalidIntLimits

func InvalidIntLimits(low, high int) error

func InvalidInteger

func InvalidInteger(value string) error

func InvalidMinutes

func InvalidMinutes(msg string) error

func InvalidMonth

func InvalidMonth(msg string) error

func InvalidPeriodOfTime

func InvalidPeriodOfTime(value string) error

func InvalidPrefix

func InvalidPrefix(value string) error

func InvalidRecurrenceRule

func InvalidRecurrenceRule(value string) error

func InvalidSeconds

func InvalidSeconds(msg string) error

func InvalidStartDateTime

func InvalidStartDateTime(msg string) error

func InvalidUTCOffset

func InvalidUTCOffset(value string) error

func InvalidUTCOffsetLength

func InvalidUTCOffsetLength(length int) error

func InvalidWeekDay

func InvalidWeekDay(value string) error

func InvalidYear

func InvalidYear(msg string) error

func OutOfBounds

func OutOfBounds(num int) error

Types

type AlarmTriggerRelationship

type AlarmTriggerRelationship AlarmTriggerRelationshipValue

func (AlarmTriggerRelationship) ParameterName

func (a AlarmTriggerRelationship) ParameterName() string

func (AlarmTriggerRelationship) String

func (a AlarmTriggerRelationship) String() string

func (AlarmTriggerRelationship) Type

type AlarmTriggerRelationshipValue

type AlarmTriggerRelationshipValue string
const (
	Start AlarmTriggerRelationshipValue = "START"
	End   AlarmTriggerRelationshipValue = "END"
)

type AlternateTextRepresentation

type AlternateTextRepresentation string // QuotedString

AlternateTextRepresentation specifies an alternate text representation for the property value on the content line. Value has to be a Token of type QuotedString.

func (AlternateTextRepresentation) ParameterName

func (a AlternateTextRepresentation) ParameterName() string

func (AlternateTextRepresentation) String

func (AlternateTextRepresentation) Type

type BinaryValue

type BinaryValue []byte

func NewBinaryValueFromBase64

func NewBinaryValueFromBase64(value string) (BinaryValue, error)

func (BinaryValue) String

func (b BinaryValue) String() string

func (BinaryValue) Type

func (b BinaryValue) Type() PropValueType

type BooleanValue

type BooleanValue bool

func NewBooleanValue

func NewBooleanValue(value string) (BooleanValue, error)

func (BooleanValue) String

func (b BooleanValue) String() string

func (BooleanValue) Type

func (b BooleanValue) Type() PropValueType

type CalendarUserAddressValue

type CalendarUserAddressValue mail.Address

func NewCalendarUserAddressValue

func NewCalendarUserAddressValue(address string) (CalendarUserAddressValue, error)

func (CalendarUserAddressValue) QuotedString

func (c CalendarUserAddressValue) QuotedString() string

func (CalendarUserAddressValue) String

func (c CalendarUserAddressValue) String() string

func (CalendarUserAddressValue) StringWithPrefix

func (c CalendarUserAddressValue) StringWithPrefix() string

func (CalendarUserAddressValue) Type

type CalendarUserType

type CalendarUserType string // CalendarUserTypeValue | IANAToken | XName

func (CalendarUserType) ParameterName

func (c CalendarUserType) ParameterName() string

func (CalendarUserType) String

func (c CalendarUserType) String() string

func (CalendarUserType) Type

type CalendarUserTypeValue

type CalendarUserTypeValue string
const (
	Individual CalendarUserTypeValue = "INDIVIDUAL"
	Group      CalendarUserTypeValue = "GROUP"
	Resource   CalendarUserTypeValue = "RESOURCE"
	Room       CalendarUserTypeValue = "ROOM"
	Unknown    CalendarUserTypeValue = "UNKNOWN"
)

type CommonName

type CommonName string // IANAToken | XName

CommonName specifies the common name to be associated with the calendar user specified by the property.

func (CommonName) ParameterName

func (c CommonName) ParameterName() string

func (CommonName) String

func (c CommonName) String() string

func (CommonName) Type

func (c CommonName) Type() PropParamType

type ContentLine

type ContentLine struct {
	Name      Name
	ParamList []Param
	Value     Value
}

type DateTimeValue

type DateTimeValue time.Time

func NewDateTimeValue

func NewDateTimeValue(value string) (DateTimeValue, error)

func (DateTimeValue) IsZero

func (d DateTimeValue) IsZero() bool

func (DateTimeValue) String

func (d DateTimeValue) String() string

func (DateTimeValue) Type

func (d DateTimeValue) Type() PropValueType

type DateValue

type DateValue time.Time

func NewDateValue

func NewDateValue(value string) (DateValue, error)

func (DateValue) IsZero

func (d DateValue) IsZero() bool

func (DateValue) String

func (d DateValue) String() string

func (DateValue) Type

func (d DateValue) Type() PropValueType

type Delegatees

type Delegatees []CalendarUserAddressValue

func (Delegatees) ParameterName

func (d Delegatees) ParameterName() string

func (Delegatees) String

func (d Delegatees) String() string

func (Delegatees) Type

func (d Delegatees) Type() PropParamType

type Delegators

type Delegators []CalendarUserAddressValue

func (Delegators) ParameterName

func (d Delegators) ParameterName() string

func (Delegators) String

func (d Delegators) String() string

func (Delegators) Type

func (d Delegators) Type() PropParamType

type DirectoryEntryReference

type DirectoryEntryReference string

TODO (c.nicola): DQUOTE uri DQUOTE (https://datatracker.ietf.org/doc/html/rfc3986#section-3)

func (DirectoryEntryReference) ParameterName

func (d DirectoryEntryReference) ParameterName() string

func (DirectoryEntryReference) String

func (d DirectoryEntryReference) String() string

func (DirectoryEntryReference) Type

type DurationValue

type DurationValue time.Duration

func NewDurationValue

func NewDurationValue(value string) (DurationValue, error)

func (DurationValue) String

func (d DurationValue) String() string

func (DurationValue) Type

func (d DurationValue) Type() PropValueType

type EncodingFormat

type EncodingFormat string
const (
	EightBit EncodingFormat = "8BIT"
	Base64   EncodingFormat = "BASE64"
)

type FloatValue

type FloatValue float64

func NewFloatValue

func NewFloatValue(value string) (FloatValue, error)

func (FloatValue) String

func (f FloatValue) String() string

func (FloatValue) Type

func (f FloatValue) Type() PropValueType

type FormatType

type FormatType string

TODO (c.nicola): type-name | subtype-name (https://datatracker.ietf.org/doc/html/rfc4288#section-4.2)

func (FormatType) ParameterName

func (f FormatType) ParameterName() string

func (FormatType) String

func (f FormatType) String() string

func (FormatType) Type

func (f FormatType) Type() PropParamType

type FreeBusyTimeType

type FreeBusyTimeType string // FreeBusyTimeValue | IANAToken | XName

func (FreeBusyTimeType) ParameterName

func (f FreeBusyTimeType) ParameterName() string

func (FreeBusyTimeType) String

func (f FreeBusyTimeType) String() string

func (FreeBusyTimeType) Type

type FreeBusyTimeValue

type FreeBusyTimeValue string
const (
	Free            FreeBusyTimeValue = "FREE"
	Busy            FreeBusyTimeValue = "BUSY"
	BusyUnavailable FreeBusyTimeValue = "BUSY-UNAVAILABLE"
	BusyTentative   FreeBusyTimeValue = "BUSY-TENTATIVE"
)

type GroupOrListMembership

type GroupOrListMembership []CalendarUserAddressValue

func (GroupOrListMembership) ParameterName

func (g GroupOrListMembership) ParameterName() string

func (GroupOrListMembership) String

func (g GroupOrListMembership) String() string

func (GroupOrListMembership) Type

type IANAToken

type IANAToken struct {
	Value string
}

type InlineEncoding

type InlineEncoding EncodingFormat

func (InlineEncoding) ParameterName

func (i InlineEncoding) ParameterName() string

func (InlineEncoding) String

func (i InlineEncoding) String() string

func (InlineEncoding) Type

func (i InlineEncoding) Type() PropParamType

type IntegerValue

type IntegerValue int

func NewIntegerValue

func NewIntegerValue(value string) (IntegerValue, error)

func (IntegerValue) String

func (i IntegerValue) String() string

func (IntegerValue) Type

func (i IntegerValue) Type() PropValueType

type Language

type Language string

TODO (c.nicola): language (https://datatracker.ietf.org/doc/html/rfc5646)

func (Language) ParameterName

func (l Language) ParameterName() string

func (Language) String

func (l Language) String() string

func (Language) Type

func (l Language) Type() PropParamType

type Name

type Name struct {
	Value interface{} // IANAToken or XName
}

type Param

type Param struct {
	ParamName Name
	ValueList []ParamValue
}

type ParamText

type ParamText struct {
	Value string
}

type ParamValue

type ParamValue struct {
	Text interface{} // ParamText or QuotedString
}

type ParticipationRole

type ParticipationRole string

TODO (c.nicola): ParticipationRoleValue | XName | IANAToken.

func (ParticipationRole) ParameterName

func (p ParticipationRole) ParameterName() string

func (ParticipationRole) String

func (p ParticipationRole) String() string

func (ParticipationRole) Type

type ParticipationRoleValue

type ParticipationRoleValue string
const (
	Chair          ParticipationRoleValue = "CHAIR"
	ReqParticipant ParticipationRoleValue = "REQ-PARTICIPANT"
	OptParticipant ParticipationRoleValue = "OPT-PARTICIPANT"
	NonParticipant ParticipationRoleValue = "NON-PARTICIPANT"
)

type ParticipationStatus

type ParticipationStatus string

TODO: (c.nicola): partstat-event | partstat-todo | partstat-jour | XName | IANAToken.

func (ParticipationStatus) ParameterName

func (p ParticipationStatus) ParameterName() string

func (ParticipationStatus) String

func (p ParticipationStatus) String() string

func (ParticipationStatus) Type

type ParticipationStatusValue

type ParticipationStatusValue string
const (
	NeedsAction ParticipationStatusValue = "NEEDS-ACTION"
	Accepted    ParticipationStatusValue = "ACCEPTED"
	Declined    ParticipationStatusValue = "DECLINED"
	Tentative   ParticipationStatusValue = "TENTATIVE"
	Delegated   ParticipationStatusValue = "DELEGATED"
	Completed   ParticipationStatusValue = "COMPLETED"
	InProcess   ParticipationStatusValue = "IN-PROCESS"
)

type PeriodOfTimeValue

type PeriodOfTimeValue [2]time.Time

func NewPeriodOfTimeValue

func NewPeriodOfTimeValue(value string) (PeriodOfTimeValue, error)

func (PeriodOfTimeValue) String

func (p PeriodOfTimeValue) String() string

func (PeriodOfTimeValue) Type

type PropParamType

type PropParamType uint
const (
	AlternateTextRepresentationType PropParamType = 1 << iota
	CommonNameType
	CalendarUserTypeType
	DelegatorType
	DelegateeType
	DirectoryEntryReferenceType
	InlineEncodingType
	FormatTypeType
	FreeBusyTimeTypeType
	LanguageType
	GroupOrListMembershipType
	ParticipationStatusType
	RecurrenceIdentifierRangeType
	AlarmTriggerRelationshipType
	RelationshipTypeType
	ParticipationRoleType
	RSVPExpectationType
	SentByType
	TimeZoneIdentifierType
	ValueDataTypeType
	XParamType
)

func (PropParamType) Is

func (p PropParamType) Is(paramType PropParamType) bool

type PropValueType

type PropValueType uint
const (
	BinaryType PropValueType = 1 << iota
	BooleanType
	CalendarUserAddressType
	DateType
	DateTimeType
	DurationType
	FloatType
	IntegerType
	PeriodOfTimeType
	RecurrenceRuleType
	TextType
	TimeType
	URIType
	UTFOffsetType
)

func (PropValueType) Is

func (p PropValueType) Is(valueType PropValueType) bool

type RSVPExpectation

type RSVPExpectation RSVPExpectationValue

func (RSVPExpectation) ParameterName

func (r RSVPExpectation) ParameterName() string

func (RSVPExpectation) String

func (r RSVPExpectation) String() string

func (RSVPExpectation) Type

func (r RSVPExpectation) Type() PropParamType

type RSVPExpectationValue

type RSVPExpectationValue string
const (
	True  RSVPExpectationValue = "TRUE"
	False RSVPExpectationValue = "FALSE"
)

type RecurrenceIdentifierRange

type RecurrenceIdentifierRange RecurrenceIdentifierRangeValue

func (RecurrenceIdentifierRange) ParameterName

func (r RecurrenceIdentifierRange) ParameterName() string

func (RecurrenceIdentifierRange) String

func (r RecurrenceIdentifierRange) String() string

func (RecurrenceIdentifierRange) Type

type RecurrenceIdentifierRangeValue

type RecurrenceIdentifierRangeValue string
const ThisAndTheFuture RecurrenceIdentifierRangeValue = "THISANDTHEFUTURE"

type RecurrenceRuleFrequency

type RecurrenceRuleFrequency uint
const (
	Secondly RecurrenceRuleFrequency = 1 << iota
	Minutely
	Hourly
	Daily
	Weekly
	Monthly
	Yearly
)

func (RecurrenceRuleFrequency) String

func (r RecurrenceRuleFrequency) String() string

type RecurrenceRuleValue

type RecurrenceRuleValue struct {
	Frequency  RecurrenceRuleFrequency
	Until      DateTimeValue
	Count      int
	Interval   int
	BySecond   []int
	ByMinute   []int
	ByHour     []int
	ByDay      []WeekDayNumber
	ByMonthDay []int
	ByYearDay  []int
	ByWeekNum  []int
	ByMonth    []int
	BySetPos   []int
	WeekDay    WeekDay
}

func NewRecurrenceRuleValue

func NewRecurrenceRuleValue(value string) (RecurrenceRuleValue, error)

func (RecurrenceRuleValue) String

func (r RecurrenceRuleValue) String() string

func (RecurrenceRuleValue) Type

type RelationshipType

type RelationshipType string

TODO (c.nicola): RelationshipTypeValue | XName | IANAToken.

func (RelationshipType) ParameterName

func (r RelationshipType) ParameterName() string

func (RelationshipType) String

func (r RelationshipType) String() string

func (RelationshipType) Type

type RelationshipTypeValue

type RelationshipTypeValue string
const (
	Parent  RelationshipTypeValue = "PARENT"
	Child   RelationshipTypeValue = "CHILD"
	Sibling RelationshipTypeValue = "SIBLING"
)

type SentBy

type SentBy string

TODO (c.nicola): DQUOTE cal-address DQUOTE (https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.3)

func (SentBy) ParameterName

func (s SentBy) ParameterName() string

func (SentBy) String

func (s SentBy) String() string

func (SentBy) Type

func (s SentBy) Type() PropParamType

type TextValue

type TextValue string

func NewTextValue

func NewTextValue(value string) (TextValue, error)

func (TextValue) String

func (t TextValue) String() string

func (TextValue) Type

func (t TextValue) Type() PropValueType

type TimeValue

type TimeValue time.Time

func NewTimeValue

func NewTimeValue(value string) (TimeValue, error)

func (TimeValue) String

func (t TimeValue) String() string

func (TimeValue) Type

func (t TimeValue) Type() PropValueType

type TimeZoneIdentifier

type TimeZoneIdentifier string

TODO (c.nicola): tzidprefix paramtext (time zone database entries) (https://www.iana.org/time-zones)

func (TimeZoneIdentifier) ParameterName

func (t TimeZoneIdentifier) ParameterName() string

func (TimeZoneIdentifier) String

func (t TimeZoneIdentifier) String() string

func (TimeZoneIdentifier) Type

type Token

type Token struct {
	Type    TokenType
	Literal string
	Line    int
	Column  int
}

func NewToken

func NewToken(tokenType TokenType, literal string, line int, column int) Token

func (Token) DebugString

func (t Token) DebugString() string

func (Token) LiteralSafe

func (t Token) LiteralSafe() string

LiteralSafe returns a version of the stored literal that is safe for terminal output.

type TokenType

type TokenType uint16
const (
	SemiColon TokenType = 1 << iota
	Colon
	Dash
	XPrefix
	Equal
	Comma
	QuotedString
	SafeChar
	ValueChar
	NonUSASCII
	ControlCode
	CarriageReturnLineFeed
	EOF
)

func (TokenType) Is

func (t TokenType) Is(tokenType TokenType) bool

type URIValue

type URIValue url.URL

func NewURIValue

func NewURIValue(value string) (URIValue, error)

func (URIValue) String

func (u URIValue) String() string

func (URIValue) Type

func (u URIValue) Type() PropValueType

type UTCOffsetValue

type UTCOffsetValue time.Duration

func NewUTCOffsetValue

func NewUTCOffsetValue(value string) (UTCOffsetValue, error)

func (UTCOffsetValue) String

func (u UTCOffsetValue) String() string

func (UTCOffsetValue) Type

func (u UTCOffsetValue) Type() PropValueType

type Value

type Value struct {
	Value string
}

type ValueDataType

type ValueDataType string

TODO (c.nicola): ValueDataTypeValue | XName | IANAToken.

func (ValueDataType) ParameterName

func (v ValueDataType) ParameterName() string

func (ValueDataType) String

func (v ValueDataType) String() string

func (ValueDataType) Type

func (v ValueDataType) Type() PropParamType

type ValueDataTypeValue

type ValueDataTypeValue string
const (
	BinaryParam     ValueDataTypeValue = "BINARY"
	BooleanParam    ValueDataTypeValue = "BOOLEAN"
	CalAddressParam ValueDataTypeValue = "CAL-ADDRESS"
	DateParam       ValueDataTypeValue = "DATE"
	DateTimeParam   ValueDataTypeValue = "DATE-TIME"
	DurationParam   ValueDataTypeValue = "DURATION"
	FloatParam      ValueDataTypeValue = "FLOAT"
	IntegerParam    ValueDataTypeValue = "INTEGER"
	PeriodParam     ValueDataTypeValue = "PERIOD"
	RecurParam      ValueDataTypeValue = "RECUR"
	TextParam       ValueDataTypeValue = "TEXT"
	TimeParam       ValueDataTypeValue = "TIME"
	URIParam        ValueDataTypeValue = "URI"
	UTCOffsetParam  ValueDataTypeValue = "UTF-OFFSET"
)

type VendorID

type VendorID struct {
	// NOTE (c.nicola): Not sure what the notation in the RFC is trying to tell me.
	//					Can this Value be only 1-3 characters long? Cannot find any
	//					examples for this. For the time being the length is unrestricted.
	Value string
}

type WeekDay

type WeekDay uint
const (
	Sunday WeekDay = 1 << iota
	Monday
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
)

func (WeekDay) String

func (w WeekDay) String() string

type WeekDayNumber

type WeekDayNumber struct {
	Week int
	Day  WeekDay
}

func (WeekDayNumber) String

func (w WeekDayNumber) String() string

type XName

type XName struct {
	VendorID VendorID
	Suffix   string
}

Jump to

Keyboard shortcuts

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