From 0f358fef909cfa231ca4c01cce963e8469779617 Mon Sep 17 00:00:00 2001 From: Nathaniel Knight Date: Thu, 2 May 2024 08:53:15 -0700 Subject: [PATCH] Add support for Chapel (#960) --- languages.json | 6 ++++++ tests/data/chapel.chpl | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/data/chapel.chpl diff --git a/languages.json b/languages.json index 08d76318d..c03cfc8d2 100644 --- a/languages.json +++ b/languages.json @@ -181,6 +181,12 @@ "quotes": [["\\\"", "\\\""], ["\\\"\\\"\\\"", "\\\"\\\"\\\""]], "extensions": ["ceylon"] }, + "Chapel": { + "line_comment": ["//"], + "multi_line_comments": [["/*", "*/"]], + "quotes": [["\\\"", "\\\""], ["'", "'"]], + "extensions": ["chpl"] + }, "CHeader": { "name": "C Header", "line_comment": ["//"], diff --git a/tests/data/chapel.chpl b/tests/data/chapel.chpl new file mode 100644 index 000000000..131241bd6 --- /dev/null +++ b/tests/data/chapel.chpl @@ -0,0 +1,24 @@ +// chapel 24 lines 9 code 9 comments 6 blanks + +// Tidy line comment + +/* Tidy block + comment. +*/ + +// Cheeky line comments /* +// */ + +/* Cheeky // block comments */ + +// Caculate a factorial +proc factorial(n: int): int { + var x = 1; // this will eventually be returned + for i in 1..n { + x *= i; + } + return x; +} + +writeln("// this isn't a comment"); +writeln('/* this is also not a comment */');