Hello, I am playing around a little bit with dparser, and I thought that maybe someone on this list can help me out (There does not seem to be a dparser list, atleast not an active one). I am total n00b to parsers so this might be very easy. I want a parser that can parse both these lines (What I am looking to construct is a parser of a _very_ limited subset of objective-c).

[[self _rowsForAddingContentObject:content] retain]
NSArray *contentRowArray

This is what I have so far.

from dparser import Parser

def d_objcmsg(t):
  'objcmsg: "\[" (objcmsg|var) msg "\]" '
def d_varDef(t):
  'varDef: classname "\*" var'
def d_classname(t):
  'classname: "[A-Z][A-Za-z_0-9]*"'
def d_var(t):
  'var: "[a-z_][A-Za-z_0-9]*" '
def d_msg(t):
  'msg: (msgWithArg|"[a-z_][A-Za-z_0-9]*")'
def d_msgWithArg(t):
  'msgWithArg: "[a-z_][A-Za-z_0-9]*" ":" (var|objcmsg)'

this makes the "[[self _rowsForAddingContentObject:content] retain]" line pass, however I get a syntax error on the other one. Switching the placing of d_obcmsg and d_varDef makes the other line pass, but then the first fail with a syntax error. I want both of the lines to pass. Anyone have any ideas?

Joachim

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to