Skip to content

Commit 480125c

Browse files
Add support for Cairo language (#1193)
1 parent 563f153 commit 480125c

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

languages.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@
192192
"multi_line_comments": [["{-", "-}"]],
193193
"extensions": ["cabal"]
194194
},
195+
"Cairo": {
196+
"line_comment": ["//"],
197+
"extensions": ["cairo"],
198+
"quotes": [
199+
["\\\"", "\\\""],
200+
["'", "'"]
201+
]
202+
},
195203
"Cangjie": {
196204
"line_comment": ["//"],
197205
"multi_line_comments": [["/*", "*/"]],

tests/data/cairo.cairo

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//! 51 lines 32 code 13 comments 6 blanks
2+
//! ```rust
3+
//! fn main () {
4+
//! // Comment
5+
//!
6+
//! println!("Hello World!");
7+
//! }
8+
//! ```
9+
10+
/// The main function
11+
fn main() {
12+
let x: ByteArray = "\"/*##\"\"##\'\'";
13+
// comment
14+
loop {
15+
if x.len() >= 2 && x[0] == '*' && x[1] == '/' { // found the */
16+
break;
17+
}
18+
}
19+
}
20+
21+
fn foo<T, +Drop<T>>(name: T) {
22+
let this_ends = 'a "\'test/"*.';
23+
call1();
24+
call2();
25+
let this_does_not = // a // nested // comment " //
26+
///"*/another /*test
27+
call3();
28+
//*/";
29+
}
30+
31+
fn call1() {}
32+
fn call2() {}
33+
fn call3() {}
34+
35+
fn foobar() {
36+
let does_not_start: ByteArray = // "
37+
"until here,
38+
test/*
39+
test"; // a quote: "
40+
let also_doesnt_start =
41+
/// " */
42+
'until here,
43+
test,'; // another quote: "
44+
}
45+
46+
fn foo2() {
47+
let a = 4; // ///
48+
let b = '5';
49+
let c = 6; // ///
50+
}
51+

0 commit comments

Comments
 (0)