Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-20 Thread Guillaume Munch

Le 20/10/2016 à 16:03, Tommaso Cucinotta a écrit :


so the issue would be to double-check whether all regex-es in
findadv.cpp can be converted to std::regex ones. But, is there a common
syntax among boost::regex and std::regex that we can use so that
libraries become interchangeable? Otherwise, if we convert all regexes
to std:: syntax, we break everything with boost.


std::regex (ECMAScript) is boost::regex minus a few perl-isms. This is
why it was decided before 2.2 to restrict to ECMAScript. (See e.g. dbce5ca.)

However we then noticed that while boost:regex is compatible with
ECMAScript for regexes, it is not for replacement strings due to a
difference in escape characters. (See e8211fb.)

When converting the regexes to the new standard we may have missed
regexes created dynamically by Adv S



Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-20 Thread Tommaso Cucinotta

On 20/10/2016 16:23, Jean-Marc Lasgouttes wrote:

But suddenly I am not sure anymore of what the problem is. The original message in this 
thread complains about "[0-9]+" not working. In theory this should work both in 
Perl regexes and ECMAscript.


need to debug a bit more, but I suspect the real issue is in some internal 
lyxfind.cpp regexps that are used only when one uses the \regexp{} inset. Apart 
from [0-9]+ not working, I had also format search (\emph{.*} or similar) not 
working, until I managed to recompile with boost!

T.



Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-20 Thread Kornel Benko
Am Donnerstag, 20. Oktober 2016 um 16:23:05, schrieb Jean-Marc Lasgouttes 

> Le 20/10/2016 à 16:03, Tommaso Cucinotta a écrit :
> > On 20/10/2016 15:48, Jean-Marc Lasgouttes wrote:
> >> Le 18/10/2016 à 18:42, Tommaso Cucinotta a écrit :
> >>> So, the problem with Advanced F might be: how do we package on Mac
> >>> OS-X ?
> >
> > I didn't see an answer to this, yet. Do we package with std::regex on
> > Mac ? What problem in packaging using boost instead ?
> 
> These days, we use std::regex by default when it is available. We may 
> have to reconsider this policy until AF is fixed.
> 
> I do not think that it would be a problem for Stephan to build with 
> boost::regex explicitly.
> 
> >> Tommaso, since regexes are mostly write-only, you are probably the
> >> person who knows best what kind of Perl extensions you like to use.
> >
> > so the issue would be to double-check whether all regex-es in
> > findadv.cpp can be converted to std::regex ones. But, is there a common
> > syntax among boost::regex and std::regex that we can use so that
> > libraries become interchangeable? Otherwise, if we convert all regexes
> > to std:: syntax, we break everything with boost.
> 
> As I understand it, Boost::regex uses Perl syntax, which is a extension 
> of normal-people-syntax. And I do not know what is the status of 
> ECMAscript syntax (used by std::regex).
> 
> But suddenly I am not sure anymore of what the problem is. The original 
> message in this thread complains about "[0-9]+" not working. In theory 
> this should work both in Perl regexes and ECMAscript.

Actually, in this case, if you use '-dbg find', you can see that the used 
expression is
lyxfind.cpp (871): Replaced text (to be used as regex): [0-9]+
lyxfind.cpp (874): Setting regexp to : '\`[0-9]+'
lyxfind.cpp (879): Setting regexp2 to: '\`.*.*[0-9]+'

> I am confused now.
> 
> >> Otherwise, we would need some Advanced F automated tests to checks
> >> how well our regexps behave.
> >
> > some are already there, see development/autotests/findadv-re-*-in.txt.
> 
> Good. I am not sure any more that the problem we have is with internal 
> regexes... The person we need on this is Georg.
> 
> JMarc

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-20 Thread Jean-Marc Lasgouttes

Le 20/10/2016 à 16:03, Tommaso Cucinotta a écrit :

On 20/10/2016 15:48, Jean-Marc Lasgouttes wrote:

Le 18/10/2016 à 18:42, Tommaso Cucinotta a écrit :

So, the problem with Advanced F might be: how do we package on Mac
OS-X ?


I didn't see an answer to this, yet. Do we package with std::regex on
Mac ? What problem in packaging using boost instead ?


These days, we use std::regex by default when it is available. We may 
have to reconsider this policy until AF is fixed.


I do not think that it would be a problem for Stephan to build with 
boost::regex explicitly.



Tommaso, since regexes are mostly write-only, you are probably the
person who knows best what kind of Perl extensions you like to use.


