Regex help

David Cantrell david at
Mon Apr 23 12:08:28 BST 2012

On Fri, Apr 20, 2012 at 10:23:36PM +0100, Simon Wistow wrote:

>     # TODO this won't cope with commas inside quotes 
>     # e.g DAT 0x20, "hello, goodbye", 0x10
>     my @operands = split /\s*,\s*/, ($operands || "");

Text::CSV_XS is your special friend, if you can rely on the operand list
being reasonably well-formed.

Alternatively you might want to take a look at CPU::Z80::Assembler.
Paulo Custodio ripped out my crappy regex-based parser and replaced it
with one that doesn't suck, so you may be able to re-use bits of that.
The DEFM etc pseudo-instructions take arbitrarily long lists of args.

David Cantrell | top google result for "topless karaoke murders"

     If you can't imagine how I do something, it's
     because I have a better imagination than you

More information about the mailing list