From f6bc7594e12073608b1a190caedb0ac6ab4fb81e Mon Sep 17 00:00:00 2001 From: hayden Date: Wed, 20 Dec 2023 11:12:18 +0800 Subject: [PATCH] docs: update visitor demo --- README-zh_CN.md | 5 +++-- README.md | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README-zh_CN.md b/README-zh_CN.md index f7f0fc3..11d30ac 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -180,8 +180,9 @@ class MyVisitor extends AbstractParseTreeVisitor implements MySqlParserV console.log('SelectElements', selectElements); return ''; } - visitProgram(ctx) { - return 'Return by program node' + visitProgram(ctx) { // program 是根规则 + this.visitChildren(ctx); + return 'Return by program context' } } const visitor = new MyVisitor(); diff --git a/README.md b/README.md index 4e951c5..21e3895 100644 --- a/README.md +++ b/README.md @@ -187,8 +187,9 @@ class MyVisitor extends AbstractParseTreeVisitor implements MySqlParserV console.log('SelectElements:', selectElements); return ''; } - visitProgram(ctx) { - return 'Return by program node' + visitProgram(ctx) { // program is root rule + this.visitChildren(ctx); + return 'Return by program context' } } const visitor = new MyVisitor();