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