Do U use >>>>>perl -e 'use re debug;/REGEX/' so U can help??

R

robertospara

Hi.
I am involved in work under project that will visualize the process of
matching the regex to input text.
As data to highlight sub-regexes which take a part in each step of
matching I want to use perl debugger output from regex compilation (
perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
very less information about subregexes position in regex that are
already use in matching process. If someone every wanted to do that
could have said the same. My question: Eny ideas to get out from
debugger output elements that I could highlight in each step to
visualize matching process.

My last idea was that I could take from offsets (look in perldebguts if
don't know what I mean) the position where sub-regex is ending for
example :

my_regex == son((mother)?father*)+daughter

| | |

13 20 22
So positions 13, 20, 22 I receive from debugger. Then I should write
parser of my regex to get positions :
- beginning of sub-regex "(mother)?"
- beginning of sub-regex "father*"
- beginning of sub-regex "((mother)?father*)+".

I don't see for now any other way. Any clues nice welcome. Best regards.
 
R

robertospara

Secret of offsets:
A(BC?(DE)*)+F - sample of regex
| | |

Comment: Offsets include information about fingered ends of the
sub-regexen, as U can see above:

Offsets: [29]
1[1] 0[0] 12[1] 0[0] 2[1] 0[0] 3[1] 0[0] 5[1] 0[0] 4[1] 0[0]
10[1] 0[0] 6[1] 0[0] 7[2] 0[0] 9[1] 0[0] 10[0] 10[0]
+ ( ?
C * (
%%%%%% %%%%%%
%%%%%

11[1] 0[0] 12[0] 12[0] 13[1] 0[0] 14[0]

t.b.c. but about beginnings too but in reverse queue. So firse
end of su-regex ( with additional quantifier ), then later first next
not-null, this one is the beginning of this sub-regex.
In this way that I would like to show above with bushes of %%%%%
precentages.

So if the first offset or first not-null from left is like position[
length] and position >1 so this is
offset that tells about position of the end of firs subregex in global
regex.
So next not-null after this is the position of the begining of this
sub-regex. Mostly position of
the beginning of global regex.

Ad. I made this "perl -e 'use re debug;/A(BC?(DE)*)+F/'".
So compiled regex looks like this:
Compiling REx `A(BC?(DE)*)+F'
size 29 Got 236 bytes for offset annotations.
first at 1
1: EXACT <A>(3)
3: CURLYX[0] {1,32767}(26)
5: OPEN1(7)
7: EXACT <B>(9)
9: CURLY {0,1}(13)
11: EXACT <C>(0)
13: CURLYM[2] {0,32767}(23)
17: EXACT <DE>(21)
21: SUCCEED(0)
22: NOTHING(23)
23: CLOSE1(25)
25: WHILEM[1/2](0)
26: NOTHING(27)
27: EXACT <F>(29)
29: END(0)
anchored "AB" at 0 floating "F" at 2..2147483647 (checking anchored)
minlen 3
 
R

robertospara

So MONKS OF THE PERL
???????????????????????????????????????????????????????
Are you still
ALIVE?????????????????????????????????????????????????????????????

Secret of offsets:
A(BC?(DE)*)+F - sample of regex
| | |

Comment: Offsets include information about fingered ends of the
sub-regexen, as U can see above:

Offsets: [29]
1[1] 0[0] 12[1] 0[0] 2[1] 0[0] 3[1] 0[0] 5[1] 0[0] 4[1] 0[0]
10[1] 0[0] 6[1] 0[0] 7[2] 0[0] 9[1] 0[0] 10[0] 10[0]
+ ( ?
C * (
%%%%%% %%%%%%
%%%%%

11[1] 0[0] 12[0] 12[0] 13[1] 0[0] 14[0]

t.b.c. but about beginnings too but in reverse queue. So firse
end of su-regex ( with additional quantifier ), then later first next
not-null, this one is the beginning of this sub-regex.
In this way that I would like to show above with bushes of %%%%%
precentages.

So if the first offset or first not-null from left is like position[
length] and position >1 so this is
offset that tells about position of the end of firs subregex in global
regex.
So next not-null after this is the position of the begining of this
sub-regex. Mostly position of
the beginning of global regex.

Ad. I made this "perl -e 'use re debug;/A(BC?(DE)*)+F/'".
So compiled regex looks like this:
Compiling REx `A(BC?(DE)*)+F'
size 29 Got 236 bytes for offset annotations.
first at 1
1: EXACT <A>(3)
3: CURLYX[0] {1,32767}(26)
5: OPEN1(7)
7: EXACT <B>(9)
9: CURLY {0,1}(13)
11: EXACT <C>(0)
13: CURLYM[2] {0,32767}(23)
17: EXACT <DE>(21)
21: SUCCEED(0)
22: NOTHING(23)
23: CLOSE1(25)
25: WHILEM[1/2](0)
26: NOTHING(27)
27: EXACT <F>(29)
29: END(0)
anchored "AB" at 0 floating "F" at 2..2147483647 (checking anchored)
minlen 3

Hi.
I am involved in work under project that will visualize the process of
matching the regex to input text.
As data to highlight sub-regexes which take a part in each step of
matching I want to use perl debugger output from regex compilation (
perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
very less information about subregexes position in regex that are
already use in matching process. If someone every wanted to do that
could have said the same. My question: Eny ideas to get out from
debugger output elements that I could highlight in each step to
visualize matching process.
My last idea was that I could take from offsets (look in perldebguts if
don't know what I mean) the position where sub-regex is ending for
example :
my_regex == son((mother)?father*)+daughter
13 20 22
So positions 13, 20, 22 I receive from debugger. Then I should write
parser of my regex to get positions :
- beginning of sub-regex "(mother)?"
- beginning of sub-regex "father*"
- beginning of sub-regex "((mother)?father*)+".
I don't see for now any other way. Any clues nice welcome. Best regards.
 
M

Mirco Wahab

robertospara said:
I am involved in work under project that will visualize the process of
matching the regex to input text.
As data to highlight sub-regexes which take a part in each step of
matching I want to use perl debugger output from regex compilation (
perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
very less information about subregexes position in regex that are
already use in matching process. If someone every wanted to do that
could have said the same. My question: Eny ideas to get out from
debugger output elements that I could highlight in each step to
visualize matching process.

My last idea was that I could take from offsets (look in perldebguts if
don't know what I mean) the position where sub-regex is ending for
example :

my_regex == son((mother)?father*)+daughter

I don't really understand what your goal is here -
and I'm none of the gurus, but I find that question
interesting.

What I guess what you want is to trace the
Regex evaluation, sth. like
- find the match
- find the part of the regex that made the match

If thats so, it'll be rather simple. Use code
assertions for that, eg.
you have a string:

my $text = 'mother and father have a son and a daughter';

and a regex:

my $regex = qr/(mother|father)?.*?(son|daughter)/;

and want to match sth. like:

$text =~ /$regex/g;

To know what happens upon the evaluations,
just print out the steps:

...
my $text = 'mother and father have a son and a daughter';

my $rg = qr'(mother|father)? (?{ print "\t\t(mother|father) matches: $& \n" })
.*? (?{ print "\t\t.*? matches: $& \n" })
(son|daughter) (?{ print "\t\t(son|daughter) matches: $& \n" })
'x;


print "@{[ $text =~ m/$rg/g ]}";
...

Maybe what you really want is much more complicated,
but don't miss the modules YAPE::Regex::Explain and
GraphViz::Regex in addidtion to your

$> perl -Mre=debug mysource.pl


Regards

Mirco
 
M

Mirco Wahab

robertospara said:
I am involved in work under project that will visualize the process of
matching the regex to input text.
As data to highlight sub-regexes which take a part in each step of
matching I want to use perl debugger output from regex compilation (
perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
very less information about subregexes position in regex that are
already use in matching process. If someone every wanted to do that
could have said the same. My question: Eny ideas to get out from
debugger output elements that I could highlight in each step to
visualize matching process.

My last idea was that I could take from offsets (look in perldebguts if
don't know what I mean) the position where sub-regex is ending for
example :

my_regex == son((mother)?father*)+daughter

I don't really understand what your goal is here -
and I'm none of the gurus, but I find that question
interesting.

What I guess what you want is to trace the
Regex evaluation, sth. like
- find the match
- find the part of the regex that made the match

If thats so, it'll be rather simple. Use code
assertions for that, eg.
you have a string:

my $text = 'mother and father have a son and a daughter';

and a regex:

my $regex = qr/(mother|father)?.*?(son|daughter)/;

and want to match sth. like:

$text =~ /$regex/g;

To know what happens upon the evaluations,
just print out the steps:

...
my $text = 'mother and father have a son and a daughter';

my $rg = qr'(mother|father)? (?{ print "\t\t(mother|father) matches:", substr($text,$-[1],$+[1]-$-[1]), "\n" })
.*? (?{ print "\t\t.*? matches: $& \n" })
(son|daughter) (?{ print "\t\t(son|daughter) matches:", substr($text,$-[2],$+[2]-$-[2]), "\n" })
'x;

print "@{[ $text =~ m/$rg/g ]}";
...

Maybe what you really want is much more complicated,
but don't miss the modules YAPE::Regex::Explain and
GraphViz::Regex in addidtion to your

$> perl -Mre=debug mysource.pl


Regards

Mirco
 
R

robertospara

my $text = 'mother and father have a son and a daughter';
my $rg = qr'(mother|father)? (?{ print "\t\t(mother|father) matches:", substr($text,$-[1],$+[1]-$-[1]), "\n" })
.*? (?{ print "\t\t.*? matches: $& \n" })
(son|daughter) (?{ print "\t\t(son|daughter) matches:", substr($text,$-[2],$+[2]-$-[2]), "\n" })
'x;

print "@{[ $text =~ m/$rg/g ]}";

You almost understand what I want to do.
That what U did is made by you with hands and head. I want to do
something like this automaticlly.
My input will be >>>>>text<<< and >>>regex<<< and in third window I
will have
debugger output with many colors and blinking stuff <<<like underlined
text resizing text , rotating,
moving, animated text, blare comments>>> and clouds appearing and
explaining
whatever should be explained TO SHOW PROCESS OF MATCHING ANY REGEX TO
ANY TEXT
WITH SOME ADDITIONAL INFO. ABOUT REGEXEN AND NFA
(NondeterministicFiniteAutomat) and optimalizator work description and
clues to efectivly change regex. I will use GTK2-Perl support for
GRAPHICAL stuff.
And I'm writing it in PErl.
Thanks for informations.
U are the first person who reply. Thanks very much.



robertospara wrote: > I am involved in work under project that will visualize the process of
matching the regex to input text.
As data to highlight sub-regexes which take a part in each step of
matching I want to use perl debugger output from regex compilation (
perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
very less information about subregexes position in regex that are
already use in matching process. If someone every wanted to do that
could have said the same. My question: Eny ideas to get out from
debugger output elements that I could highlight in each step to
visualize matching process.

My last idea was that I could take from offsets (look in perldebguts if
don't know what I mean) the position where sub-regex is ending for
example :

my_regex == son((mother)?father*)+daughter

I don't really understand what your goal is here -
and I'm none of the gurus, but I find that question
interesting.

What I guess what you want is to trace the
Regex evaluation, sth. like
- find the match
- find the part of the regex that made the match

If thats so, it'll be rather simple. Use code
assertions for that, eg.
you have a string:

my $text = 'mother and father have a son and a daughter';

and a regex:

my $regex = qr/(mother|father)?.*?(son|daughter)/;

and want to match sth. like:

$text =~ /$regex/g;

To know what happens upon the evaluations,
just print out the steps:

...
my $text = 'mother and father have a son and a daughter';

my $rg = qr'(mother|father)? (?{ print "\t\t(mother|father) matches:", substr($text,$-[1],$+[1]-$-[1]), "\n" })
.*? (?{ print "\t\t.*? matches: $& \n" })
(son|daughter) (?{ print "\t\t(son|daughter) matches:", substr($text,$-[2],$+[2]-$-[2]), "\n" })
'x;

print "@{[ $text =~ m/$rg/g ]}";
...

Maybe what you really want is much more complicated,
but don't miss the modules YAPE::Regex::Explain and
GraphViz::Regex in addidtion to your

$> perl -Mre=debug mysource.pl

Regards

Mirco
 
J

Jürgen Exner

robertospara said:
So MONKS OF THE PERL
???????????????????????????????????????????????????????
Are you still
ALIVE?????????????????????????????????????????????????????????????

Would you mind
- not top posting?
- not full quoting?
- repairing your keyboard?

jue
 
R

robertospara

Maybe someone had to move to think your old brains:):):):):)
hehehehehehehehehehehehehehehehehehehehehehhhheheh
Tad McClellan napisa³(a):
 
C

Charlton Wilbur

robertospara> So MONKS OF THE PERL ? [snip 44 redundant question
robertospara> marks] Are you still ALIVE? [snip 50 redundant
robertospara> question marks]

You're behaving like a twit, and so most of the knowledgeable Perl
posters have added you to their kill files. If you want to remedy
this, as much as it can be remedied, you can start by doing the things
Juergen has suggested -- not top posting, not full-quoting, and not
using ridiculous strings of question marks or other punctuation -- and
by reading the Posting Guidelines that are posted here twice a week
and following the advice in them.

If you don't, you're likely to be completely ignored except by trolls
and idiots, and you won't get any useful help here.

Charlton
 
R

robertospara

Really
???????????????????????????????????????????????????????????????????????????????????

"robertospara" == robertospara <[email protected]> writes: robertospara> So MONKS OF THE PERL ? [snip 44 redundant question
robertospara> marks] Are you still ALIVE? [snip 50 redundant
robertospara> question marks]

You're behaving like a twit, and so most of the knowledgeable Perl
posters have added you to their kill files. If you want to remedy
this, as much as it can be remedied, you can start by doing the things
Juergen has suggested -- not top posting, not full-quoting, and not
using ridiculous strings of question marks or other punctuation -- and
by reading the Posting Guidelines that are posted here twice a week
and following the advice in them.

If you don't, you're likely to be completely ignored except by trolls
and idiots, and you won't get any useful help here.

Charlton
 
T

Ted Zlatanov

Really
???????????????????????????????????????????????????????????????????????????????????

My 3-year old daughter is already outgrowing this stage--she now
realizes that deliberately doing the wrong thing is not funny and only
annoys adults. Good luck Roberto, you can do it!

Ted
 
R

robertospara

F... Y...! Is these your initials?
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!
Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!Asshole!

robertospara said:
robertospara> marks] Are you still ALIVE? [snip 50 redundant
robertospara> question marks]
You're behaving like a twit, and so most of the knowledgeable Perl
posters have added you to their kill files. If you want to remedy
this, as much as it can be remedied, you can start by doing the things
Juergen has suggested -- not top posting, not full-quoting, and not
using ridiculous strings of question marks or other punctuation -- and
by reading the Posting Guidelines that are posted here twice a week
and following the advice in them.
Really
???????????????????????????????????????????????????????????????????????????????????Yes - really.

It may have been accidental before, but this time your misbehavior was
deliberate. Welcome to my killfile, twit.

*plonk*

sherm--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top