Exemple #1
0
        protected override void visitCaseStatementAlternative(Alternative alternative)
        {
            writer.Append(KeywordEnum.WHEN.ToString()).Append(' ');

            bool first = true;

            foreach (Choice choice in alternative.Choices)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    writer.Append(" | ");
                }
                output.writeChoice(choice);
            }
            writer.Append(" =>").NewLine();

            writer.Indent();
            output.writeSequentialStatements(alternative.Statements);
            writer.Dedent();
            writer.NewLine();
        }
        protected override void visitSelectedSignalAssignment(SelectedSignalAssignment statement)
        {
            appendLabel(statement);
            if (statement.Postponed)
            {
                writer.Append(KeywordEnum.POSTPONED.ToString()).Append(' ');
            }
            writer.Append(KeywordEnum.WITH.ToString()).Append(' ');
            output.writeExpression(statement.Expression);
            writer.Append(' ').Append(KeywordEnum.SELECT.ToString());
            writer.NewLine().Indent();
            output.writeSignalAssignmentTarget(statement.Target);
            writer.Append(" <=");
            if (statement.Guarded)
            {
                writer.Append(' ').Append(KeywordEnum.GUARDED.ToString());
            }
            if (statement.DelayMechanism != null)
            {
                writer.Append(' ');
                output.getMiscellaneousElementOutput().delayMechanism(statement.DelayMechanism);
            }
            writer.NewLine().Indent();

            bool first = true;

            foreach (SelectedSignalAssignment.SelectedWaveform waveform in statement.SelectedWaveforms)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    writer.Append(',').NewLine();
                }

                output.getMiscellaneousElementOutput().waveform(waveform.Waveform);

                writer.Append(' ').Append(KeywordEnum.WHEN.ToString()).Append(' ');

                bool first3 = true;
                foreach (Choice choice in waveform.Choices)
                {
                    if (first3)
                    {
                        first3 = false;
                    }
                    else
                    {
                        writer.Append(" | ");
                    }
                    output.writeChoice(choice);
                }
            }
            writer.Append(';').Dedent().Dedent().NewLine();
        }
Exemple #3
0
        protected override void visitAggregate(Aggregate expression)
        {
            writer.Append('(');

            bool first = true;

            foreach (Aggregate.ElementAssociation association in expression.Associations)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    writer.Append(", ");
                }

                if (association.Choices.Count != 0)
                {
                    bool first2 = true;
                    foreach (Choice choice in association.Choices)
                    {
                        if (first2)
                        {
                            first2 = false;
                        }
                        else
                        {
                            writer.Append(" | ");
                        }
                        output.writeChoice(choice);
                    }
                    writer.Append(" => ");
                }
                visit(association.Expression);
            }

            writer.Append(')');
        }