add target option to command line, fix | when its last char on line
This commit is contained in:
@@ -46,12 +46,12 @@
|
|||||||
(let ((flag t))
|
(let ((flag t))
|
||||||
(cond ((char= #\| next-char)
|
(cond ((char= #\| next-char)
|
||||||
(read-char line-stream)
|
(read-char line-stream)
|
||||||
(if (char-equal #\Space
|
(let ((peeked (peek-char nil line-stream nil nil)))
|
||||||
(peek-char nil line-stream nil nil))
|
(if (or (not peeked) (char-equal #\Space peeked))
|
||||||
(collect (make-token :pipe line-num col :identifier)
|
(collect (make-token :pipe line-num col :identifier)
|
||||||
into tokens)
|
into tokens)
|
||||||
(progn (unread-char #\| line-stream)
|
(progn (unread-char #\| line-stream)
|
||||||
(setf flag nil))))
|
(setf flag nil)))))
|
||||||
((char= #\Space next-char) (read-char line-stream))
|
((char= #\Space next-char) (read-char line-stream))
|
||||||
((char= #\; next-char) ;; and not in string
|
((char= #\; next-char) ;; and not in string
|
||||||
(finish))
|
(finish))
|
||||||
|
|||||||
23
main.lisp
23
main.lisp
@@ -61,7 +61,13 @@
|
|||||||
:filepath
|
:filepath
|
||||||
:description "Kaynak dosyasını belirt."
|
:description "Kaynak dosyasını belirt."
|
||||||
:short-name #\k
|
:short-name #\k
|
||||||
:key :kaynak)))
|
:key :kaynak)
|
||||||
|
(clingon:make-option
|
||||||
|
:string
|
||||||
|
:initial-value "nasm"
|
||||||
|
:description "Derleme hedefini belirt."
|
||||||
|
:short-name #\h
|
||||||
|
:key :hedef)))
|
||||||
|
|
||||||
(defun subcommands ()
|
(defun subcommands ()
|
||||||
(list (clingon:make-command
|
(list (clingon:make-command
|
||||||
@@ -69,10 +75,17 @@
|
|||||||
:description "Dosyadaki programı derle"
|
:description "Dosyadaki programı derle"
|
||||||
:usage "<dosya-ismi>"
|
:usage "<dosya-ismi>"
|
||||||
:options (comp-options)
|
:options (comp-options)
|
||||||
:handler (lambda (cmd) (generate-program
|
:handler
|
||||||
(make-program
|
(lambda (cmd) (let ((hedef (clingon:getopt cmd :hedef)))
|
||||||
(clingon:getopt cmd :kaynak))
|
(generate-program
|
||||||
:compile t)))
|
(make-program
|
||||||
|
(clingon:getopt cmd :kaynak))
|
||||||
|
:path
|
||||||
|
(format nil "output.~a"
|
||||||
|
(cond ((string-equal "nasm" hedef) "asm")
|
||||||
|
((string-equal "c" hedef) "c")))
|
||||||
|
:compile t
|
||||||
|
:target (intern (string-upcase hedef) :keyword)))))
|
||||||
(clingon:make-command
|
(clingon:make-command
|
||||||
:name "test"
|
:name "test"
|
||||||
:description "Testleri çalıştır."
|
:description "Testleri çalıştır."
|
||||||
|
|||||||
Reference in New Issue
Block a user