On May 19, 2009, at 10:01 AM, Thomas Bellman wrote:
> > Luke Kanies wrote: > >> I'd really prefer we add a regex token type and AST leaf class if >> we're going to support regexes to any significant extent. Using >> strings as regexes is just painful. > > Meaning one would do it like: > > $foo = split($string, '.') # Split on period > $bar = split($string, /./) # Split on any character > > in the Puppet manifests? OK. I don't mind going that route. It > would definitely mean delving deeper into the bowels of Puppet > than I have done before, though, but it might be an interesting > exercise. :-) I very much doubt that I would have time to do it > in the 0.25.0 time-frame, though. Yep. I recommend looking in parser/lexer.rb (you'll need to make a REGEX token) and parser/ast/leaf.rb (you'll need to make a Regex subclass of Leaf, and give it an appropriate 'evaluate' method - basically just return a Ruby regex). Then the grammar has to be updated to mark where regexes are allowed. > > However, split() is still lacking in unit tests, and could do with > better error handling. I'll post patches doing just that tomorrow. Great. -- Writing is not necessarily something to be ashamed of, but do it in private and wash your hands afterwards. --Robert Heinlein --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---
