public Lexer(TextReader
reader)
        {
            allow_comments
            =
            true;
            allow_single_quoted_strings
            =
            true;
            input_buffer
            =
            0;
            string_buffer
            =
            new
            StringBuilder
            (128);
            state
            =
            1;
            end_of_input
            =
            false;
            this.reader
            =
            reader;
            fsm_context
            =
            new
            FsmContext
            ();
            fsm_context.L
            =
            this;
        }
Example #2
0
	public Lexer(TextReader reader) {
		AllowComments = true;
		AllowSingleQuotedStrings = true;

		inputBuffer = 0;
		stringBuffer = new StringBuilder(128);
		state = 1;
		EndOfInput = false;
		this.reader = reader;

		context = new FsmContext();
		context.L = this;
	}
Example #3
0
        public Lexer(TextReader reader)
        {
            _allowComments = true;
            _allowSingleQuotedStrings = true;

            _inputBuffer = 0;
            _stringBuffer = new StringBuilder (128);
            _state = 1;
            _endOfInput = false;
            _reader = reader;

            _fsmContext = new FsmContext {L = this};
        }
Example #4
0
        private static bool State6(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57)
                {
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    continue;
                }
                if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13))
                {
                    ctx.Return    = true;
                    ctx.NextState = 1;
                    return(true);
                }
                switch (ctx.L.input_char)
                {
                case 44:
                case 93:
                case 125:
                    ctx.L.UngetChar();
                    ctx.Return    = true;
                    ctx.NextState = 1;
                    return(true);

                case 69:
                case 101:
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 7;
                    return(true);

                default:
                    return(false);
                }
            }
            return(true);
        }
Example #5
0
        private static bool State4(FsmContext ctx)
        {
            ctx.L.GetChar();

            if (ctx.L.input_char == ' ' ||
                ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r')
            {
                ctx.Return    = true;
                ctx.NextState = 1;
                return(true);
            }

            switch (ctx.L.input_char)
            {
            case ',':
            case ']':
            case '}':
                ctx.L.UngetChar();
                ctx.Return    = true;
                ctx.NextState = 1;
                return(true);

            case '.':
                ctx.L.string_buffer.Append((char)ctx.L.input_char);
                ctx.NextState = 5;
                return(true);

            case 'e':
            case 'E':
                ctx.L.string_buffer.Append((char)ctx.L.input_char);
                ctx.NextState = 7;
                return(true);

            default:
                return(false);
            }
        }
Example #6
0
        private static bool State22(FsmContext ctx)
        {
            int num  = 0;
            int num2 = 4096;

            ctx.L.unichar = 0;
            while (ctx.L.GetChar())
            {
                if ((ctx.L.input_char < 48 || ctx.L.input_char > 57) && (ctx.L.input_char < 65 || ctx.L.input_char > 70) && (ctx.L.input_char < 97 || ctx.L.input_char > 102))
                {
                    return(false);
                }
                ctx.L.unichar += Lexer.HexValue(ctx.L.input_char) * num2;
                num++;
                num2 /= 16;
                if (num == 4)
                {
                    ctx.L.string_buffer.Append(Convert.ToChar(ctx.L.unichar));
                    ctx.NextState = ctx.StateStack;
                    return(true);
                }
            }
            return(true);
        }
Example #7
0
        private static bool State22(FsmContext ctx)
        {
            int num  = 0;
            int num2 = 0x1000;

            ctx.L.unichar = 0;
            while (ctx.L.GetChar())
            {
                if ((((ctx.L.input_char < 0x30) || (ctx.L.input_char > 0x39)) && ((ctx.L.input_char < 0x41) || (ctx.L.input_char > 70))) && ((ctx.L.input_char < 0x61) || (ctx.L.input_char > 0x66)))
                {
                    return(false);
                }
                ctx.L.unichar += HexValue(ctx.L.input_char) * num2;
                num++;
                num2 /= 0x10;
                if (num == 4)
                {
                    ctx.L.string_buffer.Append(Convert.ToChar(ctx.L.unichar));
                    ctx.NextState = ctx.StateStack;
                    return(true);
                }
            }
            return(true);
        }
Example #8
0
        private static bool State21(FsmContext ctx)
        {
            ctx.L.GetChar();
            switch (ctx.L.input_char)
            {
            case 0x2f:
            case 0x5c:
            case 0x22:
            case 0x27:
            case 0x62:
            case 0x66:
            case 0x72:
            case 0x74:
            case 110:
                ctx.L.string_buffer.Append(ProcessEscChar(ctx.L.input_char));
                ctx.NextState = ctx.StateStack;
                return(true);

            case 0x75:
                ctx.NextState = 0x16;
                return(true);
            }
            return(false);
        }
Example #9
0
        private static bool State8(FsmContext ctx)
        {
            bool result;

            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char < 48 || ctx.L.input_char > 57)
                {
                    if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13))
                    {
                        ctx.Return    = true;
                        ctx.NextState = 1;
                        result        = true;
                    }
                    else
                    {
                        int num = ctx.L.input_char;
                        if (num != 44 && num != 93 && num != 125)
                        {
                            result = false;
                        }
                        else
                        {
                            ctx.L.UngetChar();
                            ctx.Return    = true;
                            ctx.NextState = 1;
                            result        = true;
                        }
                    }
                    return(result);
                }
                ctx.L.string_buffer.Append((char)ctx.L.input_char);
            }
            result = true;
            return(result);
        }
