Skip to content

Commit 1a3b39a

Browse files
authored
Add Cairo snippet extractor (#108)
* Customing->customizing in README.md * Add lib/languages/cairo.txt * Add cairo tests * Remove trailing newlines * Remove whitespaces around comments * Add other comment types * Ignore mod keyword * Revert HEAD
1 parent 488d4b9 commit 1a3b39a

File tree

6 files changed

+38
-1
lines changed

6 files changed

+38
-1
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It takes the code of an Exercism submission and creates a snippet for it (shown
88
## Customizing snippet extraction
99

1010
By default, the snippet extractor extracts the first ten "interesting" (non-empty) lines of code.
11-
Whilst the default behavior is useful, we recommend customing snippet generation for most languages.
11+
Whilst the default behavior is useful, we recommend customizing snippet generation for most languages.
1212

1313
### Customization
1414

Diff for: lib/languages/cairo.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
!e
2+
use
3+
//
4+
///
5+
//!

Diff for: tests/cairo/extended/code.cairo

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! we will need this, trust me!
2+
use lib::some_function;
3+
4+
// Hmmmmmmmm
5+
6+
/// This comment is explaing
7+
/// a lot!!!
8+
mod two_fer { // we don't really
9+
// have actual multiline
10+
// comments!!
11+
fn two_fer(name: ByteArray) -> ByteArray {
12+
// There might be a comment here
13+
return "One for " + name + ", one for me."; // A comment after a valid line
14+
}
15+
} // module two_fer

Diff for: tests/cairo/extended/expected_snippet.cairo

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mod two_fer {
2+
fn two_fer(name: ByteArray) -> ByteArray {
3+
return "One for " + name + ", one for me.";
4+
}
5+
}

Diff for: tests/cairo/full/code.cairo

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use lib::some_function;
2+
3+
mod two_fer {
4+
fn two_fer(name: ByteArray) -> ByteArray {
5+
return "One for " + name + ", one for me.";
6+
}
7+
}

Diff for: tests/cairo/full/expected_snippet.cairo

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mod two_fer {
2+
fn two_fer(name: ByteArray) -> ByteArray {
3+
return "One for " + name + ", one for me.";
4+
}
5+
}

0 commit comments

Comments
 (0)