From a12efbc26e5103382e0cceef35f8c9cecf6eb55c Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9sar=20Natar=C3=A9n?= Date: Tue, 22 Apr 2003 04:59:15 +0000 Subject: [PATCH] Added Antlr.Runtime/antlr.collections and Antlr.Runtime/antlr.collections/AST.cs. svn path=/trunk/mcs/; revision=13874 --- .../Antlr.Runtime/antlr.collections/AST.cs | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 mcs/class/Microsoft.JScript/Antlr.Runtime/antlr.collections/AST.cs diff --git a/mcs/class/Microsoft.JScript/Antlr.Runtime/antlr.collections/AST.cs b/mcs/class/Microsoft.JScript/Antlr.Runtime/antlr.collections/AST.cs new file mode 100755 index 00000000000..2bbfb4ee9ac --- /dev/null +++ b/mcs/class/Microsoft.JScript/Antlr.Runtime/antlr.collections/AST.cs @@ -0,0 +1,66 @@ +using System; +using IEnumerator = System.Collections.IEnumerator; + +using Token = antlr.Token; + +namespace antlr.collections +{ + /*ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/RIGHTS.html + * + * $Id: AST.cs,v 1.1 2003/04/22 04:59:15 cesar Exp $ + */ + + // + // ANTLR C# Code Generator by Micheal Jordan + // Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com + // Anthony Oguntimehin + // + // With many thanks to Eric V. Smith from the ANTLR list. + // + + /*Minimal AST node interface used by ANTLR AST generation + * and tree-walker. + */ + public interface AST : ICloneable + { + /*Add a (rightmost) child to this node */ + void addChild(AST c); + bool Equals(AST t); + bool EqualsList(AST t); + bool EqualsListPartial(AST t); + bool EqualsTree(AST t); + bool EqualsTreePartial(AST t); + IEnumerator findAll(AST tree); + IEnumerator findAllPartial(AST subtree); + /*Get the first child of this node; null if no children */ + AST getFirstChild(); + /*Get the next sibling in line after this one */ + AST getNextSibling(); + /*Get the token text for this node */ + string getText(); + /*Get the token type for this node */ + int Type { get; set;} + /// + /// Get number of children of this node; if leaf, returns 0 + /// + /// Number of children + int getNumberOfChildren(); + void initialize(int t, string txt); + void initialize(AST t); + void initialize(Token t); + /*Set the first child of a node. */ + void setFirstChild(AST c); + /*Set the next sibling after this one. */ + void setNextSibling(AST n); + /*Set the token text for this node */ + void setText(string text); + /*Set the token type for this node */ + void setType(int ttype); + string ToString(); + string ToStringList(); + string ToStringTree(); + } + +} \ No newline at end of file -- 2.25.1