Example #10
0
        private static bool State28(FsmContext ctx)
        {
            bool result;

            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char != 42)
                {
                    if (ctx.L.input_char == 47)
                    {
                        ctx.NextState = 1;
                        result        = true;
                    }
                    else
                    {
                        ctx.NextState = 27;
                        result        = true;
                    }
                    return(result);
                }
            }
            result = true;
            return(result);
        }
Example #11
0
        private static bool State19(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                switch (ctx.L.input_char)
                {
                case 34:
                    ctx.L.UngetChar();
                    ctx.Return    = true;
                    ctx.NextState = 20;
                    return(true);

                case 92:
                    ctx.StateStack = 19;
                    ctx.NextState  = 21;
                    return(true);

                default:
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    continue;
                }
            }
            return(true);
        }
        private static bool State23(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                switch (ctx.L.inputChar)
                {
                case '\'':
                    ctx.L.UngetChar();
                    ctx.Return    = true;
                    ctx.NextState = 24;
                    return(true);

                case '\\':
                    ctx.StateStack = 23;
                    ctx.NextState  = 21;
                    return(true);

                default:
                    ctx.L.stringBuffer.Append((char)ctx.L.inputChar);
                    continue;
                }
            }
            return(true);
        }
Example #13
0
        private static bool State6(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char < 48 || ctx.L.input_char > 57)
                {
                    if (ctx.L.input_char != 32 && (ctx.L.input_char < 9 || ctx.L.input_char > 13))
                    {
                        switch (ctx.L.input_char)
                        {
                        case 44:
                        case 93:
                        case 125:
                            ctx.L.UngetChar();
                            ctx.Return    = true;
                            ctx.NextState = 1;
                            return(true);

                        case 69:
                        case 101:
                            ctx.L.string_buffer.Append((char)ctx.L.input_char);
                            ctx.NextState = 7;
                            return(true);

                        default:
                            return(false);
                        }
                    }
                    ctx.Return    = true;
                    ctx.NextState = 1;
                    return(true);
                }
                ctx.L.string_buffer.Append((char)ctx.L.input_char);
            }
            return(true);
        }
Example #14
0
 private static bool State9(FsmContext ctx)
 {
     ctx.L.GetChar();
     int num = ctx.L.input_char;
     if (num != 114)
     {
         return false;
     }
     ctx.NextState = 10;
     return true;
 }
Example #15
0
        private static bool State4(FsmContext ctx)
        {
            ctx.L.GetChar ();

            if (ctx.L.input_char == ' ' ||
                ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') {
                ctx.Return = true;
                ctx.NextState = 1;
                return true;
            }

            switch (ctx.L.input_char) {
            case ',':
            case ']':
            case '}':
                ctx.L.UngetChar ();
                ctx.Return = true;
                ctx.NextState = 1;
                return true;

            case '.':
                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                ctx.NextState = 5;
                return true;

            case 'e':
            case 'E':
                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                ctx.NextState = 7;
                return true;

            default:
                return false;
            }
        }
Example #16
0
        private static bool State7(FsmContext ctx)
        {
            ctx.L.GetChar ();

            if (ctx.L.input_char >= '0' && ctx.L.input_char<= '9') {
                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                ctx.NextState = 8;
                return true;
            }

            switch (ctx.L.input_char) {
            case '+':
            case '-':
                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                ctx.NextState = 8;
                return true;

            default:
                return false;
            }
        }
Example #17
0
 private static bool State28(FsmContext ctx)
 {
     while (ctx.L.GetChar())
     {
         if (ctx.L.input_char != 42)
         {
             if (ctx.L.input_char == 47)
             {
                 ctx.NextState = 1;
                 return true;
             }
             ctx.NextState = 27;
             return true;
         }
     }
     return true;
 }
Example #18
0
        private static bool State27(FsmContext ctx)
        {
            while (ctx.L.GetChar ()) {
                if (ctx.L.input_char == '*') {
                    ctx.NextState = 28;
                    return true;
                }
            }

            return true;
        }
Example #19
0
        private static bool State1(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char != 32 && (ctx.L.input_char < 9 || ctx.L.input_char > 13))
                {
                    if (ctx.L.input_char >= 49 && ctx.L.input_char <= 57)
                    {
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 3;
                        return(true);
                    }
                    switch (ctx.L.input_char)
                    {
                    case 34:
                        ctx.NextState = 19;
                        ctx.Return    = true;
                        return(true);

                    case 39:
                        if (!ctx.L.allow_single_quoted_strings)
                        {
                            return(false);
                        }
                        ctx.L.input_char = 34;
                        ctx.NextState    = 23;
                        ctx.Return       = true;
                        return(true);

                    case 44:
                    case 58:
                    case 91:
                    case 93:
                    case 123:
                    case 125:
                        ctx.NextState = 1;
                        ctx.Return    = true;
                        return(true);

                    case 45:
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 2;
                        return(true);

                    case 47:
                        if (!ctx.L.allow_comments)
                        {
                            return(false);
                        }
                        ctx.NextState = 25;
                        return(true);

                    case 48:
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 4;
                        return(true);

                    case 102:
                        ctx.NextState = 12;
                        return(true);

                    case 110:
                        ctx.NextState = 16;
                        return(true);

                    case 116:
                        ctx.NextState = 9;
                        return(true);

                    default:
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #20
0
        private static bool State1(FsmContext ctx)
        {
            while (ctx.L.GetChar ()) {
                if (ctx.L.input_char == ' ' ||
                    ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r')
                    continue;

                if (ctx.L.input_char >= '1' && ctx.L.input_char <= '9') {
                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                    ctx.NextState = 3;
                    return true;
                }

                switch (ctx.L.input_char) {
                case '"':
                    ctx.NextState = 19;
                    ctx.Return = true;
                    return true;

                case ',':
                case ':':
                case '[':
                case ']':
                case '{':
                case '}':
                    ctx.NextState = 1;
                    ctx.Return = true;
                    return true;

                case '-':
                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                    ctx.NextState = 2;
                    return true;

                case '0':
                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                    ctx.NextState = 4;
                    return true;

                case 'f':
                    ctx.NextState = 12;
                    return true;

                case 'n':
                    ctx.NextState = 16;
                    return true;

                case 't':
                    ctx.NextState = 9;
                    return true;

                case '\'':
                    if (! ctx.L.allow_single_quoted_strings)
                        return false;

                    ctx.L.input_char = '"';
                    ctx.NextState = 23;
                    ctx.Return = true;
                    return true;

                case '/':
                    if (! ctx.L.allow_comments)
                        return false;

                    ctx.NextState = 25;
                    return true;

                default:
                    return false;
                }
            }

            return true;
        }
Example #21
0
        private static bool State1(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char != 32 && (ctx.L.input_char < 9 || ctx.L.input_char > 13))
                {
                    if (ctx.L.input_char >= 49 && ctx.L.input_char <= 57)
                    {
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 3;
                        return(true);
                    }
                    int num = ctx.L.input_char;
                    switch (num)
                    {
                    case 39:
                        if (!ctx.L.allow_single_quoted_strings)
                        {
                            return(false);
                        }
                        ctx.L.input_char = 34;
                        ctx.NextState    = 23;
                        ctx.Return       = true;
                        return(true);

                    case 40:
                    case 41:
                    case 42:
                    case 43:
                    case 46:
IL_C7:
                        switch (num)
                        {
                        case 91:
                        case 93:
                            goto IL_12F;

                        case 92:
IL_DC:
                            switch (num)
                            {
                            case 123:
                            case 125:
                                goto IL_12F;

                            case 124:
IL_F1:
                                if (num == 34)
                                {
                                    ctx.NextState = 19;
                                    ctx.Return    = true;
                                    return(true);
                                }
                                if (num == 58)
                                {
                                    goto IL_12F;
                                }
                                if (num == 102)
                                {
                                    ctx.NextState = 12;
                                    return(true);
                                }
                                if (num == 110)
                                {
                                    ctx.NextState = 16;
                                    return(true);
                                }
                                if (num != 116)
                                {
                                    return(false);
                                }
                                ctx.NextState = 9;
                                return(true);
                            }
                            goto IL_F1;
                        }
                        goto IL_DC;

                    case 44:
                        goto IL_12F;

                    case 45:
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 2;
                        return(true);

                    case 47:
                        if (!ctx.L.allow_comments)
                        {
                            return(false);
                        }
                        ctx.NextState = 25;
                        return(true);

                    case 48:
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 4;
                        return(true);
                    }
                    goto IL_C7;
IL_12F:
                    ctx.NextState = 1;
                    ctx.Return    = true;
                    return(true);
                }
            }
            return(true);
        }
Example #22
0
 private static bool State24(FsmContext ctx)
 {
     ctx.L.GetChar();
     int num = ctx.L.input_char;
     if (num != 39)
     {
         return false;
     }
     ctx.L.input_char = 34;
     ctx.Return = true;
     ctx.NextState = 1;
     return true;
 }
Example #23
0
 private static bool State25(FsmContext ctx)
 {
     ctx.L.GetChar();
     int num = ctx.L.input_char;
     if (num == 42)
     {
         ctx.NextState = 27;
         return true;
     }
     if (num != 47)
     {
         return false;
     }
     ctx.NextState = 26;
     return true;
 }
Example #24
0
        private static bool State19(FsmContext ctx)
        {
            while (ctx.L.GetChar ()) {
                switch (ctx.L._inputChar) {
                case '"':
                    ctx.L.UngetChar ();
                    ctx.Return = true;
                    ctx.NextState = 20;
                    return true;

                case '\\':
                    ctx.StateStack = 19;
                    ctx.NextState = 21;
                    return true;

                default:
                    ctx.L._stringBuffer.Append ((char) ctx.L._inputChar);
                    continue;
                }
            }

            return true;
        }
Example #25
0
        private static bool State18(FsmContext ctx)
        {
            ctx.L.GetChar ();

            switch (ctx.L._inputChar) {
            case 'l':
                ctx.Return = true;
                ctx.NextState = 1;
                return true;

            default:
                return false;
            }
        }
Example #26
0
        private static bool State3(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if ((ctx.L.input_char >= 0x30) && (ctx.L.input_char <= 0x39))
                {
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    continue;
                }
                if ((ctx.L.input_char == 0x20) || ((ctx.L.input_char >= 9) && (ctx.L.input_char <= 13)))
                {
                    ctx.Return    = true;
                    ctx.NextState = 1;
                    return(true);
                }
                int num = ctx.L.input_char;
                if (num <= 0x45)
                {
                    switch (num)
                    {
                    case 0x2c:
                        goto Label_00BE;

                    case 0x2d:
                        goto Label_0125;

                    case 0x2e:
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 5;
                        return(true);

                    case 0x45:
                        goto Label_00FF;
                    }
                    goto Label_0125;
                }
                if (num != 0x5d)
                {
                    if (num == 0x65)
                    {
                        goto Label_00FF;
                    }
                    if (num != 0x7d)
                    {
                        goto Label_0125;
                    }
                }
Label_00BE:
                ctx.L.UngetChar();
                ctx.Return    = true;
                ctx.NextState = 1;
                return(true);

Label_00FF:
                ctx.L.string_buffer.Append((char)ctx.L.input_char);
                ctx.NextState = 7;
                return(true);

Label_0125:
                return(false);
            }
            return(true);
        }
