On Tue, Feb 04, 2003 at 10:05:00PM +0000, Angus Leeming wrote:
> On Tuesday 04 February 2003 9:36 pm, Kayvan A. Sylvan wrote:
> > > Thanks Kayvan
> >
> > You're welcome. ``perldoc -f'' is extremely useful. Especially when I don't
> > feel like going through the entire perlfunc documentation.
> 
> Since you're on line, can I avail myself of your expertise?

Sure.

> I'm trying to debug the reLyX parser which currently chokes on a snipet like
> 
> \makebox(1,0)[lb]{Verbatim}

> which obviosly fails for an OptArg == '(1,0)'. Modifying the loop is easy:
> 
>     while ($curr_args =~ s/^o//) {
>       if ($fileobject->lookAheadToken eq '[') {
>           my $opt = $fileobject->eatOptionalArgument;
>           $tex_mode_string .= $opt->exact_print;
>       } else {
>             my $tmp = $fileobject->lookAheadToken;
>           print ("\nWeird OptArg starting '$tmp'\n");
>       }
>     }

How about this??

if (($fileobject->lookAheadToken eq '[') ||
    ($fileobject->lookAheadToken eq '(')) {

> (Incidentally, why do I have to copy $fileobject->lookAheadToken to a 
> temporary to print '(' rather than '
> 'Text::TeX::OpenFile=HASH(0x8333a80)->lookAheadToken'????)

$fileobject is reference to a Text::TeX::OpenFile object, which is in fact
represented as a hash.

When you call $fileobject->lookAheadToken, you are in effect calling
the perl subroutine Text::TeX::OpenFile::lookAheadToken with the $fileobject
as its first argument.

So, ``$tmp = $fileobject->lookAheadToken'' sets $tmp to the value returned
by that subroutine.

Read the perlobj amn perltoot man pages.

> Back to the subject.
> 
> What's not so obvious is what to put in place of the print statement. Do you 
> know (off the top of your head I know) if there's a subroutine in TeX.pm 
> already?

No, I don't know. I would have to look at the source too.

-- 
Kayvan A. Sylvan          | Proud husband of       | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)

Reply via email to