parser

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlphaNumeric

func IsAlphaNumeric(c rune) bool

IsAlphaNumeric reports whether the rune is a letter or digit.

func IsDigit

func IsDigit(c rune) bool

IsDigit reports whether the rune is a digit.

func IsLetter

func IsLetter(c rune) bool

IsLetter reports whether the rune is a letter.

func IsQualifiedName

func IsQualifiedName(device string) bool

IsQualifiedName tests if a device name is qualified.

func ParseDevice

func ParseDevice(device string) (string, string, string)

ParseDevice tries to split a device name into vendor, class, and name. If this fails, for instance in the case of unqualified device names, ParseDevice returns an empty vendor and class together with name set to the verbatim input.

func ParseQualifiedName

func ParseQualifiedName(device string) (string, string, string, error)

ParseQualifiedName splits a qualified name into device vendor, class, and name. If the device fails to parse as a qualified name, or if any of the split components fail to pass syntax validation, vendor and class are returned as empty, together with the verbatim input as the name and an error describing the reason for failure.

func ParseQualifier

func ParseQualifier(kind string) (string, string)

ParseQualifier splits a device qualifier into vendor and class. The syntax for a device qualifier is

"<vendor>/<class>"

If parsing fails, an empty vendor and the class set to the verbatim input is returned.

func QualifiedName

func QualifiedName(vendor, class, name string) string

QualifiedName returns the qualified name for a device. The syntax for a qualified device names is

"<vendor>/<class>=<name>".

A valid vendor and class name may contain the following runes:

'A'-'Z', 'a'-'z', '0'-'9', '.', '-', '_'.

A valid device name may contain the following runes:

'A'-'Z', 'a'-'z', '0'-'9', '-', '_', '.', ':'

func ValidateClassName

func ValidateClassName(class string) error

ValidateClassName checks the validity of class name. A class name may contain the following ASCII characters:

  • upper- and lowercase letters ('A'-'Z', 'a'-'z')
  • digits ('0'-'9')
  • underscore, dash, and dot ('_', '-', and '.')

func ValidateDeviceName

func ValidateDeviceName(name string) error

ValidateDeviceName checks the validity of a device name. A device name may contain the following ASCII characters:

  • upper- and lowercase letters ('A'-'Z', 'a'-'z')
  • digits ('0'-'9')
  • underscore, dash, dot, colon ('_', '-', '.', ':')

func ValidateVendorName

func ValidateVendorName(vendor string) error

ValidateVendorName checks the validity of a vendor name. A vendor name may contain the following ASCII characters:

  • upper- and lowercase letters ('A'-'Z', 'a'-'z')
  • digits ('0'-'9')
  • underscore, dash, and dot ('_', '-', and '.')

Types

This section is empty.

Jump to

Keyboard shortcuts

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