11package com .github .simiacryptus .aicoder ;
22
3- import com .github .simiacryptus .aicoder .text .BlockComment ;
4- import com .github .simiacryptus .aicoder .text .LineComment ;
5- import com .github .simiacryptus .aicoder .text .TextBlockFactory ;
3+ import com .github .simiacryptus .aicoder .util .BlockComment ;
4+ import com .github .simiacryptus .aicoder .util .LineComment ;
5+ import com .github .simiacryptus .aicoder .util .TextBlockFactory ;
66import org .jetbrains .annotations .Nullable ;
77
88import java .util .Arrays ;
@@ -21,6 +21,9 @@ public enum ComputerLanguage {
2121 .setBlockComments (new BlockComment .Factory ("/*" , "" , "*/" ))
2222 .setDocComments (new BlockComment .Factory ("/**" , "*" , "*/" ))
2323 .setFileExtensions ("cpp" )),
24+ Bash (new Configuration ()
25+ .setLineComments (new LineComment .Factory ("#" ))
26+ .setFileExtensions ("sh" )),
2427 Markdown (new Configuration ()
2528 .setDocumentationStyle ("Markdown" )
2629 .setLineComments (new BlockComment .Factory ("<!--" , "" , "-->" ))
@@ -42,9 +45,6 @@ public enum ComputerLanguage {
4245 .setBlockComments (new BlockComment .Factory ("/*" , "" , "*/" ))
4346 .setDocComments (new BlockComment .Factory ("/**" , "*" , "*/" ))
4447 .setFileExtensions ("basic" , "bs" )),
45- Bash (new Configuration ()
46- .setLineComments (new LineComment .Factory ("#" ))
47- .setFileExtensions ("sh" )),
4848 C (new Configuration ()
4949 .setDocumentationStyle ("Doxygen" )
5050 .setLineComments (new LineComment .Factory ("//" ))
@@ -221,6 +221,12 @@ public enum ComputerLanguage {
221221 .setBlockComments (new BlockComment .Factory ("/*" , "" , "*/" ))
222222 .setDocComments (new BlockComment .Factory ("/**" , "*" , "*/" ))
223223 .setFileExtensions ("scheme" )),
224+ SCSS (new Configuration ()
225+ .setDocumentationStyle ("SCSS" )
226+ .setLineComments (new LineComment .Factory ("//" ))
227+ .setBlockComments (new BlockComment .Factory ("/*" , "" , "*/" ))
228+ .setDocComments (new LineComment .Factory ("///" ))
229+ .setFileExtensions ("scss" )),
224230 SQL (new Configuration ()
225231 .setLineComments (new LineComment .Factory ("--" ))
226232 .setBlockComments (new BlockComment .Factory ("/*" , "" , "*/" ))
@@ -259,7 +265,7 @@ public enum ComputerLanguage {
259265 .setLineComments (new LineComment .Factory ("#" ))
260266 .setFileExtensions ("zsh" ));
261267
262- public final List <String > extensions ;
268+ public final List <CharSequence > extensions ;
263269 public final String docStyle ;
264270 public final TextBlockFactory <?> lineComment ;
265271 public final TextBlockFactory <?> blockComment ;
@@ -274,26 +280,26 @@ public enum ComputerLanguage {
274280 }
275281
276282 @ Nullable
277- public static ComputerLanguage findByExtension (String extension ) {
283+ public static ComputerLanguage findByExtension (CharSequence extension ) {
278284 return Arrays .stream (values ()).filter (x -> x .extensions .contains (extension )).findAny ().orElse (null );
279285 }
280286
281- public String getMultilineCommentSuffix () {
287+ public CharSequence getMultilineCommentSuffix () {
282288 if (docComment instanceof BlockComment .Factory ) {
283289 return ((BlockComment .Factory ) docComment ).blockSuffix ;
284290 }
285291 return null ;
286292 }
287293
288294 public TextBlockFactory <?> getCommentModel (String text ) {
289- if (docComment .looksLike (text )) return docComment ;
290- if (blockComment .looksLike (text )) return blockComment ;
295+ if (docComment .looksLike (text )) return docComment ;
296+ if (blockComment .looksLike (text )) return blockComment ;
291297 return lineComment ;
292298 }
293299
294300 static class Configuration {
295301 private String documentationStyle = "" ;
296- private String [] fileExtensions = new String [] {};
302+ private CharSequence [] fileExtensions = new CharSequence [] {};
297303 private TextBlockFactory <?> lineComments = null ;
298304 private TextBlockFactory <?> blockComments = null ;
299305 private TextBlockFactory <?> docComments = null ;
@@ -307,11 +313,11 @@ public Configuration setDocumentationStyle(String documentationStyle) {
307313 return this ;
308314 }
309315
310- public String [] getFileExtensions () {
316+ public CharSequence [] getFileExtensions () {
311317 return fileExtensions ;
312318 }
313319
314- public Configuration setFileExtensions (String ... fileExtensions ) {
320+ public Configuration setFileExtensions (CharSequence ... fileExtensions ) {
315321 this .fileExtensions = fileExtensions ;
316322 return this ;
317323 }
0 commit comments