Diff for /parser3/src/classes/regex.C between versions 1.7 and 1.14

version 1.7, 2012/03/16 09:24:08 version 1.14, 2018/01/19 00:32:50
Line 1 Line 1
 /** @file  /** @file
         Parser: @b int parser class.          Parser: @b int parser class.
   
         Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com)          Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
 */  */
   
Line 25  public: Line 25  public:
   
 // global variable  // global variable
   
 DECLARE_CLASS_VAR(regex, new MRegex, 0);  DECLARE_CLASS_VAR(regex, new MRegex);
   
 // methods  // methods
   
 static void _create(Request& r, MethodParams& params) {  static void _create(Request& r, MethodParams& params) {
         const String& pattern=params.as_string(0, "regexp must not be code");  
   
         VRegex& vregex=GET_SELF(r, VRegex);          VRegex& vregex=GET_SELF(r, VRegex);
   
         vregex.set(r.charsets.source(),          if(VRegex* aregex = static_cast<VRegex*>(params[0].as(VREGEX_TYPE))){
                 &pattern,                  vregex.set(*aregex);
                 params.count()>1?&params.as_string(1, OPTIONS_MUST_NOT_BE_CODE):0);          } else {
                   const String& pattern=params.as_string(0, "regexp must not be code");
                   vregex.set(r.charsets.source(), &pattern, params.count()>1 ? &params.as_string(1, OPTIONS_MUST_NOT_BE_CODE) : 0);
           }
   
         vregex.compile();          vregex.compile();
   
         vregex.study();          vregex.study();
 }  }
   
   
 static void _size(Request& r, MethodParams&) {  static void _size(Request& r, MethodParams&) {
         VRegex& vregex=GET_SELF(r, VRegex);          VRegex& vregex=GET_SELF(r, VRegex);
         r.write_no_lang(*new VInt(vregex.get_info_size()));          r.write(*new VInt(vregex.get_info_size()));
 }  }
   
 static void _study_size(Request& r, MethodParams&) {  static void _study_size(Request& r, MethodParams&) {
         VRegex& vregex=GET_SELF(r, VRegex);          VRegex& vregex=GET_SELF(r, VRegex);
         r.write_no_lang(*new VInt(vregex.get_study_size()));          r.write(*new VInt(vregex.get_study_size()));
 }  }
   
 // constructor  // constructor
   
 MRegex::MRegex(): Methoded("regex") {  MRegex::MRegex(): Methoded("regex") {
         // ^regex::create[string[;options]]          // ^regex::create[string|regex[;options]]
         add_native_method("create", Method::CT_DYNAMIC, _create, 1, 2);          add_native_method("create", Method::CT_DYNAMIC, _create, 1, 2);
   
         // ^regex.info_size[]          // ^regex.info_size[]

Removed from v.1.7  
changed lines
  Added in v.1.14


E-mail: