コード例 #1
0
        /* #line 92 "./ragel/tsip_parser_header_Dummy.rl" */
        public static TSIP_HeaderDummy Parse(String data)
        {
            int cs = 0;
            int p = 0;
            int pe = data.Length;
            int eof = pe;
            TSIP_HeaderDummy hdr_Dummy = new TSIP_HeaderDummy();

            int tag_start = 0;

            /* #line 145 "../Headers/TSIP_HeaderDummy.cs" */
            {
            cs = tsip_machine_parser_header_Dummy_start;
            }

            /* #line 104 "./ragel/tsip_parser_header_Dummy.rl" */

            /* #line 152 "../Headers/TSIP_HeaderDummy.cs" */
            {
            sbyte _klen;
            sbyte _trans;
            sbyte _acts;
            sbyte _nacts;
            sbyte _keys;

            if ( p == pe )
            goto _test_eof;
            if ( cs == 0 )
            goto _out;
            _resume:
            _keys = _tsip_machine_parser_header_Dummy_key_offsets[cs];
            _trans = (sbyte)_tsip_machine_parser_header_Dummy_index_offsets[cs];

            _klen = _tsip_machine_parser_header_Dummy_single_lengths[cs];
            if ( _klen > 0 ) {
            sbyte _lower = _keys;
            sbyte _mid;
            sbyte _upper = (sbyte) (_keys + _klen - 1);
            while (true) {
            if ( _upper < _lower )
                break;

            _mid = (sbyte) (_lower + ((_upper-_lower) >> 1));
            if ( data[p] < _tsip_machine_parser_header_Dummy_trans_keys[_mid] )
                _upper = (sbyte) (_mid - 1);
            else if ( data[p] > _tsip_machine_parser_header_Dummy_trans_keys[_mid] )
                _lower = (sbyte) (_mid + 1);
            else {
                _trans += (sbyte) (_mid - _keys);
                goto _match;
            }
            }
            _keys += (sbyte) _klen;
            _trans += (sbyte) _klen;
            }

            _klen = _tsip_machine_parser_header_Dummy_range_lengths[cs];
            if ( _klen > 0 ) {
            sbyte _lower = _keys;
            sbyte _mid;
            sbyte _upper = (sbyte) (_keys + (_klen<<1) - 2);
            while (true) {
            if ( _upper < _lower )
                break;

            _mid = (sbyte) (_lower + (((_upper-_lower) >> 1) & ~1));
            if ( data[p] < _tsip_machine_parser_header_Dummy_trans_keys[_mid] )
                _upper = (sbyte) (_mid - 2);
            else if ( data[p] > _tsip_machine_parser_header_Dummy_trans_keys[_mid+1] )
                _lower = (sbyte) (_mid + 2);
            else {
                _trans += (sbyte)((_mid - _keys)>>1);
                goto _match;
            }
            }
            _trans += (sbyte) _klen;
            }

            _match:
            _trans = (sbyte)_tsip_machine_parser_header_Dummy_indicies[_trans];
            cs = _tsip_machine_parser_header_Dummy_trans_targs[_trans];

            if ( _tsip_machine_parser_header_Dummy_trans_actions[_trans] == 0 )
            goto _again;

            _acts = _tsip_machine_parser_header_Dummy_trans_actions[_trans];
            _nacts = _tsip_machine_parser_header_Dummy_actions[_acts++];
            while ( _nacts-- > 0 )
            {
            switch ( _tsip_machine_parser_header_Dummy_actions[_acts++] )
            {
            case 0:
            /* #line 31 "./ragel/tsip_parser_header_Dummy.rl" */
            {
            tag_start = p;
            }
            break;
            case 1:
            /* #line 35 "./ragel/tsip_parser_header_Dummy.rl" */
            {
            hdr_Dummy.Name = TSK_RagelState.Parser.GetString(data, p, tag_start);
            }
            break;
            case 2:
            /* #line 39 "./ragel/tsip_parser_header_Dummy.rl" */
            {
            hdr_Dummy.Value = TSK_RagelState.Parser.GetString(data, p, tag_start);
            }
            break;
            case 3:
            /* #line 43 "./ragel/tsip_parser_header_Dummy.rl" */
            {
            }
            break;
            /* #line 249 "../Headers/TSIP_HeaderDummy.cs" */
            default: break;
            }
            }

            _again:
            if ( cs == 0 )
            goto _out;
            if ( ++p != pe )
            goto _resume;
            _test_eof: {}
            _out: {}
            }

            /* #line 105 "./ragel/tsip_parser_header_Dummy.rl" */

            if( cs <
            /* #line 266 "../Headers/TSIP_HeaderDummy.cs" */
            10
            /* #line 106 "./ragel/tsip_parser_header_Dummy.rl" */
             ){
                TSK_Debug.Error("Failed to parse 'Dummy' header");
                hdr_Dummy.Dispose();
                hdr_Dummy = null;
            }

            return hdr_Dummy;
        }
