summaryrefslogtreecommitdiff
path: root/src/lexer.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lexer.lisp')
-rw-r--r--src/lexer.lisp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/lexer.lisp b/src/lexer.lisp
index 3865cd6..8694aa1 100644
--- a/src/lexer.lisp
+++ b/src/lexer.lisp
@@ -67,35 +67,35 @@
(prog1 (case (ch l)
(#\= (cond ((char= #\= (lexer-peek l))
(lexer-read l)
- (make-token token-== "=="))
+ (make-token :t/== "=="))
(t ;;(whitespace? (lexer-peek l))
- (make-token token-= (ch l)))))
- (#\+ (make-token token-+ (ch l)))
- (#\- (make-token token-- (ch l)))
+ (make-token :t/= (ch l)))))
+ (#\+ (make-token :t/+ (ch l)))
+ (#\- (make-token :t/- (ch l)))
(#\! (cond ((char= #\= (lexer-peek l))
(lexer-read l)
- (make-token token-!= "!="))
+ (make-token :t/!= "!="))
(t ;; (whitespace? (lexer-peek l))
- (make-token token-! (ch l)))))
- (#\/ (make-token token-/ (ch l)))
- (#\* (make-token token-* (ch l)))
- (#\< (make-token token-< (ch l)))
- (#\> (make-token token-> (ch l)))
- (#\; (make-token token-semicolon (ch l)))
- (#\, (make-token token-comma (ch l)))
- (#\( (make-token token-lparen (ch l)))
- (#\) (make-token token-rparen (ch l)))
- (#\{ (make-token token-lbrace (ch l)))
- (#\} (make-token token-rbrace (ch l)))
+ (make-token :t/! (ch l)))))
+ (#\/ (make-token :t// (ch l)))
+ (#\* (make-token :t/* (ch l)))
+ (#\< (make-token :t/< (ch l)))
+ (#\> (make-token :t/> (ch l)))
+ (#\; (make-token :t/semicolon (ch l)))
+ (#\, (make-token :t/comma (ch l)))
+ (#\( (make-token :t/lparen (ch l)))
+ (#\) (make-token :t/rparen (ch l)))
+ (#\{ (make-token :t/lbrace (ch l)))
+ (#\} (make-token :t/rbrace (ch l)))
(otherwise (cond ((eof? (ch l))
- (make-token token-eof ""))
+ (make-token :t/eof ""))
((letter? (ch l))
(let ((literal (read-identifier l)))
(return (make-token (lookup-identifier literal)
literal))))
((digit? (ch l))
- (return (make-token token-int (read-number l))))
- (t (make-token token-illegal "ILLEGAL")))))
+ (return (make-token :t/int (read-number l))))
+ (t (make-token :t/illegal "ILLEGAL")))))
(lexer-read l))))
(defmethod read-number ((l lexer))
@@ -116,5 +116,5 @@
(defmethod lexer-tokens ((l lexer))
(loop :for token := (next-token l)
:collect token
- :until (= token-eof (_type token))))
+ :until (eq :t/eof (_type token))))