Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cairo language support #18

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -349,6 +349,7 @@ Bitbake
BrightScript
C
Cabal
Cairo
Cassius
Ceylon
CHeader
12 changes: 5 additions & 7 deletions languages.json
Original file line number Diff line number Diff line change
@@ -182,6 +182,11 @@
"multi_line_comments": [["{-", "-}"]],
"extensions": ["cabal"]
},
"Cairo": {
"line_comment": ["//"],
"extensions": ["cairo"],
"quotes": [["\\\"", "\\\""], ["'", "'"]]
},
"Cassius": {
"line_comment": ["//"],
"multi_line_comments": [["/*", "*/"]],
@@ -1480,13 +1485,6 @@
"extensions": ["smk", "rules"],
"filenames": ["snakefile"]
},
"Snakemake": {
"line_comment": ["#"],
"doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]],
"quotes": [["\\\"", "\\\""], ["'", "'"]],
"extensions": ["smk", "rules"],
"filenames": ["snakefile"]
},
"Solidity": {
"name": "Solidity",
"line_comment": ["//"],
51 changes: 51 additions & 0 deletions tests/data/cairo.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//! 51 lines 32 code 13 comments 6 blanks
//! ```rust
//! fn main () {
//! // Comment
//!
//! println!("Hello World!");
//! }
//! ```

/// The main function
fn main() {
let x: ByteArray = "\"/*##\"\"##\'\'";
// comment
loop {
if x.len() >= 2 && x[0] == '*' && x[1] == '/' { // found the */
break;
}
}
}

fn foo<T, +Drop<T>>(name: T) {
let this_ends = 'a "\'test/"*.';
call1();
call2();
let this_does_not = // a // nested // comment " //
///"*/another /*test
call3();
//*/";
}

fn call1() {}
fn call2() {}
fn call3() {}

fn foobar() {
let does_not_start: ByteArray = // "
"until here,
test/*
test"; // a quote: "
let also_doesnt_start =
/// " */
'until here,
test,'; // another quote: "
}

fn foo2() {
let a = 4; // ///
let b = '5';
let c = 6; // ///
}