public void visit(NonterminalHeadV nonterminalHeadV)
        {
            // visit rule
            nonterminalHeadV.Rule.accept(this);

            drawnItem = new NonterminalExpanded(nonterminalHeadV, drawnItem);
        }
        /// <summary>
        /// Creates a visualised grammar based on the definitive grammar passed.
        /// </summary>
        /// <param name="dGrammarIn"></param>
        internal VisualisedGrammar(DefinitiveGrammar dGrammarIn)
        {
            // obsolete - using vistor pattern
            //startSymbol = dGrammarIn.StartSymbol.CreateVisualGrammar(true);

            // create visitor
            GrammarNodeDCreateVisualVisitor visitor = new GrammarNodeDCreateVisualVisitor();
            // traverse tree
            dGrammarIn.StartSymbol.accept(visitor);

            if (visitor.CurrentNodeV as NonterminalHeadV == null)
                throw new Exception("Creating the visualised grammar from the definitive failed.");

            startSymbol = (NonterminalHeadV)visitor.CurrentNodeV;
        }
 private void Init(NonterminalHeadV startSymbolIn)
 {
     startSymbol = startSymbolIn;
 }
        public NonterminalExpanded(NonterminalHeadV ruleIn, UserControl visualisedSymbolsIn)
        {
            InitializeComponent();

            Init(ruleIn, visualisedSymbolsIn, true);
        }
        private void Init(SymbolV ruleIn, UserControl visualisedSymbolsIn, bool isStartSymbolIn)
        {
            visualisedSymbols = visualisedSymbolsIn;
            isStartSymbol = isStartSymbolIn;

            if (isStartSymbol)
            {
                referenceHead = (NonterminalHeadV)ruleIn;
                referenceTail = null;

                setName(referenceHead.Name);

                this.Background = Global.Settings.getBrush(0);

                collapseBtn.Visibility = Visibility.Collapsed;

                if (referenceHead.Reference.IsSelected)
                    SetBorderThickness(2.0);

                rightClickMenu.Visibility = Visibility.Collapsed;
            }
            else
            {
                referenceHead = null;
                referenceTail = (NonterminalTailV)ruleIn;

                if ((referenceTail.Reference.Parent.Parent as OperationD).Children.Count == 1)
                    rightClickMenu.Items.Remove(removeChoice);

                setName(referenceTail.Name);

                this.Background = Global.Settings.getBrush(referenceTail.Level);

                if (referenceTail.Reference.Reference.IsSelected)
                    SetBorderThickness(2.0);
            }

            // change direction of nont chilren if necessary
            if (ruleIn.Direction)
            {
                // draw top to bottom
                stackPanelOuter.Orientation = Orientation.Horizontal;
                stackPanelHeading.Orientation = Orientation.Vertical;
                stackPanelInner.Orientation = Orientation.Vertical;
                stackPanelName.Orientation = Orientation.Horizontal;
                arrow_down.Visibility = Visibility.Visible;
                arrow_right.Visibility = Visibility.Collapsed;
            }

            // add child to GUI
            stackPanelInner.Children.Remove(holder);
            stackPanelInner.Children.Add(visualisedSymbols);

            // let the controller hear me y'all
            ViewController.ViewListener.Listen(this);
        }
 public void visit(NonterminalHeadV nonterminalHeadV)
 {
     // visit rule
     nonterminalHeadV.Rule.accept(this);
 }
 /// <summary>
 /// Set the reference if this nonterminal is the start symbol of the grammar
 /// </summary>
 /// <param name="refIn"></param>
 public void SetReference(NonterminalHeadV refIn)
 {
     refStartSymbol = refIn;
 }
 internal void setRule(NonterminalHeadV nonterminalHeadV)
 {
     rule = nonterminalHeadV.Reference;
 }
 public Functions(NonterminalHeadV startSymbolIn)
 {
     startSymbol = startSymbolIn;
 }