Haxe help with parser :(

hi folks,
my problem is nothing with Openfl/Lime but Haxe code i want to make a parser for this type…

{
“classname” “worldspawn”
}
{
“classname” “weapon_rocketlauncher”
“origin” “-192 -120 400”
}
{
“classname” “light”
“light” “200"
”_color" "1.000000 1.000000 1.000000"
“origin” "-64 0 456"
“spawnflags” "0"
“angle” “-2”
}
{
“classname” “info_player_deathmatch”
“angle” "180"
“origin” “80 -16 288”
}
sory about the off topic :wink:

That almost looks like JSON. http://haxe.org/manual/std-Json-parsing.html

i never use JSON just xml :frowning: by bad but i will try

JSON use ( : ) to separate values quake format don’t :frowning:

Ok. Quake uses BSP file format which is documented here: https://developer.valvesoftware.com/wiki/Source_BSP_File_Format I dont think a parser exists already so you’d have to make one. Maybe look into regular expressions and split it into chunks to parse part by part.

bubba i already have the map render now i just want to load entities in the BSP .

i write this function

var value:String="";
var cnt:Int = 0;
for (i in 0…arr.length)
{

switch arr.charAt(i)
{
   case '"':
	   {
		  cnt++; 
		  
	   }
	   case '{':
	   {
		   
	   }
	   case "\n",'}':
	   {
		   if  ( (s[1] > "") && (s[3] > ""))
		   {
			   cnt = 0;
			   trace("Name :"+s[1]+" - Value:"+s[3]);
			   
			   s[0] = ""; s[1] = ""; s[2] = "";   s[3] = "";
		   } 
			
	   }
			 default:
				 {
					  if ((cnt >= 0) && (cnt <= 3))
			          {
					   s[cnt] += arr.charAt(i); 
			           }
				
				 }
}

}
and work :stuck_out_tongue: