Пример #1
0
        public override object VisitExeCommandQuerySelectRelatedBy([NotNull] OALParser.ExeCommandQuerySelectRelatedByContext context)
        {
            String Cardinality = context.GetChild(0).GetText().Contains("many") ? "many" : "any";

            Console.WriteLine("Cardinality = " + Cardinality);

            String VariableName = context.GetChild(1).GetText();

            Console.WriteLine("VariableName = " + VariableName);

            String StartingVariable = context.GetChild(3).GetText();

            Console.WriteLine("StartingVariable = " + StartingVariable);

            String ClassName = context.GetChild(5).GetText();

            Console.WriteLine("ClassName = " + ClassName);

            String RelationshipName = context.GetChild(6).GetText().Replace('[', ' ').Replace(']', ' ').Trim();

            Console.WriteLine("RelationshipName = " + RelationshipName);

            List <EXERelationshipLink> list = new List <EXERelationshipLink>();
            EXERelationshipLink        eXERelationshipLink      = new EXERelationshipLink(RelationshipName, ClassName);
            EXERelationshipSelection   eXERelationshipSelection = new EXERelationshipSelection(StartingVariable);

            eXERelationshipSelection.AddRelationshipLink(eXERelationshipLink);
            EXEASTNode WhereExpression = null;

            int i = 7;

            while (context.GetChild(i).GetText().Equals("->"))
            {
                String ClassName2 = context.GetChild(i + 1).GetText();
                Console.WriteLine("ClassName = " + ClassName2);

                String RelationshipName2 = context.GetChild(i + 2).GetText().Replace('[', ' ').Replace(']', ' ').Trim();
                Console.WriteLine("RelationshipName = " + RelationshipName2);

                EXERelationshipLink eXERelationshipLink2 = new EXERelationshipLink(RelationshipName2, ClassName2);
                eXERelationshipSelection.AddRelationshipLink(eXERelationshipLink2);
                i += 3;
            }

            Console.WriteLine("Where 3= " + context.GetChild(context.ChildCount - 3).GetText());
            if (context.GetChild(context.ChildCount - 3).GetText().Contains("where"))
            {
                Visit(context.GetChild(context.ChildCount - 2));
                WhereExpression = stackEXEASTNode.Peek();
            }
            stackEXEScope.Peek().AddCommand(new EXECommandQuerySelectRelatedBy(Cardinality, VariableName, WhereExpression, eXERelationshipSelection));

            stackEXEASTNode.Clear();

            return(null);
            //return base.VisitExeCommandQuerySelectRelatedBy(context);
        }
Пример #2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="OALParser.exeCommandQuerySelectRelatedBy"/>.
 /// <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 VisitExeCommandQuerySelectRelatedBy([NotNull] OALParser.ExeCommandQuerySelectRelatedByContext context)
 {
     return(VisitChildren(context));
 }
Пример #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="OALParser.exeCommandQuerySelectRelatedBy"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitExeCommandQuerySelectRelatedBy([NotNull] OALParser.ExeCommandQuerySelectRelatedByContext context)
 {
 }