public static IModelParser HierarchyParser(int level)
        {
            if (LevelDictionary.ContainsKey(level))
            {
                HierarchyParser hierarchyParser;
                if (!ParserDictionary.TryGetValue(level, out hierarchyParser))
                {
                    hierarchyParser = new HierarchyParser(
                        new LineParser(level),
                        new[]
                    {
                        PropertyParser.HierarchyParser(level + 1),
                        DataTypeParser.HierarchyParser(level + 1),
                        RedefinesParser.HierarchyParser(level + 1),
                        OccursParser.HierarchyParser(level + 1),
                        EnumValueParser.HierarchyParser(level + 1)
                    });

                    ParserDictionary.Add(level, hierarchyParser);
                }
                return(hierarchyParser);
            }

            return(new EmptyParser());
        }
Exemplo n.º 2
0
        public void PropertyWithImpliedMultiline11()
        {
            Reader reader = Reader.CreateStringReader(ExampleStrings.Occurs.PropertyWithImpliedMultiLine11);

            IDataParser parser = CreateDataParser(reader, PropertyParser.HierarchyParser(5));

            IModel model =
                Build.Property("STOCK-SECTION-N", "[ 28] Group item for stock-section-n.")
                .With(
                    Build.Occurs("STOCK-SECTION OCCURS 10 INDEXED BY STOCK-SECTION-IDX",
                                 "[ 28] Internal Stock Sections (Positional) DB")
                    .WithDataType("PIC X(2)", "Implied")
                    )
                .Model();

            AssertParsedUsingXml(parser, model);
        }