Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 85f3759

Browse files
authored
Merge pull request #1252 from bjones1/rust
Add: Support Rust comments.
2 parents d68f72b + 5c7f975 commit 85f3759

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

runestone/lp/lp_common_lib.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@
1616
import os.path
1717

1818

19-
# Given a file, return the inline comment token based on the file extension.
19+
# Given a file, return the inline comment token based on the file extension. Default to an empty string if we can't find the the provided language.
2020
def commentForExt(file_name):
2121
return {
22-
".py": "# ",
2322
".c": "// ",
23+
".css": "/* ", # Will need some hand editing...
2424
".h": "// ",
25+
".ini": "; ",
2526
".js": "// ",
26-
".s": "; ",
27+
".py": "# ",
28+
# Rust.
29+
".rs": "// ",
2730
".rst": "",
28-
".css": "/* ", # Will need some hand editing...
29-
".ini": "; ",
30-
}[os.path.splitext(file_name)[1]]
31+
".s": "; ",
32+
# ARM assembly.
33+
".S": "@ ",
34+
}.get(os.path.splitext(file_name)[1], "")
3135

3236

3337
# Relative to the Sphinx output directory, the path to student source (which has all feedback and code solutions removed).

0 commit comments

Comments
 (0)