--- parser3/src/classes/op.C 2010/11/15 23:31:08 1.205 +++ parser3/src/classes/op.C 2012/03/16 09:24:07 1.209 @@ -1,12 +1,10 @@ /** @file Parser: parser @b operators. - Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_OP_C="$Date: 2010/11/15 23:31:08 $"; - #include "classes.h" #include "pa_vmethod_frame.h" @@ -20,6 +18,8 @@ static const char * const IDENT_OP_C="$D #include "pa_vclass.h" #include "pa_charset.h" +volatile const char * IDENT_OP_C="$Id: op.C,v 1.209 2012/03/16 09:24:07 moko Exp $"; + // limits #define MAX_LOOPS 20000 @@ -303,7 +303,7 @@ static void _use(Request& r, MethodParam static void set_skip(Request& r, Request::Skip askip) { if(!r.get_in_cycle()) - throw Exception(PARSER_RUNTIME, + throw Exception(askip==Request::SKIP_BREAK?"parser.break":"parser.continue", 0, "without cycle"); @@ -439,6 +439,7 @@ public: Request& r; const String* searching_string; double searching_double; + bool searching_bool; Value* found; Value* _default; public: @@ -448,9 +449,11 @@ public: if(asearching.is_string() || asearching.is_void()){ searching_string=&asearching.as_string(); searching_double=0; + searching_bool=false; } else { searching_string=0; searching_double=asearching.as_double(); + searching_bool=asearching.is_bool(); } } }; @@ -500,6 +503,8 @@ static void _case(Request& r, MethodPara bool matches; if(data->searching_string) matches=(*data->searching_string) == value.as_string(); + else if(data->searching_bool || value.is_bool()) + matches=(data->searching_double != 0) == value.as_bool(); else matches=data->searching_double == value.as_double(); @@ -876,7 +881,8 @@ static void _throw_operator(Request&, Me static void _sleep_operator(Request& r, MethodParams& params) { double seconds=params.as_double(0, "seconds must be double", r); - pa_sleep((int)trunc(seconds), (int)trunc(seconds*1000)); + if(seconds>0) + pa_sleep((int)trunc(seconds), (int)trunc((seconds-trunc(seconds))*1000000)); } #if defined(WIN32) && defined(_DEBUG)