Example #27
0
        private static bool State22(FsmContext ctx)
        {
            int counter = 0;
            int mult    = 4096;

            ctx.L.unichar = 0;

            while (ctx.L.GetChar ()) {

                if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9' ||
                    ctx.L.input_char >= 'A' && ctx.L.input_char <= 'F' ||
                    ctx.L.input_char >= 'a' && ctx.L.input_char <= 'f') {

                    ctx.L.unichar += HexValue (ctx.L.input_char) * mult;

                    counter++;
                    mult /= 16;

                    if (counter == 4) {
                        ctx.L.string_buffer.Append (
                            Convert.ToChar (ctx.L.unichar));
                        ctx.NextState = ctx.StateStack;
                        return true;
                    }

                    continue;
                }

                return false;
            }

            return true;
        }
Example #28
0
        static bool State26(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char == '\n')
                {
                    ctx.NextState = 1;
                    return true;
                }
            }

            return true;
        }
Example #29
0
        private static bool State24(FsmContext ctx)
        {
            ctx.L.GetChar ();

            switch (ctx.L.input_char) {
            case '\'':
                ctx.L.input_char = '"';
                ctx.Return = true;
                ctx.NextState = 1;
                return true;

            default:
                return false;
            }
        }
Example #30
0
        private static bool State21(FsmContext ctx)
        {
            ctx.L.GetChar ();

            switch (ctx.L.input_char) {
            case 'u':
                ctx.NextState = 22;
                return true;

            case '"':
            case '\'':
            case '/':
            case '\\':
            case 'b':
            case 'f':
            case 'n':
            case 'r':
            case 't':
                ctx.L.string_buffer.Append (
                    ProcessEscChar (ctx.L.input_char));
                ctx.NextState = ctx.StateStack;
                return true;

            default:
                return false;
            }
        }
Example #31
0
        // Token: 0x060010BB RID: 4283 RVA: 0x00062784 File Offset: 0x00060984
        private static bool State1(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char != 32 && (ctx.L.input_char < 9 || ctx.L.input_char > 13))
                {
                    if (ctx.L.input_char >= 49 && ctx.L.input_char <= 57)
                    {
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 3;
                        return(true);
                    }
                    int num = ctx.L.input_char;
                    if (num <= 91)
                    {
                        if (num <= 39)
                        {
                            if (num == 34)
                            {
                                ctx.NextState = 19;
                                ctx.Return    = true;
                                return(true);
                            }
                            if (num != 39)
                            {
                                return(false);
                            }
                            if (!ctx.L.allow_single_quoted_strings)
                            {
                                return(false);
                            }
                            ctx.L.input_char = 34;
                            ctx.NextState    = 23;
                            ctx.Return       = true;
                            return(true);
                        }
                        else
                        {
                            switch (num)
                            {
                            case 44:
                                break;

                            case 45:
                                ctx.L.string_buffer.Append((char)ctx.L.input_char);
                                ctx.NextState = 2;
                                return(true);

                            case 46:
                                return(false);

                            case 47:
                                if (!ctx.L.allow_comments)
                                {
                                    return(false);
                                }
                                ctx.NextState = 25;
                                return(true);

                            case 48:
                                ctx.L.string_buffer.Append((char)ctx.L.input_char);
                                ctx.NextState = 4;
                                return(true);

                            default:
                                if (num != 58 && num != 91)
                                {
                                    return(false);
                                }
                                break;
                            }
                        }
                    }
                    else if (num <= 110)
                    {
                        if (num != 93)
                        {
                            if (num == 102)
                            {
                                ctx.NextState = 12;
                                return(true);
                            }
                            if (num != 110)
                            {
                                return(false);
                            }
                            ctx.NextState = 16;
                            return(true);
                        }
                    }
                    else
                    {
                        if (num == 116)
                        {
                            ctx.NextState = 9;
                            return(true);
                        }
                        if (num != 123 && num != 125)
                        {
                            return(false);
                        }
                    }
                    ctx.NextState = 1;
                    ctx.Return    = true;
                    return(true);
                }
            }
            return(true);
        }
Example #32
0
        private static bool State23(FsmContext ctx)
        {
            while (ctx.L.GetChar ()) {
                switch (ctx.L.input_char) {
                case '\'':
                    ctx.L.UngetChar ();
                    ctx.Return = true;
                    ctx.NextState = 24;
                    return true;

                case '\\':
                    ctx.StateStack = 23;
                    ctx.NextState = 21;
                    return true;

                default:
                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                    continue;
                }
            }

            return true;
        }
Example #33
0
 private static bool State2(FsmContext ctx)
 {
     ctx.L.GetChar();
     if (ctx.L.inputChar >= '1' && ctx.L.inputChar <= '9') {
     ctx.L.stringBuffer.Append((char)ctx.L.inputChar);
     ctx.NextState = 3;
     return true;
     }
     switch (ctx.L.inputChar) {
     case '0':
     ctx.L.stringBuffer.Append((char)ctx.L.inputChar);
     ctx.NextState = 4;
     return true;
     default:
     return false;
     }
 }
Example #34
0
        private static bool State25(FsmContext ctx)
        {
            ctx.L.GetChar ();

            switch (ctx.L.input_char) {
            case '*':
                ctx.NextState = 27;
                return true;

            case '/':
                ctx.NextState = 26;
                return true;

            default:
                return false;
            }
        }
Example #35
0
        private static bool State4(FsmContext ctx)
        {
            ctx.L.GetChar();
            bool result;

            if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13))
            {
                ctx.Return    = true;
                ctx.NextState = 1;
                result        = true;
            }
            else
            {
                int num = ctx.L.input_char;
                if (num <= 69)
                {
                    switch (num)
                    {
                    case 44:
                        break;

                    case 45:
                        goto IL_106;

                    case 46:
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 5;
                        result        = true;
                        return(result);

                    default:
                        if (num != 69)
                        {
                            goto IL_106;
                        }
                        goto IL_DE;
                    }
                }
                else if (num != 93)
                {
                    if (num == 101)
                    {
                        goto IL_DE;
                    }
                    if (num != 125)
                    {
                        goto IL_106;
                    }
                }
                ctx.L.UngetChar();
                ctx.Return    = true;
                ctx.NextState = 1;
                result        = true;
                return(result);

IL_DE:
                ctx.L.string_buffer.Append((char)ctx.L.input_char);
                ctx.NextState = 7;
                result        = true;
                return(result);

IL_106:
                result = false;
            }
            return(result);
        }
Example #36
0
        private static bool State28(FsmContext ctx)
        {
            while (ctx.L.GetChar ()) {
                if (ctx.L.input_char == '*')
                    continue;

                if (ctx.L.input_char == '/') {
                    ctx.NextState = 1;
                    return true;
                }

                ctx.NextState = 27;
                return true;
            }

            return true;
        }
Example #37
0
        private static bool State9(FsmContext ctx)
        {
            ctx.L.GetChar ();

            switch (ctx.L.input_char) {
            case 'r':
                ctx.NextState = 10;
                return true;

            default:
                return false;
            }
        }
Example #38
0
        private static bool State5(FsmContext ctx)
        {
            ctx.L.GetChar ();

            if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') {
                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                ctx.NextState = 6;
                return true;
            }

            return false;
        }
Example #39
0
 public Lexer(TextReader reader)
 {
     this.reader        = reader;
     this.fsm_context   = new FsmContext();
     this.fsm_context.L = this;
 }
Example #40
0
        private static bool State8(FsmContext ctx)
        {
            while (ctx.L.GetChar ()) {
                if (ctx.L.input_char >= '0' && ctx.L.input_char<= '9') {
                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
                    continue;
                }

                if (ctx.L.input_char == ' ' ||
                    ctx.L.input_char >= '\t' && ctx.L.input_char<= '\r') {
                    ctx.Return = true;
                    ctx.NextState = 1;
                    return true;
                }

                switch (ctx.L.input_char) {
                case ',':
                case ']':
                case '}':
                    ctx.L.UngetChar ();
                    ctx.Return = true;
                    ctx.NextState = 1;
                    return true;

                default:
                    return false;
                }
            }

            return true;
        }
Example #41
0
 private static bool State4(FsmContext ctx)
 {
     ctx.L.GetChar();
     if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13))
     {
         ctx.Return = true;
         ctx.NextState = 1;
         return true;
     }
     int num = ctx.L.input_char;
     switch (num)
     {
     case 44:
         goto IL_98;
     case 45:
         IL_73:
         if (num != 69)
         {
             if (num == 93)
             {
                 goto IL_98;
             }
             if (num != 101)
             {
                 if (num != 125)
                 {
                     return false;
                 }
                 goto IL_98;
             }
         }
         ctx.L.string_buffer.Append((char)ctx.L.input_char);
         ctx.NextState = 7;
         return true;
     case 46:
         ctx.L.string_buffer.Append((char)ctx.L.input_char);
         ctx.NextState = 5;
         return true;
     }
     goto IL_73;
     IL_98:
     ctx.L.UngetChar();
     ctx.Return = true;
     ctx.NextState = 1;
     return true;
 }
Example #42
0
        private static bool State1(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if ((ctx.L.input_char == 0x20) || ((ctx.L.input_char >= 9) && (ctx.L.input_char <= 13)))
                {
                    continue;
                }
                if ((ctx.L.input_char >= 0x31) && (ctx.L.input_char <= 0x39))
                {
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 3;
                    return(true);
                }
                int num = ctx.L.input_char;
                switch (num)
                {
                case 0x27:
                    if (ctx.L.allow_single_quoted_strings)
                    {
                        goto Label_01BB;
                    }
                    return(false);

                case 0x2c:
                case 0x5b:
                case 0x5d:
                case 0x7b:
                case 0x7d:
                    break;

                case 0x2d:
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 2;
                    return(true);

                case 0x2f:
                    if (ctx.L.allow_comments)
                    {
                        goto Label_01EB;
                    }
                    return(false);

                case 0x30:
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 4;
                    return(true);

                default:
                    if (num != 0x22)
                    {
                        if (num != 0x3a)
                        {
                            if (num == 0x66)
                            {
                                goto Label_018B;
                            }
                            if (num == 110)
                            {
                                goto Label_0195;
                            }
                            if (num != 0x74)
                            {
                                return(false);
                            }
                            goto Label_019F;
                        }
                    }
                    else
                    {
                        ctx.NextState = 0x13;
                        ctx.Return    = true;
                        return(true);
                    }
                    break;
                }
                ctx.NextState = 1;
                ctx.Return    = true;
                return(true);

Label_018B:
                ctx.NextState = 12;
                return(true);

Label_0195:
                ctx.NextState = 0x10;
                return(true);

Label_019F:
                ctx.NextState = 9;
                return(true);

Label_01BB:
                ctx.L.input_char = 0x22;
                ctx.NextState    = 0x17;
                ctx.Return       = true;
                return(true);

Label_01EB:
                ctx.NextState = 0x19;
                return(true);
            }
            return(true);
        }
Example #43
0
 private static bool State7(FsmContext ctx)
 {
     ctx.L.GetChar();
     if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57)
     {
         ctx.L.string_buffer.Append((char)ctx.L.input_char);
         ctx.NextState = 8;
         return true;
     }
     switch (ctx.L.input_char)
     {
     case 43:
     case 45:
         ctx.L.string_buffer.Append((char)ctx.L.input_char);
         ctx.NextState = 8;
         return true;
     }
     return false;
 }
