diff --git a/ast/tests.go b/ast/tests.go index 1da010d..5e58a4a 100644 --- a/ast/tests.go +++ b/ast/tests.go @@ -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) } diff --git a/parser/parser.go b/parser/parser.go index 599aff7..925977b 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -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()