/* Generated by re2c 0.13.5 on Sun Feb 16 21:59:06 2014 */
#line 1 "scanner.re"

/*
  +------------------------------------------------------------------------+
  | Phalcon Framework                                                      |
  +------------------------------------------------------------------------+
  | Copyright (c) 2011-2014 Phalcon Team (http://www.phalconphp.com)       |
  +------------------------------------------------------------------------+
  | This source file is subject to the New BSD License that is bundled     |
  | with this package in the file docs/LICENSE.txt.                        |
  |                                                                        |
  | If you did not receive a copy of the license and are unable to         |
  | obtain it through the world-wide-web, please send an email             |
  | to license@phalconphp.com so we can send you a copy immediately.       |
  +------------------------------------------------------------------------+
  | Authors: Andres Gutierrez <andres@phalconphp.com>                      |
  |          Eduar Carvajal <eduar@phalconphp.com>                         |
  +------------------------------------------------------------------------+
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"

#include "scanner.h"

#define YYCTYPE unsigned char
#define YYCURSOR (s->start)
#define YYLIMIT (s->end)
#define YYMARKER q

int phannot_get_token(phannot_scanner_state *s, phannot_scanner_token *token) {

	char next, *q = YYCURSOR, *start = YYCURSOR;
	int status = PHANNOT_SCANNER_RETCODE_IMPOSSIBLE;

	while (PHANNOT_SCANNER_RETCODE_IMPOSSIBLE == status) {

		if (s->mode == PHANNOT_MODE_RAW) {

			if (*YYCURSOR == '\n') {
				s->active_line++;
			}

			next = *(YYCURSOR+1);

			if (*YYCURSOR == '\0' || *YYCURSOR == '@') {
				if ((next >= 'A' && next <= 'Z') || (next >= 'a' && next <= 'z')) {
					s->mode = PHANNOT_MODE_ANNOTATION;
					continue;
				}
			}

			++YYCURSOR;
			token->opcode = PHANNOT_T_IGNORE;
			return 0;

		} else {

		
#line 65 "scanner.c"
		{
			YYCTYPE yych;
			unsigned int yyaccept = 0;
			static const unsigned char yybm[] = {
				  0,  96,  96,  96,  96,  96,  96,  96, 
				 96, 104,  96,  96,  96, 104,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				104,  96,  32,  96,  96,  96,  96,  64, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				240, 240, 240, 240, 240, 240, 240, 240, 
				240, 240,  96,  96,  96,  96,  96,  96, 
				 96, 112, 112, 112, 112, 112, 112, 112, 
				112, 112, 112, 112, 112, 112, 112, 112, 
				112, 112, 112, 112, 112, 112, 112, 112, 
				112, 112, 112,  96,   0,  96,  96, 112, 
				 96, 112, 112, 112, 112, 112, 112, 112, 
				112, 112, 112, 112, 112, 112, 112, 112, 
				112, 112, 112, 112, 112, 112, 112, 112, 
				112, 112, 112,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
				 96,  96,  96,  96,  96,  96,  96,  96, 
			};

			yych = *YYCURSOR;
			switch (yych) {
			case 0x00:	goto yy38;
			case '\t':
			case '\r':
			case ' ':	goto yy34;
			case '\n':	goto yy36;
			case '"':	goto yy10;
			case '\'':	goto yy11;
			case '(':	goto yy14;
			case ')':	goto yy16;
			case ',':	goto yy32;
			case '-':	goto yy2;
			case '0':
			case '1':
			case '2':
			case '3':
			case '4':
			case '5':
			case '6':
			case '7':
			case '8':
			case '9':	goto yy4;
			case ':':	goto yy30;
			case '=':	goto yy28;
			case '@':	goto yy26;
			case 'A':
			case 'B':
			case 'C':
			case 'D':
			case 'E':
			case 'G':
			case 'H':
			case 'I':
			case 'J':
			case 'K':
			case 'L':
			case 'M':
			case 'O':
			case 'P':
			case 'Q':
			case 'R':
			case 'S':
			case 'U':
			case 'V':
			case 'W':
			case 'X':
			case 'Y':
			case 'Z':
			case '_':
			case 'a':
			case 'b':
			case 'c':
			case 'd':
			case 'e':
			case 'g':
			case 'h':
			case 'i':
			case 'j':
			case 'k':
			case 'l':
			case 'm':
			case 'o':
			case 'p':
			case 'q':
			case 'r':
			case 's':
			case 'u':
			case 'v':
			case 'w':
			case 'x':
			case 'y':
			case 'z':	goto yy13;
			case 'F':
			case 'f':	goto yy8;
			case 'N':
			case 'n':	goto yy6;
			case 'T':
			case 't':	goto yy9;
			case '[':	goto yy22;
			case '\\':	goto yy12;
			case ']':	goto yy24;
			case '{':	goto yy18;
			case '}':	goto yy20;
			default:	goto yy40;
			}
yy2:
			++YYCURSOR;
			if (yybm[0+(yych = *YYCURSOR)] & 128) {
				goto yy71;
			}
yy3:
#line 182 "scanner.re"
			{
			status = PHANNOT_SCANNER_RETCODE_ERR;
			break;
		}
#line 201 "scanner.c"
yy4:
			yyaccept = 0;
			yych = *(YYMARKER = ++YYCURSOR);
			goto yy72;
yy5:
#line 66 "scanner.re"
			{
			token->opcode = PHANNOT_T_INTEGER;
			token->value = estrndup(start, YYCURSOR - start);
			token->len = YYCURSOR - start;
			q = YYCURSOR;
			return 0;
		}
#line 215 "scanner.c"
yy6:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'U') goto yy66;
			if (yych == 'u') goto yy66;
			goto yy44;
yy7:
#line 108 "scanner.re"
			{
			token->opcode = PHANNOT_T_IDENTIFIER;
			token->value = estrndup(start, YYCURSOR - start);
			token->len = YYCURSOR - start;
			q = YYCURSOR;
			return 0;
		}
#line 231 "scanner.c"
yy8:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'A') goto yy61;
			if (yych == 'a') goto yy61;
			goto yy44;
yy9:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'R') goto yy57;
			if (yych == 'r') goto yy57;
			goto yy44;
yy10:
			yyaccept = 2;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych <= 0x00) goto yy3;
			goto yy55;
yy11:
			yyaccept = 2;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych <= 0x00) goto yy3;
			goto yy50;
yy12:
			yych = *++YYCURSOR;
			if (yych <= '^') {
				if (yych <= '@') goto yy3;
				if (yych <= 'Z') goto yy43;
				goto yy3;
			} else {
				if (yych == '`') goto yy3;
				if (yych <= 'z') goto yy43;
				goto yy3;
			}
yy13:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			goto yy44;
yy14:
			++YYCURSOR;
#line 116 "scanner.re"
			{
			token->opcode = PHANNOT_T_PARENTHESES_OPEN;
			return 0;
		}
#line 276 "scanner.c"
yy16:
			++YYCURSOR;
#line 121 "scanner.re"
			{
			token->opcode = PHANNOT_T_PARENTHESES_CLOSE;
			return 0;
		}
#line 284 "scanner.c"
yy18:
			++YYCURSOR;
#line 126 "scanner.re"
			{
			token->opcode = PHANNOT_T_BRACKET_OPEN;
			return 0;
		}
#line 292 "scanner.c"
yy20:
			++YYCURSOR;
#line 131 "scanner.re"
			{
			token->opcode = PHANNOT_T_BRACKET_CLOSE;
			return 0;
		}
#line 300 "scanner.c"
yy22:
			++YYCURSOR;
#line 136 "scanner.re"
			{
			token->opcode = PHANNOT_T_SBRACKET_OPEN;
			return 0;
		}
#line 308 "scanner.c"
yy24:
			++YYCURSOR;
#line 141 "scanner.re"
			{
			token->opcode = PHANNOT_T_SBRACKET_CLOSE;
			return 0;
		}
#line 316 "scanner.c"
yy26:
			++YYCURSOR;
#line 146 "scanner.re"
			{
			token->opcode = PHANNOT_T_AT;
			return 0;
		}
#line 324 "scanner.c"
yy28:
			++YYCURSOR;
#line 151 "scanner.re"
			{
			token->opcode = PHANNOT_T_EQUALS;
			return 0;
		}
#line 332 "scanner.c"
yy30:
			++YYCURSOR;
#line 156 "scanner.re"
			{
			token->opcode = PHANNOT_T_COLON;
			return 0;
		}
#line 340 "scanner.c"
yy32:
			++YYCURSOR;
#line 161 "scanner.re"
			{
			token->opcode = PHANNOT_T_COMMA;
			return 0;
		}
#line 348 "scanner.c"
yy34:
			++YYCURSOR;
			yych = *YYCURSOR;
			goto yy42;
yy35:
#line 166 "scanner.re"
			{
			token->opcode = PHANNOT_T_IGNORE;
			return 0;
		}
#line 359 "scanner.c"
yy36:
			++YYCURSOR;
#line 171 "scanner.re"
			{
			s->active_line++;
			token->opcode = PHANNOT_T_IGNORE;
			return 0;
		}
#line 368 "scanner.c"
yy38:
			++YYCURSOR;
#line 177 "scanner.re"
			{
			status = PHANNOT_SCANNER_RETCODE_EOF;
			break;
		}
#line 376 "scanner.c"
yy40:
			yych = *++YYCURSOR;
			goto yy3;
yy41:
			++YYCURSOR;
			yych = *YYCURSOR;
yy42:
			if (yybm[0+yych] & 8) {
				goto yy41;
			}
			goto yy35;
yy43:
			yyaccept = 1;
			YYMARKER = ++YYCURSOR;
			yych = *YYCURSOR;
yy44:
			if (yybm[0+yych] & 16) {
				goto yy43;
			}
			if (yych != '\\') goto yy7;
yy45:
			++YYCURSOR;
			yych = *YYCURSOR;
			if (yych <= '^') {
				if (yych <= '@') goto yy46;
				if (yych <= 'Z') goto yy47;
			} else {
				if (yych == '`') goto yy46;
				if (yych <= 'z') goto yy47;
			}
yy46:
			YYCURSOR = YYMARKER;
			if (yyaccept <= 2) {
				if (yyaccept <= 1) {
					if (yyaccept <= 0) {
						goto yy5;
					} else {
						goto yy7;
					}
				} else {
					goto yy3;
				}
			} else {
				if (yyaccept <= 4) {
					if (yyaccept <= 3) {
						goto yy60;
					} else {
						goto yy65;
					}
				} else {
					goto yy69;
				}
			}
yy47:
			yyaccept = 1;
			YYMARKER = ++YYCURSOR;
			yych = *YYCURSOR;
			if (yych <= '[') {
				if (yych <= '9') {
					if (yych <= '/') goto yy7;
					goto yy47;
				} else {
					if (yych <= '@') goto yy7;
					if (yych <= 'Z') goto yy47;
					goto yy7;
				}
			} else {
				if (yych <= '_') {
					if (yych <= '\\') goto yy45;
					if (yych <= '^') goto yy7;
					goto yy47;
				} else {
					if (yych <= '`') goto yy7;
					if (yych <= 'z') goto yy47;
					goto yy7;
				}
			}
yy49:
			++YYCURSOR;
			yych = *YYCURSOR;
yy50:
			if (yybm[0+yych] & 32) {
				goto yy49;
			}
			if (yych <= 0x00) goto yy46;
			if (yych <= '[') goto yy52;
			++YYCURSOR;
			yych = *YYCURSOR;
			if (yych == '\n') goto yy46;
			goto yy49;
yy52:
			++YYCURSOR;
#line 99 "scanner.re"
			{
			token->opcode = PHANNOT_T_STRING;
			token->value = estrndup(q, YYCURSOR - q - 1);
			token->len = YYCURSOR - q - 1;
			q = YYCURSOR;
			return 0;
		}
#line 477 "scanner.c"
yy54:
			++YYCURSOR;
			yych = *YYCURSOR;
yy55:
			if (yybm[0+yych] & 64) {
				goto yy54;
			}
			if (yych <= 0x00) goto yy46;
			if (yych <= '[') goto yy52;
			++YYCURSOR;
			yych = *YYCURSOR;
			if (yych == '\n') goto yy46;
			goto yy54;
yy57:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'U') goto yy58;
			if (yych != 'u') goto yy44;
yy58:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'E') goto yy59;
			if (yych != 'e') goto yy44;
yy59:
			yyaccept = 3;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yybm[0+yych] & 16) {
				goto yy43;
			}
			if (yych == '\\') goto yy45;
yy60:
#line 93 "scanner.re"
			{
			token->opcode = PHANNOT_T_TRUE;
			return 0;
		}
#line 514 "scanner.c"
yy61:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'L') goto yy62;
			if (yych != 'l') goto yy44;
yy62:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'S') goto yy63;
			if (yych != 's') goto yy44;
yy63:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'E') goto yy64;
			if (yych != 'e') goto yy44;
yy64:
			yyaccept = 4;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yybm[0+yych] & 16) {
				goto yy43;
			}
			if (yych == '\\') goto yy45;
yy65:
#line 88 "scanner.re"
			{
			token->opcode = PHANNOT_T_FALSE;
			return 0;
		}
#line 543 "scanner.c"
yy66:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'L') goto yy67;
			if (yych != 'l') goto yy44;
yy67:
			yyaccept = 1;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yych == 'L') goto yy68;
			if (yych != 'l') goto yy44;
yy68:
			yyaccept = 5;
			yych = *(YYMARKER = ++YYCURSOR);
			if (yybm[0+yych] & 16) {
				goto yy43;
			}
			if (yych == '\\') goto yy45;
yy69:
#line 83 "scanner.re"
			{
			token->opcode = PHANNOT_T_NULL;
			return 0;
		}
#line 567 "scanner.c"
yy70:
			yych = *++YYCURSOR;
			if (yych <= '/') goto yy46;
			if (yych <= '9') goto yy73;
			goto yy46;
yy71:
			yyaccept = 0;
			YYMARKER = ++YYCURSOR;
			yych = *YYCURSOR;
yy72:
			if (yybm[0+yych] & 128) {
				goto yy71;
			}
			if (yych == '.') goto yy70;
			goto yy5;
yy73:
			++YYCURSOR;
			yych = *YYCURSOR;
			if (yych <= '/') goto yy75;
			if (yych <= '9') goto yy73;
yy75:
#line 75 "scanner.re"
			{
			token->opcode = PHANNOT_T_DOUBLE;
			token->value = estrndup(start, YYCURSOR - start);
			token->len = YYCURSOR - start;
			q = YYCURSOR;
			return 0;
		}
#line 597 "scanner.c"
		}
#line 187 "scanner.re"


		}
	}

	return status;
}
