473,554 Members | 3,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ANN: pyparsing 1.5.1 released

I've just uploaded to SourceForge and PyPI the latest update to
pyparsing, version 1.5.1. It has been a couple of months since
1.5.0 was released, and a number of bug-fixes and enhancements
have accumulated in SVN, so time for a release!

Here's what's new in Pyparsing 1.5.1:

- Added __dir__() methods to ParseBaseExcept ion and ParseResults,
to support new dir() behavior in Py2.6 and Py3.0. If dir() is
called on a ParseResults object, the returned list will include
the base set of attribute names, plus any results names that are
defined.

- Added new helper method originalTextFor , to replace the use of
the current keepOriginalTex t parse action. The implementation
of originalTextFor is simpler and faster than keepOriginalTex t,
and does not depend on using the inspect or imp modules.

- Added failOn argument to SkipTo, so that grammars can define
literal strings or pyparsing expressions which, if found in the
skipped text, will cause SkipTo to fail. Useful to prevent
SkipTo from reading past terminating expression. Instigated by
question posed by Aki Niimura on the pyparsing wiki.

Pyparsing 1.5.1 also includes these bug-fixes (more details in
the CHANGES file included with the source distributions):

- Fixed bug in nestedExpr if multi-character expressions are given
for nesting delimiters.

- Removed dependency on xml.sax.saxutil s.escape, and included
internal implementation instead.

- Fixed typo in ParseResults.in sert.

- Fixed bug in '-' error stop, when '-' operator is used inside a
Combine expression.

- Reverted generator expression to use list comprehension, for
better compatibility with Python 2.3.

- Fixed bug in parseString(par seAll=True), when the input string
ends with a comment or whitespace.

- Fixed bug in LineStart and LineEnd that did not recognize any
special whitespace chars defined using ParserElement.s etDefault-
WhitespaceChars .

- Forward class is now more tolerant of subclassing.

(Python 3.0 uses syntax for catching exceptions that is incompatible
with Python versions pre 2.6, so there is no way for me to support
both existing Python releases and Python 3.0 with a common source code
base. For those who wish to try out pyparsing with Python 3.0, there
is a file pyparsing_py3.p y in the SourceForge Subversion repository.
I have done some testing of this code, but many of my unit tests
still
need to be converted to Python 3.)

Download pyparsing 1.5.1 at http://sourceforge.net/projects/pyparsing/.
The pyparsing Wiki is at http://pyparsing.wikispaces.com

-- Paul

