public static IParsingResult Parse(ParsingContext context) { RewindState rewind = context.RewindState; IParsingResult name = SimpleId.Parse(context); if (name != null) { return(name); } if (context.Parser.VerifyString("on")) { IParsingResult operatorName = OperatorName.Parse(context); if (operatorName != null) { IParsingResult arguments = TemplateArgs.Parse(context); return(new Operator(operatorName, arguments)); } context.Rewind(rewind); return(null); } if (context.Parser.VerifyString("dn")) { return(DestructorName.Parse(context)); } return(null); }
public static IParsingResult Parse(ParsingContext context) { IParsingResult name = SourceName.Parse(context); if (name != null) { IParsingResult arguments = TemplateArgs.Parse(context); return(new SimpleId(name, arguments)); } return(null); }
public static IParsingResultExtended Parse(ParsingContext context) { RewindState rewind = context.RewindState; IParsingResultExtended name = NestedName.Parse(context); if (name != null) { return(name); } name = UnscopedName.Parse(context); if (name != null) { if (context.Parser.Peek == 'I') { context.SubstitutionTable.Add(name); TemplateArgs args = TemplateArgs.Parse(context); if (args == null) { context.Rewind(rewind); return(null); } return(new UnscopedTemplate(name, args)); } else { return(name); } } name = UnscopedTemplateName.Parse(context); if (name != null) { TemplateArgs args = TemplateArgs.Parse(context); if (args == null) { context.Rewind(rewind); return(null); } return(new UnscopedTemplate(name, args)); } return(LocalName.Parse(context)); }
public static IParsingResult Parse(ParsingContext context) { IParsingResult param = TemplateParam.Parse(context); if (param != null) { TemplateArgs args = TemplateArgs.Parse(context); IParsingResult result = new Template(param, args); context.SubstitutionTable.Add(result); return(result); } IParsingResult decltype = Decltype.Parse(context); if (decltype != null) { context.SubstitutionTable.Add(decltype); return(decltype); } return(Substitution.Parse(context)); }
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); }