int-iterator is now defined interval
This commit is contained in:
@@ -173,33 +173,28 @@ func (parser *parser) parseList(scanner *scan.Scanner, ctx parserContext, termSy
|
||||
itemExpected := false
|
||||
itemCtx := remFlags(ctx, allowIndex)
|
||||
for lastSym != termSym && lastSym != sym.SymEos {
|
||||
// zeroRequired := scanner.Current().Sym == sym.SymDoubleDot
|
||||
var itemTree *scan.Ast
|
||||
if itemTree, err = parser.parseItem(scanner, itemCtx, sym.SymComma, termSym); err == nil {
|
||||
root := itemTree.Root()
|
||||
if root != nil {
|
||||
if hasFlag(ctx, allowIndex) && root.Symbol() == sym.SymDoubleDot {
|
||||
changeColonToInterval(root)
|
||||
if root.Symbol() == sym.SymDoubleDot {
|
||||
if hasFlag(ctx, allowIndex) {
|
||||
changeColonToInterval(root)
|
||||
} else {
|
||||
// err = root.Errorf("unexpected range expression")
|
||||
err = errIntervalUnexpectedExpression(root)
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasFlag(ctx, allowIndex) && root.Symbol() == sym.SymInterval {
|
||||
// err = root.Errorf("unexpected range expression")
|
||||
err = errIntervalUnexpectedExpression(root)
|
||||
break
|
||||
}
|
||||
args = append(args, root)
|
||||
// if hasFlag(ctx, allowIndex) && root.Symbol() == sym.SymInterval && zeroRequired { //len(root.children) == 0 {
|
||||
// if len(root.Children) == 1 {
|
||||
// root.Children = append(root.Children, root.Children[0])
|
||||
// } else if len(root.Children) > 1 {
|
||||
// // err = root.Errorf("invalid range specification")
|
||||
// err = errIntervalInvalidSpecification(root)
|
||||
// break
|
||||
// }
|
||||
// zeroTk := scan.NewValueToken(root.Tk.Row(), root.Tk.Col(), sym.SymInteger, "0", int64(0))
|
||||
// zeroTerm := scan.NewTerm(zeroTk)
|
||||
// zeroTerm.SetParent(root)
|
||||
// root.Children[0] = zeroTerm
|
||||
// if hasFlag(ctx, allowIndex) && root.Symbol() == sym.SymDoubleDot {
|
||||
// changeColonToInterval(root)
|
||||
// }
|
||||
// if !hasFlag(ctx, allowIndex) && root.Symbol() == sym.SymInterval {
|
||||
// // err = root.Errorf("unexpected range expression")
|
||||
// err = errIntervalUnexpectedExpression(root)
|
||||
// break
|
||||
// }
|
||||
args = append(args, root)
|
||||
} else if itemExpected {
|
||||
prev := scanner.Previous()
|
||||
err = prev.ErrorExpectedGot("list-item")
|
||||
|
||||
Reference in New Issue
Block a user