Page 1 of 1

Regex for MM2

Posted: Thu Dec 03, 2015 4:16 pm
by BlubBlab
Hi since lua's regex have their limits and not full suport all of them I thought i could make for the string add-on some extra functions but runned into some problems:

Code: Select all

1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1019): error C2039: 'difference_type': is not a member of 'std::iterator_traits<_BidIt>'
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(2904): note: see reference to class template instantiation 'std::match_results<_BidIt,std::allocator<std::sub_match<_BidIt>>>' being compiled
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(2952): note: see reference to function template instantiation '_OutIt std::_Regex_replace<_Iter,int,std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>>(_OutIt,_BidIt,_BidIt,const std::basic_regex<char,std::regex_traits<char>> &,const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &,std::regex_constants::match_flag_type)' being compiled
1>          with
1>          [
1>              _OutIt=std::back_insert_iterator<std::string>,
1>              _Iter=std::back_insert_iterator<std::string>,
1>              _BidIt=int
1>          ]
1>  string_addon.cpp(342): note: see reference to function template instantiation '_OutIt std::regex_replace<std::back_insert_iterator<std::string>,int,std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>>(_OutIt,_BidIt,_BidIt,const std::basic_regex<char,std::regex_traits<char>> &,const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &,std::regex_constants::match_flag_type)' being compiled
1>          with
1>          [
1>              _OutIt=std::back_insert_iterator<std::string>,
1>              _BidIt=int
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1019): error C3646: 'difference_type': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1019): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1022): error C2039: 'value_type': is not a member of 'std::iterator_traits<_BidIt>'
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(550): error C2039: 'value_type': is not a member of 'std::iterator_traits<_BidIt>'
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1365): note: see reference to class template instantiation 'std::sub_match<_BidIt>' being compiled
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(550): error C3646: 'value_type': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(550): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(551): error C2039: 'difference_type': is not a member of 'std::iterator_traits<_BidIt>'
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(551): error C3646: 'difference_type': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(551): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(2916): error C2664: '_OutIt std::match_results<_BidIt,std::allocator<std::sub_match<_BidIt>>>::_Format<_OutIt>(_OutIt,const std::sub_match<_BidIt> *,const std::sub_match<_BidIt> *,std::regex_constants::match_flag_type) const': cannot convert argument 2 from 'const char *' to 'const std::sub_match<_BidIt> *'
1>          with
1>          [
1>              _OutIt=std::back_insert_iterator<std::string>,
1>              _BidIt=int
1>          ]
1>          and
1>          [
1>              _BidIt=int
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(2916): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have not really an idea what going wrong besides some types get mixed. I haven't used template so I have not an idea where to start and yeahh asked the Internet but couldn't find a good answer.( I tried namespace collusions but this seems not to be th problem here)

Re: Regex for MM2

Posted: Thu Dec 03, 2015 8:03 pm
by Administrator
Unless I'm mistaken, that looks like something is wrong with the headers included with VC++. Leave it to Microsoft to put out a broken compiler.

Re: Regex for MM2

Posted: Thu Dec 03, 2015 8:36 pm
by BlubBlab
Thx I will try something else and see if that helps if not MS got my fury^^
Anyway I started to multi-task since I got my new PC soo much to do

Re: Regex for MM2

Posted: Sun Dec 13, 2015 10:58 am
by BlubBlab
Okay I solved this problem a while ago when Lisa requested that other stuff. The reason was some problem with a function parameter.

I wanted to ask what is needed or which name should that all have ? I think Admin might be interested in it so instead of 2 different codes it would be better we have 1 solution.

What I have until now is

Code: Select all

/*	string.regex_match(string str, string regex)
Returns:	string

 Test if the value fits the regex
 return true if it does and false if it doesn't
*/
/*	string.regex_search(string str, string regex)
Returns:	string

Test if the value fits the regex
return first the matching parts
*/
/*	string.regex_search_all(string str, string regex)
Returns:	string

Test if the value fits the regex
return all matching parts as multiple return values
*/
/*	string.regex_replace_all(string str, string regex, string withwhat)
Returns:	string

replace all positions in which the regex match with given string
and then return the string
*/
/*	string.regex_replace(string str, string regex, string withwhat, int start, int ende)
Returns:	string

replace all positions in which the regex match with given string
and then return the string
*/

Re: Regex for MM2

Posted: Sun Dec 13, 2015 12:56 pm
by Administrator
Only thing would be in the naming convention. Either regex.function, or string.regexFunction would apply, but we don't use snake-case in function names.

Re: Regex for MM2

Posted: Fri Dec 18, 2015 2:34 pm
by BlubBlab
Sry took me some while I went for string.regexFunction my original thought were also that I could replace also the original function just with full regex support like string.find or string.gsub . I came to the idea by looking to Autohotkey which has basically the same functions like MicroMacro , so the idea was jut add what we missing and we are better because we have full lua support not some exotic BASIC like language which just exists for Autohotkey.

So the idea was setting up MM2 wider(not much) because ROM will be properly besides private Servers be gone at the middle of next year.
I follow a smiler idea with my bot framework so that I could in theory with the same source-code control a real bot in real-life with some adjustments and change the I/O layer I put in for that.

The idea is attract more people who can use it for different things

By the way the problem with the OpenAL dll I had led my to notice that OpenAl and Lua have new version which released.

Re: Regex for MM2

Posted: Fri Dec 18, 2015 2:57 pm
by Administrator
Yeah... I've been meaning to compile those. Actually had done the 64-bit libraries and then got kind of sidetracked with other things. I'm told that I'll be working hard until mid March at the earliest.

Re: Regex for MM2

Posted: Fri Dec 18, 2015 3:36 pm
by BlubBlab
Not much different here I have already compiled it but I must go in a few minutes so it will take some days until release or at last until tomorrow.