Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Module Information
Public.Parser.JSON2
Viewing contents of Public_Parser_JSON2-0.7/json_array_utf8.c

#line 1 "src/json_array_utf8.rl"
// vim:syntax=ragel

#line 39 "src/json_array_utf8.rl"


char *_parse_JSON_array_utf8(char *p, char *pe, struct parser_state *state) {
    char *i = p;
    struct array *a;
    int cs;
    int c = 0;

    
#line 15 "work/json_array_utf8.c"
static const int JSON_array_start = 1;
static const int JSON_array_first_final = 4;
static const int JSON_array_error = 0;

static const int JSON_array_en_main = 1;

#line 48 "src/json_array_utf8.rl"

    if (!state->validate) {
	a = low_allocate_array(0,5);
    }

    
#line 29 "work/json_array_utf8.c"
	{
	cs = JSON_array_start;
	}
#line 54 "src/json_array_utf8.rl"
    
#line 35 "work/json_array_utf8.c"
	{
	if ( p == pe )
		goto _out;
	switch ( cs )
	{
case 1:
	if ( (*p) == 91 )
		goto st2;
	goto st0;
st0:
	goto _out0;
st2:
	if ( ++p == pe )
		goto _out2;
case 2:
	switch( (*p) ) {
		case 13: goto st2;
		case 32: goto st2;
		case 34: goto tr2;
		case 43: goto tr2;
		case 91: goto tr2;
		case 93: goto st4;
		case 102: goto tr2;
		case 110: goto tr2;
		case 116: goto tr2;
		case 123: goto tr2;
	}
	if ( (*p) < 45 ) {
		if ( 9 <= (*p) && (*p) <= 10 )
			goto st2;
	} else if ( (*p) > 46 ) {
		if ( 48 <= (*p) && (*p) <= 57 )
			goto tr2;
	} else
		goto tr2;
	goto st0;
tr2:
#line 7 "src/json_array_utf8.rl"
	{
	state->level++;
	i = _parse_JSON_utf8(p, pe, state);
	state->level--;

	if (i == NULL) {
	    if (!state->validate) { 
		free_array(a);
	    }
	    return NULL;
	} else if (!state->validate) {
	    a = array_insert(a, &(Pike_sp[-1]), c);
	    pop_stack();
	}

	c++;
	{p = (( i))-1;}
    }
	goto st3;
st3:
	if ( ++p == pe )
		goto _out3;
case 3:
#line 97 "work/json_array_utf8.c"
	switch( (*p) ) {
		case 13: goto st3;
		case 32: goto st3;
		case 44: goto st2;
		case 93: goto st4;
	}
	if ( 9 <= (*p) && (*p) <= 10 )
		goto st3;
	goto st0;
st4:
	if ( ++p == pe )
		goto _out4;
case 4:
#line 38 "src/json_array_utf8.rl"
	{ goto _out4; }
#line 113 "work/json_array_utf8.c"
	goto st0;
	}
	_out0: cs = 0; goto _out; 
	_out2: cs = 2; goto _out; 
	_out3: cs = 3; goto _out; 
	_out4: cs = 4; goto _out; 

	_out: {}
	}
#line 55 "src/json_array_utf8.rl"

    if (cs >= JSON_array_first_final) {
	if (!state->validate) {
	    push_array(a);
	}
	return p;
    }

    if (!state->validate) {
	free_array(a);
    }


    push_int((int)p);
    return NULL;
}


gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University