double x;
I can assign any numeric value to that:
x = 5;
x = 5.13143;
However, I can't use the "e" literals, i.e.:
x = 1.531e5;
x = 0.3813e-7;
Does Angelscript not support these type of literals?
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
double x;
I can assign any numeric value to that:
x = 5;
x = 5.13143;
However, I can't use the "e" literals, i.e.:
x = 1.531e5;
x = 0.3813e-7;
Does Angelscript not support these type of literals?
[0-9]+('.'[0-9]+(('e'|'E')('-'|'+')?[0-9])?'f'?)?
00.00.0f0.0e00.0e0f0.0e+0f0.0e-0f0.0E00.0E-0... etc
static char* parseFloatingPoint(char* start, char* end, Lexem& out){ out.value += *start; while (true) { ++start; if (start == end) return start; if (!isNumber(*start)) { if (*start == 'f') //f postfix transforms literal from type double to float. { out.value += *start; return ++start; } else return start; } else { out.value += *start; } }}
static char* parseFloatingPoint(char* start, char* end, Lexem& out){ out.value += *start; while (true) { ++start; if (start == end) return start; if (*start == 'f') //f postfix is part of float, but terminates it. { out.value += 'f'; return ++start; } if (*start == 'e' // real literal; exponent follows. || *start == 'E' || *start == 'd' || *start == 'D') { out.value += 'e'; ++start; if (start == end) return start; if (*start == '-' || *start == '+' || isNumber(*start)) { out.value += *start; } else return start; while (true) { ++start; if (start == end) return start; if (*start == 'f') { out.value += 'f'; return ++start; } if (!isNumber(*start)) return start; out.value += *start; } } if (!isNumber(*start)) return start; out.value += *start; }}
void cml_player_command(){string cp=GetParameterString();string cw=PopFirstWord(cp);Object player=GetActiveObject();Object room;GetObject(room,Location(player));Send(GetActiveObject(),"<Debug command parsing. ");while(true){Send(GetActiveObject(),"[Looking for command '"+cw+"'. ");if(cp.length()==0&&HasKey(player,"$player_command_"+cw)){Send(GetActiveObject(),"Found on player.]\n");AsyncCall(GetValue(player,"$player_command_"+cw),player,player,cp);return;}else if(cp.length()>0&&HasKey(player,"$player_string_command_"+cw)){Send(GetActiveObject(),"Found on player.]\n");AsyncCall(GetValue(player,"$player_string_command_"+cw),player,player,cp);return;}else if(cp.length()==0&&HasKey(room,"$world_command_"+cw)){Send(GetActiveObject(),"Found on room.]\n");AsyncCall(GetValue(room,"$world_command_"+cw),player,room,cp);return;}else if(cp.length()>0&&HasKey(room,"$world_string_command_"+cw)){Send(GetActiveObject(),"Found on room.]\n");AsyncCall(GetValue(room,"$world_string_command_"+cw),player,room,cp);return;}string rest;Object obj;if(ml_parse_object_ex(cp,player,rest,obj,0,false)){Send(GetActiveObject(),"[Found matching object.]");if(rest.length()==0&&Location(obj)==GetName(player)&&HasKey(obj,"$INVENTORY_COMMAND_"+cw)){Send(GetActiveObject()," Found in inventory.]\n");AsyncCall(GetValue(obj,"$inventory_command_"+cw),player,obj,rest);return;}else if(rest.length()>0&&Location(obj)==GetName(player)&&HasKey(obj,"$INVENTORY_STRING_COMMAND_"+cw)){Send(GetActiveObject()," Found in inventory.]\n");AsyncCall(GetValue(obj,"$inventory_STRING_command_"+cw),player,obj,rest);return;}else if(rest.length()==0&&HasKey(obj,"$ROOM_COMMAND_"+cw)){Send(GetActiveObject()," Found in room.]\n");AsyncCall(GetValue(obj,"$room_command_"+cw),player,obj,rest);return;}else if(rest.length()>0&&HasKey(obj,"$ROOM_STRING_COMMAND_"+cw)){Send(GetActiveObject()," Found in room.]\n");AsyncCall(GetValue(obj,"$room_STRING_command_"+cw),player,obj,rest);return;}}Send(GetActiveObject()," Command Not Found.]");string co=PopFirstWord(cp);if(co.length()==0){Send(GetActiveObject(),"\nHuh?\n");return;}cw+="_"+co;}}