/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following functions.
- yyparse
- aggr_mtderror
1 %{
2 /*
3 filename: aggr_mtd.y
4
5 description:
6 Defines the grammar for an RPSL aggr-mtd attribute. It was mostly
7 stolen from the IRRToolSet, simplified by removing ability to parse
8 things defined by a dictionary (we use XML for extensibility rather
9 than a dictionary).
10
11 notes:
12 Defines tokens for the associated lexer, aggr_mtd.l.
13 */
14 %}
15
16 %token KEYW_INBOUND KEYW_OUTBOUND
17 %token OP_OR OP_AND
18 %token KEYW_EXCEPT
19 %token TKN_ASNO TKN_ASNAME
20
21 %{
22 #include <stdio.h>
23 #include <stdarg.h>
24 #include <stdlib.h>
25
26 int yyerror(const char *s);
27
28 %}
29
30 %%
/* [<][>][^][v][top][bottom][index][help] */
31
32 aggr_mtd: KEYW_INBOUND
33 | KEYW_OUTBOUND opt_as_expr
34 ;
35
36 opt_as_expr:
37 | as_expr
38 ;
39
40 as_expr: as_expr OP_OR as_expr_term
41 | as_expr_term
42 ;
43
44 as_expr_term: as_expr_term OP_AND as_expr_factor
45 | as_expr_term KEYW_EXCEPT as_expr_factor
46 | as_expr_factor
47 ;
48
49 as_expr_factor: '(' as_expr ')'
50 | as_expr_operand
51 ;
52
53 as_expr_operand: TKN_ASNO
54 | TKN_ASNAME
55 ;
56
57 %%
58
59 #undef aggr_mtderror
60 #undef yyerror
61
62 int
63 aggr_mtderror (const char *s)
/* [<][>][^][v][top][bottom][index][help] */
64 {
65 yyerror(s);
66 return 0;
67 }
68
69