Skip to content

Commit ffd0afb

Browse files
committed
Add Hare lang
Added Hare's syntax to languages.json, along with an example for the testing system.
1 parent 1e3547e commit ffd0afb

File tree

5 files changed

+71
-2
lines changed

5 files changed

+71
-2
lines changed

LANGUAGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ HAML (haml)
103103
Hamlet (hamlet)
104104
Handlebars (hbs,handlebars)
105105
Happy (y,ly)
106+
Hare (ha)
106107
Haskell (hs)
107108
Haxe (hx)
108109
HEX (hex)

examples/language/hare.ha

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
use fmt;
2+
use strings;
3+
4+
export type error = !str;
5+
6+
type example = struct {
7+
number: i64,
8+
error: error,
9+
};
10+
11+
fn function(a: i32, b: i32) i32 = a + b;
12+
13+
export fn main() void = {
14+
for (true) {
15+
break;
16+
};
17+
18+
const string = "A string"; // a comment
19+
const another_string = `aaa`;
20+
let iter = strings::iter(string);
21+
22+
let r = match (strings::next(&iter)) {
23+
case void => return;
24+
case let r: rune =>
25+
// comment
26+
yield r;
27+
};
28+
29+
switch (r) {
30+
case 'a' =>
31+
abort();
32+
case =>
33+
if (r != 'd') fmt::println("not d!")! else fmt::println("d!")!;
34+
};
35+
36+
for (let i = 0z; i <= 10; i += 1) {
37+
fmt::print(i, ' ')!;
38+
};
39+
};

languages.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3097,6 +3097,35 @@
30973097
"multi_line": [],
30983098
"quotes": []
30993099
},
3100+
"Hare": {
3101+
"complexitychecks": [
3102+
"for ",
3103+
"if ",
3104+
"else ",
3105+
"match ",
3106+
"switch ",
3107+
"|| ",
3108+
"&& ",
3109+
"!= ",
3110+
"== "
3111+
],
3112+
"extensions": [
3113+
"ha"
3114+
],
3115+
"line_comment": [
3116+
"//"
3117+
],
3118+
"quotes": [
3119+
{
3120+
"end": "\"",
3121+
"start": "\""
3122+
},
3123+
{
3124+
"end": "`",
3125+
"start": "`"
3126+
}
3127+
]
3128+
},
31003129
"Haskell": {
31013130
"complexitychecks": [
31023131
"for ",

processor/constants.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

test-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ else
883883
fi
884884

885885
# Try out specific languages
886-
for i in 'Bosque ' 'Flow9 ' 'Bitbucket Pipeline ' 'Docker ignore ' 'Q# ' 'Futhark ' 'Alloy ' 'Wren ' 'Monkey C ' 'Alchemist ' 'Luna ' 'ignore ' 'XML Schema ' 'Web Services' 'Go ' 'Java ' 'Boo ' 'License ' 'BASH ' 'C Shell ' 'Korn Shell ' 'Makefile ' 'Shell ' 'Zsh ' 'Rakefile ' 'Gemfile ' 'Dockerfile ' 'Yarn ' 'Sieve ' 'F# ' 'Elm ' 'Terraform ' 'Clojure ' 'C# ' 'LLVM IR ' 'HAML ' 'FXML ' 'DM ' 'Nushell ' 'Racket ' 'DOT ' 'YAML ' 'Teal ' 'FSL ' 'INI '
886+
for i in 'Bosque ' 'Flow9 ' 'Bitbucket Pipeline ' 'Docker ignore ' 'Q# ' 'Futhark ' 'Alloy ' 'Wren ' 'Monkey C ' 'Alchemist ' 'Luna ' 'ignore ' 'XML Schema ' 'Web Services' 'Go ' 'Java ' 'Boo ' 'License ' 'BASH ' 'C Shell ' 'Korn Shell ' 'Makefile ' 'Shell ' 'Zsh ' 'Rakefile ' 'Gemfile ' 'Dockerfile ' 'Yarn ' 'Sieve ' 'F# ' 'Elm ' 'Terraform ' 'Clojure ' 'C# ' 'LLVM IR ' 'HAML ' 'FXML ' 'DM ' 'Nushell ' 'Racket ' 'DOT ' 'YAML ' 'Teal ' 'FSL ' 'INI ' 'Hare '
887887
do
888888
if ./scc "examples/language/" | grep -q "$i "; then
889889
echo -e "${GREEN}PASSED $i Language Check"

0 commit comments

Comments
 (0)