Ply

Latest version: v3.11

Safety actively analyzes 625726 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 5

3.5

---------------------
04/21/15: beazley
Added support for defaulted_states in the parser. A
defaulted_state is a state where the only legal action is a
reduction of a single grammar rule across all valid input
tokens. For such states, the rule is reduced and the
reading of the next lookahead token is delayed until it is
actually needed at a later point in time.

This delay in consuming the next lookahead token is a
potentially important feature in advanced parsing
applications that require tight interaction between the
lexer and the parser. For example, a grammar rule change
modify the lexer state upon reduction and have such changes
take effect before the next input token is read.

*** POTENTIAL INCOMPATIBILITY ***
One potential danger of defaulted_states is that syntax
errors might be deferred to a a later point of processing
than where they were detected in past versions of PLY.
Thus, it's possible that your error handling could change
slightly on the same inputs. defaulted_states do not change
the overall parsing of the input (i.e., the same grammar is
accepted).

If for some reason, you need to disable defaulted states,
you can do this:

parser = yacc.yacc()
parser.defaulted_states = {}

04/21/15: beazley
Fixed debug logging in the parser. It wasn't properly reporting goto states
on grammar rule reductions.

04/20/15: beazley
Added actions to be defined to character literals (Issue 32). For example:

literals = [ '{', '}' ]

def t_lbrace(t):
r'\{'
Some action
t.type = '{'
return t

def t_rbrace(t):
r'\}'
Some action
t.type = '}'
return t

04/19/15: beazley
Import of the 'parsetab.py' file is now constrained to only consider the
directory specified by the outputdir argument to yacc(). If not supplied,
the import will only consider the directory in which the grammar is defined.
This should greatly reduce problems with the wrong parsetab.py file being
imported by mistake. For example, if it's found somewhere else on the path
by accident.

*** POTENTIAL INCOMPATIBILITY *** It's possible that this might break some
packaging/deployment setup if PLY was instructed to place its parsetab.py
in a different location. You'll have to specify a proper outputdir= argument
to yacc() to fix this if needed.

04/19/15: beazley
Changed default output directory to be the same as that in which the
yacc grammar is defined. If your grammar is in a file 'calc.py',
then the parsetab.py and parser.out files should be generated in the
same directory as that file. The destination directory can be changed
using the outputdir= argument to yacc().

04/19/15: beazley
Changed the parsetab.py file signature slightly so that the parsetab won't
regenerate if created on a different major version of Python (ie., a
parsetab created on Python 2 will work with Python 3).

04/16/15: beazley
Fixed Issue 44 call_errorfunc() should return the result of errorfunc()

04/16/15: beazley
Support for versions of Python <2.7 is officially dropped. PLY may work, but
the unit tests requires Python 2.7 or newer.

04/16/15: beazley
Fixed bug related to calling yacc(start=...). PLY wasn't regenerating the
table file correctly for this case.

04/16/15: beazley
Added skipped tests for PyPy and Java. Related to use of Python's -O option.

05/29/13: beazley
Added filter to make unit tests pass under 'python -3'.
Reported by Neil Muller.

05/29/13: beazley
Fixed CPP_INTEGER regex in ply/cpp.py (Issue 21).
Reported by vbraun.

05/29/13: beazley
Fixed yacc validation bugs when from __future__ import unicode_literals
is being used. Reported by Kenn Knowles.

05/29/13: beazley
Added support for Travis-CI. Contributed by Kenn Knowles.

05/29/13: beazley
Added a .gitignore file. Suggested by Kenn Knowles.

05/29/13: beazley
Fixed validation problems for source files that include a
different source code encoding specifier. Fix relies on
the inspect module. Should work on Python 2.6 and newer.
Not sure about older versions of Python.
Contributed by Michael Droettboom

05/21/13: beazley
Fixed unit tests for yacc to eliminate random failures due to dict hash value
randomization in Python 3.3
Reported by Arfrever

10/15/12: beazley
Fixed comment whitespace processing bugs in ply/cpp.py.
Reported by Alexei Pososin.

10/15/12: beazley
Fixed token names in ply/ctokens.py to match rule names.
Reported by Alexei Pososin.

04/26/12: beazley
Changes to functions available in panic mode error recover. In previous versions
of PLY, the following global functions were available for use in the p_error() rule:

yacc.errok() Reset error state
yacc.token() Get the next token
yacc.restart() Reset the parsing stack

The use of global variables was problematic for code involving multiple parsers
and frankly was a poor design overall. These functions have been moved to methods
of the parser instance created by the yacc() function. You should write code like
this:

def p_error(p):
...
parser.errok()

parser = yacc.yacc()

*** POTENTIAL INCOMPATIBILITY *** The original global functions now issue a
DeprecationWarning.

04/19/12: beazley
Fixed some problems with line and position tracking and the use of error
symbols. If you have a grammar rule involving an error rule like this:

def p_assignment_bad(p):
'''assignment : location EQUALS error SEMI'''
...

You can now do line and position tracking on the error token. For example:

def p_assignment_bad(p):
'''assignment : location EQUALS error SEMI'''
start_line = p.lineno(3)
start_pos = p.lexpos(3)

If the trackng=True option is supplied to parse(), you can additionally get
spans:

def p_assignment_bad(p):
'''assignment : location EQUALS error SEMI'''
start_line, end_line = p.linespan(3)
start_pos, end_pos = p.lexspan(3)

Note that error handling is still a hairy thing in PLY. This won't work
unless your lexer is providing accurate information. Please report bugs.
Suggested by a bug reported by Davis Herring.

04/18/12: beazley
Change to doc string handling in lex module. Regex patterns are now first
pulled from a function's .regex attribute. If that doesn't exist, then
.doc is checked as a fallback. The TOKEN decorator now sets the .regex
attribute of a function instead of its doc string.
Changed suggested by Kristoffer Ellersgaard Koch.

04/18/12: beazley
Fixed issue 1: Fixed _tabversion. It should use __tabversion__ instead of __version__
Reported by Daniele Tricoli

04/18/12: beazley
Fixed issue 8: Literals empty list causes IndexError
Reported by Walter Nissen.

04/18/12: beazley
Fixed issue 12: Typo in code snippet in documentation
Reported by florianschanda.

04/18/12: beazley
Fixed issue 10: Correctly escape t_XOREQUAL pattern.
Reported by Andy Kittner.

3.4

---------------------
02/17/11: beazley
Minor patch to make cpp.py compatible with Python 3. Note: This
is an experimental file not currently used by the rest of PLY.

02/17/11: beazley
Fixed setup.py trove classifiers to properly list PLY as
Python 3 compatible.

01/02/11: beazley
Migration of repository to github.

3.3

-----------------------------
08/25/09: beazley
Fixed issue 15 related to the set_lineno() method in yacc. Reported by
mdsherry.

08/25/09: beazley
Fixed a bug related to regular expression compilation flags not being
properly stored in lextab.py files created by the lexer when running
in optimize mode. Reported by Bruce Frederiksen.

3.2

-----------------------------
03/24/09: beazley
Added an extra check to not print duplicated warning messages
about reduce/reduce conflicts.

03/24/09: beazley
Switched PLY over to a BSD-license.

03/23/09: beazley
Performance optimization. Discovered a few places to make
speedups in LR table generation.

03/23/09: beazley
New warning message. PLY now warns about rules never
reduced due to reduce/reduce conflicts. Suggested by
Bruce Frederiksen.

03/23/09: beazley
Some clean-up of warning messages related to reduce/reduce errors.

03/23/09: beazley
Added a new picklefile option to yacc() to write the parsing
tables to a filename using the pickle module. Here is how
it works:

yacc(picklefile="parsetab.p")

This option can be used if the normal parsetab.py file is
extremely large. For example, on jython, it is impossible
to read parsing tables if the parsetab.py exceeds a certain
threshold.

The filename supplied to the picklefile option is opened
relative to the current working directory of the Python
interpreter. If you need to refer to the file elsewhere,
you will need to supply an absolute or relative path.

For maximum portability, the pickle file is written
using protocol 0.

