Skip to content

Commit

Permalink
Add scons, handle languages with no extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
kazimuth committed Apr 8, 2017
1 parent f3fe43e commit cbdc2a2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ C Header
C#
C Shell
Clojure
CMake
CoffeeScript
Cogent
ColdFusion
Expand Down Expand Up @@ -334,6 +335,7 @@ Ruby HTML
Rust
Sass
Scala
Scons
Standard ML
SQL
Swift
Expand Down
26 changes: 26 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,32 @@
"scala"
]
},
"Scons":{
"base":"hash",
"quotes":[
[
"\\\"",
"\\\""
],
[
"'",
"'"
],
[
"\\\"\\\"\\\"",
"\\\"\\\"\\\""
],
[
"'''",
"'''"
]
],
"filenames":[
"sconstruct",
"sconscript"
]
},

"Sml":{
"name":"Standard ML (SML)",
"base":"func",
Expand Down
10 changes: 6 additions & 4 deletions src/language/language_type.hbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ impl LanguageType {
if let Some(extension) = extension {
match &*extension {
{{~#each languages}}
{{~#each this.extensions}}
"{{~this}}" {{~#unless @last}} | {{~/unless}}
{{~/each}}
=> Some({{~@key}}),
{{~#if this.extensions}}
{{~#each this.extensions}}
"{{~this}}" {{~#unless @last}} | {{~/unless}}
{{~/each}}
=> Some({{~@key}}),
{{~/if}}
{{~/each}}
extension => {
warn!("Unknown extension: {}", extension);
Expand Down
10 changes: 10 additions & 0 deletions tests/data/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!python
# 10 lines 3 code 3 comments 4 blanks

# this is a comment

Program('cpp.cpp') # this is a line-ending comment

env = Environment(CCFLAGS='-O3')
env.Append(CCFLAGS='-O3')

0 comments on commit cbdc2a2

Please sign in to comment.