Wasn't unclear. Just that it's similar to the invoking an instance of perl to do the same except that it saves context, while up, more like my calc does (which is limited to 1 line).

It would be closer to what I want if you "assumed" 1 semi -- see if that parses. If so, goto next. If not, then this is where that PPI module could be useful -- run the parse w & w/o the semi and see if it only can work the 2nd way -- if so, ask for another line. If it can work w/a semi- default to closing the statement unless a backslash is on the end.

Of course if it works with or w/o a semi (like after a closing '}'), then you goback to ask for a new line.

Yours is more of a REPL (gee, wonder why!;-)), while mine was intended to print results like a calculator -- used to do a better job until I 'fixed' it some time back -- and haven't fixed it again -- printed the hex, string and fractional formats if they made sense.

BTW -- when I say 'calc', I really mean evaluate a perl expression and print the result, which was sufficient for my purposes.

It also stopped working right when my distro updated one of the Term::readchar/line routines and now it thinks it is talking to a dumb tty... real annoying, but those are 'transitory issues'... It's not something I use too much -- just now and then and now and then make changes in it -- and the "itch" of it not handling multiple lines like bash would, got "itchier", sorta, if that makes any sense.

Maybe going through the extra pain of the trying dual-parsing w/PPI and "with", and "with/out" semi's to determine whether to close input and return a result might be the shortest path to get where I might want to go, but that's too much work for a short scratching session and got bigger fish to fry before I can play in my playground...*sigh*.


In reply to Re^4: howto parse (or determining end) of a line of perl by perl-diddler
in thread howto parse (or determining end) of a line of perl by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.