03/13/09: beazley
Fixed a bug in parser.out generation where the rule numbers
where off by one.

03/13/09: beazley
Fixed a string formatting bug with one of the error messages.
Reported by Richard Reitmeyer

3.1

-----------------------------
02/28/09: beazley
Fixed broken start argument to yacc(). PLY-3.0 broke this
feature by accident.

02/28/09: beazley
Fixed debugging output. yacc() no longer reports shift/reduce
or reduce/reduce conflicts if debugging is turned off. This
restores similar behavior in PLY-2.5. Reported by Andrew Waters.

3.0

-----------------------------
02/03/09: beazley
Fixed missing lexer attribute on certain tokens when
invoking the parser p_error() function. Reported by
Bart Whiteley.

02/02/09: beazley
The lex() command now does all error-reporting and diagonistics
using the logging module interface. Pass in a Logger object
using the errorlog parameter to specify a different logger.

02/02/09: beazley
Refactored ply.lex to use a more object-oriented and organized
approach to collecting lexer information.

02/01/09: beazley
Removed the nowarn option from lex(). All output is controlled
by passing in a logger object. Just pass in a logger with a high
level setting to suppress output. This argument was never
documented to begin with so hopefully no one was relying upon it.

02/01/09: beazley
Discovered and removed a dead if-statement in the lexer. This
resulted in a 6-7% speedup in lexing when I tested it.

01/13/09: beazley
Minor change to the procedure for signalling a syntax error in a
production rule. A normal SyntaxError exception should be raised
instead of yacc.SyntaxError.

01/13/09: beazley
Added a new method p.set_lineno(n,lineno) that can be used to set the
line number of symbol n in grammar rules. This simplifies manual
tracking of line numbers.

01/11/09: beazley
Vastly improved debugging support for yacc.parse(). Instead of passing
debug as an integer, you can supply a Logging object (see the logging
module). Messages will be generated at the ERROR, INFO, and DEBUG
logging levels, each level providing progressively more information.
The debugging trace also shows states, grammar rule, values passed
into grammar rules, and the result of each reduction.

01/09/09: beazley
The yacc() command now does all error-reporting and diagnostics using
the interface of the logging module. Use the errorlog parameter to
specify a logging object for error messages. Use the debuglog parameter
to specify a logging object for the 'parser.out' output.

01/09/09: beazley
*HUGE* refactoring of the the ply.yacc() implementation. The high-level
user interface is backwards compatible, but the internals are completely
reorganized into classes. No more global variables. The internals
are also more extensible. For example, you can use the classes to
construct a LALR(1) parser in an entirely different manner than
what is currently the case. Documentation is forthcoming.

01/07/09: beazley
Various cleanup and refactoring of yacc internals.

01/06/09: beazley
Fixed a bug with precedence assignment. yacc was assigning the precedence
each rule based on the left-most token, when in fact, it should have been
using the right-most token. Reported by Bruce Frederiksen.

11/27/08: beazley
Numerous changes to support Python 3.0 including removal of deprecated
statements (e.g., has_key) and the additional of compatibility code
to emulate features from Python 2 that have been removed, but which
are needed. Fixed the unit testing suite to work with Python 3.0.
The code should be backwards compatible with Python 2.

11/26/08: beazley
Loosened the rules on what kind of objects can be passed in as the
"module" parameter to lex() and yacc(). Previously, you could only use
a module or an instance. Now, PLY just uses dir() to get a list of
symbols on whatever the object is without regard for its type.

11/26/08: beazley
Changed all except: statements to be compatible with Python2.x/3.x syntax.

11/26/08: beazley
Changed all raise Exception, value statements to raise Exception(value) for
forward compatibility.

11/26/08: beazley
Removed all print statements from lex and yacc, using sys.stdout and sys.stderr
directly. Preparation for Python 3.0 support.

11/04/08: beazley
Fixed a bug with referring to symbols on the the parsing stack using negative
indices.

05/29/08: beazley
Completely revamped the testing system to use the unittest module for everything.
Added additional tests to cover new errors/warnings.

Page 2 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.