Imports #
"errors"
"unicode/utf8"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/bidi"
"errors"
"unicode/utf8"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/bidi"
ErrInvalid indicates a label is invalid according to the Bidi Rule.
var ErrInvalid = *ast.CallExprPrecomputing the ASCII values decreases running time for the ASCII fast path by about 30%.
var asciiTable [128]bidi.Properties[2.4] In an RTL label, if an EN is present, no AN may be present, and vice versa.
const exclusiveRTL = *ast.CallExprconst ruleInitial ruleState = iotaconst ruleInvalidconst ruleLTRconst ruleLTRFinalconst ruleRTLconst ruleRTLFinalvar transitions = [...][2]ruleTransition{...}type ruleState uint8Transformer implements transform.Transform.
type Transformer struct {
state ruleState
hasRTL bool
seen uint16
}type ruleTransition struct {
next ruleState
mask uint16
}Direction reports the direction of the given label as defined by RFC 5893. The Bidi Rule does not have to be applied to labels of the category LeftToRight.
func Direction(b []byte) bidi.DirectionDirectionString reports the direction of the given label as defined by RFC 5893. The Bidi Rule does not have to be applied to labels of the category LeftToRight.
func DirectionString(s string) bidi.DirectionNew returns a Transformer that verifies that input adheres to the Bidi Rule.
func New() *TransformerReset implements transform.Transformer.
func (t *Transformer) Reset()Span returns the first n bytes of src that conform to the Bidi rule.
func (t *Transformer) Span(src []byte, atEOF bool) (n int, err error)Transform implements transform.Transformer. This Transformer has state and needs to be reset between uses.
func (t *Transformer) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)Valid reports whether b conforms to the BiDi rule.
func Valid(b []byte) boolValidString reports whether s conforms to the BiDi rule.
func ValidString(s string) boolfunc (t *Transformer) advance(s []byte) (n int, ok bool)func (t *Transformer) advanceString(s string) (n int, ok bool)func init()func (t *Transformer) isFinal() boolfunc (t *Transformer) isFinal() boolA rule can only be violated for "Bidi Domain names", meaning if one of the following categories has been observed.
func (t *Transformer) isRTL() boolGenerated with Arrow