diff options
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/lexer.go | 6 | ||||
-rw-r--r-- | compiler/parser/parser.go | 5 | ||||
-rw-r--r-- | compiler/parser/tree.go | 5 |
3 files changed, 7 insertions, 9 deletions
diff --git a/compiler/parser/lexer.go b/compiler/parser/lexer.go index 01cebeb..3861825 100644 --- a/compiler/parser/lexer.go +++ b/compiler/parser/lexer.go @@ -416,7 +416,7 @@ func (l *lexer) nextInCodePoint(c rune) (*token, error) { return nil, err } if eof { - l.restore() + err := l.restore() if err != nil { return nil, err } @@ -471,7 +471,7 @@ func (l *lexer) nextInCharProp(c rune) (*token, error) { return nil, err } if eof { - l.restore() + err := l.restore() if err != nil { return nil, err } @@ -512,7 +512,7 @@ func (l *lexer) nextInFragment(c rune) (*token, error) { return nil, err } if eof { - l.restore() + err := l.restore() if err != nil { return nil, err } diff --git a/compiler/parser/parser.go b/compiler/parser/parser.go index fd85fab..3706525 100644 --- a/compiler/parser/parser.go +++ b/compiler/parser/parser.go @@ -446,10 +446,7 @@ func genAnyCharAST() CPTree { } func isValidOrder(from, to rune) bool { - if from <= to { - return true - } - return false + return from <= to } func genConcatNode(cs ...CPTree) CPTree { diff --git a/compiler/parser/tree.go b/compiler/parser/tree.go index b5fb723..04ba723 100644 --- a/compiler/parser/tree.go +++ b/compiler/parser/tree.go @@ -207,7 +207,7 @@ func newConcatNode(left, right CPTree) *concatNode { } func (n *concatNode) String() string { - return fmt.Sprintf("concat") + return "concat" } func (n *concatNode) Range() (rune, rune, bool) { @@ -258,7 +258,7 @@ func newAltNode(left, right CPTree) *altNode { } func (n *altNode) String() string { - return fmt.Sprintf("alt") + return "alt" } func (n *altNode) Range() (rune, rune, bool) { @@ -419,6 +419,7 @@ func (n *fragmentNode) clone() CPTree { return newFragmentNode(n.kind, n.tree.clone()) } +//nolint:unused func printCPTree(w io.Writer, t CPTree, ruledLine string, childRuledLinePrefix string) { if t == nil { return |