#include <hxcpp.h>

#ifndef INCLUDED_Std
#include <Std.h>
#endif
#ifndef INCLUDED_hxMath
#include <hxMath.h>
#endif
#ifndef INCLUDED_luxe_utils_json_JSONParseError
#include <luxe/utils/json/JSONParseError.h>
#endif
#ifndef INCLUDED_luxe_utils_json_JSONToken
#include <luxe/utils/json/JSONToken.h>
#endif
#ifndef INCLUDED_luxe_utils_json_JSONTokenType
#include <luxe/utils/json/JSONTokenType.h>
#endif
#ifndef INCLUDED_luxe_utils_json_JSONTokenizer
#include <luxe/utils/json/JSONTokenizer.h>
#endif
namespace luxe{
namespace utils{
namespace json{

Void JSONTokenizer_obj::__construct(::String s,bool strict)
{
HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","new",0x517159d0,"luxe.utils.json.JSONTokenizer.new","luxe/utils/json/JSONTokenizer.hx",64,0x0b23c79f)

HX_STACK_ARG(s,"s")

HX_STACK_ARG(strict,"strict")
{
	HX_STACK_LINE(65)
	this->jsonString = s;
	HX_STACK_LINE(66)
	this->strict = strict;
	HX_STACK_LINE(67)
	this->loc = (int)0;
	HX_STACK_LINE(69)
	this->nextChar();
}
;
	return null();
}

//JSONTokenizer_obj::~JSONTokenizer_obj() { }

Dynamic JSONTokenizer_obj::__CreateEmpty() { return  new JSONTokenizer_obj; }
hx::ObjectPtr< JSONTokenizer_obj > JSONTokenizer_obj::__new(::String s,bool strict)
{  hx::ObjectPtr< JSONTokenizer_obj > result = new JSONTokenizer_obj();
	result->__construct(s,strict);
	return result;}

Dynamic JSONTokenizer_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< JSONTokenizer_obj > result = new JSONTokenizer_obj();
	result->__construct(inArgs[0],inArgs[1]);
	return result;}

::luxe::utils::json::JSONToken JSONTokenizer_obj::getNextToken( ){
	HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","getNextToken",0xe8c50220,"luxe.utils.json.JSONTokenizer.getNextToken","luxe/utils/json/JSONTokenizer.hx",76,0x0b23c79f)
	HX_STACK_THIS(this)
	HX_STACK_LINE(77)
	::luxe::utils::json::JSONToken token = ::luxe::utils::json::JSONToken_obj::__new(null(),null());		HX_STACK_VAR(token,"token");
	HX_STACK_LINE(80)
	this->skipIgnored();
	HX_STACK_LINE(82)
	{
		HX_STACK_LINE(82)
		::String _g = this->ch;		HX_STACK_VAR(_g,"_g");
		HX_STACK_LINE(82)
		::String _switch_1 = (_g);
		if (  ( _switch_1==HX_CSTRING("{"))){
			HX_STACK_LINE(84)
			token->type = ::luxe::utils::json::JSONTokenType_obj::tLEFT_BRACE;
			HX_STACK_LINE(85)
			token->value = HX_CSTRING("{");
			HX_STACK_LINE(86)
			this->nextChar();
		}
		else if (  ( _switch_1==HX_CSTRING("}"))){
			HX_STACK_LINE(88)
			token->type = ::luxe::utils::json::JSONTokenType_obj::tRIGHT_BRACE;
			HX_STACK_LINE(89)
			token->value = HX_CSTRING("}");
			HX_STACK_LINE(90)
			this->nextChar();
		}
		else if (  ( _switch_1==HX_CSTRING("["))){
			HX_STACK_LINE(92)
			token->type = ::luxe::utils::json::JSONTokenType_obj::tLEFT_BRACKET;
			HX_STACK_LINE(93)
			token->value = HX_CSTRING("[");
			HX_STACK_LINE(94)
			this->nextChar();
		}
		else if (  ( _switch_1==HX_CSTRING("]"))){
			HX_STACK_LINE(96)
			token->type = ::luxe::utils::json::JSONTokenType_obj::tRIGHT_BRACKET;
			HX_STACK_LINE(97)
			token->value = HX_CSTRING("]");
			HX_STACK_LINE(98)
			this->nextChar();
		}
		else if (  ( _switch_1==HX_CSTRING(","))){
			HX_STACK_LINE(100)
			token->type = ::luxe::utils::json::JSONTokenType_obj::tCOMMA;
			HX_STACK_LINE(101)
			token->value = HX_CSTRING(",");
			HX_STACK_LINE(102)
			this->nextChar();
		}
		else if (  ( _switch_1==HX_CSTRING(":"))){
			HX_STACK_LINE(104)
			token->type = ::luxe::utils::json::JSONTokenType_obj::tCOLON;
			HX_STACK_LINE(105)
			token->value = HX_CSTRING(":");
			HX_STACK_LINE(106)
			this->nextChar();
		}
		else if (  ( _switch_1==HX_CSTRING("t"))){
			HX_STACK_LINE(109)
			::String possibleTrue = HX_CSTRING("t");		HX_STACK_VAR(possibleTrue,"possibleTrue");
			HX_STACK_LINE(110)
			possibleTrue = (possibleTrue + this->nextChar());
			HX_STACK_LINE(111)
			possibleTrue = (possibleTrue + this->nextChar());
			HX_STACK_LINE(112)
			possibleTrue = (possibleTrue + this->nextChar());
			HX_STACK_LINE(116)
			if (((possibleTrue == HX_CSTRING("true")))){
				HX_STACK_LINE(117)
				token->type = ::luxe::utils::json::JSONTokenType_obj::tTRUE;
				HX_STACK_LINE(118)
				token->value = true;
				HX_STACK_LINE(119)
				this->nextChar();
			}
			else{
				HX_STACK_LINE(121)
				this->parseError((HX_CSTRING("Expecting 'true' but found ") + possibleTrue));
			}
		}
		else if (  ( _switch_1==HX_CSTRING("f"))){
			HX_STACK_LINE(125)
			::String possibleFalse = HX_CSTRING("f");		HX_STACK_VAR(possibleFalse,"possibleFalse");
			HX_STACK_LINE(126)
			possibleFalse = (possibleFalse + this->nextChar());
			HX_STACK_LINE(127)
			possibleFalse = (possibleFalse + this->nextChar());
			HX_STACK_LINE(128)
			possibleFalse = (possibleFalse + this->nextChar());
			HX_STACK_LINE(129)
			possibleFalse = (possibleFalse + this->nextChar());
			HX_STACK_LINE(133)
			if (((possibleFalse == HX_CSTRING("false")))){
				HX_STACK_LINE(134)
				token->type = ::luxe::utils::json::JSONTokenType_obj::tFALSE;
				HX_STACK_LINE(135)
				token->value = false;
				HX_STACK_LINE(136)
				this->nextChar();
			}
			else{
				HX_STACK_LINE(138)
				this->parseError((HX_CSTRING("Expecting 'false' but found ") + possibleFalse));
			}
		}
		else if (  ( _switch_1==HX_CSTRING("n"))){
			HX_STACK_LINE(142)
			::String possibleNull = HX_CSTRING("n");		HX_STACK_VAR(possibleNull,"possibleNull");
			HX_STACK_LINE(143)
			possibleNull = (possibleNull + this->nextChar());
			HX_STACK_LINE(144)
			possibleNull = (possibleNull + this->nextChar());
			HX_STACK_LINE(145)
			possibleNull = (possibleNull + this->nextChar());
			HX_STACK_LINE(149)
			if (((possibleNull == HX_CSTRING("null")))){
				HX_STACK_LINE(150)
				token->type = ::luxe::utils::json::JSONTokenType_obj::tNULL;
				HX_STACK_LINE(151)
				token->value = null();
				HX_STACK_LINE(152)
				this->nextChar();
			}
			else{
				HX_STACK_LINE(154)
				this->parseError((HX_CSTRING("Expecting 'null' but found ") + possibleNull));
			}
		}
		else if (  ( _switch_1==HX_CSTRING("N"))){
			HX_STACK_LINE(158)
			::String possibleNAN = HX_CSTRING("N");		HX_STACK_VAR(possibleNAN,"possibleNAN");
			HX_STACK_LINE(159)
			possibleNAN = (possibleNAN + this->nextChar());
			HX_STACK_LINE(160)
			possibleNAN = (possibleNAN + this->nextChar());
			HX_STACK_LINE(164)
			if (((bool((possibleNAN == HX_CSTRING("NAN"))) || bool((possibleNAN == HX_CSTRING("NaN")))))){
				HX_STACK_LINE(165)
				token->type = ::luxe::utils::json::JSONTokenType_obj::tNAN;
				HX_STACK_LINE(166)
				token->value = ::Math_obj::NaN;
				HX_STACK_LINE(167)
				this->nextChar();
			}
			else{
				HX_STACK_LINE(170)
				this->parseError((HX_CSTRING("Expecting 'nan' but found ") + possibleNAN));
			}
		}
		else if (  ( _switch_1==HX_CSTRING("\""))){
			HX_STACK_LINE(173)
			token = this->readString();
		}
		else  {
			HX_STACK_LINE(176)
			if (((  ((!(this->isDigit(this->ch)))) ? bool((this->ch == HX_CSTRING("-"))) : bool(true) ))){
				HX_STACK_LINE(177)
				token = this->readNumber();
			}
			else{
				HX_STACK_LINE(178)
				if (((this->ch == HX_CSTRING("")))){
					HX_STACK_LINE(180)
					return null();
				}
				else{
					HX_STACK_LINE(184)
					this->parseError(((HX_CSTRING("Unexpected ") + this->ch) + HX_CSTRING(" encountered")));
				}
			}
		}
;
;
	}
	HX_STACK_LINE(187)
	return token;
}


HX_DEFINE_DYNAMIC_FUNC0(JSONTokenizer_obj,getNextToken,return )

::luxe::utils::json::JSONToken JSONTokenizer_obj::readString( ){
	HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","readString",0xcc539157,"luxe.utils.json.JSONTokenizer.readString","luxe/utils/json/JSONTokenizer.hx",198,0x0b23c79f)
	HX_STACK_THIS(this)
	HX_STACK_LINE(200)
	::String string = HX_CSTRING("");		HX_STACK_VAR(string,"string");
	HX_STACK_LINE(202)
	this->nextChar();
	HX_STACK_LINE(203)
	while(((bool((this->ch != HX_CSTRING("\""))) && bool((this->ch != HX_CSTRING("")))))){
		HX_STACK_LINE(206)
		if (((this->ch == HX_CSTRING("\\")))){
			HX_STACK_LINE(209)
			this->nextChar();
			HX_STACK_LINE(210)
			{
				HX_STACK_LINE(210)
				::String _g = this->ch;		HX_STACK_VAR(_g,"_g");
				HX_STACK_LINE(210)
				::String _switch_2 = (_g);
				if (  ( _switch_2==HX_CSTRING("\""))){
					HX_STACK_LINE(212)
					hx::AddEq(string,HX_CSTRING("\""));
				}
				else if (  ( _switch_2==HX_CSTRING("/"))){
					HX_STACK_LINE(214)
					hx::AddEq(string,HX_CSTRING("/"));
				}
				else if (  ( _switch_2==HX_CSTRING("\\/"))){
					HX_STACK_LINE(216)
					hx::AddEq(string,HX_CSTRING("/"));
				}
				else if (  ( _switch_2==HX_CSTRING("\\"))){
					HX_STACK_LINE(218)
					hx::AddEq(string,HX_CSTRING("\\"));
				}
				else if (  ( _switch_2==HX_CSTRING("n"))){
					HX_STACK_LINE(220)
					hx::AddEq(string,HX_CSTRING("\n"));
				}
				else if (  ( _switch_2==HX_CSTRING("r"))){
					HX_STACK_LINE(222)
					hx::AddEq(string,HX_CSTRING("\r"));
				}
				else if (  ( _switch_2==HX_CSTRING("t"))){
					HX_STACK_LINE(224)
					hx::AddEq(string,HX_CSTRING("\t"));
				}
				else if (  ( _switch_2==HX_CSTRING("u"))){
					HX_STACK_LINE(230)
					::String hexValue = HX_CSTRING("");		HX_STACK_VAR(hexValue,"hexValue");
					HX_STACK_LINE(232)
					{
						HX_STACK_LINE(232)
						int _g1 = (int)0;		HX_STACK_VAR(_g1,"_g1");
						HX_STACK_LINE(232)
						while(((_g1 < (int)4))){
							HX_STACK_LINE(232)
							int i = (_g1)++;		HX_STACK_VAR(i,"i");
							HX_STACK_LINE(235)
							if ((!(this->isHexDigit(this->nextChar())))){
								HX_STACK_LINE(236)
								this->parseError((HX_CSTRING(" Excepted a hex digit, but found: ") + this->ch));
							}
							HX_STACK_LINE(239)
							hx::AddEq(hexValue,this->ch);
						}
					}
					struct _Function_5_1{
						inline static int Block( ::String &hexValue){
							HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/utils/json/JSONTokenizer.hx",255,0x0b23c79f)
							{
								HX_STACK_LINE(255)
								int ret = (int)0;		HX_STACK_VAR(ret,"ret");
								HX_STACK_LINE(255)
								{
									HX_STACK_LINE(255)
									int _g1 = (int)0;		HX_STACK_VAR(_g1,"_g1");
									HX_STACK_LINE(255)
									int _g2 = hexValue.length;		HX_STACK_VAR(_g2,"_g2");
									HX_STACK_LINE(255)
									while(((_g1 < _g2))){
										HX_STACK_LINE(255)
										int i = (_g1)++;		HX_STACK_VAR(i,"i");
										HX_STACK_LINE(255)
										ret = (int(ret) << int((int)4));
										HX_STACK_LINE(255)
										{
											HX_STACK_LINE(255)
											::String _g21 = hexValue.charAt(i).toUpperCase();		HX_STACK_VAR(_g21,"_g21");
											HX_STACK_LINE(255)
											::String _switch_3 = (_g21);
											if (  ( _switch_3==HX_CSTRING("1"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)1);
											}
											else if (  ( _switch_3==HX_CSTRING("2"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)2);
											}
											else if (  ( _switch_3==HX_CSTRING("3"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)3);
											}
											else if (  ( _switch_3==HX_CSTRING("4"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)4);
											}
											else if (  ( _switch_3==HX_CSTRING("5"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)5);
											}
											else if (  ( _switch_3==HX_CSTRING("6"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)6);
											}
											else if (  ( _switch_3==HX_CSTRING("7"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)7);
											}
											else if (  ( _switch_3==HX_CSTRING("8"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)8);
											}
											else if (  ( _switch_3==HX_CSTRING("9"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)9);
											}
											else if (  ( _switch_3==HX_CSTRING("A"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)10);
											}
											else if (  ( _switch_3==HX_CSTRING("B"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)11);
											}
											else if (  ( _switch_3==HX_CSTRING("C"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)12);
											}
											else if (  ( _switch_3==HX_CSTRING("D"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)13);
											}
											else if (  ( _switch_3==HX_CSTRING("E"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)14);
											}
											else if (  ( _switch_3==HX_CSTRING("F"))){
												HX_STACK_LINE(255)
												hx::AddEq(ret,(int)15);
											}
										}
									}
								}
								HX_STACK_LINE(255)
								return ret;
							}
							return null();
						}
					};
					HX_STACK_LINE(255)
					hx::AddEq(string,::String::fromCharCode(_Function_5_1::Block(hexValue)));
				}
				else  {
					HX_STACK_LINE(260)
					hx::AddEq(string,(HX_CSTRING("\\") + this->ch));
				}
;
;
			}
		}
		else{
			HX_STACK_LINE(264)
			hx::AddEq(string,this->ch);
		}
		HX_STACK_LINE(267)
		this->nextChar();
	}
	HX_STACK_LINE(272)
	if (((this->ch == HX_CSTRING("")))){
		HX_STACK_LINE(273)
		this->parseError(HX_CSTRING("Unterminated string literal"));
	}
	HX_STACK_LINE(276)
	this->nextChar();
	HX_STACK_LINE(278)
	::luxe::utils::json::JSONToken token = ::luxe::utils::json::JSONToken_obj::__new(null(),null());		HX_STACK_VAR(token,"token");
	HX_STACK_LINE(279)
	token->type = ::luxe::utils::json::JSONTokenType_obj::tSTRING;
	HX_STACK_LINE(281)
	token->value = string;
	HX_STACK_LINE(282)
	return token;
}


HX_DEFINE_DYNAMIC_FUNC0(JSONTokenizer_obj,readString,return )

int JSONTokenizer_obj::hexValToInt( ::String hexVal){
	HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","hexValToInt",0x98310afe,"luxe.utils.json.JSONTokenizer.hexValToInt","luxe/utils/json/JSONTokenizer.hx",285,0x0b23c79f)
	HX_STACK_THIS(this)
	HX_STACK_ARG(hexVal,"hexVal")
	HX_STACK_LINE(286)
	int ret = (int)0;		HX_STACK_VAR(ret,"ret");
	HX_STACK_LINE(287)
	{
		HX_STACK_LINE(287)
		int _g1 = (int)0;		HX_STACK_VAR(_g1,"_g1");
		HX_STACK_LINE(287)
		int _g = hexVal.length;		HX_STACK_VAR(_g,"_g");
		HX_STACK_LINE(287)
		while(((_g1 < _g))){
			HX_STACK_LINE(287)
			int i = (_g1)++;		HX_STACK_VAR(i,"i");
			HX_STACK_LINE(288)
			ret = (int(ret) << int((int)4));
			HX_STACK_LINE(289)
			{
				HX_STACK_LINE(289)
				::String _g2 = hexVal.charAt(i).toUpperCase();		HX_STACK_VAR(_g2,"_g2");
				HX_STACK_LINE(289)
				::String _switch_4 = (_g2);
				if (  ( _switch_4==HX_CSTRING("1"))){
					HX_STACK_LINE(290)
					hx::AddEq(ret,(int)1);
				}
				else if (  ( _switch_4==HX_CSTRING("2"))){
					HX_STACK_LINE(291)
					hx::AddEq(ret,(int)2);
				}
				else if (  ( _switch_4==HX_CSTRING("3"))){
					HX_STACK_LINE(292)
					hx::AddEq(ret,(int)3);
				}
				else if (  ( _switch_4==HX_CSTRING("4"))){
					HX_STACK_LINE(293)
					hx::AddEq(ret,(int)4);
				}
				else if (  ( _switch_4==HX_CSTRING("5"))){
					HX_STACK_LINE(294)
					hx::AddEq(ret,(int)5);
				}
				else if (  ( _switch_4==HX_CSTRING("6"))){
					HX_STACK_LINE(295)
					hx::AddEq(ret,(int)6);
				}
				else if (  ( _switch_4==HX_CSTRING("7"))){
					HX_STACK_LINE(296)
					hx::AddEq(ret,(int)7);
				}
				else if (  ( _switch_4==HX_CSTRING("8"))){
					HX_STACK_LINE(297)
					hx::AddEq(ret,(int)8);
				}
				else if (  ( _switch_4==HX_CSTRING("9"))){
					HX_STACK_LINE(298)
					hx::AddEq(ret,(int)9);
				}
				else if (  ( _switch_4==HX_CSTRING("A"))){
					HX_STACK_LINE(299)
					hx::AddEq(ret,(int)10);
				}
				else if (  ( _switch_4==HX_CSTRING("B"))){
					HX_STACK_LINE(300)
					hx::AddEq(ret,(int)11);
				}
				else if (  ( _switch_4==HX_CSTRING("C"))){
					HX_STACK_LINE(301)
					hx::AddEq(ret,(int)12);
				}
				else if (  ( _switch_4==HX_CSTRING("D"))){
					HX_STACK_LINE(302)
					hx::AddEq(ret,(int)13);
				}
				else if (  ( _switch_4==HX_CSTRING("E"))){
					HX_STACK_LINE(303)
					hx::AddEq(ret,(int)14);
				}
				else if (  ( _switch_4==HX_CSTRING("F"))){
					HX_STACK_LINE(304)
					hx::AddEq(ret,(int)15);
				}
			}
		}
	}
	HX_STACK_LINE(307)
	return ret;
}


HX_DEFINE_DYNAMIC_FUNC1(JSONTokenizer_obj,hexValToInt,return )

::luxe::utils::json::JSONToken JSONTokenizer_obj::readNumber( ){
	HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","readNumber",0x5c9def4f,"luxe.utils.json.JSONTokenizer.readNumber","luxe/utils/json/JSONTokenizer.hx",318,0x0b23c79f)
	HX_STACK_THIS(this)
	HX_STACK_LINE(321)
	::String input = HX_CSTRING("");		HX_STACK_VAR(input,"input");
	HX_STACK_LINE(323)
	if (((this->ch == HX_CSTRING("-")))){
		HX_STACK_LINE(324)
		hx::AddEq(input,HX_CSTRING("-"));
		HX_STACK_LINE(325)
		this->nextChar();
	}
	HX_STACK_LINE(328)
	if ((!(this->isDigit(this->ch)))){
		HX_STACK_LINE(329)
		this->parseError(HX_CSTRING("Expecting a digit"));
	}
	HX_STACK_LINE(333)
	if (((this->ch == HX_CSTRING("0")))){
		HX_STACK_LINE(334)
		hx::AddEq(input,this->ch);
		HX_STACK_LINE(335)
		this->nextChar();
		HX_STACK_LINE(337)
		if ((this->isDigit(this->ch))){
			HX_STACK_LINE(338)
			this->parseError(HX_CSTRING("A digit cannot immediately follow 0"));
		}
		else{
			HX_STACK_LINE(343)
			if (((bool(!(this->strict)) && bool((this->ch == HX_CSTRING("x")))))){
				HX_STACK_LINE(345)
				hx::AddEq(input,this->ch);
				HX_STACK_LINE(346)
				this->nextChar();
				HX_STACK_LINE(349)
				if ((this->isHexDigit(this->ch))){
					HX_STACK_LINE(350)
					hx::AddEq(input,this->ch);
					HX_STACK_LINE(351)
					this->nextChar();
				}
				else{
					HX_STACK_LINE(354)
					this->parseError(HX_CSTRING("Number in hex format require at least one hex digit after \"0x\""));
				}
				HX_STACK_LINE(357)
				while((this->isHexDigit(this->ch))){
					HX_STACK_LINE(358)
					hx::AddEq(input,this->ch);
					HX_STACK_LINE(359)
					this->nextChar();
				}
				struct _Function_4_1{
					inline static int Block( ::String &input){
						HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/utils/json/JSONTokenizer.hx",361,0x0b23c79f)
						{
							HX_STACK_LINE(361)
							int ret = (int)0;		HX_STACK_VAR(ret,"ret");
							HX_STACK_LINE(361)
							{
								HX_STACK_LINE(361)
								int _g1 = (int)0;		HX_STACK_VAR(_g1,"_g1");
								HX_STACK_LINE(361)
								int _g = input.length;		HX_STACK_VAR(_g,"_g");
								HX_STACK_LINE(361)
								while(((_g1 < _g))){
									HX_STACK_LINE(361)
									int i = (_g1)++;		HX_STACK_VAR(i,"i");
									HX_STACK_LINE(361)
									ret = (int(ret) << int((int)4));
									HX_STACK_LINE(361)
									{
										HX_STACK_LINE(361)
										::String _g2 = input.charAt(i).toUpperCase();		HX_STACK_VAR(_g2,"_g2");
										HX_STACK_LINE(361)
										::String _switch_5 = (_g2);
										if (  ( _switch_5==HX_CSTRING("1"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)1);
										}
										else if (  ( _switch_5==HX_CSTRING("2"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)2);
										}
										else if (  ( _switch_5==HX_CSTRING("3"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)3);
										}
										else if (  ( _switch_5==HX_CSTRING("4"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)4);
										}
										else if (  ( _switch_5==HX_CSTRING("5"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)5);
										}
										else if (  ( _switch_5==HX_CSTRING("6"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)6);
										}
										else if (  ( _switch_5==HX_CSTRING("7"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)7);
										}
										else if (  ( _switch_5==HX_CSTRING("8"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)8);
										}
										else if (  ( _switch_5==HX_CSTRING("9"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)9);
										}
										else if (  ( _switch_5==HX_CSTRING("A"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)10);
										}
										else if (  ( _switch_5==HX_CSTRING("B"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)11);
										}
										else if (  ( _switch_5==HX_CSTRING("C"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)12);
										}
										else if (  ( _switch_5==HX_CSTRING("D"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)13);
										}
										else if (  ( _switch_5==HX_CSTRING("E"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)14);
										}
										else if (  ( _switch_5==HX_CSTRING("F"))){
											HX_STACK_LINE(361)
											hx::AddEq(ret,(int)15);
										}
									}
								}
							}
							HX_STACK_LINE(361)
							return ret;
						}
						return null();
					}
				};
				HX_STACK_LINE(361)
				input = ::Std_obj::string(_Function_4_1::Block(input));
			}
		}
	}
	else{
		HX_STACK_LINE(367)
		while((this->isDigit(this->ch))){
			HX_STACK_LINE(368)
			hx::AddEq(input,this->ch);
			HX_STACK_LINE(369)
			this->nextChar();
		}
	}
	HX_STACK_LINE(373)
	if (((this->ch == HX_CSTRING(".")))){
		HX_STACK_LINE(374)
		hx::AddEq(input,HX_CSTRING("."));
		HX_STACK_LINE(375)
		this->nextChar();
		HX_STACK_LINE(377)
		if ((!(this->isDigit(this->ch)))){
			HX_STACK_LINE(378)
			this->parseError(HX_CSTRING("Expecting a digit"));
		}
		HX_STACK_LINE(381)
		while((this->isDigit(this->ch))){
			HX_STACK_LINE(382)
			hx::AddEq(input,this->ch);
			HX_STACK_LINE(383)
			this->nextChar();
		}
	}
	HX_STACK_LINE(387)
	if (((bool((this->ch == HX_CSTRING("e"))) || bool((this->ch == HX_CSTRING("E")))))){
		HX_STACK_LINE(388)
		hx::AddEq(input,HX_CSTRING("e"));
		HX_STACK_LINE(389)
		this->nextChar();
		HX_STACK_LINE(391)
		if (((bool((this->ch == HX_CSTRING("+"))) || bool((this->ch == HX_CSTRING("-")))))){
			HX_STACK_LINE(392)
			hx::AddEq(input,this->ch);
			HX_STACK_LINE(393)
			this->nextChar();
		}
		HX_STACK_LINE(397)
		if ((!(this->isDigit(this->ch)))){
			HX_STACK_LINE(398)
			this->parseError(HX_CSTRING("Scientific notation number needs exponent value"));
		}
		HX_STACK_LINE(401)
		while((this->isDigit(this->ch))){
			HX_STACK_LINE(402)
			hx::AddEq(input,this->ch);
			HX_STACK_LINE(403)
			this->nextChar();
		}
	}
	HX_STACK_LINE(407)
	Float num = ::Std_obj::parseFloat(input);		HX_STACK_VAR(num,"num");
	HX_STACK_LINE(408)
	if (((  ((::Math_obj::isFinite(num))) ? bool(!(::Math_obj::isNaN(num))) : bool(false) ))){
		HX_STACK_LINE(410)
		::luxe::utils::json::JSONToken token = ::luxe::utils::json::JSONToken_obj::__new(null(),null());		HX_STACK_VAR(token,"token");
		HX_STACK_LINE(411)
		token->type = ::luxe::utils::json::JSONTokenType_obj::tNUMBER;
		HX_STACK_LINE(412)
		token->value = num;
		HX_STACK_LINE(413)
		return token;
	}
	else{
		HX_STACK_LINE(415)
		this->parseError(((HX_CSTRING("Number ") + num) + HX_CSTRING(" is not valid!")));
	}
	HX_STACK_LINE(417)
	return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JSONTokenizer_obj,readNumber,return )

::String JSONTokenizer_obj::nextChar( ){
	HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","nextChar",0x1fb645f9,"luxe.utils.json.JSONTokenizer.nextChar","luxe/utils/json/JSONTokenizer.hx",428,0x0b23c79f)
	HX_STACK_THIS(this)
	HX_STACK_LINE(428)
	return this->ch = this->jsonString.charAt((this->loc)++);
}


HX_DEFINE_DYNAMIC_FUNC0(JSONTokenizer_obj,nextChar,return )

Void JSONTokenizer_obj::skipIgnored( ){
{
		HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","skipIgnored",0x29371fc3,"luxe.utils.json.JSONTokenizer.skipIgnored","luxe/utils/json/JSONTokenizer.hx",435,0x0b23c79f)
		HX_STACK_THIS(this)
		HX_STACK_LINE(436)
		int originalLoc;		HX_STACK_VAR(originalLoc,"originalLoc");
		HX_STACK_LINE(439)
		do{
			HX_STACK_LINE(440)
			originalLoc = this->loc;
			HX_STACK_LINE(441)
			this->skipWhite();
			HX_STACK_LINE(442)
			this->skipComments();
		}
while(((originalLoc != this->loc)));
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JSONTokenizer_obj,skipIgnored,(void))

Void JSONTokenizer_obj::skipComments( ){
{
		HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","skipComments",0x46c84b63,"luxe.utils.json.JSONTokenizer.skipComments","luxe/utils/json/JSONTokenizer.hx",452,0x0b23c79f)
		HX_STACK_THIS(this)
		HX_STACK_LINE(452)
		if (((this->ch == HX_CSTRING("/")))){
			HX_STACK_LINE(454)
			this->nextChar();
			HX_STACK_LINE(455)
			{
				HX_STACK_LINE(455)
				::String _g = this->ch;		HX_STACK_VAR(_g,"_g");
				HX_STACK_LINE(455)
				::String _switch_6 = (_g);
				if (  ( _switch_6==HX_CSTRING("/"))){
					HX_STACK_LINE(459)
					do{
						HX_STACK_LINE(460)
						this->nextChar();
					}
while(((bool((this->ch != HX_CSTRING("\n"))) && bool((this->ch != HX_CSTRING(""))))));
					HX_STACK_LINE(463)
					this->nextChar();
				}
				else if (  ( _switch_6==HX_CSTRING("*"))){
					HX_STACK_LINE(466)
					this->nextChar();
					HX_STACK_LINE(468)
					while((true)){
						HX_STACK_LINE(469)
						if (((this->ch == HX_CSTRING("*")))){
							HX_STACK_LINE(471)
							this->nextChar();
							HX_STACK_LINE(472)
							if (((this->ch == HX_CSTRING("/")))){
								HX_STACK_LINE(474)
								this->nextChar();
								HX_STACK_LINE(475)
								break;
							}
						}
						else{
							HX_STACK_LINE(479)
							this->nextChar();
						}
						HX_STACK_LINE(483)
						if (((this->ch == HX_CSTRING("")))){
							HX_STACK_LINE(484)
							this->parseError(HX_CSTRING("Multi-line comment not closed"));
						}
					}
				}
				else  {
					HX_STACK_LINE(489)
					this->parseError(((HX_CSTRING("Unexpected ") + this->ch) + HX_CSTRING(" encountered (expecting '/' or '*' )")));
				}
;
;
			}
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JSONTokenizer_obj,skipComments,(void))

Void JSONTokenizer_obj::skipWhite( ){
{
		HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","skipWhite",0x9086f51a,"luxe.utils.json.JSONTokenizer.skipWhite","luxe/utils/json/JSONTokenizer.hx",504,0x0b23c79f)
		HX_STACK_THIS(this)
		HX_STACK_LINE(504)
		while((this->isWhiteSpace(this->ch))){
			HX_STACK_LINE(505)
			this->nextChar();
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JSONTokenizer_obj,skipWhite,(void))

bool JSONTokenizer_obj::isWhiteSpace( ::String ch){
	HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","isWhiteSpace",0xc8d75e77,"luxe.utils.json.JSONTokenizer.isWhiteSpace","luxe/utils/json/JSONTokenizer.hx",516,0x0b23c79f)
	HX_STACK_THIS(this)
	HX_STACK_ARG(ch,"ch")
	HX_STACK_LINE(516)
	return (bool((bool((bool((ch == HX_CSTRING(" "))) || bool((ch == HX_CSTRING("\t"))))) || bool((ch == HX_CSTRING("\n"))))) || bool((ch == HX_CSTRING("\r"))));
}


HX_DEFINE_DYNAMIC_FUNC1(JSONTokenizer_obj,isWhiteSpace,return )

bool JSONTokenizer_obj::isDigit( ::String ch){
	HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","isDigit",0x7c4492d3,"luxe.utils.json.JSONTokenizer.isDigit","luxe/utils/json/JSONTokenizer.hx",528,0x0b23c79f)
	HX_STACK_THIS(this)
	HX_STACK_ARG(ch,"ch")
	HX_STACK_LINE(528)
	return (bool((ch >= HX_CSTRING("0"))) && bool((ch <= HX_CSTRING("9"))));
}


HX_DEFINE_DYNAMIC_FUNC1(JSONTokenizer_obj,isDigit,return )

bool JSONTokenizer_obj::isHexDigit( ::String ch){
	HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","isHexDigit",0x4895776c,"luxe.utils.json.JSONTokenizer.isHexDigit","luxe/utils/json/JSONTokenizer.hx",537,0x0b23c79f)
	HX_STACK_THIS(this)
	HX_STACK_ARG(ch,"ch")
	HX_STACK_LINE(540)
	::String uc = ch.toUpperCase();		HX_STACK_VAR(uc,"uc");
	HX_STACK_LINE(543)
	if ((!(this->isDigit(ch)))){
		HX_STACK_LINE(543)
		return (bool((uc >= HX_CSTRING("A"))) && bool((uc <= HX_CSTRING("F"))));
	}
	else{
		HX_STACK_LINE(543)
		return true;
	}
	HX_STACK_LINE(543)
	return false;
}


HX_DEFINE_DYNAMIC_FUNC1(JSONTokenizer_obj,isHexDigit,return )

Void JSONTokenizer_obj::parseError( ::String message){
{
		HX_STACK_FRAME("luxe.utils.json.JSONTokenizer","parseError",0x5eb29725,"luxe.utils.json.JSONTokenizer.parseError","luxe/utils/json/JSONTokenizer.hx",553,0x0b23c79f)
		HX_STACK_THIS(this)
		HX_STACK_ARG(message,"message")
		HX_STACK_LINE(553)
		HX_STACK_DO_THROW(::luxe::utils::json::JSONParseError_obj::__new(message,this->loc,this->jsonString));
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC1(JSONTokenizer_obj,parseError,(void))


JSONTokenizer_obj::JSONTokenizer_obj()
{
}

void JSONTokenizer_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(JSONTokenizer);
	HX_MARK_MEMBER_NAME(obj,"obj");
	HX_MARK_MEMBER_NAME(jsonString,"jsonString");
	HX_MARK_MEMBER_NAME(loc,"loc");
	HX_MARK_MEMBER_NAME(ch,"ch");
	HX_MARK_MEMBER_NAME(strict,"strict");
	HX_MARK_END_CLASS();
}

void JSONTokenizer_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(obj,"obj");
	HX_VISIT_MEMBER_NAME(jsonString,"jsonString");
	HX_VISIT_MEMBER_NAME(loc,"loc");
	HX_VISIT_MEMBER_NAME(ch,"ch");
	HX_VISIT_MEMBER_NAME(strict,"strict");
}

Dynamic JSONTokenizer_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 2:
		if (HX_FIELD_EQ(inName,"ch") ) { return ch; }
		break;
	case 3:
		if (HX_FIELD_EQ(inName,"obj") ) { return obj; }
		if (HX_FIELD_EQ(inName,"loc") ) { return loc; }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"strict") ) { return strict; }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"isDigit") ) { return isDigit_dyn(); }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"nextChar") ) { return nextChar_dyn(); }
		break;
	case 9:
		if (HX_FIELD_EQ(inName,"skipWhite") ) { return skipWhite_dyn(); }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"jsonString") ) { return jsonString; }
		if (HX_FIELD_EQ(inName,"readString") ) { return readString_dyn(); }
		if (HX_FIELD_EQ(inName,"readNumber") ) { return readNumber_dyn(); }
		if (HX_FIELD_EQ(inName,"isHexDigit") ) { return isHexDigit_dyn(); }
		if (HX_FIELD_EQ(inName,"parseError") ) { return parseError_dyn(); }
		break;
	case 11:
		if (HX_FIELD_EQ(inName,"hexValToInt") ) { return hexValToInt_dyn(); }
		if (HX_FIELD_EQ(inName,"skipIgnored") ) { return skipIgnored_dyn(); }
		break;
	case 12:
		if (HX_FIELD_EQ(inName,"getNextToken") ) { return getNextToken_dyn(); }
		if (HX_FIELD_EQ(inName,"skipComments") ) { return skipComments_dyn(); }
		if (HX_FIELD_EQ(inName,"isWhiteSpace") ) { return isWhiteSpace_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic JSONTokenizer_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 2:
		if (HX_FIELD_EQ(inName,"ch") ) { ch=inValue.Cast< ::String >(); return inValue; }
		break;
	case 3:
		if (HX_FIELD_EQ(inName,"obj") ) { obj=inValue.Cast< Dynamic >(); return inValue; }
		if (HX_FIELD_EQ(inName,"loc") ) { loc=inValue.Cast< int >(); return inValue; }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"strict") ) { strict=inValue.Cast< bool >(); return inValue; }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"jsonString") ) { jsonString=inValue.Cast< ::String >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void JSONTokenizer_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("obj"));
	outFields->push(HX_CSTRING("jsonString"));
	outFields->push(HX_CSTRING("loc"));
	outFields->push(HX_CSTRING("ch"));
	outFields->push(HX_CSTRING("strict"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	String(null()) };

#if HXCPP_SCRIPTABLE
static hx::StorageInfo sMemberStorageInfo[] = {
	{hx::fsObject /*Dynamic*/ ,(int)offsetof(JSONTokenizer_obj,obj),HX_CSTRING("obj")},
	{hx::fsString,(int)offsetof(JSONTokenizer_obj,jsonString),HX_CSTRING("jsonString")},
	{hx::fsInt,(int)offsetof(JSONTokenizer_obj,loc),HX_CSTRING("loc")},
	{hx::fsString,(int)offsetof(JSONTokenizer_obj,ch),HX_CSTRING("ch")},
	{hx::fsBool,(int)offsetof(JSONTokenizer_obj,strict),HX_CSTRING("strict")},
	{ hx::fsUnknown, 0, null()}
};
#endif

static ::String sMemberFields[] = {
	HX_CSTRING("obj"),
	HX_CSTRING("jsonString"),
	HX_CSTRING("loc"),
	HX_CSTRING("ch"),
	HX_CSTRING("strict"),
	HX_CSTRING("getNextToken"),
	HX_CSTRING("readString"),
	HX_CSTRING("hexValToInt"),
	HX_CSTRING("readNumber"),
	HX_CSTRING("nextChar"),
	HX_CSTRING("skipIgnored"),
	HX_CSTRING("skipComments"),
	HX_CSTRING("skipWhite"),
	HX_CSTRING("isWhiteSpace"),
	HX_CSTRING("isDigit"),
	HX_CSTRING("isHexDigit"),
	HX_CSTRING("parseError"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
	HX_MARK_MEMBER_NAME(JSONTokenizer_obj::__mClass,"__mClass");
};

#ifdef HXCPP_VISIT_ALLOCS
static void sVisitStatics(HX_VISIT_PARAMS) {
	HX_VISIT_MEMBER_NAME(JSONTokenizer_obj::__mClass,"__mClass");
};

#endif

Class JSONTokenizer_obj::__mClass;

void JSONTokenizer_obj::__register()
{
	hx::Static(__mClass) = hx::RegisterClass(HX_CSTRING("luxe.utils.json.JSONTokenizer"), hx::TCanCast< JSONTokenizer_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics
#ifdef HXCPP_VISIT_ALLOCS
    , sVisitStatics
#endif
#ifdef HXCPP_SCRIPTABLE
    , sMemberStorageInfo
#endif
);
}

void JSONTokenizer_obj::__boot()
{
}

} // end namespace luxe
} // end namespace utils
} // end namespace json
