Goblin - A Platform for 3D AR and VR Applications

DDW.CSharp.Dom Namespace

C# grammar (based on ecma-334 spec) -- Robin Debreuil Fri Mar 5, 2004 11:50 -- A (mostly) complete cs parser. It parses into a tree structure loosely based on the CodeDom. Does not yet do #if preprocessor segments, and no unsafe code (as of yet). You can test by downloading the CSharp.zip file and dragging cs files into CSharp.exe. The zip includes the grammar file, as well as the cs token classes (the grammar uses a heterogeneous tree, though that should be simple to turn off). -- permalink: http://www.debreuil.com/CSharp. TJP: copied src, exe to antlr.org and changed link as debreuil's links are dead.

Namespace hierarchy

Classes

Class Description
AccessorDecl An accessor declartation.
ArgumentRef An argument reference.
ArrayCreateExpr An expression that creates a new array.
ArrayElementRef A reference to a specific element of an array.
ArrayInitializer An expression that initializes a new array being created (the {1,2,3} part).
AssemblyReference A reference to an assembly. This is normally something on the command line.
AssemblyReferenceCollection A strongly-typed collection of AssemblyReference objects.
AssignExpr An assignment expression.
AttachDelegateStmt Attaches a delegate to an event.
BaseRef A 'base' reference.
BinaryExpr A binary expression.
BooleanLiteral A boolean literal.
BreakStmt A break statement.
BuiltInType A C# built in type.
Case A case clause for a switch statement.
CaseCollection A strongly-typed collection of Case objects.
CastExpr A cast expression.
Catch A catch clause.
CatchCollection A strongly-typed collection of Catch objects.
CharLiteral A character literal.
CheckedStmt A checked statement - explicitly checks for overflow.
ClassDecl A class declartation.
CodeCollectionAttribute An attribute that specifies that a CSharp Graph property is a code element (as opposed to a helper property) as well as a collection.
CodeElementAttribute An attribute that specifies that a CSharp Graph property is a code element as opposed to a helper property.
Comment A comment that may be mixed in with other elements.
CommentStmt A normal comment.
CommentStmtCollection A strongly-typed collection of CommentStmt objects.
CompileUnit A C# file level unit of code. This must be a complete C# file, snippets are not valid.
CompileUnitCollection A strongly-typed collection of CompileUnit objects.
ConstantDecl A constant declartation.
ConstantDeclStmt A constant declaration statement.
ConstructorDecl A constructor declartation.
ContinueStmt A continue statement.
CreateDelegateExpr An expression that creates a new delegate.
CSharpGraph An abstract base class for CSharpDom elements.
CustomAttribute An single attribute applied to a code element (eg. [Flags]). Note: multiple comma separated attributes declared in a single attribute element are separated into multiple attributes.
CustomAttributeCollection A strongly-typed collection of CustomAttribute objects.
Declarator Code elements such as fields or events can declare multiple variables of the same type in one statement (int x=5, y=6, z=7;). Each of these are declarators.
DeclaratorCollection A strongly-typed collection of Declarator objects.
DelegateDecl A delegate declartation.
DelegateInvokeExpr Invokes a delegate.
DestructorDecl A destructor declartation.
EnumDecl An enum declartation.
EnumMemberDecl An enum declartation.
EventDecl An event declaration.
EventRef A reference to an event.
Expression An abstract base class for expressions.
ExpressionCollection A strongly-typed collection of Expression objects.
ExprStmt A code expression that can be treated as a code statement.
FieldDecl A field declaration.
FieldRef A reference to a field.
ForEachStmt A foreach statement that enumerates over a collection.
GotoStmt A goto statement, jumps to a label or a case clause.
IfStmt An if (conditional) statement.
Import An import declaration. This maps to the 'using' statement, so it can also be used to set aliases.
ImportCollection A strongly-typed collection of Import objects.
IndexerDecl An indexer declartation.
IndexerRef A reference to a class indexer.
IntegerLiteral An interger literal.
InterfaceDecl An interface declartation.
IterationStmt A loop construct. This can be a for, do or while loop, however foreach loops are treated separately (as a ForEachStmt).
LabeledStmt A labeled statement that can be jumped to with a goto statement.
LinePragma  
LocalRef A local reference.
LockStmt A lock statement.
MemberAccess An expression that accesses a member of a variable (x.y).
MemberDecl An abstract class for all types (class, struct...) and type members (method, field...).
MemberDeclCollection A strongly-typed collection of MemberDecl objects.
MethodDecl A method declaration.
MethodInvokeExpr Invokes a method with the given parameters.
MethodRef A reference to a method.
NamespaceDecl A namespace declaration.
NamespaceDeclCollection A strongly-typed collection of NamespaceDecl objects.
NullLiteral A null literal.
ObjectCreateExpr An expression that creates a new object.
OperatorDecl An operator declartation.
Param A parameter that will be passed to another code element.
ParamCollection A strongly-typed collection of Param objects.
ParamDecl A parameter delaration.
ParamDeclCollection A strongly-typed collection of ParamDecl objects.
PostfixExpr A postfix expression (x++, y--).
PrimitiveExpr An abstract base class for primative types.
PropertyDecl A property declaration.
PropertyRef A reference to a property.
PropertySetValueRef A 'value' reference, used inside a set accessor.
RankSpecifier A rank specifier for an array. There can be more than one rank specifier in the case of a jagged array (x[][]).
RankSpecifierCollection A strongly-typed collection of RankSpecifier objects.
RealLiteral An real literal. Will be a floating point number.
Reference A variable.
RemoveDelegateStmt Removes a delegate from an event.
ReturnStmt A return statement.
Statement An abstract base class for statements.
StatementCollection A strongly-typed collection of Statement objects.
StringLiteral A string literal.
StructDecl A struct declartation.
SubExpr A sub (parenthesized) expression. This overrides regular operator precedence eg: (2+4)*6.
SwitchStmt A switch statement.
TernaryExpr A ternary (conditional) expression (bool ? expr : expr).
ThisRef A 'this' reference.
ThrowStmt A throw statement.
TryCatchFinallyStmt A try, catch, finally construct.
TypeDecl An abstract base class for types (classes, structs, interfaces etc).
TypeDeclCollection A strongly-typed collection of TypeDecl objects.
TypeOfExpr A 'typeof' expression.
TypeRef A reference to a type (interface, class, struct, enum, delegate - this includes built in types).
TypeRefCollection A strongly-typed collection of TypeRef objects.
UnaryExpr A unary expression.
UncheckedStmt An unchecked statement - explicitly ignores overflow.
UnknownReference A variable who's type has not yet been determined.
UsingStmt A using statement, aquires a resource that will be disposed at the end of the scope.
VariableDecl A variable declaration.
VariableDeclStmt A variable declaration statement.

