Add missing issue number in Misc/NEWS entry.
[python.git] / Lib / lib2to3 / PatternGrammar.txt
blob36bf8148273bd7a27b4a76817a776fe2ab234562
1 # Copyright 2006 Google, Inc. All Rights Reserved.
2 # Licensed to PSF under a Contributor Agreement.
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.
10 # The start symbol is 'Matcher'.
12 Matcher: Alternatives ENDMARKER
14 Alternatives: Alternative ('|' Alternative)*
16 Alternative: (Unit | NegatedUnit)+
18 Unit: [NAME '='] ( STRING [Repeater]
19                  | NAME [Details] [Repeater]
20                  | '(' Alternatives ')' [Repeater]
21                  | '[' Alternatives ']'
22                  )
24 NegatedUnit: 'not' (STRING | NAME [Details] | '(' Alternatives ')')
26 Repeater: '*' | '+' | '{' NUMBER [',' NUMBER] '}'
28 Details: '<' Alternatives '>'