Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26258 > unrolled thread

Re: simplified Python parsing question

Started byLaszlo Nagy <gandalf@shopzeus.com>
First post2012-07-30 16:59 +0200
Last post2012-07-30 16:59 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: simplified Python parsing question Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-30 16:59 +0200

#26258 — Re: simplified Python parsing question

FromLaszlo Nagy <gandalf@shopzeus.com>
Date2012-07-30 16:59 +0200
SubjectRe: simplified Python parsing question
Message-ID<mailman.2733.1343660358.4697.python-list@python.org>
>
> yeah the problem is also little more complicated than simple parsing 
> of Python code. For example, one example (from the white paper)
>
> *meat space blowback = Friends and family [well-meaning attempt]
>
> *could that be parsed by the tools you mention?

It is not valid Python code. Pygments is able to tokenize code that is 
not valid Python code. Because it is not parsing, it is just tokenizing. 
But if you put a bunch of random tokens into a file, then of course you 
will never be able to split that into statements.

Probably, you will need to process ident/dedent tokens, identify the 
"level" of the satement. And then you can tell what file, class, inner 
class, method you are staying in. Inside one "level" or code block, you 
could try to divide the code into statements.

Otherwise, I have no idea how a blind person could navigate in a Python 
source. In fact I have no idea how they use regular programs. So I'm 
affraid I cannot help too much with this. :-(

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web