grammar = """

digit = anything:x ?(x.isdigit())
nonzeroDigit = anything:x ?(x != '0' and x.isdigit())
digits = <'0' | nonzeroDigit digit*>:i -> int(i)

netstring = digits:length ':' <anything{length}>:string ',' -> string

initial = netstring:string -> receiver.netstringReceived(string)

"""

class NetstringSender(object):
    def __init__(self, transport):
        self.transport = transport

    def sendNetstring(self, string):
        self.transport.write('%d:%s,' % (len(string), string))

@@ -12,42 +12,8 @@
 %22%22%0A%0A
-digit = anything:x ?(x.isdigit())%0A
 nonz
@@ -23,24 +23,21 @@
 Digit = 
-anything
+digit
 :x ?(x !
@@ -45,24 +45,8 @@
  '0'
- and x.isdigit()
 )%0Adi

Update the netstring code with newfound knowledge.