aboutsummaryrefslogtreecommitdiff
path: root/src/lang/lexer.clj
diff options
context:
space:
mode:
authorEduardo Julian2014-12-01 01:05:17 -0400
committerEduardo Julian2014-12-01 01:05:17 -0400
commitce096da3d8a6c28da0983a230e2e9d561618809e (patch)
tree8c8cb49ec045fb47f10658d031f62e16037bc5f7 /src/lang/lexer.clj
parent60cf264468d4833fd2cb8b103b0fc29a17d55eec (diff)
Doing some basic compilation.
Diffstat (limited to '')
-rw-r--r--src/lang/lexer.clj12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lang/lexer.clj b/src/lang/lexer.clj
index 5bd57f7de..54e83c078 100644
--- a/src/lang/lexer.clj
+++ b/src/lang/lexer.clj
@@ -49,7 +49,7 @@
_ (lex-str "}")]
(return [::record members])))
-(def +ident-re+ #"^([a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|'][a-zA-Z0-9\-\+\_\=!@$%^&*<>\.,/\\\|']*)")
+(def +ident-re+ #"^([a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|'][0-9a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|']*)")
(do-template [<name> <tag> <regex>]
(def <name>
@@ -60,6 +60,15 @@
^:private lex-int ::int #"^(0|[1-9][0-9]*)"
^:private lex-ident ::ident +ident-re+)
+(def lex-string
+ (exec [_ (lex-str "\"")
+ token (lex-regex #"^(.+?(?=\"))")
+ _ (lex-str "\"")
+ ]
+ (return [::string token])))
+
+;; (lex "(_. (_.. java.lang.System out) (println \"YOLO\"))")
+
(def ^:private lex-single-line-comment
(exec [_ (lex-str "##")
comment (lex-regex #"^([^\n]*)")
@@ -105,6 +114,7 @@
(exec [_ (try-m lex-white-space)
form (try-all-m [lex-float
lex-int
+ lex-string
lex-ident
lex-tag
lex-list