766fc4bd2cfa6c06ab056cf332904dc58f5101d9
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / antlr / LeafRefPathParser.g4
1 parser grammar LeafRefPathParser;
2
3 @header {
4 package org.opendaylight.yangtools.antlrv4.code.gen;
5 }
6
7 options {
8  tokenVocab = LeafRefPathLexer;
9 }
10
11 path_arg : absolute_path | relative_path;
12
13 absolute_path : (SLASH node_identifier (path_predicate)*)+;
14
15 relative_path : (DOTS SLASH)* descendant_path;
16
17 descendant_path : node_identifier ((path_predicate)* absolute_path)?;
18
19 path_predicate : LEFT_SQUARE_BRACKET SEP? path_equality_expr SEP? RIGHT_SQUARE_BRACKET;
20
21 path_equality_expr : node_identifier SEP? EQUAL SEP? path_key_expr;
22
23 path_key_expr : current_function_invocation SEP? SLASH SEP? rel_path_keyexpr;
24
25 rel_path_keyexpr : (DOTS SEP? SLASH SEP?)* (node_identifier SEP? SLASH SEP?)* node_identifier;
26
27 node_identifier : (prefix COLON)? identifier;
28
29 current_function_invocation : CURRENT_KEYWORD SEP? LEFT_PARENTHESIS SEP? RIGHT_PARENTHESIS;
30
31 prefix : identifier;
32
33 identifier: IDENTIFIER | CURRENT_KEYWORD;
34