Quantcast
Channel: User Tarmil - Stack Overflow
Viewing all articles
Browse latest Browse all 38

Answer by Tarmil for FParsec and postfix modifiers to parsed items

$
0
0

I think you can use opt to allow parseCount to not find a count if there isn't one:

let parseCount =    parseTerm    .>>. opt (choice [ skipChar '*'>>% (MinCount 0)                       skipChar '+'>>% (MinCount 1)                       skipChar '?'>>% (RangeCount(0, 1)) ])    |>> function    | term, None -> term    | term, Some count -> Count (term, count)let parseTerms =    many parseCount .>> eof

Viewing all articles
Browse latest Browse all 38

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>