so the issue would be to double-check whether all regex-es in
findadv.cpp can be converted to std::regex ones. But, is there a common
syntax among boost::regex and std::regex that we can use so that
libraries become interchangeable? Otherwise, if we convert all regexes
to std:: syntax, we break everything with boost.


As I understand it, Boost::regex uses Perl syntax, which is a extension 
of normal-people-syntax. And I do not know what is the status of 
ECMAscript syntax (used by std::regex).


But suddenly I am not sure anymore of what the problem is. The original 
message in this thread complains about "[0-9]+" not working. In theory 
this should work both in Perl regexes and ECMAscript.


I am confused now.


Otherwise, we would need some Advanced F automated tests to checks
how well our regexps behave.


some are already there, see development/autotests/findadv-re-*-in.txt.


Good. I am not sure any more that the problem we have is with internal 
regexes... The person we need on this is Georg.


JMarc



Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-20 Thread Tommaso Cucinotta

On 20/10/2016 15:48, Jean-Marc Lasgouttes wrote:

Le 18/10/2016 à 18:42, Tommaso Cucinotta a écrit :

So, the problem with Advanced F might be: how do we package on Mac OS-X ?


I didn't see an answer to this, yet. Do we package with std::regex on Mac ? 
What problem in packaging using boost instead ?

The problem is not regex inset. It is than _internally_, Advanced F should 
only use std::regex-compatible regexes.


Sure, one thing is what is supposed to be the syntax for users of the inset, 
another thing is our internal implementation.


We would like to get eventually get rid of boost if we can.

Tommaso, since regexes are mostly write-only, you are probably the person who 
knows best what kind of Perl extensions you like to use.


so the issue would be to double-check whether all regex-es in findadv.cpp can 
be converted to std::regex ones. But, is there a common syntax among 
boost::regex and std::regex that we can use so that libraries become 
interchangeable? Otherwise, if we convert all regexes to std:: syntax, we break 
everything with boost.


Otherwise, we would need some Advanced F automated tests to checks how well 
our regexps behave.


some are already there, see development/autotests/findadv-re-*-in.txt.

T.



Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-20 Thread Jean-Marc Lasgouttes

Le 18/10/2016 à 18:42, Tommaso Cucinotta a écrit :

So, the problem with Advanced F might be: how do we package on Mac OS-X ?

Side issue: ideally, we'd like that regex inset to work with all regex
libs also on Linux, no?
(except for complex/advanced regexs...)


Actually, boost::regex supports some perl features that std::regex does 
not (the latter is more like ECMAScript, from what I understand).


The problem is not regex inset. It is than _internally_, Advanced F 
should only use std::regex-compatible regexes. We would like to get 
eventually get rid of boost if we can.


The question is: is there a good tool to check which regexes use the 
Perl extensions that boost allows?


Tommaso, since regexes are mostly write-only, you are probably the 
person who knows best what kind of Perl extensions you like to use.


Otherwise, we would need some Advanced F automated tests to checks how 
well our regexps behave.


JMarc



Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-18 Thread Kornel Benko
Am Dienstag, 18. Oktober 2016 um 18:42:02, schrieb Tommaso Cucinotta 

> On 18/10/2016 17:14, Kornel Benko wrote:
> > Maybe mixed compilation units (compiled with different settings)?
> > I see 2 possibilities
> > 1.) try on _really_ clean build tree.
> 
> had clean, distclean, autogen.sh several times :-(...
> 
> However, seems the crash on start went away after
> 
>--disable-std-regex --without-included-boost --disable-stdlib-debug
> 
> (configure was hinting to disable-stdlib-debug).
> 
> And, with the above settings, I have (back) a working regex inset in Advanced 
> Find & Replace :-)!
> 
> So, the problem with Advanced F might be: how do we package on Mac OS-X ?

No, I have the same problem iff using enabled std:regex. (linux)

> Side issue: ideally, we'd like that regex inset to work with all regex libs 
> also on Linux, no?
> (except for complex/advanced regexs...)

I think 'including complex/advanced regexs...'.
ATM, the regexes in adv are totally unusable with std:regex.

>  T.

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-18 Thread Tommaso Cucinotta

On 18/10/2016 17:14, Kornel Benko wrote:

Maybe mixed compilation units (compiled with different settings)?
I see 2 possibilities
1.) try on _really_ clean build tree.