Example #44
0
 private static bool State23(FsmContext ctx)
 {
     while (ctx.L.GetChar())
     {
         int num = ctx.L.input_char;
         if (num == 39)
         {
             ctx.L.UngetChar();
             ctx.Return = true;
             ctx.NextState = 24;
             return true;
         }
         if (num == 92)
         {
             ctx.StateStack = 23;
             ctx.NextState = 21;
             return true;
         }
         ctx.L.string_buffer.Append((char)ctx.L.input_char);
     }
     return true;
 }
Example #45
0
 private static bool State8(FsmContext ctx)
 {
     while (ctx.L.GetChar())
     {
         if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57)
         {
             ctx.L.string_buffer.Append((char)ctx.L.input_char);
         }
         else
         {
             if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13))
             {
                 ctx.Return = true;
                 ctx.NextState = 1;
                 return true;
             }
             int num = ctx.L.input_char;
             if (num != 44 && num != 93 && num != 125)
             {
                 return false;
             }
             ctx.L.UngetChar();
             ctx.Return = true;
             ctx.NextState = 1;
             return true;
         }
     }
     return true;
 }
Example #46
0
        private static bool State1(FsmContext ctx)
        {
            bool result;

            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char != 32 && (ctx.L.input_char < 9 || ctx.L.input_char > 13))
                {
                    if (ctx.L.input_char >= 49 && ctx.L.input_char <= 57)
                    {
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 3;
                        result        = true;
                    }
                    else
                    {
                        int num = ctx.L.input_char;
                        if (num <= 58)
                        {
                            if (num <= 39)
                            {
                                if (num == 34)
                                {
                                    ctx.NextState = 19;
                                    ctx.Return    = true;
                                    result        = true;
                                    return(result);
                                }
                                if (num != 39)
                                {
                                    goto IL_231;
                                }
                                if (!ctx.L.allow_single_quoted_strings)
                                {
                                    result = false;
                                    return(result);
                                }
                                ctx.L.input_char = 34;
                                ctx.NextState    = 23;
                                ctx.Return       = true;
                                result           = true;
                                return(result);
                            }
                            else
                            {
                                switch (num)
                                {
                                case 44:
                                    break;

                                case 45:
                                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                                    ctx.NextState = 2;
                                    result        = true;
                                    return(result);

                                case 46:
                                    goto IL_231;

                                case 47:
                                    if (!ctx.L.allow_comments)
                                    {
                                        result = false;
                                        return(result);
                                    }
                                    ctx.NextState = 25;
                                    result        = true;
                                    return(result);

                                case 48:
                                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                                    ctx.NextState = 4;
                                    result        = true;
                                    return(result);

                                default:
                                    if (num != 58)
                                    {
                                        goto IL_231;
                                    }
                                    break;
                                }
                            }
                        }
                        else if (num <= 102)
                        {
                            switch (num)
                            {
                            case 91:
                            case 93:
                                break;

                            case 92:
                                goto IL_231;

                            default:
                                if (num != 102)
                                {
                                    goto IL_231;
                                }
                                ctx.NextState = 12;
                                result        = true;
                                return(result);
                            }
                        }
                        else
                        {
                            if (num == 110)
                            {
                                ctx.NextState = 16;
                                result        = true;
                                return(result);
                            }
                            if (num == 116)
                            {
                                ctx.NextState = 9;
                                result        = true;
                                return(result);
                            }
                            switch (num)
                            {
                            case 123:
                            case 125:
                                break;

                            case 124:
                                goto IL_231;

                            default:
                                goto IL_231;
                            }
                        }
                        ctx.NextState = 1;
                        ctx.Return    = true;
                        result        = true;
                        return(result);

IL_231:
                        result = false;
                    }
                    return(result);
                }
            }
            result = true;
            return(result);
        }
Example #47
0
 private static bool State6(FsmContext ctx)
 {
     while (ctx.L.GetChar())
     {
         if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57)
         {
             ctx.L.string_buffer.Append((char)ctx.L.input_char);
         }
         else
         {
             if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13))
             {
                 ctx.Return = true;
                 ctx.NextState = 1;
                 return true;
             }
             int num = ctx.L.input_char;
             if (num != 44)
             {
                 if (num != 69)
                 {
                     if (num == 93)
                     {
                         goto IL_CA;
                     }
                     if (num != 101)
                     {
                         if (num != 125)
                         {
                             return false;
                         }
                         goto IL_CA;
                     }
                 }
                 ctx.L.string_buffer.Append((char)ctx.L.input_char);
                 ctx.NextState = 7;
                 return true;
             }
             IL_CA:
             ctx.L.UngetChar();
             ctx.Return = true;
             ctx.NextState = 1;
             return true;
         }
     }
     return true;
 }
