Recent

Author Topic: TRegExpr issue  (Read 4472 times)

Capsticks

  • Newbie
  • Posts: 2
TRegExpr issue
« on: June 13, 2021, 05:28:00 pm »
Hi,
I'm fairly new to Lazarus, but I have managed to produce one project.
I now wish to convert a source 'c' library (.h extension) to .pas using h2pas.
However, all that happens is a fatal error: TRegExpr exec: empty input string.

I have found minimal mention of this issue but without any solution (except it seems in a later version which isn't available yet).
Is there any solution to this - and please make it simple so I can actually understand it.
Current setup:
Windows 10
Lazarus 2.0.12
Fpc 3.2.0

Thanks.

jamie

  • Hero Member
  • *****
  • Posts: 4732
Re: TRegExpr issue
« Reply #1 on: June 13, 2021, 05:35:02 pm »
unless you are using it wrong, there could be some C code that the RegExpr is crashing on..

I've never used that utility myself so I can't comment much on that but I will say that all it does is converts headers of types, it will not convert program code to pascal..

 You most likely would do better simply hand converting it.
The only true wisdom is knowing you know nothing

engkin

  • Hero Member
  • *****
  • Posts: 2854
Re: TRegExpr issue
« Reply #2 on: June 13, 2021, 08:16:51 pm »
I think the title is not correct. It is more of h2pas problem.

If you can share the c file (.h) it would make it possible for someone to try and track the error, if any.

Alextp

  • Hero Member
  • *****
  • Posts: 1315
    • UVviewsoft
Re: TRegExpr issue
« Reply #3 on: June 13, 2021, 08:20:17 pm »
Quote
However, all that happens is a fatal error: TRegExpr exec: empty input string.
That was a bug in RegExpr, fixed in FPC trunk (seems FPC 3.2.2 has that fix).

Alextp

  • Hero Member
  • *****
  • Posts: 1315
    • UVviewsoft
Re: TRegExpr issue
« Reply #4 on: June 13, 2021, 08:22:10 pm »
Bug was added by me, fixed by me, and last RegExpr is here--
https://github.com/Alexey-T/TRegExpr

Capsticks

  • Newbie
  • Posts: 2
Re: TRegExpr issue
« Reply #5 on: June 13, 2021, 08:33:34 pm »
OK. So it looks like a fix is available - but not in fpc 3.2.0
Therefore (as a newbie) can I download fpc 3.2.2 (from somewhere - binaries for Windows) and run it with IDE 2.0.12???
Any help (in laymans terms) would be gratefully received.

jamie

  • Hero Member
  • *****
  • Posts: 4732
Re: TRegExpr issue
« Reply #6 on: June 14, 2021, 02:38:08 am »
The only true wisdom is knowing you know nothing

Spoonhorse

  • Jr. Member
  • **
  • Posts: 52
Re: TRegExpr issue
« Reply #7 on: June 19, 2021, 03:03:27 pm »
By the way I was using that lately and am I using it wrong or are some of the regex features mentioned in the documentation simply not there? I couldn't get it to work with (?<= and things like that.

jamie

  • Hero Member
  • *****
  • Posts: 4732
Re: TRegExpr issue
« Reply #8 on: June 19, 2021, 04:30:55 pm »
By the way I was using that lately and am I using it wrong or are some of the regex features mentioned in the documentation simply not there? I couldn't get it to work with (?<= and things like that.

 I cringe when ever I see  "RegEx" even mentioned let alone see it being used in lib code..
 It's an utter complete mess of twisted logic that is way out of control in my opinion..

 
The only true wisdom is knowing you know nothing

engkin

  • Hero Member
  • *****
  • Posts: 2854
Re: TRegExpr issue
« Reply #9 on: June 19, 2021, 05:03:56 pm »
LOL, Jamie, it is not that bad. Yes, I agree, they do look ugly if you are not familiar with them.

It sounds like you never used the "Regular expressions" check box in the Find/Find in Files. You can't avoid them when you really need their power.

How would you find functions whose names start with "jForm_" and end with "URI" like:
jForm_CopyFileFromUri
?

jamie

  • Hero Member
  • *****
  • Posts: 4732
Re: TRegExpr issue
« Reply #10 on: June 19, 2021, 05:24:12 pm »
I've used it before only when I had to do to when others insisting on it..

the code is a twisted mess, that is my point.

The layout of the code makes it very hard to correct for errors because the logic layout is so sloppy with the implementation I've seen here..

  I've used other libs for that same code and it's much easier to fix if there is an issue because it was thought out properly..

 And even if it current imp used here was bug free I wouldn't use it.. There are far much better ways to find something.
« Last Edit: June 19, 2021, 05:25:53 pm by jamie »
The only true wisdom is knowing you know nothing

Alextp

  • Hero Member
  • *****
  • Posts: 1315
    • UVviewsoft
Re: TRegExpr issue
« Reply #11 on: June 19, 2021, 05:43:33 pm »
By the way I was using that lately and am I using it wrong or are some of the regex features mentioned in the documentation simply not there? I couldn't get it to work with (?<= and things like that.

That patches for (?<=) etc were NOT merged to FPC repo yet!
https://github.com/alexey-T/tregexpr

 

TinyPortal © 2005-2018