]> gerrit.simantics Code Review - simantics/fmil.git/blob - org.simantics.fmil.core/native/FMILibrary/src/XML/src/FMI2/fmi2_xml_variable_name_parser.y
Switch to full JavaSE-11+ compatibility
[simantics/fmil.git] / org.simantics.fmil.core / native / FMILibrary / src / XML / src / FMI2 / fmi2_xml_variable_name_parser.y
1 /*\r
2     Copyright (C) 2012 Modelon AB\r
3 \r
4     This program is free software: you can redistribute it and/or modify\r
5     it under the terms of the BSD style license.\r
6 \r
7      This program is distributed in the hope that it will be useful,\r
8     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
10     FMILIB_License.txt file for more details.\r
11 \r
12     You should have received a copy of the FMILIB_License.txt file\r
13     along with this program. If not, contact Modelon AB <http://www.modelon.com>.\r
14 */\r
15 \r
16 /* http://www.gnu.org/software/bison/manual/bison.html#Decl-Summary */\r
17 %{\r
18 \r
19 /*\r
20 #define YYDEBUG 1\r
21 int yydebug = 1;\r
22 */\r
23 \r
24 #include <stdio.h>\r
25 #include "fmi2_xml_variable_name_parser.tab.h"\r
26 #include "fmi2_xml_variable_name_lex.h"\r
27 \r
28 #define MODULE "FMI2XML"\r
29 #include <JM/jm_portability.h>\r
30 \r
31 void yyfmi2error(yyscan_t* scanner, jm_callbacks* cb, char* name, char const *msg)\r
32 {\r
33         jm_log_error(cb, MODULE, "Invalid structured ScalarVariable name \"%s\": %s", name, msg);\r
34 }\r
35 \r
36 %}\r
37 \r
38 %require "2.7"\r
39 %expect 0 //Declare the expected number of shift-reduce conflicts\r
40 \r
41 %error-verbose\r
42 \r
43 %define api.pure full\r
44 \r
45 %parse-param {void* scanner}\r
46 %parse-param {void* cb}\r
47 %parse-param {char* name}\r
48 %lex-param {yyscan_t scanner}\r
49 \r
50 %language "C"\r
51 \r
52 %token DER UNSIGNED_INTEGER NONDIGIT Q_NAME\r
53 \r
54 %start name\r
55 %%\r
56 \r
57 name:\r
58         identifier_list\r
59         | DER identifier_list ')'\r
60         | DER identifier_list ',' UNSIGNED_INTEGER ')'\r
61         ;\r
62 \r
63 identifier_list:\r
64         identifier\r
65         | identifier_list '.' identifier\r
66         ;\r
67 \r
68 identifier:\r
69         bname\r
70         | bname '[' arrayIndices ']'\r
71     ;\r
72 \r
73 bname:\r
74         NONDIGIT nondigit_or_digit\r
75         | Q_NAME\r
76         ;\r
77 \r
78 nondigit_or_digit:\r
79         /* empty */\r
80         | UNSIGNED_INTEGER nondigit_or_digit\r
81         | NONDIGIT nondigit_or_digit\r
82         ;\r
83 \r
84 arrayIndices:\r
85         UNSIGNED_INTEGER\r
86         | arrayIndices ',' UNSIGNED_INTEGER\r
87         ;\r
88 \r
89 %%\r