progs/lexer/lexer.sc
changeset 792 34132a854d03
parent 757 ea0be0662be0
child 793 46cc69622a56
--- a/progs/lexer/lexer.sc	Mon Oct 26 10:27:01 2020 +0000
+++ b/progs/lexer/lexer.sc	Tue Oct 27 13:46:01 2020 +0000
@@ -303,4 +303,22 @@
 
 @doc("All tests.")
 @main
-def all() = { small(); fib() ; loops() } 
\ No newline at end of file
+def all() = { small(); fib() ; loops() } 
+
+
+val SYM1 = RANGE("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz_.-")
+val NAME = RECD("name", PLUS(SYM1))
+
+val SYM2 = RANGE("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-")
+val DOMAIN = RECD("domain", PLUS(SYM2))
+
+val RE = RANGE("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz.")
+val TOPLEVEL = RECD("tl", (RE ~ RE) |
+                          (RE ~ RE ~ RE) | 
+                          (RE ~ RE ~ RE ~ RE) | 
+                          (RE ~ RE ~ RE ~ RE ~ RE) |
+                          (RE ~ RE ~ RE ~ RE ~ RE ~ RE))
+
+val EMAIL = NAME ~ "@" ~ DOMAIN ~ "." ~ TOPLEVEL
+
+println(lexing_simp(EMAIL, "christian.urban@kcl.ac.uk"))