Documentation ¶
Index ¶
- Constants
- Variables
- func EscapeStr(s string) string
- func EscapeStrForGV(s string) string
- func N4Blanks(n int) (rv string)
- func NameOfLR_TokType(x LR_TokType) string
- type LR_TokType
- type LexReMatcherType
- type LexReType
- func (lr *LexReType) CalcLength() (int, bool)
- func (lr *LexReType) CalcLengthChild(tree *ReTreeNodeType, d int) (x int, hard bool)
- func (lr *LexReType) DumpParseNodes()
- func (lr *LexReType) DumpParseNodesChild(ch []ReTreeNodeType, d int)
- func (lr *LexReType) Err(s string)
- func (lr *LexReType) GenerateSigma() (rv string)
- func (lr *LexReType) GenerateSigmaFromTree(tree *ReTreeNodeType, d int) (rv string)
- func (lr *LexReType) Next() (ss string, cl LR_TokType)
- func (lr *LexReType) ParseRe(ss string)
- func (lr *LexReType) SetBuf(s string)
- func (lr *LexReType) Warn(s string)
- type ReTreeNodeType
Constants ¶
View Source
const ( X_DOT = "\uF8FA" // Any char in Sigma X_BOL = "\uF8F3" // Beginning of line X_EOL = "\uF8F4" // End of line X_NUMERIC = "\uF8F5" X_LOWER = "\uF8F6" X_UPPER = "\uF8F7" X_ALPHA = "\uF8F8" X_ALPHNUM = "\uF8F9" X_EOF = "\uF8FB" X_not_CH = "\uF8FC" // On input lookup if the char is NOT in Signa then it is returned as this. X_else_CH = "\uF8FC" // If char is not matched in this state then take this path X_N_CCL = "\uF8FD" X_LAMBDA_MATCH = "\uF8FE" )
View Source
const ( R_min_reserved = '\uF8FA' // R_DOT = '\uF8FA' // Any char in Sigma R_BOL = '\uF8F3' // Beginning of line R_EOL = '\uF8F4' // End of line R_NUMERIC = '\uF8F5' R_LOWER = '\uF8F6' R_UPPER = '\uF8F7' R_ALPHA = '\uF8F8' R_ALPHNUM = '\uF8F9' R_EOF = '\uF8FB' R_not_CH = '\uF8FC' // On input lookup if the char is NOT in Signa then it is returned as this. R_else_CH = '\uF8FC' // If char is not matched in this state then take this path R_N_CCL = '\uF8FD' // If char is not matched in this state then take this path R_LAMBDA_MATCH = '\uF8FE' )
View Source
const InfiniteIteration = 9999999999
Variables ¶
View Source
var LR_TokTypeLookup map[LR_TokType]string
View Source
var LexReMatcher = []LexReMatcherType{ {Sym: `\[`, Rv: LR_Text, Repl: "["}, {Sym: `\]`, Rv: LR_Text, Repl: "]"}, {Sym: `\(`, Rv: LR_Text, Repl: "("}, {Sym: `\)`, Rv: LR_Text, Repl: ")"}, {Sym: `\^`, Rv: LR_Text, Repl: "^"}, {Sym: `\?`, Rv: LR_Text, Repl: "?"}, {Sym: `\*`, Rv: LR_Text, Repl: "*"}, {Sym: `\+`, Rv: LR_Text, Repl: "+"}, {Sym: `\.`, Rv: LR_Text, Repl: "."}, {Sym: `\-`, Rv: LR_Text, Repl: "-"}, {Sym: `\^`, Rv: LR_Text, Repl: "^"}, {Sym: `\$`, Rv: LR_Text, Repl: "$"}, {Sym: `\\`, Rv: LR_Text, Repl: "\\"}, {Sym: `\|`, Rv: LR_Text, Repl: "|"}, {Sym: `\{`, Rv: LR_Text, Repl: "{"}, {Sym: `\}`, Rv: LR_Text, Repl: "}"}, {Sym: `\,`, Rv: LR_Text, Repl: ","}, {Sym: "[^", Rv: LR_N_CCL}, {Sym: ".", Rv: LR_DOT}, {Sym: "*", Rv: LR_STAR}, {Sym: "+", Rv: LR_PLUS}, {Sym: "?", Rv: LR_QUEST}, {Sym: "[", Rv: LR_CCL}, {Sym: "]", Rv: LR_E_CCL}, {Sym: "(", Rv: LR_OP_PAR}, {Sym: ")", Rv: LR_CL_PAR}, {Sym: "^", Rv: LR_CARROT}, {Sym: "-", Rv: LR_MINUS}, {Sym: "$", Rv: LR_DOLLAR}, {Sym: "|", Rv: LR_OR}, {Sym: "{", Rv: LR_OP_BR}, {Sym: "}", Rv: LR_CL_BR}, {Sym: ",", Rv: LR_COMMA}, }
Functions ¶
func EscapeStrForGV ¶
func NameOfLR_TokType ¶
func NameOfLR_TokType(x LR_TokType) string
Types ¶
type LR_TokType ¶
type LR_TokType int
const ( LR_null LR_TokType = iota // 0 LR_Text // 1 LR_EOF // 2 LR_DOT // 3 . LR_STAR // 4 * LR_PLUS // 5 + LR_QUEST // 6 ? LR_OP_PAR // 7 ( LR_CL_PAR // 8 ) LR_CCL // 9 [...] LR_N_CCL // 10 [^...] LR_E_CCL // 11 ] LR_CARROT // 12 ^ LR_MINUS // 13 - LR_DOLLAR // 14 $ LR_OR // 15 | LR_OP_BR // 16 { LR_CL_BR // 17 } LR_COMMA // 18 , )
type LexReMatcherType ¶
type LexReMatcherType struct { Sym string Rv LR_TokType Repl string }
type LexReType ¶
type LexReType struct { Buf string // Holds the RE being parsed Pos int // Where we are Tree *ReTreeNodeType // Pointer to the top of the tree Error []error // Set of errors Sigma string // }
func NewLexReType ¶
func NewLexReType() *LexReType
func (*LexReType) CalcLength ¶
func (*LexReType) CalcLengthChild ¶
func (lr *LexReType) CalcLengthChild(tree *ReTreeNodeType, d int) (x int, hard bool)
func (*LexReType) DumpParseNodes ¶
func (lr *LexReType) DumpParseNodes()
func (*LexReType) DumpParseNodesChild ¶
func (lr *LexReType) DumpParseNodesChild(ch []ReTreeNodeType, d int)
What can I see at the top of a RE
LR_Text // LR_EOF // LR_DOT // . -- Match any char LR_STAR // * -- Error if 1st char LR_PLUS // + -- Error if 1st char LR_QUEST // ? -- Error if 1st char LR_B_CCL // [ -- Start of CCL Node LR_E_CCL // ] LR_OP_PAR // ( -- Start of Sub_Re LR_CL_PAR // ) LR_CCL // [...] -- CCL Node (Above) LR_N_CCL // [^...] -- N_CCL Node LR_CARROT // ^ -- BOL LR_MINUS // - -- Text if not in CCL and not 1st char in CCL Item string LR_Tok LR_TokType Children []*ReTreeNodeType Next *ReTreeNodeType
func (*LexReType) GenerateSigma ¶
func (*LexReType) GenerateSigmaFromTree ¶
func (lr *LexReType) GenerateSigmaFromTree(tree *ReTreeNodeType, d int) (rv string)
func (*LexReType) Next ¶
func (lr *LexReType) Next() (ss string, cl LR_TokType)
type ReTreeNodeType ¶
type ReTreeNodeType struct { Item string // Set of Runes Mm int // { m, n } Nn int // { m, n } LR_Tok LR_TokType // Node Type Children []ReTreeNodeType // Children of this node }
func NewReTreeNodeType ¶
func NewReTreeNodeType() *ReTreeNodeType
Click to show internal directories.
Click to hide internal directories.