Exemple #1
0
        // Token: 0x06000056 RID: 86 RVA: 0x000055BC File Offset: 0x000037BC
        private string GetSimpleKeywordToken()
        {
            string text = "";

            for (;;)
            {
                if (text.EndsWith("/*"))
                {
                    text = text.Remove(text.Length - 2);
                    int num;
                    for (;;)
                    {
                        num = this.Line.IndexOf("*/", this.LinePos);
                        if (num != -1)
                        {
                            break;
                        }
                        if (!this.GetNextLine())
                        {
                            goto Block_3;
                        }
                    }
                    this.LinePos = num + 2;
                }
                if (this.IsEndOfLine() || char.IsWhiteSpace(this.Line[this.LinePos]) || this.Line[this.LinePos] == '(' || this.Line[this.LinePos] == ')' || this.Line[this.LinePos] == '{' || this.Line[this.LinePos] == '}' || this.Line[this.LinePos] == '[' || this.Line[this.LinePos] == ']')
                {
                    return(text);
                }
                if (char.IsControl(this.Line[this.LinePos]))
                {
                    DTAParserWarning dtaparserWarning = new DTAParserWarning();
                    dtaparserWarning.Line     = this.LineCount;
                    dtaparserWarning.Position = this.LinePos;
                    dtaparserWarning.Text     = "The character is a control character.";
                    this.WarningList.Add(dtaparserWarning);
                }
                if (this.Line[this.LinePos] == '\'' || this.Line[this.LinePos] == '"')
                {
                    DTAParserWarning dtaparserWarning2 = new DTAParserWarning();
                    dtaparserWarning2.Line     = this.LineCount;
                    dtaparserWarning2.Position = this.LinePos;
                    dtaparserWarning2.Text     = "The character is likely to be a complex keyword or string terminator. Did you forget a initializer character?";
                    this.WarningList.Add(dtaparserWarning2);
                }
                text += this.Line[this.LinePos++];
            }
Block_3:
            throw new DTBException("The last multi-line comment is never closed.");
        }
Exemple #2
0
        // Token: 0x06000058 RID: 88 RVA: 0x000058F0 File Offset: 0x00003AF0
        private string GetStringToken(char EndChar)
        {
            string text = "";

            for (;;)
            {
                if (this.IsEndOfLine())
                {
                    DTAParserWarning dtaparserWarning = new DTAParserWarning();
                    dtaparserWarning.Line     = this.LineCount;
                    dtaparserWarning.Position = this.LinePos;
                    dtaparserWarning.Text     = "ERROR: A newline character has been found in the middle of a string. Check if you've closed the last string, or use the \\n escape sequence to insert a new line. (Note: This does not abort DTA parsing because some official files have this problem).";
                    this.WarningList.Add(dtaparserWarning);
                    if (!this.GetNextLine())
                    {
                        break;
                    }
                    text += "\r\n";
                }
                else
                {
                    if (this.Line[this.LinePos] == EndChar)
                    {
                        goto Block_3;
                    }
                    if (this.Line[this.LinePos] == '\\')
                    {
                        this.LinePos++;
                        if (this.IsEndOfLine())
                        {
                            goto Block_5;
                        }
                        char c = this.Line[this.LinePos];
                        if (c != 'n')
                        {
                            if (c != 'q')
                            {
                                DTAParserWarning dtaparserWarning2 = new DTAParserWarning();
                                dtaparserWarning2.Line     = this.LineCount;
                                dtaparserWarning2.Position = this.LinePos;
                                dtaparserWarning2.Text     = "ERROR: Unknown escape sequence, will copy the characters literally. (Note: This does not about DTA parsing because some official files have this problem).";
                                this.WarningList.Add(dtaparserWarning2);
                                text += '\\';
                                text += this.Line[this.LinePos];
                            }
                            else
                            {
                                text += '"';
                            }
                        }
                        else
                        {
                            text += '\n';
                        }
                        this.LinePos++;
                    }
                    else
                    {
                        if (char.IsControl(this.Line[this.LinePos]))
                        {
                            DTAParserWarning dtaparserWarning3 = new DTAParserWarning();
                            dtaparserWarning3.Line     = this.LineCount;
                            dtaparserWarning3.Position = this.LinePos;
                            dtaparserWarning3.Text     = "The character is a control character.";
                            this.WarningList.Add(dtaparserWarning3);
                        }
                        text += this.Line[this.LinePos++];
                    }
                }
            }
            throw new DTBException("End of file found while reading a string or a keyword.");
Block_3:
            this.LinePos++;
            return(text);

Block_5:
            throw new DTBException("End of line found while expecting a escape sequence.");
        }