Add nested mutations
This commit is contained in:
@ -28,7 +28,7 @@ type Pos int
|
||||
|
||||
// item represents a token or text string returned from the scanner.
|
||||
type item struct {
|
||||
typ itemType // The type of this item.
|
||||
_type itemType // The type of this item.
|
||||
pos Pos // The starting position, in bytes, of this item in the input string.
|
||||
end Pos // The ending position, in bytes, of this item in the input string.
|
||||
line uint16 // The line number at the start of this item.
|
||||
@ -211,7 +211,7 @@ func lex(l *lexer, input []byte) error {
|
||||
|
||||
l.run()
|
||||
|
||||
if last := l.items[len(l.items)-1]; last.typ == itemError {
|
||||
if last := l.items[len(l.items)-1]; last._type== itemError {
|
||||
return l.err
|
||||
}
|
||||
return nil
|
||||
@ -435,7 +435,7 @@ func lowercase(b []byte, s Pos, e Pos) {
|
||||
func (i *item) String() string {
|
||||
var v string
|
||||
|
||||
switch i.typ {
|
||||
switch i._type{
|
||||
case itemEOF:
|
||||
v = "EOF"
|
||||
case itemError:
|
||||
|
@ -169,7 +169,7 @@ func (p *Parser) next() item {
|
||||
n := p.pos + 1
|
||||
if n >= len(p.items) {
|
||||
p.err = errEOT
|
||||
return item{typ: itemEOF}
|
||||
return item{_type: itemEOF}
|
||||
}
|
||||
p.pos = n
|
||||
return p.items[p.pos]
|
||||
@ -186,14 +186,14 @@ func (p *Parser) ignore() {
|
||||
|
||||
func (p *Parser) peek(types ...itemType) bool {
|
||||
n := p.pos + 1
|
||||
if p.items[n].typ == itemEOF {
|
||||
if p.items[n]._type == itemEOF {
|
||||
return false
|
||||
}
|
||||
if n >= len(p.items) {
|
||||
return false
|
||||
}
|
||||
for i := 0; i < len(types); i++ {
|
||||
if p.items[n].typ == types[i] {
|
||||
if p.items[n]._type == types[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ func (p *Parser) parseOp() (*Operation, error) {
|
||||
op := opPool.Get().(*Operation)
|
||||
op.Reset()
|
||||
|
||||
switch item.typ {
|
||||
switch item._type {
|
||||
case itemQuery:
|
||||
op.Type = opQuery
|
||||
case itemMutation:
|
||||
@ -471,7 +471,7 @@ func (p *Parser) parseValue() (*Node, error) {
|
||||
node := nodePool.Get().(*Node)
|
||||
node.Reset()
|
||||
|
||||
switch item.typ {
|
||||
switch item._type {
|
||||
case itemIntVal:
|
||||
node.Type = NodeInt
|
||||
case itemFloatVal:
|
||||
|
@ -1086,7 +1086,6 @@ func (t ExpOp) String() string {
|
||||
}
|
||||
|
||||
func FreeExp(ex *Exp) {
|
||||
// fmt.Println(">", ex.doFree)
|
||||
if ex.doFree {
|
||||
expPool.Put(ex)
|
||||
}
|
||||
|
Reference in New Issue
Block a user