"Khoa Nguyen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> for tokens,start,end in commaSeparatedList.scanString(data):
> print tokens
>
>
> This returns:
>
> ['f1', 'f2', 'f3', 'f4', 'f5', 'f6']
> ['f1', 'f2']
> ['f1', 'f2', '', 'f4', '', 'f6']
>
> On 2nd thought, I don'
"Khoa Nguyen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks for your reply. This looks promising, but I have a few more
questions:
> 1. If f(i) is non-terminal (e.g f(i) is another grammar expression),
> how would I adapt your idea to a more generic way?
> 2. The field deli
Am Mittwoch 17 Mai 2006 20:24 schrieb Heiko Wundram:
> If I'm not completely mistaken, parsers written using PyParsing can accept
> a small superset of all languages that an N/DFA can accept,
Okay, forget what I said about PyParsing here; using Forward(), you can create
recursion, but it took an
Am Mittwoch 17 Mai 2006 20:05 schrieb Khoa Nguyen:
>
> On 2nd thought, I don't think this will check for the correct order of
> the fields. For example, the following would be incorrectly accepted:
>
> f1,f5,f2 END_RECORD
>
> Thanks,
> Khoa
If I'm not completely mistaken, parsers written
>
> for tokens,start,end in commaSeparatedList.scanString(data):
> print tokens
>
>
> This returns:
>
> ['f1', 'f2', 'f3', 'f4', 'f5', 'f6']
> ['f1', 'f2']
> ['f1', 'f2', '', 'f4', '', 'f6']
>
Thanks for your reply. This looks promising, but I have a few more questions:
1. If f(i) is non-termi
> record = f1,f2,...,fn END_RECORD
> All the f(i) has to be in that order.
> Any f(i) can be absent (e.g. f1,,f3,f4,,f6 END_RECORD)
> Number of f(i)'s can vary. For example, the followings are allowed:
> f1,f2 END_RECORD
> f1,f2,,f4,,f6 END_RECORD
>
> Any suggestions?
>
>
>
> pyparsing in
"Khoa Nguyen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I am trying to come up with a grammar that describes the following:
record = f1,f2,...,fn END_RECORD
All the f(i) has to be in that order.
Any f(i) can be absent (e.g. f1,,f3,f4,,f6 END_RECORD)
Number of f(i)'s can vary. For
Am Mittwoch 17 Mai 2006 17:53 schrieb Heiko Wundram:
> If you're not limited to PyParsing, pyrr.ltk/ptk might be appropriate for
> you here (if you're used to bison/flex). The following file implements a
> small sample lexer/parser which does exactly what you need. pyrr.ltk (the
> lexing toolkit) i
Am Mittwoch 17 Mai 2006 17:24 schrieb Khoa Nguyen:
> Any suggestions?
If you're not limited to PyParsing, pyrr.ltk/ptk might be appropriate for you
here (if you're used to bison/flex). The following file implements a small
sample lexer/parser which does exactly what you need. pyrr.ltk (the lexin
I am trying to come up with a grammar that describes the following:
record = f1,f2,...,fn END_RECORD
All the f(i) has to be in that order.
Any f(i) can be absent (e.g. f1,,f3,f4,,f6 END_RECORD)
Number of f(i)'s can vary. For example, the followings are allowed:
f1,f2 END_RECORD
f1,f2,,f4,,f6 END_R
10 matches
Mail list logo