Пример #1
0
 private static void ValidateStructure(FileStructure structure)
 {
     foreach (CommandStructure cmdStructure in structure)
     {
         ValidateCommandStructure(cmdStructure);
     }
 }
Пример #2
0
        private static FileStructure CollectStructure(CommandFileReader reader)
        {
            FileStructure result = new FileStructure();

            string line = null;

            while (!reader.IsDone)
            {
                line = reader.NextLine();
                if (line.StartsWith("#"))
                {
                    continue;
                }
                if (Regex.IsMatch(line, RegexCommand))
                {
                    result.Add(CollectCommandStructure(reader.Copy(), out int skip));
                    reader.Skip(skip);
                    if (!reader.IsDone)
                    {
                        reader.Back();
                    }
                }
                else
                {
                    throw new PositionException(reader.GetLineObject(),
                                                new MalformedCodeException(RegexCommand));
                }
            }
            return(result);
        }
Пример #3
0
        public static void Validate(CommandFileReader reader, int[] supportedVersions)
        {
            reader.Reset();
            CheckVersion(reader, supportedVersions);
            reader.Reset();
            FileStructure structure = CollectStructure(reader);

            ValidateStructure(structure);
        }