Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hare Support #385

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ HAML (haml)
Hamlet (hamlet)
Handlebars (hbs,handlebars)
Happy (y,ly)
Hare (ha)
Haskell (hs)
Haxe (hx)
HEX (hex)
Expand Down
39 changes: 39 additions & 0 deletions examples/language/hare.ha
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use fmt;
use strings;

export type error = !str;

type example = struct {
number: i64,
error: error,
};

fn function(a: i32, b: i32) i32 = a + b;

export fn main() void = {
for (true) {
break;
};

const string = "A string"; // a comment
const another_string = `aaa`;
let iter = strings::iter(string);

let r = match (strings::next(&iter)) {
case void => return;
case let r: rune =>
// comment
yield r;
};

switch (r) {
case 'a' =>
abort();
case =>
if (r != 'd') fmt::println("not d!")! else fmt::println("d!")!;
};

for (let i = 0z; i <= 10; i += 1) {
fmt::print(i, ' ')!;
};
};
29 changes: 29 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3097,6 +3097,35 @@
"multi_line": [],
"quotes": []
},
"Hare": {
"complexitychecks": [
"for ",
"if ",
"else ",
"match ",
"switch ",
"|| ",
"&& ",
"!= ",
"== "
],
"extensions": [
"ha"
],
"line_comment": [
"//"
],
"quotes": [
{
"end": "\"",
"start": "\""
},
{
"end": "`",
"start": "`"
}
]
},
"Haskell": {
"complexitychecks": [
"for ",
Expand Down
2 changes: 1 addition & 1 deletion processor/constants.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ else
fi

# Try out specific languages
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 '
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 '
do
if ./scc "examples/language/" | grep -q "$i "; then
echo -e "${GREEN}PASSED $i Language Check"
Expand Down