summaryrefslogtreecommitdiffstats
path: root/Grammar
Commit message (Collapse)AuthorAgeFilesLines
* Make 'as' an actual keyword when with's future statement is used. NotThomas Wouters2006-02-281-3/+3
| | | | actually necessary for functionality, but good for transition.
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - IMPORT_NAME takes an extra argument from the stack: the relativeness of the import. Only passed to __import__ when it's not -1. - __import__() takes an optional 5th argument for the same thing; it __defaults to -1 (old semantics: try relative, then absolute) - 'from . import name' imports name (be it module or regular attribute) from the current module's *package*. Likewise, 'from .module import name' will import name from a sibling to the current module. - Importing from outside a package is not allowed; 'from . import sys' in a toplevel module will not work, nor will 'from .. import sys' in a (single-level) package. - 'from __future__ import absolute_import' will turn on the new semantics for import and from-import: imports will be absolute, except for from-import with dots. Includes tests for regular imports and importhooks, parser changes and a NEWS item, but no compiler-package changes or documentation changes.
* PEP 343 -- the with-statement.Guido van Rossum2006-02-271-1/+3
| | | | | | | | | | | | | This was started by Mike Bland and completed by Guido (with help from Neal). This still needs a __future__ statement added; Thomas is working on Michael's patch for that aspect. There's a small amount of code cleanup and refactoring in ast.c, compile.c and ceval.c (I fixed the lltrace behavior when EXT_POP is used -- however I had to make lltrace a static global).
* PEP 308 implementation, including minor refdocs and some testcases. ItThomas Wouters2006-02-271-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | breaks the parser module, because it adds the if/else construct as well as two new grammar rules for backward compatibility. If no one else fixes parsermodule, I guess I'll go ahead and fix it later this week. The TeX code was checked with texcheck.py, but not rendered. There is actually a slight incompatibility: >>> (x for x in lambda:0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: iteration over non-sequence changes into >>> (x for x in lambda: 0) File "<stdin>", line 1 (x for x in lambda: 0) ^ SyntaxError: invalid syntax Since there's no way the former version can be useful, it's probably a bugfix ;)
* Implement change suggested by Jiwon Seo on python-dev.Neal Norwitz2006-02-241-1/+1
| | | | ['(' gen_for ')'] is redundant with test, so remove it.
* Wrap long lines in the grammarNeal Norwitz2005-12-181-9/+23
|
* SF patch #1355913, PEP 341 - Unification of try/except and try/finallyNeal Norwitz2005-12-171-2/+1
| | | | Modified since ast-arenas was implemented.
* Remove .cvsignore files, as they live in svn:ignoreMartin v. Löwis2005-10-301-3/+0
| | | | properties now.
* Fix SF bug #1167751, Argument genexp corner caseNeal Norwitz2005-10-211-1/+1
| | | | | | | | | | | | | Incorrect code was generated for: foo(a = i for i in range(10)) This should have generated a SyntaxError. Fix the Grammar so it raises a SyntaxError and test it. I'm uncertain whether this should be backported. It makes something that was Syntactically valid invalid. However, the code would either be completely broken or do the wrong thing.
* PEP 342 implementation. Per Guido's comments, the generator throw()Phillip J. Eby2005-08-021-3/+6
| | | | | method still needs to support string exceptions, and allow None for the third argument. Documentation updates are needed, too.
* Allow classes to be defined with empty parentheses. This means thatBrett Cannon2005-03-051-1/+1
| | | | ``class C(): pass`` is no longer a syntax error.
* SF patch #1007189, multi-line imports, for instance:Anthony Baxter2004-08-311-1/+5
| | | | | "from blah import (foo, bar baz, bongo)"
* This is Mark Russell's patch:Michael W. Hudson2004-08-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ 1009560 ] Fix @decorator evaluation order From the description: Changes in this patch: - Change Grammar/Grammar to require newlines between adjacent decorators. - Fix order of evaluation of decorators in the C (compile.c) and python (Lib/compiler/pycodegen.py) compilers - Add better order of evaluation check to test_decorators.py (test_eval_order) - Update the decorator documentation in the reference manual (improve description of evaluation order and update syntax description) and the comment: Used Brett's evaluation order (see http://mail.python.org/pipermail/python-dev/2004-August/047835.html) (I'm checking this in for Anthony who was having problems getting SF to talk to him)
* PEP-0318, @decorator-style. In Guido's words:Anthony Baxter2004-08-021-1/+3
| | | | | "@ seems the syntax that everybody can hate equally" Implementation by Mark Russell, from SF #979728.
* SF patch #872326: Generator expression implementationRaymond Hettinger2004-05-191-2/+7
| | | | | | | | | | | | | | (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.
* Patch #534304: Implement phase 1 of PEP 263.Martin v. Löwis2002-08-041-0/+3
|
* Disambiguate the grammar for backtick.Guido van Rossum2002-05-241-1/+3
| | | | | | The old syntax suggested that a trailing comma was OK inside backticks, but in fact (due to ideosyncrasies of pgen) it was not. Fix the grammar to avoid the ambiguity. Fred: you may want to update the refman.
* John Aycock correctly pointed out that the grammar forTim Peters2002-05-231-1/+1
| | | | "power" was formally ambiguous. Here's his fix.
* Very subtle syntax change: in a list comprehension, the testlist inGuido van Rossum2001-10-151-1/+2
| | | | | | | | | | | | | | | "for <var> in <testlist> may no longer be a single test followed by a comma. This solves SF bug #431886. Note that if the testlist contains more than one test, a trailing comma is still allowed, for maximum backward compatibility; but this example is not: [(x, y) for x in range(10), for y in range(10)] ^ The fix involved creating a new nonterminal 'testlist_safe' whose definition doesn't allow the trailing comma if there's only one test: testlist_safe: test [(',' test)+ [',']]
* Implement PEP 238 in its (almost) full glory.Guido van Rossum2001-08-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This introduces: - A new operator // that means floor division (the kind of division where 1/2 is 0). - The "future division" statement ("from __future__ import division) which changes the meaning of the / operator to implement "true division" (where 1/2 is 0.5). - New overloadable operators __truediv__ and __floordiv__. - New slots in the PyNumberMethods struct for true and floor division, new abstract APIs for them, new opcodes, and so on. I emphasize that without the future division statement, the semantics of / will remain unchanged until Python 3.0. Not yet implemented are warnings (default off) when / is used with int or long arguments. This has been on display since 7/31 as SF patch #443474. Flames to /dev/null.
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-181-1/+2
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* remove commented-out vestiges of access statementJeremy Hylton2001-02-271-5/+0
|
* Superseded by $(srcdir)/Makefile.pre.in.Neil Schemenauer2001-02-031-54/+0
|
* Fix typo: config.stat --> config.statusFred Drake2000-09-281-1/+1
|
* Support for three-token characters (**=, >>=, <<=) which was written byThomas Wouters2000-08-241-3/+4
| | | | | Michael Hudson, and support in general for the augmented assignment syntax. The graminit.c patch is large!
* Added note stating that the parser module will need updating for mostFred Drake2000-08-231-0/+7
| | | | changes to this file.
* require list comprehensions to start with a for clauseSkip Montanaro2000-08-221-1/+1
|
* PEP 214, Extended print Statement, has been accepted by the BDFL.Barry Warsaw2000-08-211-2/+2
| | | | | This change modifies Python's grammar to include the extended print form.
* Ignore Grammar/Makefile now that it's a made Makefile.Thomas Wouters2000-08-211-0/+1
|
* Apply SF patch #101135, adding 'import module as m' and 'from module importThomas Wouters2000-08-171-1/+3
| | | | | | | | name as n'. By doing some twists and turns, "as" is not a reserved word. There is a slight change in semantics for 'from module import name' (it will now honour the 'global' keyword) but only in cases that are explicitly undocumented.
* Fix up problems when compiling in a directory other than the sourceSjoerd Mullender2000-08-172-33/+54
| | | | directory.
* add dummy 'add2lib' target to Grammar/Makefile so non-GNU makes don't bail outTrent Mick2000-08-161-0/+3
| | | | | This closes patch: http://sourceforge.net/patch/index.php?func=detailpatch&patch_id=101176&group_id=5470
* list comprehensions. seeSkip Montanaro2000-08-121-1/+6
| | | | | | http://sourceforge.net/patch/?func=detailpatch&patch_id=100654&group_id=5470 for details.
* added .cvsignore so cvs doesn't complain about the generated graminit.h andSkip Montanaro2000-07-271-0/+2
| | | | graminit.c files.
* slightly modified version of Greg Ewing's extended call syntax patchJeremy Hylton2000-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | executive summary: Instead of typing 'apply(f, args, kwargs)' you can type 'f(*arg, **kwargs)'. Some file-by-file details follow. Grammar/Grammar: simplify varargslist, replacing '*' '*' with '**' add * & ** options to arglist Include/opcode.h & Lib/dis.py: define three new opcodes CALL_FUNCTION_VAR CALL_FUNCTION_KW CALL_FUNCTION_VAR_KW Python/ceval.c: extend TypeError "keyword parameter redefined" message to include the name of the offending keyword reindent CALL_FUNCTION using four spaces add handling of sequences and dictionaries using extend calls fix function import_from to use PyErr_Format
* Make first raise argument optionalGuido van Rossum1998-04-091-1/+1
|
* OK, ready to make 'assert' a keyword (instead of '__assert__').Guido van Rossum1997-04-161-1/+1
|
* Added __assert__ statement (later to be renamed)Guido van Rossum1997-04-021-1/+2
|
* Disable support for access statementGuido van Rossum1996-08-121-5/+6
|
* Changes for stride in slices (x[a:b:c]) and ellipses (x[a,...,z])Guido van Rossum1996-07-301-2/+4
|
* Added power (**) operatorGuido van Rossum1996-01-121-3/+4
|
* new grammar for 3rd raise arg and keyword parametersGuido van Rossum1995-07-071-3/+6
|
* changed import to support NAME.NAME...NAMEGuido van Rossum1995-01-071-1/+2
|
* Got rid of history (was beginning to get silly).Guido van Rossum1994-09-291-100/+10
| | | | Removed a few diagram breaks since Kees' program is now cleverer
* Added #diagram:... comments for Kees Blom's railroad diagram generatorGuido van Rossum1994-08-171-3/+19
|
* Bring alpha100 revision back to mainlineGuido van Rossum1994-08-011-3/+12
|
* Added (dummy) depend targetGuido van Rossum1993-12-281-0/+2
|
* Py -> IncludeGuido van Rossum1993-12-261-1/+1
|
* NoneGuido van Rossum1993-12-241-0/+28
|
* * Grammar: corrected old typo (class instead of 'class')Guido van Rossum1993-12-201-1/+1
| | | | | | | * dosmodule.c: MSDOS specific stuff from posixmodule.c. * posixmodule.c: removed all MSDOS specific stuff. * tokenizer.h, parsetok.h: in prototypes, don't mix named and unnamed parameters (MSC doesn't like this).