PageRenderTime 82ms CodeModel.GetById 41ms app.highlight 0ms RepoModel.GetById 40ms app.codeStats 0ms

/Lib/lib2to3/PatternGrammar.txt

http://unladen-swallow.googlecode.com/
Plain Text | 28 lines | 19 code | 9 blank | 0 comment | 0 complexity | 4b47e92dafaedf0ea24c8097b65797c4 MD5 | raw file
 1# Copyright 2006 Google, Inc. All Rights Reserved.
 2# Licensed to PSF under a Contributor Agreement.
 3
 4# A grammar to describe tree matching patterns.
 5# Not shown here:
 6# - 'TOKEN' stands for any token (leaf node)
 7# - 'any' stands for any node (leaf or interior)
 8# With 'any' we can still specify the sub-structure.
 9
10# The start symbol is 'Matcher'.
11
12Matcher: Alternatives ENDMARKER
13
14Alternatives: Alternative ('|' Alternative)*
15
16Alternative: (Unit | NegatedUnit)+
17
18Unit: [NAME '='] ( STRING [Repeater]
19                 | NAME [Details] [Repeater]
20                 | '(' Alternatives ')' [Repeater]
21                 | '[' Alternatives ']'
22		 )
23
24NegatedUnit: 'not' (STRING | NAME [Details] | '(' Alternatives ')')
25
26Repeater: '*' | '+' | '{' NUMBER [',' NUMBER] '}'
27
28Details: '<' Alternatives '>'