Example #48
0
        private static bool State6(FsmContext ctx)
        {
            bool result;

            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char < 48 || ctx.L.input_char > 57)
                {
                    if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13))
                    {
                        ctx.Return    = true;
                        ctx.NextState = 1;
                        result        = true;
                    }
                    else
                    {
                        int num = ctx.L.input_char;
                        if (num <= 69)
                        {
                            if (num != 44)
                            {
                                if (num != 69)
                                {
                                    goto IL_110;
                                }
                                goto IL_E8;
                            }
                        }
                        else if (num != 93)
                        {
                            if (num == 101)
                            {
                                goto IL_E8;
                            }
                            if (num != 125)
                            {
                                goto IL_110;
                            }
                        }
                        ctx.L.UngetChar();
                        ctx.Return    = true;
                        ctx.NextState = 1;
                        result        = true;
                        return(result);

IL_E8:
                        ctx.L.string_buffer.Append((char)ctx.L.input_char);
                        ctx.NextState = 7;
                        result        = true;
                        return(result);

IL_110:
                        result = false;
                    }
                    return(result);
                }
                ctx.L.string_buffer.Append((char)ctx.L.input_char);
            }
            result = true;
            return(result);
        }
Example #49
0
        private static bool State1(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if ((ctx.L.input_char == 0x20) || ((ctx.L.input_char >= 9) && (ctx.L.input_char <= 13)))
                {
                    continue;
                }
                if ((ctx.L.input_char >= 0x31) && (ctx.L.input_char <= 0x39))
                {
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 3;
                    return(true);
                }
                switch (ctx.L.input_char)
                {
                case 0x2c:
                case 0x3a:
                case 0x5b:
                case 0x5d:
                case 0x7b:
                case 0x7d:
                    ctx.NextState = 1;
                    ctx.Return    = true;
                    return(true);

                case 0x2d:
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 2;
                    return(true);

                case 0x2f:
                    if (ctx.L.allow_comments)
                    {
                        break;
                    }
                    return(false);

                case 0x30:
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 4;
                    return(true);

                case 0x22:
                    ctx.NextState = 0x13;
                    ctx.Return    = true;
                    return(true);

                case 0x27:
                    if (!ctx.L.allow_single_quoted_strings)
                    {
                        return(false);
                    }
                    ctx.L.input_char = 0x22;
                    ctx.NextState    = 0x17;
                    ctx.Return       = true;
                    return(true);

                case 0x66:
                    ctx.NextState = 12;
                    return(true);

                case 0x74:
                    ctx.NextState = 9;
                    return(true);

                case 110:
                    ctx.NextState = 0x10;
                    return(true);

                default:
                    return(false);
                }
                ctx.NextState = 0x19;
                return(true);
            }
            return(true);
        }
Example #50
0
        private static bool State1(FsmContext ctx)
        {
            while (ctx.L.GetChar())
            {
                if (ctx.L.input_char == ' ' ||
                    ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r')
                {
                    continue;
                }

                if (ctx.L.input_char >= '1' && ctx.L.input_char <= '9')
                {
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 3;
                    return(true);
                }

                switch (ctx.L.input_char)
                {
                case '"':
                    ctx.NextState = 19;
                    ctx.Return    = true;
                    return(true);

                case ',':
                case ':':
                case '[':
                case ']':
                case '{':
                case '}':
                    ctx.NextState = 1;
                    ctx.Return    = true;
                    return(true);

                case '-':
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 2;
                    return(true);

                case '0':
                    ctx.L.string_buffer.Append((char)ctx.L.input_char);
                    ctx.NextState = 4;
                    return(true);

                case 'f':
                    ctx.NextState = 12;
                    return(true);

                case 'n':
                    ctx.NextState = 16;
                    return(true);

                case 't':
                    ctx.NextState = 9;
                    return(true);

                case '\'':
                    if (!ctx.L.AllowSingleQuotedStrings)
                    {
                        return(false);
                    }

                    ctx.L.input_char = '"';
                    ctx.NextState    = 23;
                    ctx.Return       = true;
                    return(true);

                case '/':
                    if (!ctx.L.AllowComments)
                    {
                        return(false);
                    }

                    ctx.NextState = 25;
                    return(true);

                default:
                    return(false);
                }
            }

            return(true);
        }
Example #51
0
 private static bool State22(FsmContext ctx)
 {
     int num = 0;
     int num2 = 4096;
     ctx.L.unichar = 0;
     while (ctx.L.GetChar())
     {
         if ((ctx.L.input_char < 48 || ctx.L.input_char > 57) && (ctx.L.input_char < 65 || ctx.L.input_char > 70) && (ctx.L.input_char < 97 || ctx.L.input_char > 102))
         {
             return false;
         }
         ctx.L.unichar += Lexer.HexValue(ctx.L.input_char) * num2;
         num++;
         num2 /= 16;
         if (num == 4)
         {
             ctx.L.string_buffer.Append(Convert.ToChar(ctx.L.unichar));
             ctx.NextState = ctx.StateStack;
             return true;
         }
     }
     return true;
 }