]> gerrit.simantics Code Review - simantics/fmil.git/blobdiff - org.simantics.fmil.core/native/FMILibrary/src/XML/src/FMI1/fmi1_xml_variable_name_parser.y
Add FMILibrary-2.0.3 to org.simantics.fmil.core\native.
[simantics/fmil.git] / org.simantics.fmil.core / native / FMILibrary / src / XML / src / FMI1 / fmi1_xml_variable_name_parser.y
diff --git a/org.simantics.fmil.core/native/FMILibrary/src/XML/src/FMI1/fmi1_xml_variable_name_parser.y b/org.simantics.fmil.core/native/FMILibrary/src/XML/src/FMI1/fmi1_xml_variable_name_parser.y
new file mode 100644 (file)
index 0000000..e27620a
--- /dev/null
@@ -0,0 +1,89 @@
+/*\r
+    Copyright (C) 2012 Modelon AB\r
+\r
+    This program is free software: you can redistribute it and/or modify\r
+    it under the terms of the BSD style license.\r
+\r
+     This program is distributed in the hope that it will be useful,\r
+    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+    FMILIB_License.txt file for more details.\r
+\r
+    You should have received a copy of the FMILIB_License.txt file\r
+    along with this program. If not, contact Modelon AB <http://www.modelon.com>.\r
+*/\r
+\r
+/* http://www.gnu.org/software/bison/manual/bison.html#Decl-Summary */\r
+%{\r
+\r
+/*\r
+#define YYDEBUG 1\r
+int yydebug = 1;\r
+*/\r
+\r
+#include <stdio.h>\r
+#include "fmi1_xml_variable_name_parser.tab.h"\r
+#include "fmi1_xml_variable_name_lex.h"\r
+\r
+#define MODULE "FMI1XML"\r
+#include <JM/jm_portability.h>\r
+\r
+void yyfmi1error(yyscan_t* scanner, jm_callbacks* cb, char* name, char const *msg)\r
+{\r
+       jm_log_error(cb, MODULE, "Invalid structured ScalarVariable name \"%s\": %s", name, msg);\r
+}\r
+\r
+%}\r
+\r
+%require "2.7"\r
+%expect 0 //Declare the expected number of shift-reduce conflicts\r
+\r
+%error-verbose\r
+\r
+%define api.pure full\r
+\r
+%parse-param {void* scanner}\r
+%parse-param {void* cb}\r
+%parse-param {char* name}\r
+%lex-param {void* scanner}\r
+\r
+%language "C"\r
+\r
+%token DER UNSIGNED_INTEGER NONDIGIT Q_NAME\r
+\r
+%start name\r
+%%\r
+\r
+name:\r
+       identifier_list\r
+       | DER identifier_list ')'\r
+       | DER identifier_list ',' UNSIGNED_INTEGER ')'\r
+       ;\r
+\r
+identifier_list:\r
+       identifier\r
+       | identifier_list '.' identifier\r
+       ;\r
+\r
+identifier:\r
+       bname\r
+       | bname '[' arrayIndices ']'\r
+       ;\r
+\r
+bname:\r
+       NONDIGIT nondigit_or_digit\r
+       | Q_NAME\r
+       ;\r
+\r
+nondigit_or_digit:\r
+       /* empty */\r
+       | UNSIGNED_INTEGER nondigit_or_digit\r
+       | NONDIGIT nondigit_or_digit\r
+       ;\r
+\r
+arrayIndices:\r
+       UNSIGNED_INTEGER\r
+       | arrayIndices ',' UNSIGNED_INTEGER\r
+       ;\r
+\r
+%%
\ No newline at end of file