diff --git a/lib/ast/visitor.js b/lib/ast/visitor.js index 198b5e1..4148331 100644 --- a/lib/ast/visitor.js +++ b/lib/ast/visitor.js @@ -40,7 +40,7 @@ module.exports = { }; // Helper's to create visitor's for use with the ASTVisitor class -const on = ASTVisitor.for = { +const on = ASTVisitor.on = { // Visit a node that is defined as a property on another node property( name ) { diff --git a/lib/typings/api.d.ts b/lib/typings/api.d.ts index b9c4968..f08e728 100644 --- a/lib/typings/api.d.ts +++ b/lib/typings/api.d.ts @@ -317,7 +317,15 @@ declare namespace peg { } + interface IOn { + + property( name: string ): IVisitor; + children( name: string ): IVisitor; + + } + const build: IVisitorBuilder; + const on: IFor; } @@ -325,6 +333,7 @@ declare namespace peg { ASTVisitor: visitor.ASTVisitor; build: visitor.IVisitorBuilder; + on: visitor.IOn; }