messages

package
v0.0.0-...-76354a4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInlineMarkupMessage

func IsInlineMarkupMessage(m MessageType) bool

IsInlineMarkupMessage returns true if the MessageType m is a inline markup message type.

func IsSectionMessage

func IsSectionMessage(m MessageType) bool

IsSectionMessage returns true if the MessageType m is a section message type.

Types

type MessageType

type MessageType int

MessageType implements messages generated by the parser. Parser messages are leveled using systemMessageLevels.

const (
	ParserMessageNil MessageType = iota
	SectionWarningOverlineTooShortForTitle
	SectionWarningUnexpectedTitleOverlineOrTransition
	SectionWarningUnderlineTooShortForTitle
	SectionWarningShortOverline
	SectionWarningShortUnderline
	SectionErrorInvalidSectionOrTransitionMarker
	SectionErrorUnexpectedSectionTitle
	SectionErrorUnexpectedSectionTitleOrTransition
	SectionErrorIncompleteSectionTitle
	SectionErrorMissingMatchingUnderlineForOverline
	SectionErrorOverlineUnderlineMismatch
	SectionErrorTitleLevelInconsistent
	InlineMarkupWarningExplicitMarkupWithUnIndent
)

func (MessageType) String

func (m MessageType) String() string

String implements Stringer and returns the MessageType as a string. The returned string is the MessageType name, not the message itself.

type ParserMessage

type ParserMessage struct {
	Type          MessageType
	StartLine     int    // The line where literal text begins
	EndLine       int    // The line where literal text ends
	MessageLine   int    // The line in the input that caused the message
	LiteralText   string // Additional text
	StartPosition int    // The start position of the problem resulting in a message
}

func NewParserMessage

func NewParserMessage(t MessageType) *ParserMessage

NewParserMessage returns a parser message built from t.

func (ParserMessage) Level

func (p ParserMessage) Level() string

Level returns the MessageType level.

func (ParserMessage) Message

func (p ParserMessage) Message() string

Message returns the message of the MessageType as a string.

type SystemMessageLevel

type SystemMessageLevel int

SystemMessageLevel implements four levels for messages and is used in conjunction with the ParserMessage type.

func SystemMessageLevelFromString

func SystemMessageLevelFromString(name string) SystemMessageLevel

FromString returns the SystemMessageLevel converted from the string name.

func (SystemMessageLevel) String

func (s SystemMessageLevel) String() string

String implments Stringer and return a string of the SystemMessageLevel.

Jump to

Keyboard shortcuts

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