Browse Source

add in base for NOT_TEST

master
Brett Langdon 10 years ago
parent
commit
96513b67c1
2 changed files with 24 additions and 0 deletions
  1. +18
    -0
      ast/tests.go
  2. +6
    -0
      parser/parser.go

+ 18
- 0
ast/tests.go View File

@ -54,3 +54,21 @@ func NewAndTest() *AndTest {
func (node *AndTest) orTestChild() {}
func (node *AndTest) Append(n AndTestChildNode) { node.ListNode.Append(n) }
type NotTestChild interface {
Node
notTestChild()
}
type NotTest struct {
ParentNode
}
func NewNotTest() *NotTest {
node := &NotTest{}
node.initBaseNode(NOT_TEST)
return node
}
func (node *NotTest) notTestChild() {}
func (node *NotTest) SetChild(n NotTestChild) { node.ParentNode.SetChild(n) }

+ 6
- 0
parser/parser.go View File

@ -62,6 +62,12 @@ func (parser *Parser) parseCompoundStatement() *ast.CompoundStatement {
return compoundStmt
}
// not_test: 'not' not_test | comparison
func (parser *Parser) parseNotTest() *ast.NotTest {
notTest := ast.NewNotTest()
return notTest
}
// and_test: not_test ('and' not_test)*
func (parser *Parser) parseAndTest() *ast.AndTest {
andTest := ast.NewAndTest()


Loading…
Cancel
Save