/* Generated by re2c 4.1 */
/* scanner.re
 * This file is part of the Phalcon Framework.
 *
 * (c) Phalcon Team <team@phalcon.io>
 *
 * For the full copyright and license information, please view the
 * LICENSE.txt file that was distributed with this source code.
 */

#include "php_phalcon.h"

#include "scanner.h"

#define AACTYPE unsigned char
#define AACURSOR (s->start)
#define AALIMIT (s->end)
#define AAMARKER q

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

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

	while (PHANNOT_SCANNER_RETCODE_IMPOSSIBLE == status) {

		if (s->mode == PHANNOT_MODE_RAW) {

			/* End of input: nothing after the terminator may be read. */
			if (*AACURSOR == '\0') {
				return PHANNOT_SCANNER_RETCODE_EOF;
			}

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

			next = *(AACURSOR+1);

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

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

		} else {

		
		{
			AACTYPE aach;
			unsigned int aaaccept = 0;
			aach = *AACURSOR;
			switch (aach) {
				case 0x00: goto aa1;
				case '\t':
				case '\r':
				case ' ': goto aa4;
				case '\n': goto aa6;
				case '"': goto aa7;
				case '\'': goto aa8;
				case '(': goto aa9;
				case ')': goto aa10;
				case ',': goto aa11;
				case '-': goto aa12;
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto aa13;
				case ':': goto aa15;
				case '=': goto aa16;
				case '@': goto aa17;
				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 aa18;
				case 'F':
				case 'f': goto aa21;
				case 'N':
				case 'n': goto aa22;
				case 'T':
				case 't': goto aa23;
				case '[': goto aa24;
				case '\\': goto aa25;
				case ']': goto aa26;
				case '{': goto aa27;
				case '}': goto aa28;
				default: goto aa2;
			}
aa1:
			++AACURSOR;
			{
			status = PHANNOT_SCANNER_RETCODE_EOF;
			break;
		}
aa2:
			++AACURSOR;
aa3:
			{
			status = PHANNOT_SCANNER_RETCODE_ERR;
			break;
		}
aa4:
			aach = *++AACURSOR;
			switch (aach) {
				case '\t':
				case '\r':
				case ' ': goto aa4;
				default: goto aa5;
			}
aa5:
			{
			token->opcode = PHANNOT_T_IGNORE;
			return 0;
		}
aa6:
			++AACURSOR;
			{
			s->active_line++;
			token->opcode = PHANNOT_T_IGNORE;
			return 0;
		}
aa7:
			aaaccept = 0;
			aach = *(AAMARKER = ++AACURSOR);
			if (aach <= 0x00) goto aa3;
			goto aa30;
aa8:
			aaaccept = 0;
			aach = *(AAMARKER = ++AACURSOR);
			if (aach <= 0x00) goto aa3;
			goto aa35;
aa9:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_PARENTHESES_OPEN;
			return 0;
		}
aa10:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_PARENTHESES_CLOSE;
			return 0;
		}
aa11:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_COMMA;
			return 0;
		}
aa12:
			aach = *++AACURSOR;
			switch (aach) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto aa13;
				default: goto aa3;
			}
aa13:
			aaaccept = 1;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case '.': goto aa37;
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto aa13;
				default: goto aa14;
			}
aa14:
			{
			token->opcode = PHANNOT_T_INTEGER;
			token->value = estrndup(start, AACURSOR - start);
			token->len = AACURSOR - start;
			q = AACURSOR;
			return 0;
		}
aa15:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_COLON;
			return 0;
		}
aa16:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_EQUALS;
			return 0;
		}
aa17:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_AT;
			return 0;
		}
aa18:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
aa19:
			switch (aach) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9':
				case 'A':
				case 'B':
				case 'C':
				case 'D':
				case 'E':
				case 'F':
				case 'G':
				case 'H':
				case 'I':
				case 'J':
				case 'K':
				case 'L':
				case 'M':
				case 'N':
				case 'O':
				case 'P':
				case 'Q':
				case 'R':
				case 'S':
				case 'T':
				case 'U':
				case 'V':
				case 'W':
				case 'X':
				case 'Y':
				case 'Z':
				case '_':
				case 'a':
				case 'b':
				case 'c':
				case 'd':
				case 'e':
				case 'f':
				case 'g':
				case 'h':
				case 'i':
				case 'j':
				case 'k':
				case 'l':
				case 'm':
				case 'n':
				case 'o':
				case 'p':
				case 'q':
				case 'r':
				case 's':
				case 't':
				case 'u':
				case 'v':
				case 'w':
				case 'x':
				case 'y':
				case 'z': goto aa18;
				case '\\': goto aa38;
				default: goto aa20;
			}
