public static IParsingResultExtended Parse(ParsingContext context) { RewindState rewind = context.RewindState; if (!context.Parser.VerifyString("N")) { return(null); } CvQualifiers cvQualifiers = CvQualifiers.Parse(context); RefQualifier refQualifier = RefQualifier.Parse(context); IParsingResultExtended prefix = Parsers.Prefix.Parse(context); if (prefix == null) { context.Rewind(rewind); return(null); } if (!(prefix is Parsers.Prefix.NestedName) && !(prefix is Parsers.Prefix.Template)) { context.Rewind(rewind); return(null); } if (!context.Parser.VerifyString("E")) { context.Rewind(rewind); return(null); } return(new NestedName(prefix, cvQualifiers, refQualifier)); }
public static IParsingResult Parse(ParsingContext context) { RewindState rewind = context.RewindState; if (!context.Parser.VerifyString("f")) { return(null); } int scope = 0; if (context.Parser.VerifyString("L")) { if (!context.Parser.ParseNumber(out scope)) { context.Rewind(rewind); return(null); } } if (context.Parser.VerifyString("p")) { CvQualifiers qualifiers = CvQualifiers.Parse(context); int? param = context.Parser.ParseNumber(); if (context.Parser.VerifyString("_")) { return(new FunctionParam(qualifiers, scope, param)); } } context.Rewind(rewind); return(null); }
public static IParsingResultExtended Parse(ParsingContext context) { RewindState rewind = context.RewindState; CvQualifiers cvQualifiers = CvQualifiers.Parse(context); bool transactionSafe = context.Parser.VerifyString("Dx"); if (context.Parser.VerifyString("F")) { bool externC = context.Parser.VerifyString("Y"); BareFunctionType bareType = BareFunctionType.Parse(context); if (bareType != null) { RefQualifier refQualifier = RefQualifier.Parse(context); if (context.Parser.VerifyString("E")) { return(new FunctionType(bareType, cvQualifiers, refQualifier, transactionSafe, externC)); } } } context.Rewind(rewind); return(null); }
public void Demangle(DemanglingContext context) { // TODO: transactions safety? // TODO: extern C? BareType.Demangle(context); CvQualifiers?.Demangle(context); // TODO: ref_qualifier? }
public FunctionType(BareFunctionType bareType, CvQualifiers cvQualifiers, RefQualifier refQualifier, bool transactionSafe, bool externC) { CvQualifiers = cvQualifiers; TransactionSafe = transactionSafe; ExternC = externC; BareType = bareType; RefQualifier = refQualifier; }
public void Demangle(DemanglingContext context) { Prefix.Demangle(context); if (context.Inner.Count > 0) { context.Inner.Pop().DemangleAsInner(context); } CvQualifiers?.Demangle(context); if (RefQualifier != null) { context.Writer.EnsureSpace(); RefQualifier.Demangle(context); } }
public static CvQualifiers Parse(ParsingContext context) { CvQualifiers qualifiers = null; if (context.Parser.VerifyString("r")) { qualifiers = qualifiers ?? new CvQualifiers(); qualifiers.Restrict = true; } if (context.Parser.VerifyString("V")) { qualifiers = qualifiers ?? new CvQualifiers(); qualifiers.Volatile = true; } if (context.Parser.VerifyString("K")) { qualifiers = qualifiers ?? new CvQualifiers(); qualifiers.Const = true; } return(qualifiers); }
public NestedName(IParsingResultExtended prefix, CvQualifiers cvQualifiers, RefQualifier refQualifier) { Prefix = prefix; CvQualifiers = cvQualifiers; RefQualifier = refQualifier; }
public FunctionParam(CvQualifiers cvQualifiers, int scope, int?param) { CvQualifiers = cvQualifiers; Scope = scope; Param = param; }
public Qualified(CvQualifiers qualifiers, IParsingResultExtended type) { CvQualifiers = qualifiers; Type = type; }
public static IParsingResultExtended Parse(ParsingContext context) { IParsingResultExtended type = BuiltinType.Parse(context); if (type != null) { return(type); } type = ClassEnumType.Parse(context); if (type != null) { return(AddToSubstitutionTable(context, type)); } RewindState rewind = context.RewindState; type = Substitution.Parse(context); if (type != null) { if (context.Parser.Peek != 'I') { return(type); } context.Rewind(rewind); } type = FunctionType.Parse(context) ?? ArrayType.Parse(context) ?? PointerToMemberType.Parse(context); if (type != null) { return(AddToSubstitutionTable(context, type)); } type = TemplateParam.Parse(context); if (type != null) { if (context.Parser.Peek != 'I') { return(AddToSubstitutionTable(context, type)); } context.Rewind(rewind); } type = TemplateTemplateParam.Parse(context); if (type != null) { TemplateArgs arguments = TemplateArgs.Parse(context); if (arguments == null) { context.Rewind(rewind); return(null); } return(AddToSubstitutionTable(context, new TemplateTemplate(type, arguments))); } type = Decltype.Parse(context); if (type != null) { return(type); } CvQualifiers qualifiers = CvQualifiers.Parse(context); if (qualifiers != null) { type = Parse(context); if (type == null) { context.Rewind(rewind); return(null); } if (type is BuiltinType) { return(new QualifiedBuiltin(qualifiers, type)); } return(AddToSubstitutionTable(context, new Qualified(qualifiers, type))); } if (context.Parser.VerifyString("P")) { type = Parse(context); if (type == null) { context.Rewind(rewind); return(null); } return(AddToSubstitutionTable(context, new PointerTo(type))); } if (context.Parser.VerifyString("R")) { type = Parse(context); if (type == null) { context.Rewind(rewind); return(null); } return(AddToSubstitutionTable(context, new LvalueRef(type))); } if (context.Parser.VerifyString("O")) { type = Parse(context); if (type == null) { context.Rewind(rewind); return(null); } return(AddToSubstitutionTable(context, new RvalueRef(type))); } if (context.Parser.VerifyString("C")) { type = Parse(context); if (type == null) { context.Rewind(rewind); return(null); } return(AddToSubstitutionTable(context, new Complex(type))); } if (context.Parser.VerifyString("G")) { type = Parse(context); if (type == null) { context.Rewind(rewind); return(null); } return(AddToSubstitutionTable(context, new Imaginary(type))); } if (context.Parser.VerifyString("U")) { IParsingResult name = SourceName.Parse(context); if (name == null) { context.Rewind(rewind); return(null); } TemplateArgs arguments = TemplateArgs.Parse(context); type = Parse(context); return(AddToSubstitutionTable(context, new VendorExtension(name, arguments, type))); } if (context.Parser.VerifyString("Dp")) { type = Parse(context); if (type == null) { context.Rewind(rewind); return(null); } return(AddToSubstitutionTable(context, new PackExtension(type))); } return(null); }