=============== =============== ==========
Pyparsing is a pure-Python class library for quickly developing
recursive-descent parsers. Parser grammars are assembled directly in
the calling Python code, using classes such as Literal, Word,
OneOrMore, Optional, etc., combined with operators '+', '|', and '^'
for And, MatchFirst, and Or. No separate code-generation or external
files are required. Pyparsing can be used in many cases in place of
regular expressions, with shorter learning curve and greater
readability and maintainability . Pyparsing comes with a number of
parsing examples, including:
- "Hello, World!" (English, Korean, Greek, and Spanish)
- chemical formulas
- configuration file parser
- web page URL extractor
- 5-function arithmetic expression parser
- subset of CORBA IDL
- chess portable game notation
- simple SQL parser
- Mozilla calendar file parser
- EBNF parser/compiler
- Python value string parser (lists, dicts, tuples, with nesting)
(safe alternative to eval)
- HTML tag stripper
- S-expression parser
- macro substitution preprocessor
- TAP output parser
Oct 18 '08 #1
5 1478
Paul McGuire wrote:
I've just uploaded to SourceForge and PyPI the latest update to
(Python 3.0 uses syntax for catching exceptions that is incompatible
with Python versions pre 2.6, so there is no way for me to support
both existing Python releases and Python 3.0 with a common source code
base.
I thought 2to3.py was supposed to make that change automatically. Have
you tried it and found it not to work?

tjr

Oct 18 '08 #2
On Oct 18, 1:05*pm, Terry Reedy <tjre...@udel.e duwrote:
Paul McGuire wrote:
I've just uploaded to SourceForge and PyPI the latest update to
(Python 3.0 uses syntax for catching exceptions that is incompatible
with Python versions pre 2.6, so there is no way for me to support
both existing Python releases and Python 3.0 with a common source code
base.

I thought 2to3.py was supposed to make that change automatically. Have
you tried it and found it not to work?

tjr
Please re-read my caveat. What I said was (or tried to anyway) was
that I cannot write a source file that will work on 2.4, 2.5, 2.6, and
3.0. Actually, it was very close - but for the change in the "except"
syntax, I could actually have pulled it off.

I should probably use 2to3.py on my unit tests, so that my Py3 version
of pyparsing can get tested more fully. I'll also use 2to3.py on
pyparsing.py itself, it will make it easier to maintain the Py3 source
version. (I'll still have to keep and support two different source
versions though, pity.)

-- Paul
Oct 19 '08 #3
Paul McGuire wrote in
news:bf******** *************** ***********@y21 g2000hsf.google groups.com
in comp.lang.pytho n:
On Oct 18, 1:05*pm, Terry Reedy <tjre...@udel.e duwrote:
>Paul McGuire wrote:
I've just uploaded to SourceForge and PyPI the latest update to
(Python 3.0 uses syntax for catching exceptions that is
incompatible with Python versions pre 2.6, so there is no way for
me to support both existing Python releases and Python 3.0 with a
common source code base.

I thought 2to3.py was supposed to make that change automatically.
Have you tried it and found it not to work?

tjr

Please re-read my caveat. What I said was (or tried to anyway) was
that I cannot write a source file that will work on 2.4, 2.5, 2.6, and
3.0. Actually, it was very close - but for the change in the "except"
syntax, I could actually have pulled it off.

I should probably use 2to3.py on my unit tests, so that my Py3 version
of pyparsing can get tested more fully. I'll also use 2to3.py on
pyparsing.py itself, it will make it easier to maintain the Py3 source
version. (I'll still have to keep and support two different source
versions though, pity.)
AIUI the idea is that you write your 2.x python code (and tests) so
that when they are processed by 2to3.py you get valid python 3.x
code that will pass all its tests.

You then maintain your 2.x code base adding another test where the
code (and tests) is run through 2to3.py and then python 3.x runs
the test suite.

Presumably you only need to start maintining a 3.x code base when
you start adding 3.x specific features or abandon support for
2.x python.

Rob.
--
http://www.victim-prime.dsl.pipex.com/
Oct 19 '08 #4
On Oct 17, 11:14*pm, Paul McGuire <pt...@austin.r r.comwrote:
>
(Python 3.0 uses syntax for catching exceptions that is incompatible
with Python versions pre 2.6, so there is no way for me to support
both existing Python releases and Python 3.0 with a common source code
base. *For those who wish to try out pyparsing with Python 3.0, there
is a file pyparsing_py3.p y in the SourceForge Subversion repository.
I have done some testing of this code, but many of my unit tests
still
need to be converted to Python 3.)
As mentioned above it should be easy to convert this at release time
by running "2to3 -f except pyparsing.py". (Do tell me if you have any
feedback; I'm maintaining it at the moment.)
Oct 20 '08 #5
Rob Williscroft wrote:
AIUI the idea is that you write your 2.x python code (and tests) so
that when they are processed by 2to3.py you get valid python 3.x
code that will pass all its tests.

You then maintain your 2.x code base adding another test where the
code (and tests) is run through 2to3.py and then python 3.x runs
the test suite.

Presumably you only need to start maintining a 3.x code base when
you start adding 3.x specific features or abandon support for
2.x python.
http://wiki.python.org/moin/Early2to3Migrations

reports some early experiences (some a year old). Martin's was edited
most recently, but even his report misses recent changes to 2to3.

Oct 20 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2338
by: Lukas Holcik | last post by:
Hi everyone! How can I simply search text for regexps (lets say <a href="(.*?)">(.*?)</a>) and save all URLs(1) and link contents(2) in a dictionary { name : URL}? In a single pass if it could. Or how can I replace the html &entities; in a string "blablabla&amp;blablabal&amp;balbalbal" with the chars they mean using re.sub? I found out they are...
3
1927
by: Berteun Damman | last post by:
Hello, I'm having some problems with pyparsing, I could not find how to tell it to view certain words as keywords, i.e. not as a possible variable name (in an elegant way), for example, I have this little grammar: terminator = Literal(";") expr = Word(alphas) body = Forward();
3
1458
by: Paul McGuire | last post by:
"The best laid plans o' mice an' men / Gang aft a-gley" So said Robert Burns (who really should do something about that speech impediment!). And so said I about 6 weeks ago, when I thought that I would leave pyparsing alone for awhile, after the 1.3.1 release. Well, here we are, and I'm announcing the 1.3.2 release, with some changes...
6
1389
by: Chad Z. Hower aka Kudzu | last post by:
I debated over whether or not to post this on the .ann group or not. Its not an announcement as I am really looking for feedback only on the asp.net relative portions. This does of course require the user visit web pages about a product for ASP.net. We have recently released an ASP.net related product. I say released - but it has not been...
13
2048
by: 7stud | last post by:
To the developer: 1) I went to the pyparsing wiki to download the pyparsing module and try it 2) At the wiki, there was no index entry in the table of contents for Downloads. After searching around a bit, I finally discovered a tiny link buried in some text at the top of the home page. 3) Link goes to sourceforge. At sourceforge, there...
0
898
by: Lee Harr | last post by:
TZMud is a Python MUD server. http://tzmud.googlecode.com/ A MUD is a text-based virtual environment accessed via telnet, or with a specialized MUD client. TZMud development is still in early stages, focusing on API and server stability.
4
5261
by: Marek Kubica | last post by:
Hi, I am trying to get this stuff working, but I still fail. I have a format which consists of three elements: \d{4}M?-\d (4 numbers, optional M, dash, another number) EMPTY (the <EMPTYtoken) (the <PAGEBREAKtoken. The line may contain whitespaces, but nothing else)
1
942
by: oyster | last post by:
but the pyparsing.py in pyparsing-1.5.1.tar.gz is marked as 2008-10-02 I think it is good too touch all the files' time up-to-date.
0
1105
by: Lee Harr | last post by:
TZMud is a Python MUD server. http://tzmud.googlecode.com/ A MUD is a text-based virtual environment accessed via telnet, or with a specialised MUD client. TZMud development is still in early stages, focusing on API and server stability.
0
7584
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7783
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7876
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6128
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5424
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5143
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
827
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.