コード例 #2
0
/* #line 92 "./ragel/tsip_parser_header_Dummy.rl" */

        public static TSIP_HeaderDummy Parse(String data)
        {
            int cs  = 0;
            int p   = 0;
            int pe  = data.Length;
            int eof = pe;
            TSIP_HeaderDummy hdr_Dummy = new TSIP_HeaderDummy();

            int tag_start = 0;


/* #line 145 "../Headers/TSIP_HeaderDummy.cs" */
            {
                cs = tsip_machine_parser_header_Dummy_start;
            }

/* #line 104 "./ragel/tsip_parser_header_Dummy.rl" */

/* #line 152 "../Headers/TSIP_HeaderDummy.cs" */
            {
                sbyte _klen;
                sbyte _trans;
                sbyte _acts;
                sbyte _nacts;
                sbyte _keys;

                if (p == pe)
                {
                    goto _test_eof;
                }
                if (cs == 0)
                {
                    goto _out;
                }
_resume:
                _keys  = _tsip_machine_parser_header_Dummy_key_offsets[cs];
                _trans = (sbyte)_tsip_machine_parser_header_Dummy_index_offsets[cs];

                _klen = _tsip_machine_parser_header_Dummy_single_lengths[cs];
                if (_klen > 0)
                {
                    sbyte _lower = _keys;
                    sbyte _mid;
                    sbyte _upper = (sbyte)(_keys + _klen - 1);
                    while (true)
                    {
                        if (_upper < _lower)
                        {
                            break;
                        }

                        _mid = (sbyte)(_lower + ((_upper - _lower) >> 1));
                        if (data[p] < _tsip_machine_parser_header_Dummy_trans_keys[_mid])
                        {
                            _upper = (sbyte)(_mid - 1);
                        }
                        else if (data[p] > _tsip_machine_parser_header_Dummy_trans_keys[_mid])
                        {
                            _lower = (sbyte)(_mid + 1);
                        }
                        else
                        {
                            _trans += (sbyte)(_mid - _keys);
                            goto _match;
                        }
                    }
                    _keys  += (sbyte)_klen;
                    _trans += (sbyte)_klen;
                }

                _klen = _tsip_machine_parser_header_Dummy_range_lengths[cs];
                if (_klen > 0)
                {
                    sbyte _lower = _keys;
                    sbyte _mid;
                    sbyte _upper = (sbyte)(_keys + (_klen << 1) - 2);
                    while (true)
                    {
                        if (_upper < _lower)
                        {
                            break;
                        }

                        _mid = (sbyte)(_lower + (((_upper - _lower) >> 1) & ~1));
                        if (data[p] < _tsip_machine_parser_header_Dummy_trans_keys[_mid])
                        {
                            _upper = (sbyte)(_mid - 2);
                        }
                        else if (data[p] > _tsip_machine_parser_header_Dummy_trans_keys[_mid + 1])
                        {
                            _lower = (sbyte)(_mid + 2);
                        }
                        else
                        {
                            _trans += (sbyte)((_mid - _keys) >> 1);
                            goto _match;
                        }
                    }
                    _trans += (sbyte)_klen;
                }

_match:
                _trans = (sbyte)_tsip_machine_parser_header_Dummy_indicies[_trans];
                cs     = _tsip_machine_parser_header_Dummy_trans_targs[_trans];

                if (_tsip_machine_parser_header_Dummy_trans_actions[_trans] == 0)
                {
                    goto _again;
                }

                _acts  = _tsip_machine_parser_header_Dummy_trans_actions[_trans];
                _nacts = _tsip_machine_parser_header_Dummy_actions[_acts++];
                while (_nacts-- > 0)
                {
                    switch (_tsip_machine_parser_header_Dummy_actions[_acts++])
                    {
                    case 0:
/* #line 31 "./ragel/tsip_parser_header_Dummy.rl" */
                    {
                        tag_start = p;
                    }
                    break;

                    case 1:
/* #line 35 "./ragel/tsip_parser_header_Dummy.rl" */
                    {
                        hdr_Dummy.Name = TSK_RagelState.Parser.GetString(data, p, tag_start);
                    }
                    break;

                    case 2:
/* #line 39 "./ragel/tsip_parser_header_Dummy.rl" */
                    {
                        hdr_Dummy.Value = TSK_RagelState.Parser.GetString(data, p, tag_start);
                    }
                    break;

                    case 3:
/* #line 43 "./ragel/tsip_parser_header_Dummy.rl" */
                    {
                    }
                    break;

/* #line 249 "../Headers/TSIP_HeaderDummy.cs" */
                    default: break;
                    }
                }

_again:
                if (cs == 0)
                {
                    goto _out;
                }
                if (++p != pe)
                {
                    goto _resume;
                }
                _test_eof : {}
                _out      : {}
            }

/* #line 105 "./ragel/tsip_parser_header_Dummy.rl" */

            if (cs <
/* #line 266 "../Headers/TSIP_HeaderDummy.cs" */
                10
/* #line 106 "./ragel/tsip_parser_header_Dummy.rl" */
                )
            {
                TSK_Debug.Error("Failed to parse 'Dummy' header");
                hdr_Dummy.Dispose();
                hdr_Dummy = null;
            }

            return(hdr_Dummy);
        }