Skip to content

Commit

Permalink
Add Hare lang
Browse files Browse the repository at this point in the history
Added Hare's syntax to languages.json, along with an example for the
testing system.
  • Loading branch information
KAAtheWiseGit committed Apr 24, 2023
1 parent 1e3547e commit ffd0afb
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
1 change: 1 addition & 0 deletions LANGUAGES.md
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
@@ -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
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
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

0 comments on commit ffd0afb

Please sign in to comment.