示例#1
0
        private static DiagramItem EBNFSuffix(ANTLRv4Parser.EbnfSuffixContext ebnfSuffix, DiagramItem element)
        {
            if (ebnfSuffix == null)
            {
                return(element);
            }
            switch (ebnfSuffix.GetText())
            {
            case "?":
                return(Optional(element, false));

            case "*":
            case "*?":
                return(ZeroOrMore(FSharpChoice <DiagramItem, string> .NewChoice1Of2(element),
                                  FSharpOption <FSharpChoice <DiagramItem, string> > .None, false));

            case "+":
                return(new OneOrMore(FSharpChoice <DiagramItem, string> .NewChoice1Of2(element),
                                     FSharpOption <FSharpChoice <DiagramItem, string> > .None));

            default:
                throw new InvalidOperationException("WTF?!");
            }
        }
 /// <summary>
 /// Exit a parse tree produced by <see cref="ANTLRv4Parser.ebnfSuffix"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitEbnfSuffix([NotNull] ANTLRv4Parser.EbnfSuffixContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="ANTLRv4Parser.ebnfSuffix"/>.
 /// <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 VisitEbnfSuffix([NotNull] ANTLRv4Parser.EbnfSuffixContext context)
 {
     return(VisitChildren(context));
 }