📄 arithmeticanalyzer.cs
字号:
/* * ArithmeticAnalyzer.cs * * THIS FILE HAS BEEN GENERATED AUTOMATICALLY. DO NOT EDIT! * * This work is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This work is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * As a special exception, the copyright holders of this library give * you permission to link this library with independent modules to * produce an executable, regardless of the license terms of these * independent modules, and to copy and distribute the resulting * executable under terms of your choice, provided that you also meet, * for each linked independent module, the terms and conditions of the * license of that module. An independent module is a module which is * not derived from or based on this library. If you modify this * library, you may extend this exception to your version of the * library, but you are not obligated to do so. If you do not wish to * do so, delete this exception statement from your version. * * Copyright (c) 2003 Per Cederberg. All rights reserved. */using PerCederberg.Grammatica.Parser;namespace PerCederberg.Grammatica.Test { /** * <remarks>A class providing callback methods for the * parser.</remarks> */ internal abstract class ArithmeticAnalyzer : Analyzer { /** * <summary>Called when entering a parse tree node.</summary> * * <param name='node'>the node being entered</param> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public override void Enter(Node node) { switch (node.GetId()) { case (int) ArithmeticConstants.ADD: EnterAdd((Token) node); break; case (int) ArithmeticConstants.SUB: EnterSub((Token) node); break; case (int) ArithmeticConstants.MUL: EnterMul((Token) node); break; case (int) ArithmeticConstants.DIV: EnterDiv((Token) node); break; case (int) ArithmeticConstants.LEFT_PAREN: EnterLeftParen((Token) node); break; case (int) ArithmeticConstants.RIGHT_PAREN: EnterRightParen((Token) node); break; case (int) ArithmeticConstants.NUMBER: EnterNumber((Token) node); break; case (int) ArithmeticConstants.IDENTIFIER: EnterIdentifier((Token) node); break; case (int) ArithmeticConstants.EXPRESSION: EnterExpression((Production) node); break; case (int) ArithmeticConstants.EXPRESSION_REST: EnterExpressionRest((Production) node); break; case (int) ArithmeticConstants.TERM: EnterTerm((Production) node); break; case (int) ArithmeticConstants.TERM_REST: EnterTermRest((Production) node); break; case (int) ArithmeticConstants.FACTOR: EnterFactor((Production) node); break; case (int) ArithmeticConstants.ATOM: EnterAtom((Production) node); break; } } /** * <summary>Called when exiting a parse tree node.</summary> * * <param name='node'>the node being exited</param> * * <returns>the node to add to the parse tree, or * null if no parse tree should be created</returns> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public override Node Exit(Node node) { switch (node.GetId()) { case (int) ArithmeticConstants.ADD: return ExitAdd((Token) node); case (int) ArithmeticConstants.SUB: return ExitSub((Token) node); case (int) ArithmeticConstants.MUL: return ExitMul((Token) node); case (int) ArithmeticConstants.DIV: return ExitDiv((Token) node); case (int) ArithmeticConstants.LEFT_PAREN: return ExitLeftParen((Token) node); case (int) ArithmeticConstants.RIGHT_PAREN: return ExitRightParen((Token) node); case (int) ArithmeticConstants.NUMBER: return ExitNumber((Token) node); case (int) ArithmeticConstants.IDENTIFIER: return ExitIdentifier((Token) node); case (int) ArithmeticConstants.EXPRESSION: return ExitExpression((Production) node); case (int) ArithmeticConstants.EXPRESSION_REST: return ExitExpressionRest((Production) node); case (int) ArithmeticConstants.TERM: return ExitTerm((Production) node); case (int) ArithmeticConstants.TERM_REST: return ExitTermRest((Production) node); case (int) ArithmeticConstants.FACTOR: return ExitFactor((Production) node); case (int) ArithmeticConstants.ATOM: return ExitAtom((Production) node); } return node; } /** * <summary>Called when adding a child to a parse tree * node.</summary> * * <param name='node'>the parent node</param> * <param name='child'>the child node, or null</param> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public override void Child(Production node, Node child) { switch (node.GetId()) { case (int) ArithmeticConstants.EXPRESSION: ChildExpression(node, child); break; case (int) ArithmeticConstants.EXPRESSION_REST: ChildExpressionRest(node, child); break; case (int) ArithmeticConstants.TERM: ChildTerm(node, child); break; case (int) ArithmeticConstants.TERM_REST: ChildTermRest(node, child); break; case (int) ArithmeticConstants.FACTOR: ChildFactor(node, child); break; case (int) ArithmeticConstants.ATOM: ChildAtom(node, child); break; } } /** * <summary>Called when entering a parse tree node.</summary> * * <param name='node'>the node being entered</param> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual void EnterAdd(Token node) { } /** * <summary>Called when exiting a parse tree node.</summary> * * <param name='node'>the node being exited</param> * * <returns>the node to add to the parse tree, or * null if no parse tree should be created</returns> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual Node ExitAdd(Token node) { return node; } /** * <summary>Called when entering a parse tree node.</summary> * * <param name='node'>the node being entered</param> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual void EnterSub(Token node) { } /** * <summary>Called when exiting a parse tree node.</summary> * * <param name='node'>the node being exited</param> * * <returns>the node to add to the parse tree, or * null if no parse tree should be created</returns> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual Node ExitSub(Token node) { return node; } /** * <summary>Called when entering a parse tree node.</summary> * * <param name='node'>the node being entered</param> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual void EnterMul(Token node) { } /** * <summary>Called when exiting a parse tree node.</summary> * * <param name='node'>the node being exited</param> * * <returns>the node to add to the parse tree, or * null if no parse tree should be created</returns> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual Node ExitMul(Token node) { return node; } /** * <summary>Called when entering a parse tree node.</summary> * * <param name='node'>the node being entered</param> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual void EnterDiv(Token node) { } /** * <summary>Called when exiting a parse tree node.</summary> * * <param name='node'>the node being exited</param> * * <returns>the node to add to the parse tree, or * null if no parse tree should be created</returns> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual Node ExitDiv(Token node) { return node; } /** * <summary>Called when entering a parse tree node.</summary> * * <param name='node'>the node being entered</param> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual void EnterLeftParen(Token node) { } /** * <summary>Called when exiting a parse tree node.</summary> * * <param name='node'>the node being exited</param> * * <returns>the node to add to the parse tree, or * null if no parse tree should be created</returns> * * <exception cref='ParseException'>if the node analysis * discovered errors</exception> */ public virtual Node ExitLeftParen(Token node) { return node; } /** * <summary>Called when entering a parse tree node.</summary> * * <param name='node'>the node being entered</param> * * <exception cref='ParseException'>if the node analysis
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -