After some private exchange of info between Uwe and me it became clear
that it may not have been immediately clear that the error messages in
my original posting where actually part of a more involved process.
By removing the optional part in the pCommand (i.e. making the part
starting
Uwe Hollerbach wrote:
Yes, I've looked at that and am thinking about it. I'm not quite
certain it's needed in my real program... I seem to have convinced
myself that if I actually specify a proper set of unique prefixes, ie,
set the required lengths for both frito and fromage to 3 in the
test
Hi, all, thanks for the further inputs, all good stuff to think
about... although it's going to be a little while before I can
appreciate the inner beauty of Doaitse's version! :-) I had considered
the approach of doing a post-parsec verification, but decided I wanted
to keep it all inside the
On 15 okt 2009, at 16:58, Uwe Hollerbach wrote:
Hi, all, thanks for the further inputs, all good stuff to think
about... although it's going to be a little while before I can
appreciate the inner beauty of Doaitse's version! :-)
The nice thing is that you do not have to understand the inner
I could not resist this. The code
import Text.ParserCombinators.UU.Parsing
pCommand [] = pure []
pCommand xxs@(x:xs) = ((:) $ pSym x * pCommand xs) `opt` xxs
pCommands = amb . foldr (|) pFail . map pCommand $ [banana,
chocolate, frito, fromage]
t :: String - ([String], [Error Char Char
Brandon S. Allbery KF8NH wrote:
My fix would be to have myPrefixOf require the prefix be terminated in
whatever way is appropriate (end of input, white space, operator?)
instead of simply accepting as soon as it gets a prefix match regardless
of what follows.
Maybe you can use notFollowedBy
On 10/12/09, Martijn van Steenbergen mart...@van.steenbergen.nl wrote:
Brandon S. Allbery KF8NH wrote:
My fix would be to have myPrefixOf require the prefix be terminated in
whatever way is appropriate (end of input, white space, operator?)
instead of simply accepting as soon as it gets a
a brain fart?
Hi, cafe, I've been playing a little bit with a small command
processor, and I decided it'd be nice to allow the user to not have to
enter a complete command, but to recognize a unique prefix of it. So I
started with the list of allowed commands, used filter and isPrefixOf,
and was
On Oct 12, 2009, at 22:28 , Uwe Hollerbach wrote:
parsePrefixOf n str =
string (take n str) opts (drop n str) return str
where opts [] = return ()
opts (c:cs) = optional (char c opts cs)
Seems to me this will succeed as soon as it possibly can...
myTest = myPrefixOf 1 banana
On 10/12/09, Derek Elkins derek.a.elk...@gmail.com wrote:
On Mon, Oct 12, 2009 at 9:28 PM, Uwe Hollerbach uhollerb...@gmail.com
wrote:
a brain fart?
Hi, cafe, I've been playing a little bit with a small command
processor, and I decided it'd be nice to allow the user to not have to
enter a
10 matches
Mail list logo