forked from rrevenantt/antlr4rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
visitorbasicvisitor.rs
42 lines (39 loc) · 1.24 KB
/
visitorbasicvisitor.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#![allow(nonstandard_style)]
// Generated from VisitorBasic.g4 by ANTLR 4.8
use super::visitorbasicparser::*;
use antlr_rust::tree::{ParseTreeVisitor, ParseTreeVisitorCompat};
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link VisitorBasicParser}.
*/
pub trait VisitorBasicVisitor<'input>:
ParseTreeVisitor<'input, VisitorBasicParserContextType>
{
/**
* Visit a parse tree produced by {@link VisitorBasicParser#s}.
* @param ctx the parse tree
*/
fn visit_s(&mut self, ctx: &SContext<'input>) {
self.visit_children(ctx)
}
}
pub trait VisitorBasicVisitorCompat<'input>:
ParseTreeVisitorCompat<'input, Node = VisitorBasicParserContextType>
{
/**
* Visit a parse tree produced by {@link VisitorBasicParser#s}.
* @param ctx the parse tree
*/
fn visit_s(&mut self, ctx: &SContext<'input>) -> Self::Return {
self.visit_children(ctx)
}
}
impl<'input, T> VisitorBasicVisitor<'input> for T
where
T: VisitorBasicVisitorCompat<'input>,
{
fn visit_s(&mut self, ctx: &SContext<'input>) {
let result = <Self as VisitorBasicVisitorCompat>::visit_s(self, ctx);
*<Self as ParseTreeVisitorCompat>::temp_result(self) = result;
}
}