示例#1
0
        protected override void visitComponentDeclaration(Component declaration)
        {
            writer.Append(KeywordEnum.COMPONENT.ToString()).Append(' ');
            writer.AppendIdentifier(declaration);

            OptionalIsFormat format = Annotations.getAnnotation <OptionalIsFormat>(declaration);

            if (format != null && format.UseIs)
            {
                writer.Append(' ').Append(KeywordEnum.IS.ToString());
            }

            writer.Indent().NewLine();
            if (declaration.Generic.Count != 0)
            {
                output.getMiscellaneousElementOutput().generic(declaration.Generic);
            }
            if (declaration.Port.Count != 0)
            {
                output.getMiscellaneousElementOutput().port(declaration.Port);
            }
            writer.Dedent().Append(KeywordEnum.END.ToString()).Append(KeywordEnum.COMPONENT.ToString());
            if (writer.Format.RepeatLabels)
            {
                writer.Append(' ').AppendIdentifier(declaration);
            }
            writer.Append(";").NewLine();
        }
        protected override void visitComponentConfiguration(ComponentConfiguration configuration)
        {
            writer.Append(KeywordEnum.FOR.ToString()).Append(' ');
            output.writeComponentSpecification(configuration.ComponentSpecification);
            writer.Indent();

            bool hasBindingIndication = false;

            if (configuration.EntityAspect != null)
            {
                hasBindingIndication = true;
                writer.NewLine().Append(KeywordEnum.USE.ToString()).Append(' ');
                writer.Append(configuration.EntityAspect.ToString());
            }

            if (configuration.GenericMap.Count != 0)
            {
                hasBindingIndication = true;
                writer.NewLine();
                writer.Append(KeywordEnum.GENERIC.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().genericMap(configuration.GenericMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }

            if (configuration.PortMap.Count != 0)
            {
                hasBindingIndication = true;
                writer.NewLine();
                writer.Append(KeywordEnum.PORT.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().portMap(configuration.PortMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }

            if (hasBindingIndication)
            {
                writer.Append(";");
            }

            writer.NewLine();

            if (configuration.BlockConfiguration != null)
            {
                visit(configuration.BlockConfiguration);
            }
            writer.Dedent().Append(KeywordEnum.END.ToString()).Append(KeywordEnum.FOR.ToString());
            writer.Append(';').NewLine();
        }
        protected override void visitConfiguration(Configuration configuration)
        {
            writer.Append(KeywordEnum.CONFIGURATION.ToString()).Append(' ');
            writer.AppendIdentifier(configuration).Append(' ');
            writer.Append(KeywordEnum.OF.ToString()).Append(' ');
            writer.AppendIdentifier(configuration.Entity).Append(' ');
            writer.Append(KeywordEnum.IS.ToString()).NewLine();

            writer.Indent();
            output.writeDeclarationMarkers(configuration.Declarations);
            output.writeConfigurationItem(configuration.BlockConfiguration);
            writer.Dedent();

            writer.Append(KeywordEnum.END.ToString());
            if (writer.Format.RepeatLabels)
            {
                writer.Append(' ').Append(KeywordEnum.CONFIGURATION.ToString());
                writer.Append(' ').AppendIdentifier(configuration.Entity);
            }
            writer.Append(";").NewLine();
        }
示例#4
0
        protected override void visitCaseStatement(CaseStatement statement)
        {
            appendLabel(statement);
            writer.Append(KeywordEnum.CASE.ToString()).Append(' ');
            output.writeExpression(statement.Expression);
            writer.Append(' ').Append(KeywordEnum.IS.ToString()).NewLine();

            writer.Indent();
            foreach (CaseStatement.Alternative alternative in statement.Alternatives)
            {
                visitCaseStatementAlternative(alternative);
            }
            writer.Dedent();

            writer.Append(KeywordEnum.END.ToString()).Append(KeywordEnum.CASE.ToString());

            if (writer.Format.RepeatLabels && statement.Label != null)
            {
                writer.Append(' ').Append(statement.Label);
            }

            writer.Append(';').NewLine();
        }
示例#5
0
        protected override void visitPhysicalType(PhysicalType type)
        {
            //TODO: implement repeated label
            appendTypePrefix(type);
            writer.Append(' ').Append(KeywordEnum.RANGE.ToString()).Append(' ');
            output.writeDiscreteRange(type.Range);
            writer.Append(' ').NewLine();
            writer.Indent().Append(KeywordEnum.UNITS.ToString()).NewLine();
            writer.Indent().Append(type.PrimaryUnit).Append(';').NewLine().BeginAlign();
            foreach (PhysicalType.Unit unit in type.Units)
            {
                writer.AppendIdentifier(unit).Align().Append(" = ");
                if (unit.Factor != null)
                {
                    output.writeExpression(unit.Factor);
                    writer.Append(' ');
                }
                writer.Append(unit.BaseUnit).Append(';').NewLine();
            }
            writer.EndAlign().Dedent();

            writer.Append(KeywordEnum.END.ToString()).Append(KeywordEnum.UNITS.ToString()).Append(';').Dedent().NewLine();
        }
        private void appendComponentInstantiationMaps(AbstractComponentInstantiation instantiation)
        {
            if (instantiation.GenericMap.Count != 0)
            {
                writer.NewLine();
                writer.Append(KeywordEnum.GENERIC.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().genericMap(instantiation.GenericMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }

            if (instantiation.PortMap.Count != 0)
            {
                writer.NewLine();
                writer.Append(KeywordEnum.PORT.ToString()).Append(KeywordEnum.MAP.ToString()).Append(" (").NewLine();
                writer.Indent().BeginAlign();
                output.getMiscellaneousElementOutput().portMap(instantiation.PortMap);
                writer.EndAlign().Dedent();
                writer.Append(")");
            }
        }