diff --git a/wip-duuqnd/user-side-compiler/parser.lisp b/wip-duuqnd/user-side-compiler/parser.lisp index c54fa2a..f6d611a 100644 --- a/wip-duuqnd/user-side-compiler/parser.lisp +++ b/wip-duuqnd/user-side-compiler/parser.lisp @@ -105,27 +105,7 @@ parser's debug output.") left)) (define-syntax-matcher expression () - (match-syntax call)) - -(define-syntax-matcher arglist (arguments) - (setf arguments (list (match-syntax expression))) - (loop :while (match-token 'token-comma) - :do (push (match-syntax expression) arguments)) - (nreverse arguments)) - -(define-syntax-matcher call (name arguments) - (setf name (match-syntax equality)) - (cond ((and (typep name 'token-name) - (match-token 'token-open-paren)) - (setf arguments (match-syntax arglist)) - (consume-token 'token-close-paren - "Close parenthesis ')' is required to end function call argument list.") - (make-instance 'node-call - :source *syntax-source* - :comment *token-comment* - :callee (transform name 'asm-function) - :arguments arguments)) - (t name))) + (match-syntax equality)) (define-binary-expr-matcher equality comparison (token-equal-equal node-expr-test-equal) @@ -153,7 +133,27 @@ parser's debug output.") :comment *token-comment* :operator-token (previous-token) :operand (match-syntax primary)) - (match-syntax primary)))) + (match-syntax call)))) + +(define-syntax-matcher arglist (arguments) + (setf arguments (list (match-syntax expression))) + (loop :while (match-token 'token-comma) + :do (push (match-syntax expression) arguments)) + (nreverse arguments)) + +(define-syntax-matcher call (name arguments) + (setf name (match-syntax primary)) + (cond ((and (typep name 'token-name) + (match-token 'token-open-paren)) + (setf arguments (match-syntax arglist)) + (consume-token 'token-close-paren + "Close parenthesis ')' is required to end function call argument list.") + (make-instance 'node-call + :source *syntax-source* + :comment *token-comment* + :callee (transform name 'asm-function) + :arguments arguments)) + (t name))) (define-syntax-matcher primary () (cond ((or (match-token 'token-name)