public static TypeNode Create(LeafParser.TypeContext ctx) { if (ctx.name != null) { return(new PlainTypeNode(ctx.name.Text, ctx.ns?.Text)); } if (ctx.ptr != null) { return(new PointerNode(Create(ctx.type(0)))); } if (ctx.Ref() != null) { return new ReferenceTypeNode(Create(ctx.type(0))) { Mutable = ctx.mut != null } } ; throw new NotImplementedException(); } }
public CastNode(LeafParser.ValueContext v, LeafParser.TypeContext t) { Line = v.Start.Line; Value = Create(v); Type = TypeNode.Create(t); }
/// <summary> /// Visit a parse tree produced by <see cref="LeafParser.type"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitType([NotNull] LeafParser.TypeContext context) { return(VisitChildren(context)); }