
2009/3/16 ChrisK
Let me open the discussion with all the questions I can quickly ask:
What should the "subRegex" function do, exactly? (Single replacement,global replacement,once per line,...)
Try to do the same thing as =~ s/../../ in perl. For a version 1: Global replacements, don't treat newlines separately, ^ and $ anchor at start and end of string. There could be a Bool option to support multiline replacement modes.
What should the replacement template be able to specify? (Can it refer to all text before a match or all text after?) (Can it access the start/stop offsets as numbers?)
Again, follow =~ s/../../ I'm not sure what =~ allows in this dimension though. My instinct is
(Can it refer to all text before a match or all text after?)
no
(Can it access the start/stop offsets as numbers?)
no But maybe that's just because I've never needed the above functionality. I basically think of =~ s as "quick cleanup for dirty text" solution, nothing approaching full-fledged parsing.
Should the replacement template be specif~ied in a "String"?
Sure, just like it is in Text.Regex.subRegex now. No combinators, \numbered capture references are fine.
As an abstract data type or syntax tree? With combinators?
Just a string I think.
What happens if the referenced capture was not made? Empty text?
Return the original string. Isn't that what subRegex already does?
How will syntax errors in the template be handled (e.g. referring to a capture that does not exist in the regular expression)?
runtime error
Will the output text be String? ByteString? ByteString.Lazy? Seq Char? Note: String and Strict Bytestrings are poor with concatenation.
String. Add support for others if users holler for it
Can the output text type differ from the input text type?
Nah. My 2c.
-- Chris
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe