Module grammar

Module grammar 

Source
Expand description

Helper functions and rules for enforcing the ABNF grammar for RFC 7468-flavored PEM as described in Section 3.

The grammar described below is intended to follow the β€œABNF (Strict)” subset of the grammar as described in Section 3 Figure 3.

ConstantsΒ§

CHAR_COLON πŸ”’
Colon β€˜:’
CHAR_CR πŸ”’
Carriage return
CHAR_HT πŸ”’
Horizontal tab
CHAR_LF πŸ”’
Line feed
CHAR_NUL πŸ”’
NUL char
CHAR_SP πŸ”’
Space

FunctionsΒ§

is_allowed_in_label πŸ”’
Does the provided byte match a character allowed in a label?
is_labelchar πŸ”’
Any printable character except hyphen-minus, as defined in the β€˜labelchar’ production in the RFC 7468 ABNF grammar
is_wsp πŸ”’
Does the provided byte match the β€œWSP” ABNF production from Section 3?
split_label πŸ”’
Split a slice beginning with a type label as located in an encapsulation boundary. Returns the label as a &str, and slice beginning with the encapsulated text with leading ----- and newline removed.
strip_leading_eol πŸ”’
Strip a newline (eol) from the beginning of the provided byte slice.
strip_preamble πŸ”’
Strip the β€œpreamble”, i.e. data that appears before the PEM pre-encapsulation boundary.
strip_trailing_eol πŸ”’
Strip a newline (eol) from the end of the provided byte slice.
validate_label πŸ”’
Validate that the given bytes are allowed as a PEM type label, i.e. the label encoded in the BEGIN and END encapsulation boundaries.