aa20:
			{
			token->opcode = PHANNOT_T_IDENTIFIER;
			token->value = estrndup(start, AACURSOR - start);
			token->len = AACURSOR - start;
			q = AACURSOR;
			return 0;
		}
aa21:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'A':
				case 'a': goto aa39;
				default: goto aa19;
			}
aa22:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'U':
				case 'u': goto aa40;
				default: goto aa19;
			}
aa23:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'R':
				case 'r': goto aa41;
				default: goto aa19;
			}
aa24:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_SBRACKET_OPEN;
			return 0;
		}
aa25:
			aach = *++AACURSOR;
			switch (aach) {
				case 'A':
				case 'B':
				case 'C':
				case 'D':
				case 'E':
				case 'F':
				case 'G':
				case 'H':
				case 'I':
				case 'J':
				case 'K':
				case 'L':
				case 'M':
				case 'N':
				case 'O':
				case 'P':
				case 'Q':
				case 'R':
				case 'S':
				case 'T':
				case 'U':
				case 'V':
				case 'W':
				case 'X':
				case 'Y':
				case 'Z':
				case '_':
				case 'a':
				case 'b':
				case 'c':
				case 'd':
				case 'e':
				case 'f':
				case 'g':
				case 'h':
				case 'i':
				case 'j':
				case 'k':
				case 'l':
				case 'm':
				case 'n':
				case 'o':
				case 'p':
				case 'q':
				case 'r':
				case 's':
				case 't':
				case 'u':
				case 'v':
				case 'w':
				case 'x':
				case 'y':
				case 'z': goto aa18;
				default: goto aa3;
			}
aa26:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_SBRACKET_CLOSE;
			return 0;
		}
aa27:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_BRACKET_OPEN;
			return 0;
		}
aa28:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_BRACKET_CLOSE;
			return 0;
		}
aa29:
			aach = *++AACURSOR;
aa30:
			switch (aach) {
				case 0x00: goto aa31;
				case '"': goto aa32;
				case '\\': goto aa33;
				default: goto aa29;
			}
aa31:
			AACURSOR = AAMARKER;
			switch (aaaccept) {
				case 0: goto aa3;
				case 1: goto aa14;
				case 2: goto aa20;
				case 3: goto aa49;
				case 4: goto aa51;
				default: goto aa53;
			}
aa32:
			++AACURSOR;
			{
			token->opcode = PHANNOT_T_STRING;
			token->value = estrndup(q, AACURSOR - q - 1);
			token->len = AACURSOR - q - 1;
			q = AACURSOR;
			return 0;
		}
aa33:
			aach = *++AACURSOR;
			switch (aach) {
				case 0x00:
				case '\n': goto aa31;
				default: goto aa29;
			}
aa34:
			aach = *++AACURSOR;
aa35:
			switch (aach) {
				case 0x00: goto aa31;
				case '\'': goto aa32;
				case '\\': goto aa36;
				default: goto aa34;
			}
aa36:
			aach = *++AACURSOR;
			switch (aach) {
				case 0x00:
				case '\n': goto aa31;
				default: goto aa34;
			}
aa37:
			aach = *++AACURSOR;
			switch (aach) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto aa42;
				default: goto aa31;
			}
aa38:
			aach = *++AACURSOR;
			switch (aach) {
				case 'A':
				case 'B':
				case 'C':
				case 'D':
				case 'E':
				case 'F':
				case 'G':
				case 'H':
				case 'I':
				case 'J':
				case 'K':
				case 'L':
				case 'M':
				case 'N':
				case 'O':
				case 'P':
				case 'Q':
				case 'R':
				case 'S':
				case 'T':
				case 'U':
				case 'V':
				case 'W':
				case 'X':
				case 'Y':
				case 'Z':
				case '_':
				case 'a':
				case 'b':
				case 'c':
				case 'd':
				case 'e':
				case 'f':
				case 'g':
				case 'h':
				case 'i':
				case 'j':
				case 'k':
				case 'l':
				case 'm':
				case 'n':
				case 'o':
				case 'p':
				case 'q':
				case 'r':
				case 's':
				case 't':
				case 'u':
				case 'v':
				case 'w':
				case 'x':
				case 'y':
				case 'z': goto aa18;
				default: goto aa31;
			}
aa39:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'L':
				case 'l': goto aa44;
				default: goto aa19;
			}
