-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdap-weevil.el
99 lines (81 loc) · 4.79 KB
/
dap-weevil.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
;;; dap-weevil.el --- Debug Adapter Protocol mode for Michelson -*- lexical-binding: t; -*-
;; Copyright (C) 2022 KaroshiBee
;; Author: Simon Parry <simon.parry@karoshibee.com>
;; Keywords: languages
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; dap-mode adapter for https://github.com/karoshibee/weevil
;;; Code:
(require 'dap-mode)
(defun dap-weevil--full-example-filename (filename)
"Utility to make the fully qualified FILENAME of the examples/*.tz ."
(f-join (f-dirname (f-this-file)) ".." "examples" filename))
(defconst dap-weevil--script-filename1 (dap-weevil--full-example-filename "open_tezos_example1_looping.tz"))
(defconst dap-weevil--script-filename2 (dap-weevil--full-example-filename "open_tezos_example2_iter.tz"))
(defconst dap-weevil--script-filename3 (dap-weevil--full-example-filename "open_tezos_example3_lambda.tz"))
(defconst dap-weevil--script-filename4 (dap-weevil--full-example-filename "open_tezos_example4_loop_left.tz"))
(defconst dap-weevil--script-filename5 (dap-weevil--full-example-filename "open_tezos_example5_factorial.tz"))
(defun dap-weevil--populate-start-tcp-args (conf)
"Populate CONF with the required arguments."
(let ((conf (-> conf
(dap--put-if-absent :host "localhost")
(dap--put-if-absent :debugServer 9000)
(dap--put-if-absent :request "launch")
;(dap--put-if-absent :name "Tezos-Weevil::Connected")
(dap--put-if-absent :script_filename "TODO")
(dap--put-if-absent :storage "Unit")
(dap--put-if-absent :parameter "Unit")
(dap--put-if-absent :entrypoint "default"))))
conf))
(dap-register-debug-provider "tezos-weevil-tcp" #'dap-weevil--populate-start-tcp-args)
(dap-register-debug-template "Tezos Weevil Launch (Open Tezos - example 5)"
(list :type "tezos-weevil-tcp"
:request "launch"
:mode "launch"
:script_filename dap-weevil--script-filename5
:storage "1"
:parameter "5"
:name "Tezos-Weevil::Launch5"))
(dap-register-debug-template "Tezos Weevil Launch (Open Tezos - example 4)"
(list :type "tezos-weevil-tcp"
:request "launch"
:mode "launch"
:script_filename dap-weevil--script-filename4
:storage "100"
:parameter "5"
:name "Tezos-Weevil::Launch4"))
(dap-register-debug-template "Tezos Weevil Launch (Open Tezos - example 3)"
(list :type "tezos-weevil-tcp"
:request "launch"
:mode "launch"
:script_filename dap-weevil--script-filename3
:storage "5"
:parameter "1"
:name "Tezos-Weevil::Launch3"))
(dap-register-debug-template "Tezos Weevil Launch (Open Tezos - example 2)"
(list :type "tezos-weevil-tcp"
:request "launch"
:mode "launch"
:script_filename dap-weevil--script-filename2
:storage "None"
:parameter "{1;2;5;3;7;2;15;4}"
:name "Tezos-Weevil::Launch2"))
(dap-register-debug-template "Tezos Weevil Launch (Open Tezos - example 1)"
(list :type "tezos-weevil-tcp"
:request "launch"
:mode "launch"
:script_filename dap-weevil--script-filename1
:storage "0"
:parameter "(Pair 7 5)"
:name "Tezos-Weevil::Launch1"))
(provide 'dap-weevil)
;;; dap-weevil.el ends here