[python-users] Pyparsing
hunniger
do_not_reply_to_this_address at t-online.de
Mi Mai 21 19:26:57 CEST 2008
Hallo,
Ich habe mich vor ein paar Monaten schon mal mit pyparsing versucht, war
damals aber nicht sehr erfolgreich. Vieleicht kann mir ja der Mensch der
den Pyparsing Vortrag gehalten hat weiter helfen. Siehe unten.
Gruß Dirk
I am trying to get started with the pyparing. I am working on a programm
that read files in the mediawiki format and write files in the latex
format. I currently have got a problem with the "|" character since it
is used as a seperator inside an intrawikilink as well as a seperator
for cells in a table, which naturaly causes problems with tables which
contain intrawikilinks. As far as I found out pyparsing is able to solve
this problem in a good way.
So I tryed to write a grammer for a wikilink, which is given in the
attached file. There is a problem with the asXML function. You may look
at the output when you run the program comparing it with the multiline
docstring given in the sourcecode. Essetially I would have expected the
output to be similar to the docstring. But it is much different.
Pyparsing writes a list like structure and I expected a tree like
structure. I often heard the term parse tree. So how is it possible to
access the parse tree that pypasing creates. The list view of the
parsetree does not seem to be useful for my problem. The second problem
I have is that I want to run pyparsing on a unicode file that I open
with codecs.open("text","r","utf8"). So there are very many possible
characters that I do not want to list in my sourcecode. So how can I
write down a grammer expression that machtes a series of arbitrary
characters, which does not include certain specifically mentioned
charactes.
Cheers Dirk
Mehr Informationen über die Mailingliste python-users