aa40:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'L':
				case 'l': goto aa45;
				default: goto aa19;
			}
aa41:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'U':
				case 'u': goto aa46;
				default: goto aa19;
			}
aa42:
			aach = *++AACURSOR;
			switch (aach) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto aa42;
				default: goto aa43;
			}
aa43:
			{
			token->opcode = PHANNOT_T_DOUBLE;
			token->value = estrndup(start, AACURSOR - start);
			token->len = AACURSOR - start;
			q = AACURSOR;
			return 0;
		}
aa44:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'S':
				case 's': goto aa47;
				default: goto aa19;
			}
aa45:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'L':
				case 'l': goto aa48;
				default: goto aa19;
			}
aa46:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'E':
				case 'e': goto aa50;
				default: goto aa19;
			}
aa47:
			aaaccept = 2;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case 'E':
				case 'e': goto aa52;
				default: goto aa19;
			}
aa48:
			aaaccept = 3;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9':
				case 'A':
				case 'B':
				case 'C':
				case 'D':
				case 'E':
				case 'F':
				case 'G':
				case 'H':
				case 'I':
				case 'J':
				case 'K':
				case 'L':
				case 'M':
				case 'N':
				case 'O':
				case 'P':
				case 'Q':
				case 'R':
				case 'S':
				case 'T':
				case 'U':
				case 'V':
				case 'W':
				case 'X':
				case 'Y':
				case 'Z':
				case '_':
				case 'a':
				case 'b':
				case 'c':
				case 'd':
				case 'e':
				case 'f':
				case 'g':
				case 'h':
				case 'i':
				case 'j':
				case 'k':
				case 'l':
				case 'm':
				case 'n':
				case 'o':
				case 'p':
				case 'q':
				case 'r':
				case 's':
				case 't':
				case 'u':
				case 'v':
				case 'w':
				case 'x':
				case 'y':
				case 'z': goto aa18;
				case '\\': goto aa38;
				default: goto aa49;
			}
aa49:
			{
			token->opcode = PHANNOT_T_NULL;
			return 0;
		}
aa50:
			aaaccept = 4;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9':
				case 'A':
				case 'B':
				case 'C':
				case 'D':
				case 'E':
				case 'F':
				case 'G':
				case 'H':
				case 'I':
				case 'J':
				case 'K':
				case 'L':
				case 'M':
				case 'N':
				case 'O':
				case 'P':
				case 'Q':
				case 'R':
				case 'S':
				case 'T':
				case 'U':
				case 'V':
				case 'W':
				case 'X':
				case 'Y':
				case 'Z':
				case '_':
				case 'a':
				case 'b':
				case 'c':
				case 'd':
				case 'e':
				case 'f':
				case 'g':
				case 'h':
				case 'i':
				case 'j':
				case 'k':
				case 'l':
				case 'm':
				case 'n':
				case 'o':
				case 'p':
				case 'q':
				case 'r':
				case 's':
				case 't':
				case 'u':
				case 'v':
				case 'w':
				case 'x':
				case 'y':
				case 'z': goto aa18;
				case '\\': goto aa38;
				default: goto aa51;
			}
aa51:
			{
			token->opcode = PHANNOT_T_TRUE;
			return 0;
		}
aa52:
			aaaccept = 5;
			aach = *(AAMARKER = ++AACURSOR);
			switch (aach) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9':
				case 'A':
				case 'B':
				case 'C':
				case 'D':
				case 'E':
				case 'F':
				case 'G':
				case 'H':
				case 'I':
				case 'J':
				case 'K':
				case 'L':
				case 'M':
				case 'N':
				case 'O':
				case 'P':
				case 'Q':
				case 'R':
				case 'S':
				case 'T':
				case 'U':
				case 'V':
				case 'W':
				case 'X':
				case 'Y':
				case 'Z':
				case '_':
				case 'a':
				case 'b':
				case 'c':
				case 'd':
				case 'e':
				case 'f':
				case 'g':
				case 'h':
				case 'i':
				case 'j':
				case 'k':
				case 'l':
				case 'm':
				case 'n':
				case 'o':
				case 'p':
				case 'q':
				case 'r':
				case 's':
				case 't':
				case 'u':
				case 'v':
				case 'w':
				case 'x':
				case 'y':
				case 'z': goto aa18;
				case '\\': goto aa38;
				default: goto aa53;
			}
aa53:
			{
			token->opcode = PHANNOT_T_FALSE;
			return 0;
		}
		}


		}
	}

	return status;
}
