cluaupp 0.2.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -79
- package/README.md +42 -88
- package/docs/README.md +13 -21
- package/docs/architecture.md +13 -76
- package/docs/cli.md +12 -64
- package/docs/comparison.md +6 -24
- package/docs/config.md +6 -7
- package/docs/examples/combat.md +19 -227
- package/docs/examples/hud.md +13 -81
- package/docs/examples/index.md +9 -16
- package/docs/getting-started.md +20 -137
- package/docs/intellisense.md +5 -41
- package/docs/intro.md +16 -15
- package/docs/migration.md +38 -0
- package/docs/oop/file-tags.md +12 -36
- package/docs/oop/index.md +8 -14
- package/docs/syntax.md +54 -236
- package/editors/vscode/extension.js +1 -1
- package/editors/vscode/package.json +4 -4
- package/examples/README.md +5 -7
- package/examples/game/.vscode/extensions.json +0 -3
- package/examples/game/.vscode/settings.json +6 -14
- package/examples/game/src/client/hud.client.clpp +54 -0
- package/examples/game/src/client/init.client.clpp +6 -0
- package/examples/game/src/server/combat.server.clpp +85 -0
- package/examples/game/src/server/leaderstats.server.clpp +28 -0
- package/examples/game/src/shared/PlayerData.clh +20 -0
- package/examples/game/src/shared/config.clp +6 -0
- package/examples/game/src/shared/features.clp +88 -0
- package/generated/cli.js +40 -24
- package/generated/clpp/contract.js +5 -0
- package/generated/clpp/index.js +27 -0
- package/generated/clpp/paths.js +121 -0
- package/generated/clpp/postprocess.js +78 -0
- package/generated/clpp/runner.js +102 -0
- package/generated/compile.js +26 -138
- package/generated/intellisense.js +38 -157
- package/generated/libs.js +1 -1
- package/generated/lsp.js +1 -8
- package/generated/preprocess.js +8 -179
- package/generated/system-understander.js +1 -1
- package/generated/transpile.js +3 -50
- package/generated/utils/project.js +13 -28
- package/include/{cluaupp/datatypes.hpp → clpp/datatypes.clh} +1 -1
- package/include/{cluaupp/generated/instances.hpp → clpp/generated/instances.clh} +1 -1
- package/include/{cluaupp/libs/chrono.hpp → clpp/libs/chrono.clh} +9 -9
- package/include/{cluaupp/libs/cmdr.hpp → clpp/libs/cmdr.clh} +4 -4
- package/include/{cluaupp/libs/dataservice.hpp → clpp/libs/dataservice.clh} +8 -15
- package/include/{cluaupp/libs/display.hpp → clpp/libs/display.clh} +1 -2
- package/include/{cluaupp/libs/ezvisual.hpp → clpp/libs/ezvisual.clh} +1 -3
- package/include/{cluaupp/libs/formatnumber.hpp → clpp/libs/formatnumber.clh} +2 -3
- package/include/{cluaupp/libs/fusion.hpp → clpp/libs/fusion.clh} +5 -5
- package/include/{cluaupp/libs/iris.hpp → clpp/libs/iris.clh} +2 -2
- package/include/{cluaupp/libs/janitor.hpp → clpp/libs/janitor.clh} +1 -2
- package/include/{cluaupp/libs/module3d.hpp → clpp/libs/module3d.clh} +2 -4
- package/include/{cluaupp/libs/net.hpp → clpp/libs/net.clh} +2 -4
- package/include/{cluaupp/libs/promise.hpp → clpp/libs/promise.clh} +1 -4
- package/include/{cluaupp/libs/spring.hpp → clpp/libs/spring.clh} +1 -2
- package/include/{cluaupp/libs/statemachine.hpp → clpp/libs/statemachine.clh} +2 -3
- package/include/{cluaupp/libs/stickybillboard.hpp → clpp/libs/stickybillboard.clh} +1 -2
- package/include/{cluaupp/libs/topbarplus.hpp → clpp/libs/topbarplus.clh} +3 -4
- package/include/clpp/libs.clh +24 -0
- package/include/clpp/roblox.clh +31 -0
- package/package.json +7 -14
- package/src/cli.ts +39 -25
- package/src/clpp/contract.ts +39 -0
- package/src/clpp/index.ts +18 -0
- package/src/clpp/paths.ts +117 -0
- package/src/clpp/postprocess.ts +93 -0
- package/src/clpp/runner.ts +102 -0
- package/src/compile.ts +26 -149
- package/src/intellisense.ts +36 -165
- package/src/libs.ts +1 -1
- package/src/lsp.ts +1 -5
- package/src/preprocess.ts +8 -180
- package/src/system-understander.ts +1 -1
- package/src/transpile.ts +9 -52
- package/src/utils/project.ts +12 -28
- package/templates/game/.vscode/extensions.json +0 -3
- package/templates/game/.vscode/settings.json +6 -14
- package/templates/game/src/client/init.client.clpp +6 -0
- package/templates/game/src/server/leaderstats.server.clpp +29 -0
- package/templates/game/src/shared/config.clp +6 -0
- package/examples/game/.clangd +0 -25
- package/examples/game/compile_flags.txt +0 -6
- package/examples/game/src/client/hud.client.cpp +0 -12
- package/examples/game/src/client/init.client.cpp +0 -6
- package/examples/game/src/server/combat.server.cpp +0 -23
- package/examples/game/src/server/leaderstats.server.cpp +0 -29
- package/examples/game/src/shared/config.cpp +0 -5
- package/examples/game/src/shared/config.h +0 -5
- package/include/cluaupp/libs.hpp +0 -25
- package/include/cluaupp/roblox.hpp +0 -47
- package/src/architecture.ts +0 -500
- package/src/ast.ts +0 -37
- package/src/emit.ts +0 -609
- package/src/emitter/luau-codegen.ts +0 -187
- package/src/emitter/translators.ts +0 -168
- package/src/headers.ts +0 -233
- package/src/layout.ts +0 -114
- package/src/lex.ts +0 -158
- package/src/parse.ts +0 -729
- package/src/parser/collector.ts +0 -148
- package/src/parser/index.ts +0 -27
- package/src/tree-sitter-cpp.d.ts +0 -4
- package/src/understand.ts +0 -322
- package/templates/game/src/client/init.client.cpp +0 -6
- package/templates/game/src/server/leaderstats.server.cpp +0 -29
- package/templates/game/src/shared/config.cpp +0 -5
- package/templates/game/src/shared/config.h +0 -5
- /package/include/{cluaupp/generated/enums.hpp → clpp/generated/enums.clh} +0 -0
- /package/include/{cluaupp/libs/math.hpp → clpp/libs/math.clh} +0 -0
- /package/include/{cluaupp/libs/twinkle.hpp → clpp/libs/twinkle.clh} +0 -0
- /package/include/{cluaupp/libs/vfx.hpp → clpp/libs/vfx.clh} +0 -0
package/src/lex.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import type { Token } from "./ast.js";
|
|
2
|
-
|
|
3
|
-
const KEYWORDS = new Set([
|
|
4
|
-
"if",
|
|
5
|
-
"else",
|
|
6
|
-
"for",
|
|
7
|
-
"while",
|
|
8
|
-
"return",
|
|
9
|
-
"new",
|
|
10
|
-
"auto",
|
|
11
|
-
"const",
|
|
12
|
-
"void",
|
|
13
|
-
"int",
|
|
14
|
-
"bool",
|
|
15
|
-
"float",
|
|
16
|
-
"double",
|
|
17
|
-
"true",
|
|
18
|
-
"false",
|
|
19
|
-
"nullptr",
|
|
20
|
-
"class",
|
|
21
|
-
"struct",
|
|
22
|
-
"public",
|
|
23
|
-
"private",
|
|
24
|
-
"protected",
|
|
25
|
-
"namespace",
|
|
26
|
-
"using",
|
|
27
|
-
"template",
|
|
28
|
-
"typedef",
|
|
29
|
-
"extern",
|
|
30
|
-
"enum",
|
|
31
|
-
"switch",
|
|
32
|
-
"case",
|
|
33
|
-
"default",
|
|
34
|
-
"break",
|
|
35
|
-
"static",
|
|
36
|
-
"constexpr",
|
|
37
|
-
"inline",
|
|
38
|
-
]);
|
|
39
|
-
|
|
40
|
-
export function tokenize(source: string): Token[] {
|
|
41
|
-
const tokens: Token[] = [];
|
|
42
|
-
let i = 0;
|
|
43
|
-
let line = 1;
|
|
44
|
-
let col = 1;
|
|
45
|
-
|
|
46
|
-
const push = (type: string, value: string, startLine: number, startCol: number, start: number, end: number) => {
|
|
47
|
-
tokens.push({ type, value, line: startLine, col: startCol, start, end });
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
while (i < source.length) {
|
|
51
|
-
const c = source[i];
|
|
52
|
-
|
|
53
|
-
if (c === "\n") {
|
|
54
|
-
i += 1;
|
|
55
|
-
line += 1;
|
|
56
|
-
col = 1;
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (c === " " || c === "\t" || c === "\r") {
|
|
60
|
-
i += 1;
|
|
61
|
-
col += 1;
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (c === "#") {
|
|
65
|
-
while (i < source.length && source[i] !== "\n") {
|
|
66
|
-
i += 1;
|
|
67
|
-
}
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
if (c === "/" && source[i + 1] === "/") {
|
|
71
|
-
while (i < source.length && source[i] !== "\n") {
|
|
72
|
-
i += 1;
|
|
73
|
-
}
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (c === "/" && source[i + 1] === "*") {
|
|
77
|
-
i += 2;
|
|
78
|
-
col += 2;
|
|
79
|
-
while (i < source.length && !(source[i] === "*" && source[i + 1] === "/")) {
|
|
80
|
-
if (source[i] === "\n") {
|
|
81
|
-
line += 1;
|
|
82
|
-
col = 1;
|
|
83
|
-
} else {
|
|
84
|
-
col += 1;
|
|
85
|
-
}
|
|
86
|
-
i += 1;
|
|
87
|
-
}
|
|
88
|
-
i += 2;
|
|
89
|
-
col += 2;
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const startLine = line;
|
|
94
|
-
const startCol = col;
|
|
95
|
-
|
|
96
|
-
if (c === '"') {
|
|
97
|
-
const start = i;
|
|
98
|
-
i += 1;
|
|
99
|
-
col += 1;
|
|
100
|
-
let value = "";
|
|
101
|
-
while (i < source.length && source[i] !== '"') {
|
|
102
|
-
if (source[i] === "\\" && i + 1 < source.length) {
|
|
103
|
-
value += source[i] + source[i + 1];
|
|
104
|
-
i += 2;
|
|
105
|
-
col += 2;
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
value += source[i];
|
|
109
|
-
i += 1;
|
|
110
|
-
col += 1;
|
|
111
|
-
}
|
|
112
|
-
i += 1;
|
|
113
|
-
col += 1;
|
|
114
|
-
push("string", value, startLine, startCol, start, i);
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (/[0-9]/.test(c)) {
|
|
119
|
-
const start = i;
|
|
120
|
-
let value = "";
|
|
121
|
-
while (i < source.length && /[0-9.]/.test(source[i])) {
|
|
122
|
-
value += source[i];
|
|
123
|
-
i += 1;
|
|
124
|
-
col += 1;
|
|
125
|
-
}
|
|
126
|
-
push("number", value, startLine, startCol, start, i);
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (/[A-Za-z_]/.test(c)) {
|
|
131
|
-
const start = i;
|
|
132
|
-
let value = "";
|
|
133
|
-
while (i < source.length && /[A-Za-z0-9_]/.test(source[i])) {
|
|
134
|
-
value += source[i];
|
|
135
|
-
i += 1;
|
|
136
|
-
col += 1;
|
|
137
|
-
}
|
|
138
|
-
push(KEYWORDS.has(value) ? "kw" : "ident", value, startLine, startCol, start, i);
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const two = source.slice(i, i + 2);
|
|
143
|
-
const start = i;
|
|
144
|
-
if (["->", "==", "!=", "<=", ">=", "&&", "||", "::", "<<", ">>"].includes(two)) {
|
|
145
|
-
push("op", two, startLine, startCol, start, i + 2);
|
|
146
|
-
i += 2;
|
|
147
|
-
col += 2;
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
push("op", c, startLine, startCol, start, i + 1);
|
|
152
|
-
i += 1;
|
|
153
|
-
col += 1;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
push("eof", "", line, col, source.length, source.length);
|
|
157
|
-
return tokens;
|
|
158
|
-
}
|