コード例 #1
0
 private GenCompactProfileParser(GenDataDef genDataDef, CompactProfileScanner scan)
     : base(new GenProfileParams(genDataDef))
 {
     Scan = scan;
     try
     {
         _compactPrimaryBodyParser   = new CompactPrimaryBodyParser(this);
         _compactSecondaryBodyParser = new CompactSecondaryBodyParser(this);
         ScanBody(ClassId, Body, this, Profile);
     }
     finally
     {
         Scan.Dispose();
     }
     _parameterSeparator = new CharSet(" " + Scan.Delimiter);
 }
コード例 #2
0
        private void ScanBody(int classId, GenSegBody body, GenContainerFragmentBase parentContainer,
                              ContainerFragment containerFragment)
        {
            var saveClassId = GenDataDef.CurrentClassId;

            GenDataDef.CurrentClassId = classId;
            if (!Scan.Eof)
            {
                TokenType t;
                CompactPrimaryBodyParser.ScanPartialBody(classId, body, parentContainer, containerFragment, out t);
                if (t == TokenType.Secondary)
                {
                    Scan.SkipChar();
                    CompactSecondaryBodyParser.ScanPartialBody(classId, body, parentContainer, containerFragment, out t);
                }

                if (t != TokenType.Close)
                {
                    if (Scan.Eof && classId != 0)
                    {
                        //throw new Exception("<<<<Missing Segment end bracket>>>>");
                        OutputText(parentContainer, true, "<<<<Missing Segment end bracket>>>>");
                    }
                    if (!Scan.Eof)
                    {
                        //throw new Exception("<<<<Unknown text in profile>>>>");
                        OutputText(parentContainer, true, "<<<<Unknown text in profile>>>>");
                    }
                }
                else
                {
                    if (Scan.CheckChar(']'))
                    {
                        Scan.SkipChar();
                    }
                }
            }
            else if (classId != 0)
            {
                //throw new Exception("<<<<<Missing Segment end bracket>>>>>");
                OutputText(parentContainer, true, "<<<<Unknown text in profile>>>>");
            }
            GenDataDef.CurrentClassId = saveClassId;
        }