コード例 #1
0
        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());
        }
コード例 #2
0
 public LineParser(int level)
     : base("Redefines",
            Line.Multiple(
                Line.And(
                    Line.StartsWithMarker(Prefix.Marker(level)),
                    Line.Contains("REDEFINES")
                    ),
                Line.Optional(
                    Line.Repeat(Line.StartsWith(Prefix.Empty))
                    )
                ),
            Data.OnLine(0,
                        Data
                        .TruncateAtColumn(59)
                        .IgnoreBefore(Prefix.Marker(level)).ExcludeMarker()
                        .IgnoreAfter(".").ExcludeMarker()
                        .RemoveSpaces()
                        .Trim())
            .TruncateAt(59)
            .IgnoreAfter(".").ExcludeMarker()
            .RemoveSpaces()
            .Trim(),
            Comment
            .IgnoreBefore(59)
            .RemoveSpaces()
            .Trim(),
            new[]
 {
     OccursAndDataImpliedParser(),
     DataTypeParser.ImpliedParser(RedefinesModel.Factory),
     OccursParser.ImpliedParser(RedefinesModel.Factory),
 },
            RedefinesModel.Factory
            )
 {
 }