summaryrefslogtreecommitdiff
path: root/project2/files/configuration.ll
diff options
context:
space:
mode:
Diffstat (limited to 'project2/files/configuration.ll')
-rw-r--r--project2/files/configuration.ll64
1 files changed, 64 insertions, 0 deletions
diff --git a/project2/files/configuration.ll b/project2/files/configuration.ll
new file mode 100644
index 0000000..b3c8de7
--- /dev/null
+++ b/project2/files/configuration.ll
@@ -0,0 +1,64 @@
+%option batch
+%option c++
+%option noyywrap
+%option yyclass="configFlexLexer"
+
+%{
+#include "configFlexLexer.h"
+%}
+
+element [a-zA-Z][a-zA-Z0-9_-]*
+identifier {element}("."{element})*
+begindomain "["
+enddomain "]"
+beginplatform "/"
+eq "="
+value [^ ][^\r\n]*
+
+%x DOMAIN
+%x PLATFORM
+%x POSTOPT
+%x VALUE
+%x EQUAL
+
+%%
+
+<INITIAL>{begindomain} {
+ domain.clear();
+ yy_push_state(DOMAIN);
+}
+
+<DOMAIN>{identifier} {
+ domain = YYText();
+}
+
+<DOMAIN>{enddomain} {
+ yy_pop_state();
+}
+
+<INITIAL>{identifier} {
+ option = YYText();
+ platform.clear();
+ value.clear();
+ BEGIN(POSTOPT);
+}
+
+<POSTOPT>{beginplatform} {
+ BEGIN(PLATFORM);
+}
+
+<POSTOPT,EQUAL>{eq} {
+ BEGIN(VALUE);
+}
+
+<PLATFORM>{identifier} {
+ platform = YYText();
+ BEGIN(EQUAL);
+}
+
+<VALUE>{value} {
+ value = YYText();
+ process();
+ BEGIN(INITIAL);
+}
+