[PATCH] RE: J2 decorator grammar

Michael Sparks zathras at thwackety.com
Sun Aug 22 10:01:39 EDT 2004


Anthony Baxter wrote:

> On Sun, 22 Aug 2004 11:05:35 +0100 (BST), Michael Sparks
> <zathras at thwackety.com> wrote:
>> 
>> 
>> On Sun, 22 Aug 2004, Anthony Baxter wrote:
>> > On Sun, 22 Aug 2004 01:41:58 +0100 (BST), Michael Sparks wrote
>> > > The patch can be found here:
>> > >    * http://thwackety.com/decorator_syntax_J2.patch
>> >
>> > Good to see. There's a few more bits than this that need to be
>> > done, though - see http://www.python.org/sf/979728 for the original
>> > @decorator patch, this should show you what else needs to be
>> > changed.
>> 
>> Many thanks for the pointer. I'll try and make sure I cover all the
>> bases, but I suspect I'll miss something, but I'll try not to :)
> 
> Well, in the comments for that patch, I listed all of the files changed by
> the @syntax - that at least gives you a 'to-do list' to work through.

That's what I'm doing - I'm also working through the patch itself to see
what needs changing. So far my changes include:
   * Doc/lib/libfuncs.tex - Changed examples from @ format
     to decorate: format
   * Doc/ref/ref7.tex 
      - changed Function Definitions production rules to match
        the change in syntax.
      - Changed example to use the change in syntax.
   * Lib/compiler/transformer.py - Modified to handle the new syntax
   * Lib/test/test_parser.py - Changed tests for old syntax to check new
     form
   * Lib/test/tokenize_tests.txt - changed @staticmethod to J2 format
   * Lib/test/output/test_tokenize - Changed to match the changed test file
   * Modules/parsermodule.c - Changed to support new Grammar
   * Lib/test/pyclbr_input.py - Changed from @ syntax to decorate: syntax
   * Lib/test/test_decorators.py - changed all "decorate" functions to
     decorate_ and all @ usages to "decorate:" syntax.

Stuff I've not changed after checking:
   * Doc/lib/asttable.tex - Can't see any necessary changes
   * Lib/compiler/pycodegen.py - Can't see any necessary changes
   * Lib/compiler/symbols.py - Can't see any necessary changes
   * Tools/compiler/ast.txt - Can't see any necessary changes
   * Tools/compiler/astgen.py - Can't see any necessary changes
   * Tools/compiler/regrtest.py - No changes
   * I can't see whether ast.py should/should not be changed and
     if it should, *how* it should be changed, as a result I've left
     well alone.

Current Issues (which I want to resolve before posting to SF):
   * Keyword clash with test suite is bad - suggest change to "using"
     to limit clash with existing user code as far as possible.
     (Also "def decorate python" shows *lots* of results on google, which
     is the other reason :)
   * Patch is against the vanilla 2.4a2 download from python.org, does
     this need changing to being a patch against the current CVS head?
     (I suspect the answer to this is "yes")

It should be done sometime this afternoon though. (Bulk of the time taken up
is on re-running the test suite unsuprisingly)

> Once you've got what you think is the complete set, create a patch and
> post it to SF.

Will do.

Best Regards,


Michael.




More information about the Python-list mailing list