in reply to Re^4: howto parse (or determining end) of a line of perl
in thread howto parse (or determining end) of a line of perl
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.
Hm. My point in posting my solution to the problem is that it is extremely simple. And it works.
As the user, I know exactly when what I've typed is complete and should be evaluated. And that is true every time I use the interface.
There is -- IMO; definitely for my repl, but also from my understanding of your calculator -- simply no purpose or benefit from attempting to program in a heuristic to try and predict what the user -- sat right there at the keyboard entering the text your heuristic would be trying to analyse -- is thinking or wanting.
With all of the complexity that is PPI and all the effort that would be required to try and achieve guessing what the user wants; when the user can simply indicate it directly...pointless.
Of course, it's your time, your effort and your choice; but KISS is a fine principal to adopt.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: howto parse (or determining end) of a line of perl
by perl-diddler (Chaplain) on Aug 26, 2016 at 00:40 UTC | |
by BrowserUk (Patriarch) on Aug 26, 2016 at 00:58 UTC | |
by perl-diddler (Chaplain) on Aug 26, 2016 at 14:25 UTC | |
by hippo (Archbishop) on Aug 26, 2016 at 15:12 UTC | |
by perl-diddler (Chaplain) on Aug 27, 2016 at 09:01 UTC | |
|