Skip to content

Commit 370d494

Browse files
authored
feat: add support for C++20 modules (#1278)
* add support for C++20 modules * add support for C++20 modules * add support for C++20 modules * add C++20 module support * add C++20 module support * fixed? param comment * hope to have fixed the lines error * hopefully actually fixed the lines error * this should fix everything * if this doesn't fix it i don't know what will
1 parent fc5cea5 commit 370d494

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

languages.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"name": "APL",
3838
"line_comment": [""],
3939
"extensions": ["apl", "aplf", "apls"],
40-
"quotes": [["'", "'"]],
40+
"quotes": [["'", "'"]]
4141
},
4242
"Arduino": {
4343
"name": "Arduino C++",
@@ -194,7 +194,7 @@
194194
"name": "BQN",
195195
"line_comment": ["#"],
196196
"extensions": ["bqn"],
197-
"quotes": [["\\\"", "\\\""], ["'", "'"]],
197+
"quotes": [["\\\"", "\\\""], ["'", "'"]]
198198
},
199199
"BrightScript": {
200200
"quotes": [["\\\"", "\\\""]],
@@ -340,6 +340,14 @@
340340
"quotes": [["\\\"", "\\\""]],
341341
"extensions": ["hh", "hpp", "hxx", "inl", "ipp"]
342342
},
343+
"CppModule": {
344+
"name": "C++ Module",
345+
"line_comment": ["//"],
346+
"multi_line_comments": [["/*", "*/"]],
347+
"quotes": [["\\\"", "\\\""]],
348+
"verbatim_quotes": [["R\\\"(", ")\\\""]],
349+
"extensions": ["cppm", "ixx", "ccm", "mpp", "mxx", "cxxm", "hppm", "hxxm"]
350+
},
343351
"Crystal": {
344352
"line_comment": ["#"],
345353
"shebangs": ["#!/usr/bin/crystal"],

tests/data/cppm.cppm

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* 46 lines 37 code 3 comments 6 blanks */
2+
3+
#include <stdio.h>
4+
5+
// bubble_sort_function
6+
void bubble_sort(int a[10], int n) {
7+
int t;
8+
int j = n;
9+
int s = 1;
10+
while (s > 0) {
11+
s = 0;
12+
int i = 1;
13+
while (i < j) {
14+
if (a[i] < a[i - 1]) {
15+
t = a[i];
16+
a[i] = a[i - 1];
17+
a[i - 1] = t;
18+
s = 1;
19+
}
20+
i++;
21+
}
22+
j--;
23+
}
24+
}
25+
26+
int main() {
27+
int a[] = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1};
28+
int n = 10;
29+
int i = 0;
30+
31+
printf(R"(Before sorting:\n\n" )");
32+
// Single line comment
33+
while (i < n) {
34+
printf("%d ", a[i]);
35+
i++;
36+
}
37+
38+
bubble_sort(a, n);
39+
40+
printf("\n\nAfter sorting:\n\n");
41+
i = 0;
42+
while (i < n) {
43+
printf("%d ", a[i]);
44+
i++;
45+
}
46+
}

0 commit comments

Comments
 (0)