*lexes*))))
(defun lex (text)
+ "LEX TEXT => AST
+
+ARGUMENTS AND VALUES:
+
+ TEXT: Some NetLogo code
+ AST: An ambigious AST that can later be parsed
+
+DESCRIPTION:
+
+ LEX lexes NetLogo code.
+
+ LEX checks for some things, in as much as it can without knowing anything
+ about some of the backgrounds of NetLogo. However, it does the first pass
+ with as much as it can."
(if (string= "" text)
(let
((lex (find-if (lambda (f) (funcall f *state* :eof)) *lexes* :from-end t :key #'car)))
(let
((*readtable* (copy-readtable nil))
(*read-eval* nil))
- (read-from-string text))))
+ (read-from-string (format nil "~Ad0" text)))))
(if (numberp num?) num? (error "Invalid number")))))
(deflex :initial (format nil "~A*" *identifier-char*) #'as-symbol)