title: Pyparsing - Trouble parsing file to dictionary structure
body: <p>I am attempting to use Pyparsing to parse Aspartix(.apx) format files (<a href="http://www.dbai.tuwien.ac.at/research/project/argumentation/systempage/docu.htm" rel="nofollow">http://www.dbai.tuwien.ac.at/research/project/argumentation/systempage/docu.htm</a>) and I am having trouble structuring my results to a dictionary.</p>
  
  <p>I have specified the grammar as follows:</p>
  
  <pre><code>from pyparsing import *
  
  ID = Word(alphanums)
  arg_pair = Group(ID + Suppress(',') + ID)
  value = Word(nums)
  lineEnd = Suppress(').')
  arg = Suppress('arg(') + ID + lineEnd
  attack = Suppress('att(') + arg_pair + lineEnd
  pref = Suppress('pref(') + arg_pair + lineEnd
  val = Suppress('val(') + ID + Suppress(',') + value + lineEnd
  valpref = Suppress('valpref(') + value + Suppress(',') + value +  lineEnd
  support = Suppress('support(') + arg_pair + lineEnd
  
  apx = OneOrMore(arg.setName('arg') | attack.setName('att') | pref.setName('pref') | val.setName('val') | valpref.setName('valpref') | support.setName('support'))
  </code></pre>
  
  <p>I am unsure of how to use the setName() function to define dictionary keys so that each occurrence of the arg, attack etc rules maps to the defined key.  Using the above code yields no usable dictionary keys.</p>
  
  <p>For example:</p>
  
  <pre><code>"""arg(a).
  arg(b).
  att(a,b)."""
  </code></pre>
  
  <p>Would map to:</p>
  
  <pre><code>{"arg": ["a","b"], "att":[["a","b"]]}
  </code></pre>
  
  <p>I would appreciate any help you can give.</p>