blob: b2307cb1b7f8da4eb0e5ae670c3620c8a6aec482 [file] [log] [blame]
Bram Moolenaarc1c365c2022-12-04 20:13:24 +00001/* vi:set ts=8 sts=4 sw=4 noet:
2 *
3 * VIM - Vi IMproved by Bram Moolenaar
4 *
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 * See README.txt for an overview of the Vim source code.
8 */
9
10/*
11 * vim9class.c: Vim9 script class support
12 */
13
14#define USING_FLOAT_STUFF
15#include "vim.h"
16
17#if defined(FEAT_EVAL) || defined(PROTO)
18
19// When not generating protos this is included in proto.h
20#ifdef PROTO
21# include "vim9.h"
22#endif
23
24/*
25 * Handle ":class" and ":abstract class" up to ":endclass".
26 */
27 void
28ex_class(exarg_T *eap)
29{
30 int is_abstract = eap->cmdidx == CMD_abstract;
31
32 char_u *arg = eap->arg;
33 if (is_abstract)
34 {
35 if (STRNCMP(arg, "class", 5) != 0 || !VIM_ISWHITE(arg[5]))
36 {
37 semsg(_(e_invalid_argument_str), arg);
38 return;
39 }
40 arg = skipwhite(arg + 5);
41 }
42
43 if (!ASCII_ISUPPER(*arg))
44 {
45 semsg(_(e_class_name_must_start_with_uppercase_letter_str), arg);
46 return;
47 }
48
49 // TODO:
50 // generics: <Tkey, Tentry>
51 // extends SomeClass
52 // implements SomeInterface
53 // specifies SomeInterface
54
55
56 // TODO: handle until "endclass" is found:
57 // object and class members (public, read access, private):
58 // public this.varname
59 // public static varname
60 // this.varname
61 // static varname
62 // this._varname
63 // static _varname
64 //
65 // constructors:
66 // def new()
67 // enddef
68 // def newOther()
69 // enddef
70 //
71 // methods (object, class, generics):
72 // def someMethod()
73 // enddef
74 // static def someMethod()
75 // enddef
76 // def <Tval> someMethod()
77 // enddef
78 // static def <Tval> someMethod()
79 // enddef
80}
81
82/*
83 * Handle ":interface" up to ":endinterface".
84 */
85 void
86ex_interface(exarg_T *eap UNUSED)
87{
88 // TODO
89}
90
91/*
92 * Handle ":enum" up to ":endenum".
93 */
94 void
95ex_enum(exarg_T *eap UNUSED)
96{
97 // TODO
98}
99
100/*
101 * Handle ":type".
102 */
103 void
104ex_type(exarg_T *eap UNUSED)
105{
106 // TODO
107}
108
109
110#endif // FEAT_EVAL