private bool ReadEvent()

in Source/Tx.Windows.TypeGeneration/TmfParser.cs [172:230]


        private bool ReadEvent()
        {
            string fileLine;
            string lineNumber;
            string opcode;
            string function;

            string line = _reader.ReadLine();
            if (line == null)
                return false;

            while (line.StartsWith("#enumv"))
            {
                ReadEnum();
                line = _reader.ReadLine();

                if (line == null)
                    return false;
            }

            if (line.StartsWith("// PDB"))
                return false;
                    // looks like some TMFs contain the same information over and over again from different PDBs 

            while (true)
            {
                string more = _reader.ReadLine();
                if (more == "{")
                    break;

                line += " " + more;
            }

            Match m = _eventHeader1.Match(line);
            if (m.Success)
            {
                fileLine = m.Groups[1].Value;
                lineNumber = fileLine.Substring(_srcfile.Length);
                opcode = m.Groups[2].Value;
                function = CreateIdentifier(m.Groups[4].Value);

                EmitClass(function, lineNumber, opcode);
            }
            else
            {
                m = _eventHeader2.Match(line);
                if (!m.Success)
                    throw new Exception("the TMF format does not match one of the two supported formats");

                fileLine = m.Groups[1].Value;
                lineNumber = fileLine.Substring(_srcfile.Length);
                opcode = m.Groups[3].Value;
                function = CreateIdentifier(m.Groups[5].Value);

                EmitClass(function, lineNumber, opcode);
            }

            return true;
        }