yamlchar

package
v0.0.0-...-70fd0a4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package yamlchar contains functions related to YAML characters and keywords specification.

Index

Constants

View Source
const (
	// YAMLDirective represents a YAML directive keyword "YAML".
	YAMLDirective = "YAML"
	// TagDirective represents a YAML directive keyword "TAG".
	TagDirective = "TAG"
)

Variables

This section is empty.

Functions

func AreHexDigits

func AreHexDigits(runes ...rune) bool

AreHexDigits checks if given runes are hex digits

func ConformsCharSet

func ConformsCharSet(s string, cst CharSetType) bool

ConformsCharSet checks if given string consists of and follows the rules of provided CharSetType

func ConvertFromYAMLDoubleQuotedString

func ConvertFromYAMLDoubleQuotedString(s string) (string, error)

ConvertFromYAMLDoubleQuotedString 'unquotes' double quoted YAML string

func ConvertFromYAMLSingleQuotedString

func ConvertFromYAMLSingleQuotedString(s string) (string, error)

ConvertFromYAMLSingleQuotedString 'unquotes' single quoted YAML string

func ConvertToYAMLDoubleQuotedString

func ConvertToYAMLDoubleQuotedString(s string) (string, error)

ConvertToYAMLDoubleQuotedString 'quotes' given string as YAML double quoted string

func ConvertToYAMLSingleQuotedString

func ConvertToYAMLSingleQuotedString(s string) (string, error)

ConvertToYAMLSingleQuotedString 'quotes' given string as YAML single quoted string

func IsASCIILetter

func IsASCIILetter(r rune) bool

IsASCIILetter checks if given rune is ASCII letter (a-z or A-Z)

func IsAnchorString

func IsAnchorString(s string) bool

YAML specification: [102] ns-anchor-char

func IsBlankChar

func IsBlankChar(r rune) bool

IsWhitespaceChar OR IsLineBreakChar

func IsDecimal

func IsDecimal(s string) bool

IsDecimal checks if given string represents a decimal number (i.e. consists only of decimal digits)

func IsDigit

func IsDigit(r rune) bool

IsDigit checks if given rune is decimal digit

func IsDoubleQuotedString

func IsDoubleQuotedString(s string) bool

YAML specification: [107] nb-double-char

func IsEscapedCharacter

func IsEscapedCharacter(runes []rune, i int) (int, bool)

IsEscapedCharacter checks if given runes are valid escaped sequence of characters in YAML (i.e. \<valid single escaped character>, \x<two hex digits>, \u<four hex digits> or \U<eight hex digits>)

func IsFlowIndicatorChar

func IsFlowIndicatorChar(r rune) bool

YAML specification: [23] c-flow-indicator

func IsHexDigit

func IsHexDigit(r rune) bool

IsHexDigit checks if given rune is hex digit

func IsJSONChar

func IsJSONChar(r rune) bool

YAML specification: [2] nb-json

func IsLineBreakChar

func IsLineBreakChar(r rune) bool

IsLineBreakChar checks if given rune is either LF or CR character.

func IsPlainSafeString

func IsPlainSafeString(s string) bool

YAML specification: [129] ns-plain-safe-in

func IsSingleQuotedString

func IsSingleQuotedString(s string) bool

YAML specification: [118] nb-single-char

func IsTagString

func IsTagString(s string) bool

YAML specification: [40] ns-tag-char

func IsURI

func IsURI(s string) bool

YAML specification: [39] ns-uri-char

func IsWhitespaceChar

func IsWhitespaceChar(r rune) bool

IsWhitespaceChar checks if given rune is either space or tab

func IsWord

func IsWord(s string) bool

YAML specification: [39] ns-word-char

Types

type CharSetType

type CharSetType int16

CharSetType defines a limited set of characters used in YAML specification definitions.

const (
	// DecimalCharSetType corresponds to [35] ns-dec-digit of YAML specification
	DecimalCharSetType CharSetType = 1 << iota
	// WordCharSetType corresponds to [38] ns-word-char of YAML specification
	WordCharSetType
	// URICharSetType corresponds to [39] ns-uri-char of YAML specification
	URICharSetType
	// TagCharSetType corresponds to [40] ns-tag-char of YAML specification
	TagCharSetType
	// AnchorCharSetType corresponds to [102] ns-anchor-char of YAML specification
	AnchorCharSetType
	// PlainSafeCharSetType corresponds to [129] ns-plain-safe-in of YAML specification
	PlainSafeCharSetType
	// SingleQuotedCharSetType corresponds to [119] ns-single-char of YAML specification
	SingleQuotedCharSetType
	// DoubleQuotedCharSetType corresponds to [108] ns-double-char of YAML specification
	DoubleQuotedCharSetType
)
const (
	UnknownCharSetType CharSetType = 0
)

type Character

type Character = rune

Character represents a single YAML character

const (
	SequenceEntryCharacter     Character = '-'
	MappingKeyCharacter        Character = '?'
	MappingValueCharacter      Character = ':'
	CollectEntryCharacter      Character = ','
	SequenceStartCharacter     Character = '['
	SequenceEndCharacter       Character = ']'
	MappingStartCharacter      Character = '{'
	MappingEndCharacter        Character = '}'
	CommentCharacter           Character = '#'
	AnchorCharacter            Character = '&'
	AliasCharacter             Character = '*'
	TagCharacter               Character = '!'
	LiteralCharacter           Character = '|'
	FoldedCharacter            Character = '>'
	SingleQuoteCharacter       Character = '\''
	DoubleQuoteCharacter       Character = '"'
	DirectiveCharacter         Character = '%'
	ReservedAtCharacter        Character = '@'
	ReservedBackquoteCharacter Character = '`'
	LineFeedCharacter          Character = '\n'
	CarriageReturnCharacter    Character = '\r'
	SpaceCharacter             Character = ' '
	TabCharacter               Character = '\t'
	EscapeCharacter            Character = '\\'
	DotCharacter               Character = '.'
	ByteOrderMarkCharacter     Character = 0xFEFF
	DirectiveEndCharacter      Character = '-'
	StripChompingCharacter     Character = '-'
	KeepChompingCharacter      Character = '+'
	DocumentEndCharacter       Character = '.'
)

Jump to

Keyboard shortcuts

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