had clean, distclean, autogen.sh several times :-(...

However, seems the crash on start went away after

  --disable-std-regex --without-included-boost --disable-stdlib-debug

(configure was hinting to disable-stdlib-debug).

And, with the above settings, I have (back) a working regex inset in Advanced Find 
& Replace :-)!

So, the problem with Advanced F might be: how do we package on Mac OS-X ?

Side issue: ideally, we'd like that regex inset to work with all regex libs 
also on Linux, no?
(except for complex/advanced regexs...)

T.



Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-18 Thread Kornel Benko
Am Dienstag, 18. Oktober 2016 um 16:58:02, schrieb Tommaso Cucinotta 

> On 17/10/2016 23:24, Kornel Benko wrote:
> > Please try with std:regex enabled. 
> 
> just realized I was missing libboost_regex-dev, that's why configure was not
> using nor linking to that lib. After adding that, and compiling with
> 
>--without-included-boost --disable-std-regex

Here I think you should use
 --with-included-boost --enable-std-regex
The error does not show if boost:regex is used.

> I have now a spectacular
> 
> tommaso@tommylap:~/lyx-trunk-ws/lyx$ ./src/lyx -dbg any
> terminate called after throwing an instance of 'std::bad_alloc'
>what():  std::bad_alloc
> Aborted (core dumped)
> 
> Kornel, any clue?
> 
> Thx,
> 
>  T.

Maybe mixed compilation units (compiled with different settings)?

I see 2 possibilities
1.) try on _really_ clean build tree.
2.) try with cmake.

Kornel


signature.asc
Description: This is a digitally signed message part.


Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-18 Thread Tommaso Cucinotta

On 17/10/2016 23:24, Kornel Benko wrote:
Please try with std:regex enabled. 


just realized I was missing libboost_regex-dev, that's why configure was not
using nor linking to that lib. After adding that, and compiling with

  --without-included-boost --disable-std-regex

I have now a spectacular

tommaso@tommylap:~/lyx-trunk-ws/lyx$ ./src/lyx -dbg any
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

Kornel, any clue?

Thx,

T.



Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-17 Thread Kornel Benko
Am Montag, 17. Oktober 2016 um 22:53:25, schrieb Tommaso Cucinotta 

> On 17/10/2016 19:41, Tadeus Ras wrote:
> > I had posted a bug report on this a while ago: 
> > http://www.lyx.org/trac/ticket/10356
> > With the recent activity of Mac users on this list and dear Tommaso 
> > Cucinotta asking whether people are still using his nice feature (I am!) I 
> > thought this might be a good moment to readdress my issue.
> 
> sure, right moment, but I don't have a Mac :-). However, I'll go through that 
> TT and double-check whether we have any regression on Linux!
> 
> Thanks,
> 
>  T.

Please try with std:regex enabled.

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: Regular expressions (adv search) not working on Mac OS X?

2016-10-17 Thread Tommaso Cucinotta

On 17/10/2016 19:41, Tadeus Ras wrote:

I had posted a bug report on this a while ago: 
http://www.lyx.org/trac/ticket/10356
With the recent activity of Mac users on this list and dear Tommaso Cucinotta 
asking whether people are still using his nice feature (I am!) I thought this 
might be a good moment to readdress my issue.


sure, right moment, but I don't have a Mac :-). However, I'll go through that 
TT and double-check whether we have any regression on Linux!

Thanks,

T.



Regular expressions (adv search) not working on Mac OS X?

2016-10-17 Thread Tadeus Ras
Hello fellow Mac LyXonauts,

Has anyone of you given the (imho very useful :) advanced search feature a try 
with regular expressions?
With the new maintenance release, I have revisited it. However it constantly 
refuses to give any matches with patterns as simple as
\regexp{[0-9]+\endregexp{}}   (source code panel entry obtained from 
advanced search —> insert —> regular expression —> arbitrary digit)

Is there an obvious bug in the above line of code? Or has anyone found a 
workaround — or not even that problem? I am on Mac OS X 10.11.6 (El Capitan) 
with the re-released LyX 2.2.2. The search with regular expressions seems to 
work on Windows 7 at least. Is it functional on Linux?

I had posted a bug report on this a while ago: 
http://www.lyx.org/trac/ticket/10356 
With the recent activity of Mac users on this list and dear Tommaso Cucinotta 
asking whether people are still using his nice feature (I am!) I thought this 
might be a good moment to readdress my issue.

Thanks for any feedback!
Tadeus