forked from Mirror/Ryujinx
46a11460d4
* Rewrite the C++ Demangler This new Demangler provides support to almost every possible mangled symbols and should behaves like GNU c++filt. It works on 98.9% of the sdk's symbols and 99.5% of Puyo Puyo Tetris's symbols. * Fix code style * Fix noexcept enclosed expression parsing issues * fix code style issues
113 lines
No EOL
2.5 KiB
C#
113 lines
No EOL
2.5 KiB
C#
using System.IO;
|
|
|
|
namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
|
{
|
|
public enum NodeType
|
|
{
|
|
CVQualifierType,
|
|
SimpleReferenceType,
|
|
NameType,
|
|
EncodedFunction,
|
|
NestedName,
|
|
SpecialName,
|
|
LiteralOperator,
|
|
NodeArray,
|
|
ElaboratedType,
|
|
PostfixQualifiedType,
|
|
SpecialSubstitution,
|
|
ExpandedSpecialSubstitution,
|
|
CtorDtorNameType,
|
|
EnclosedExpression,
|
|
ForwardTemplateReference,
|
|
NameTypeWithTemplateArguments,
|
|
PackedTemplateArgument,
|
|
TemplateArguments,
|
|
BooleanExpression,
|
|
CastExpression,
|
|
CallExpression,
|
|
IntegerCastExpression,
|
|
PackedTemplateParameter,
|
|
PackedTemplateParameterExpansion,
|
|
IntegerLiteral,
|
|
DeleteExpression,
|
|
MemberExpression,
|
|
ArraySubscriptingExpression,
|
|
InitListExpression,
|
|
PostfixExpression,
|
|
ConditionalExpression,
|
|
ThrowExpression,
|
|
FunctionParameter,
|
|
ConversionExpression,
|
|
BinaryExpression,
|
|
PrefixExpression,
|
|
BracedExpression,
|
|
BracedRangeExpression,
|
|
NewExpression,
|
|
QualifiedName,
|
|
StdQualifiedName,
|
|
DtOrName,
|
|
GlobalQualifiedName,
|
|
NoexceptSpec,
|
|
DynamicExceptionSpec,
|
|
FunctionType,
|
|
PointerType,
|
|
ReferenceType,
|
|
ConversionOperatorType,
|
|
LocalName,
|
|
CtorVtableSpecialName,
|
|
ArrayType
|
|
}
|
|
|
|
public abstract class BaseNode
|
|
{
|
|
public NodeType Type { get; protected set; }
|
|
|
|
public BaseNode(NodeType Type)
|
|
{
|
|
this.Type = Type;
|
|
}
|
|
|
|
public virtual void Print(TextWriter Writer)
|
|
{
|
|
PrintLeft(Writer);
|
|
|
|
if (HasRightPart())
|
|
{
|
|
PrintRight(Writer);
|
|
}
|
|
}
|
|
|
|
public abstract void PrintLeft(TextWriter Writer);
|
|
|
|
public virtual bool HasRightPart()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsArray()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool HasFunctions()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual string GetName()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public virtual void PrintRight(TextWriter Writer) {}
|
|
|
|
public override string ToString()
|
|
{
|
|
StringWriter Writer = new StringWriter();
|
|
|
|
Print(Writer);
|
|
|
|
return Writer.ToString();
|
|
}
|
|
}
|
|
} |