aboutsummaryrefslogtreecommitdiffstats
path: root/wlp_lex.py
diff options
context:
space:
mode:
Diffstat (limited to 'wlp_lex.py')
-rw-r--r--wlp_lex.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/wlp_lex.py b/wlp_lex.py
new file mode 100644
index 0000000..2cd912b
--- /dev/null
+++ b/wlp_lex.py
@@ -0,0 +1,12 @@
+import rply
+
+lg = rply.LexerGenerator()
+# Add takes a rule name, and a regular expression that defines the rule.
+lg.add("OWNER", r'<[a-zA-Z0-9_.+-]+@[a-zA-Z0-9._-]+>')
+lg.add("VAL", r'[\'`"][a-zA-Z0-9@_+.<>() -]+[\'`"]')
+lg.add("VAR", r'[a-zA-Z0-9_<>-]+[:]?')
+
+lg.ignore(r"\s+")
+lg.ignore(r'[{}=]+')
+
+lexer = lg.build()