Interfaces

Interface Description
AssemblyReferenceCollection.IAssemblyReferenceCollectionEnumerator Supports type-safe iteration over a AssemblyReferenceCollection.
CaseCollection.ICaseCollectionEnumerator Supports type-safe iteration over a CaseCollection.
CatchCollection.ICatchCollectionEnumerator Supports type-safe iteration over a CatchCollection.
CommentStmtCollection.ICommentStmtCollectionEnumerator Supports type-safe iteration over a CommentStmtCollection.
CompileUnitCollection.ICompileUnitCollectionEnumerator Supports type-safe iteration over a CompileUnitCollection.
CustomAttributeCollection.ICustomAttributeCollectionEnumerator Supports type-safe iteration over a CustomAttributeCollection.
DeclaratorCollection.IDeclaratorCollectionEnumerator Supports type-safe iteration over a DeclaratorCollection.
ExpressionCollection.IExpressionCollectionEnumerator Supports type-safe iteration over a ExpressionCollection.
IDeclaration  
IGraph An interface that all CSharpDom elements must implement.
ImportCollection.IImportCollectionEnumerator Supports type-safe iteration over a ImportCollection.
IOverloadable  
IScope  
ISymbolRef  
MemberDeclCollection.IMemberDeclCollectionEnumerator Supports type-safe iteration over a MemberDeclCollection.
NamespaceDeclCollection.INamespaceDeclCollectionEnumerator Supports type-safe iteration over a NamespaceDeclCollection.
ParamCollection.IParamCollectionEnumerator Supports type-safe iteration over a ParamCollection.
ParamDeclCollection.IParamDeclCollectionEnumerator Supports type-safe iteration over a ParamDeclCollection.
RankSpecifierCollection.IRankCollectionEnumerator Supports type-safe iteration over a RankSpecifierCollection.
StatementCollection.IStatementCollectionEnumerator Supports type-safe iteration over a StatementCollection.
TypeDeclCollection.ITypeDeclCollectionEnumerator Supports type-safe iteration over a TypeDeclCollection.
TypeRefCollection.ITypeRefCollectionEnumerator Supports type-safe iteration over a TypeRefCollection.

Enumerations

Enumeration Description
AccessorModifiers An enumeration of possible accessor types (get, set, add, or remove).
AssemblyReferenceCollection.Tag  
AssignOperator An enumeration of possible assign expression operators (=, +=, *=...).
AttributeTarget An enumeration of possible targets a custom attribute can apply to.
BinaryOperator An enumeration of possible binary expression operators.
CaseCollection.Tag  
CatchCollection.Tag  
CommentStmtCollection.Tag  
CompileUnitCollection.Tag  
CustomAttributeCollection.Tag  
DeclaratorCollection.Tag  
ExpressionCollection.Tag  
GraphTypes An enumeration of all CSharpDom types. Used to speed up and simplify reflection (each CSharp type has a 'GraphType' property).
ImportCollection.Tag  
IterationType An enumeration of possible types of iterations (for, do, while, and foreach).
MemberDeclCollection.Tag  
MemberKind An enumeration of possible type kinds (class, interface, enum etc).
Modifiers A bit field enumeration of the modifier attributes that can be applied to type members (eg. public, static, override etc).
NamespaceDeclCollection.Tag  
OverloadableOperator An enumeration of possible overloadable operators (operators that can be redefined).
ParamCollection.Tag  
ParamDeclCollection.Tag  
ParamDirection An enumeration of possible parameter directions (ref or out).
PostfixOperator An enumeration of possible postfix expression operators (++ and --).
RankSpecifierCollection.Tag  
StatementCollection.Tag  
TypeDeclCollection.Tag  
TypeKind An enumeration of possible type kinds (class, interface, enum etc).
TypeModifiers A bit field enumeration of the modifier attributes that can be applied to types.
TypeRefCollection.Tag  
UnaryOperator An enumeration of possible unary expression operators.