Beispiel #1
0
 void BindComments(LexSection section)
 {
     section.functions.ForEach(x => x.comment     = section.FindComment(x.begin, x.end));
     section.variables.ForEach(x => x.comment     = section.FindComment(x.begin, x.end));
     section.unknownBlocks.ForEach(x => x.comment = section.FindComment(x.begin, x.end));
     section.childSections.ForEach(x => BindComments(x));
 }
Beispiel #2
0
    void ParseLexSection(LexSection section, ProtectLevel protectionLevel)
    {
        section.source = source;

        string skipSymbols = " \r\n\t";
        int    dataLen     = section.data.Length;
        int    caret       = 0;

        for (caret = 0; caret < dataLen; caret++)
        {
            if (skipSymbols.Contains(section.data[caret]))
            {
                continue;
            }

            Dictionary <string, ParserFunc> keyParsers = globalKeyParsers;

            if (section.GetType() == typeof(LexClass))
            {
                keyParsers = classBodyKeyParsers;
            }

            bool passedKeyWord = false;
            foreach (var keyWordParser in keyParsers)
            {
                string sub = section.data.Substring(caret, Math.Min(keyWordParser.Key.Length, dataLen - caret));

                if (sub == keyWordParser.Key)
                {
                    keyWordParser.Value(section, ref caret, ref protectionLevel);
                    passedKeyWord = true;
                    break;
                }
            }

            if (passedKeyWord)
            {
                continue;
            }

            int    blockbegin = caret;
            string block      = ReadBlock(section.data, ref caret);
            block = block.Trim(' ', '\r', '\t', '\n');

            if (block.Length > 0)
            {
                TryParseBlock(section, block, blockbegin, ref caret, ref protectionLevel);
            }
        }

        section.functions.ForEach(x => x.comment     = section.FindComment(x.begin, x.end));
        section.variables.ForEach(x => x.comment     = section.FindComment(x.begin, x.end));
        section.unknownBlocks.ForEach(x => x.comment = section.FindComment(x.begin, x.end));
    }
    void ParseLexSection(LexSection section, ProtectLevel protectionLevel)
    {
        section.source = source;

        string skipSymbols = " \r\n\t";
        int dataLen = section.data.Length;
        int caret = 0;

        for (caret = 0; caret < dataLen; caret++)
        {
            if (skipSymbols.Contains(section.data[caret]))
                continue;

            Dictionary<string, ParserFunc> keyParsers = globalKeyParsers;

            if (section.GetType() == typeof(LexClass))
                keyParsers = classBodyKeyParsers;

            bool passedKeyWord = false;
            foreach (var keyWordParser in keyParsers)
            {
                string sub = section.data.Substring(caret, Math.Min(keyWordParser.Key.Length, dataLen - caret));

                if (sub == keyWordParser.Key)
                {
                    keyWordParser.Value(section, ref caret, ref protectionLevel);
                    passedKeyWord = true;
                    break;
                }
            }

            if (passedKeyWord)
                continue;

            int blockbegin = caret;
            string block = ReadBlock(section.data, ref caret);
            block = block.Trim(' ', '\r', '\t', '\n');

            if (block.Length > 0)
                TryParseBlock(section, block, blockbegin, ref caret, ref protectionLevel);
        }

        section.functions.ForEach(x => x.comment = section.FindComment(x.begin, x.end));
        section.variables.ForEach(x => x.comment = section.FindComment(x.begin, x.end));
        section.unknownBlocks.ForEach(x => x.comment = section.FindComment(x.begin, x.end));
    }
 void BindComments(LexSection section)
 {
     section.functions.ForEach(x => x.comment = section.FindComment(x.begin, x.end));
     section.variables.ForEach(x => x.comment = section.FindComment(x.begin, x.end));
     section.unknownBlocks.ForEach(x => x.comment = section.FindComment(x.begin, x.end));
     section.childSections.ForEach(x => BindComments(x));
 }