summaryrefslogtreecommitdiff
path: root/examples/manual/myname2.lex
diff options
context:
space:
mode:
Diffstat (limited to 'examples/manual/myname2.lex')
-rw-r--r--examples/manual/myname2.lex19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/manual/myname2.lex b/examples/manual/myname2.lex
new file mode 100644
index 0000000..cef55d8
--- /dev/null
+++ b/examples/manual/myname2.lex
@@ -0,0 +1,19 @@
+/*
+ * myname2.lex : A sample Flex program
+ * that does token replacement.
+ */
+
+%{
+#include <stdio.h>
+%}
+
+%x STRING
+%%
+\" ECHO; BEGIN(STRING);
+<STRING>[^\"\n]* ECHO;
+<STRING>\" ECHO; BEGIN(INITIAL);
+
+%NAME { printf("%s",getenv("LOGNAME")); }
+%HOST { printf("%s",getenv("HOST")); }
+%HOSTTYPE { printf("%s",getenv("HOSTTYPE"));}
+%HOME { printf("%s",getenv("HOME")); }