Re: pyparsing question: single word values with a double quoted string every once in a while

2009-05-27 Thread Piet van Oostrum
hubritic colinland...@gmail.com (h) wrote: h I want to parse a log that has entries like this: h [2009-03-17 07:28:05.545476 -0500] rprt s=d2bpr80d6 m=2 mod=mail h cmd=msg module=access rule=x_dynamic_ip action=discard attachments=0 h rcpts=1 h

pyparsing question: single word values with a double quoted string every once in a while

2009-05-19 Thread hubritic
I want to parse a log that has entries like this: [2009-03-17 07:28:05.545476 -0500] rprt s=d2bpr80d6 m=2 mod=mail cmd=msg module=access rule=x_dynamic_ip action=discard attachments=0 rcpts=1 routes=DL_UK_ALL,NOT_DL_UK_ALL,default_inbound,firewallsafe,mail01_mail02,spfsafe size=4363

Pyparsing Question

2008-05-16 Thread Ant
Hi all, I have a question on PyParsing. I am trying to create a parser for a hierarchical todo list format, but have hit a stumbling block. I have parsers for the header of the list (title and description), and the body (recursive descent on todo items). Individually they are working fine,

Re: Pyparsing Question

2008-05-16 Thread Paul McGuire
On May 16, 6:43 am, Ant [EMAIL PROTECTED] wrote: Hi all, I have a question on PyParsing. I am trying to create a parser for a hierarchical todo list format, but have hit a stumbling block. I have parsers for the header of the list (title and description), and the body (recursive descent on

Re: Pyparsing Question

2008-05-16 Thread castironpi
On May 16, 6:43 am, Ant [EMAIL PROTECTED] wrote: Hi all, I have a question on PyParsing. I am trying to create a parser for a hierarchical todo list format, but have hit a stumbling block. I have parsers for the header of the list (title and description), and the body (recursive descent on

Re: Pyparsing Question

2008-05-16 Thread Ant
Hi Paul, LineStart *really* wants to be parsed at the beginning of a line. Your textline reads up to but not including the LineEnd. Try making these changes. 1. Change textline to: textline = pp.Combine( pp.Group(pp.Word(pp.alphas, pp.printables) + pp.restOfLine)) + \

Re: Pyparsing Question

2008-05-16 Thread castironpi
On May 16, 10:45 am, Ant [EMAIL PROTECTED] wrote: Hi Paul, LineStart *really* wants to be parsed at the beginning of a line. Your textline reads up to but not including the LineEnd.  Try making these changes. 1. Change textline to:      textline = pp.Combine(        

Re: pyparsing question

2008-01-02 Thread hubritic
On Jan 1, 4:18 pm, John Machin [EMAIL PROTECTED] wrote: On Jan 2, 10:32 am, hubritic [EMAIL PROTECTED] wrote: The data I have has a fixed number of characters per field, so I could split it up that way, but wouldn't that defeat the purpose of using a parser? The purpose of a parser is to

Re: pyparsing question

2008-01-02 Thread Paul McGuire
On Jan 1, 5:32 pm, hubritic [EMAIL PROTECTED] wrote: I am trying to parse data that looks like this: IDENTIFIER    TIMESTAMP   T  C   RESOURCE_NAME   DESCRIPTION 2BFA76F6     1208230607   T   S   SYSPROC                    SYSTEM SHUTDOWN BY USER A6D1BD62   1215230807     I H                

pyparsing question

2008-01-01 Thread hubritic
I am trying to parse data that looks like this: IDENTIFIERTIMESTAMP T C RESOURCE_NAME DESCRIPTION 2BFA76F6 1208230607 T S SYSPROCSYSTEM SHUTDOWN BY USER A6D1BD62 1215230807 I HFirmware Event My problem is

Re: pyparsing question

2008-01-01 Thread Neil Cerutti
On Jan 1, 2008 6:32 PM, hubritic [EMAIL PROTECTED] wrote: I am trying to parse data that looks like this: IDENTIFIERTIMESTAMP T C RESOURCE_NAME DESCRIPTION 2BFA76F6 1208230607 T S SYSPROCSYSTEM SHUTDOWN BY USER A6D1BD62 1215230807 I H

Re: pyparsing question

2008-01-01 Thread Neil Cerutti
On Jan 1, 2008 6:54 PM, Neil Cerutti [EMAIL PROTECTED] wrote: There's no standard Python tool for reading and writing fixed-length field flatfile data files, but it's pretty simple to use named slices to get at the data. identifier = slice(0, 8) timestamp = slice(8, 18) t = slice(18, 21)

Re: pyparsing question

2008-01-01 Thread John Machin
On Jan 2, 10:32 am, hubritic [EMAIL PROTECTED] wrote: The data I have has a fixed number of characters per field, so I could split it up that way, but wouldn't that defeat the purpose of using a parser? The purpose of a parser is to parse. Data in fixed columns does not need parsing. I am

Re: Pyparsing Question.

2006-11-23 Thread Ant
Welcome to pyparsing! The simplest way to implement a markup processor in pyparsing is to define the grammar of the markup, attach a parse action to each markup type to convert the original markup to the actual results, and then use transformString to run through the input and do the

Pyparsing Question.

2006-11-22 Thread Ant
I have a home-grown Wiki that I created as an excercise, with it's own wiki markup (actually just a clone of the Trac wiki markup). The wiki text parser I wrote works nicely, but makes heavy use of regexes, tags and stacks to parse the text. As such it is a bit of a mantainability nightmare -

Re: Pyparsing Question.

2006-11-22 Thread Stefan Behnel
Ant wrote: So I thought I'd look into the pyparsing module, but can't find a simple example of processing random text. Have you looked at the examples on the pyparsing web page? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyparsing Question.

2006-11-22 Thread Paul McGuire
Ant [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a home-grown Wiki that I created as an excercise, with it's own wiki markup (actually just a clone of the Trac wiki markup). The wiki text parser I wrote works nicely, but makes heavy use of regexes, tags and stacks to parse