Wireshark-dev: [Wireshark-dev] Help on ASN2Wrs
From: tulip neo <[email protected]>
Date: Wed, 25 Mar 2009 23:54:19 -0700 (PDT)
Hi List,
Good morning.
I have some problem with  ASn2wrs.I m developing a parser which should be capable of generating target code(c/c++) from ASN description.In other words asn->python data structure->xml->c/c++.I went through the asn2wrs.py bit by bit and found it very intresting and help full.I need to store different elements and there type and child in some data structure so that i can be able to generate a message tree.
pls help me how should i proceed.One doubt with Lex.py and asn2wrs.py
snippets from lex.py
 # No match. Call t_error() if defined.

                if self.lexerrorf:
                    tok = LexToken()
                    tok.value = self.lexdata[lexpos:]
                    tok.lineno = self.lineno
                    tok.type = "error"
                    tok.lexer = self
                    tok.lexpos = lexpos
                    self.lexpos = lexpos
                    newtok = self.lexerrorf(tok)
                    if lexpos == self.lexpos:

How does above self.lexerrorf(tok) calls t_error() of asn2wrs.py.i dont also understand why it is t_.i understand atleast it defines rules.but how both are maped?same case with the definitions starting with def p_.do Prefix P_ and t_ have any significance?how they are maped from lex.py?
snippets from asn2wrs.py
def t_error(t):
  global input_file
  raise LexError(t, input_file)

Add more friends to your messenger and enjoy! Invite them now.