How to in Python

John Machin sjmachin at lexicon.net
Wed Dec 19 15:32:35 EST 2007


On Dec 20, 4:02 am, MartinRineh... at gmail.com wrote:
> I've got a pointer to a position in a line of code that contains
> either a digit or a period (decimal point). I've got this comment:
>
>             Numbers are one of these:
>                 integers:
>                     digit+
>                     0xhex_digit+
>                 decimals:
>                     digit+.digit*[E['+'|'-']digit+]
>                     .digit+[E['+'|'-']digit+]
>                     digit+[.digit*]%
>                     .digit+%
>
> Common metacode: '*' = 0 or more, '+' = 1 or more, [] = optional, | =
> or, ...
>
> Now I need to instantiate the comment. How would an experienced Python
> coder proceed?

Use a proper lexer written by somebody who knows what they are doing,
as has already been recommended to you.



More information about the Python-list mailing list