Skip to content

Commit 6b82365

Browse files
feat(language): add code_jule (@adamperkowski) (monkeytypegame#6282)
### Description Hey. I'm adding the keywords & snippets (quotes) for the [Jule programming language](https://jule.dev). Feel free to suggest any changes :) ### Checks - [x] Adding quotes? - [x] Adding a language or a theme? - [x] If is a language, did you edit `_list.json`, `_groups.json` and add `code_jule.json`? - [x] Check if any open issues are related to this PR; if so, be sure to tag them below. - [x] Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info) - [x] Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title. Signed-off-by: Adam Perkowski <[email protected]>
1 parent 8a41cce commit 6b82365

File tree

4 files changed

+243
-0
lines changed

4 files changed

+243
-0
lines changed

frontend/static/languages/_groups.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@
601601
"code_javascript",
602602
"code_javascript_1k",
603603
"code_javascript_react",
604+
"code_jule",
604605
"code_julia",
605606
"code_haskell",
606607
"code_html",

frontend/static/languages/_list.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@
332332
,"code_javascript"
333333
,"code_javascript_1k"
334334
,"code_javascript_react"
335+
,"code_jule"
335336
,"code_julia"
336337
,"code_haskell"
337338
,"code_html"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "code_jule",
3+
"noLazyMode": true,
4+
"words": [
5+
"chan",
6+
"map",
7+
"error",
8+
"use",
9+
"fn",
10+
"struct",
11+
"enum",
12+
"unsafe",
13+
"let",
14+
"match",
15+
"defer",
16+
"if",
17+
"else",
18+
"for",
19+
"in",
20+
"impl",
21+
"trait",
22+
"break",
23+
"continue",
24+
"goto",
25+
"cpp",
26+
"type",
27+
"ret",
28+
"fall",
29+
"co",
30+
"select",
31+
"int",
32+
"uint",
33+
"i8",
34+
"i16",
35+
"i32",
36+
"i64",
37+
"u8",
38+
"u16",
39+
"u32",
40+
"u64",
41+
"f32",
42+
"f64",
43+
"bool",
44+
"str",
45+
"byte",
46+
"rune",
47+
"static",
48+
"const",
49+
"mut",
50+
"self",
51+
"true",
52+
"false",
53+
"nil",
54+
"#build",
55+
"#typedef",
56+
"#cdef",
57+
"#namespace",
58+
"#test",
59+
"#export",
60+
"#pass"
61+
]
62+
}
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
{
2+
"language": "code_jule",
3+
"groups": [
4+
[0, 100],
5+
[101, 300],
6+
[301, 600],
7+
[601, 9999]
8+
],
9+
"quotes": [
10+
{
11+
"text": "fn main() {\n\tprintln(\"Hello, Jule!\")\n}",
12+
"source": "Basic Hello World Example",
13+
"length": 38,
14+
"id": 1
15+
},
16+
{
17+
"text": "let a: int = 0\na := 0\nlet mut a: int = 0\nmut a := 0\nlet a: int",
18+
"source": "Basic Variable Declaration Example",
19+
"length": 62,
20+
"id": 2
21+
},
22+
{
23+
"text": "struct Employee {\n\tname: str\n\tage: u8\n\ttitle: str\n\tsalary: u32\n}",
24+
"source": "Common Concepts - Structures | manual.jule.dev",
25+
"length": 64,
26+
"id": 3
27+
},
28+
{
29+
"text": "fn ok(a: int, mut b: int, c: ...str): (int, int) {\n\tfor _, v in c {\n\t\tprint(v)\n\t}\n\n\tb++\n\tret a, b\n}",
30+
"source": "Basic Function Declaration Example",
31+
"length": 99,
32+
"id": 4
33+
},
34+
{
35+
"text": "fn anon() {\n\tx, y := 10, 20\n\tmut f := fn(a: int, b: int): int {\n\t\tret a + b\n\t}\n\tprintln(f(x, y)) // 30\n\tf = fn(a: int, b: int): int {\n\t\tret a * b\n\t}\n\tprintln(f(x, y)) // 200\n}",
36+
"source": "Common Concepts - Anonymous Functions | manual.jule.dev",
37+
"length": 175,
38+
"id": 5
39+
},
40+
{
41+
"text": "let x: [2]int = [1, 2]\nlet x: [...]int = [1, 2, 3, 4, 5] // [5]int\nx := [5]int([1, 2, 3, 4, 5])\nlet x: [1000]int = [100, ...] // [1000]int = [100, 100, 100, ...]",
42+
"source": "Common Concepts - Arrays | manual.jule.dev",
43+
"length": 161,
44+
"id": 6
45+
},
46+
{
47+
"text": "fn arr() {\n\tlet mut myArray: [3]str = [\"Hello\", \"arrays\", \"indexes\"]\n\tprintln(myArray[0])\n\tmyArray[0] = \"Hi\"\n\tprintln(myArray)\n}",
48+
"source": "Common Concepts - Arrays | manual.jule.dev",
49+
"length": 128,
50+
"id": 7
51+
},
52+
{
53+
"text": "let myArray: [2][2]str = [\n\t[\"Apple\", \"Banana\"],\n\t[\"Bred\", \"Cheese\"],\n]\nprintln(myArray)\n// Outputs: [[Apple Banana] [Bred Cheese]]",
54+
"source": "Common Concepts - Arrays | manual.jule.dev",
55+
"length": 131,
56+
"id": 8
57+
},
58+
{
59+
"text": "let mut mySlice: []str = nil\nmySlice = [\"Hello\", \"Jule\", \"slices!\"]\nprintln(mySlice)\n// Outputs: [Hello Jule slices!]",
60+
"source": "Common Concepts - Slices | manual.jule.dev",
61+
"length": 117,
62+
"id": 9
63+
},
64+
{
65+
"text": "enum FileMode {\n\tRead: 35,\n\tWrite: 89\n\tBoth,\n}",
66+
"source": "Common Concepts - Enums | manual.jule.dev",
67+
"length": 46,
68+
"id": 10
69+
},
70+
{
71+
"text": "match {\n| false:\n\tprintln(\"Case1\")\n| true:\n\tprintln(\"Case2\")\n\tfall\n| false:\n\tprintln(\"Case3\")\n\tfall\n|:\n\tprintln(\"Default\")\n}",
72+
"source": "Common Concepts - Match Statements | manual.jule.dev",
73+
"length": 124,
74+
"id": 11
75+
},
76+
{
77+
"text": "fn example[T: int | uint]() {\n\tmatch type T {\n\t| int:\n\t\tprintln(\"int\")\n\t| uint:\n\t\tprintln(\"uint\")\n\t}\n}",
78+
"source": "Types - Constraints | manual.jule.dev",
79+
"length": 102,
80+
"id": 12
81+
},
82+
{
83+
"text": "let x: int = 10\nlet y: *int = &x\nprintln(y) // Prints stored address\nunsafe { println(*y) } // Prints value at address (so 10)",
84+
"source": "Memory - Pointers | manual.jule.dev",
85+
"length": 126,
86+
"id": 13
87+
},
88+
{
89+
"text": "let mut a = 20\nlet (mut &x, mut y) = a, 20\nx += y\nprintln(a) // 40",
90+
"source": "Memory - References | manual.jule.dev",
91+
"length": 66,
92+
"id": 14
93+
},
94+
{
95+
"text": "fn myExceptional()!: int {\n\terror(\"my error\")\n}",
96+
"source": "Error Handling - Exceptions | manual.jule.dev",
97+
"length": 47,
98+
"id": 15
99+
},
100+
{
101+
"text": "use \"snapbox\"\nuse \"snapbox/header\"\nuse \"snapbox/status\"\n\nfn main() {\n\tlet headerMap: header::HeaderMap = {\n\t\theader::ACCEPT: \"application/json\",\n\t}\n\n\trequest := snapbox::GET(\"https://httpbin.org/get\").Headers(headerMap)\n\tresponse := request.Send()\n\n\tif !status::IsSuccess(response.status) {\n\t\tprintln(\"Error: \")\n\t\tprintln(response.status)\n\t}\n\n\tprint(response.body)\n}",
102+
"source": "Usage Examples | snapbox.adamperkowski.dev",
103+
"length": 366,
104+
"id": 16
105+
},
106+
{
107+
"text": "fn cond(x: int)! {\n\tif x > 1000 {\n\t\tprintln(\"greater than thousand\")\n\t} else if x < 100 {\n\t\tprintln(\"less than hundred\")\n\t} else if x == 100 {\n\t\tprintln(\"equals to hundred\")\n\t} else {\n\t\terror(\"huh?\")\n\t}\n}",
108+
"source": "Common Concepts - Conditional | manual.jule.dev",
109+
"length": 204,
110+
"id": 17
111+
},
112+
{
113+
"text": "struct Dog {\n\tname: str\n\twords: str = \"woof woof\"\n}\n\nimpl Dog {\n static fn spawn(name: str): Dog {\n\t\tret Dog { name: name }\n }\n\n\tfn voice(self) {\n\t\tprintln(self.name + \" - \" + self.words)\n\t}\n}\n\nfn main() {\n\tdog0 := Dog.spawn(\"Rex\")\n\tdog1 := Dog.spawn(\"Buddy\")\n\n\tprintln(dog0.name)\n\n\tdog0.voice()\n\tdog1.voice()\n}",
114+
"source": "Common Concepts - Structures | manual.jule.dev",
115+
"length": 317,
116+
"id": 18
117+
},
118+
{
119+
"text": "let (x, y) = 20, false\nif x == 10 ||\n\ty == false {\n}",
120+
"source": "Introduction - Syntax | manual.jule.dev",
121+
"length": 52,
122+
"id": 19
123+
},
124+
{
125+
"text": "let mut counter = 0\nfor counter <= 5 {\n\tprintln(counter)\n\tcounter += 10\n}",
126+
"source": "Common Concepts - Interations | manual.jule.dev",
127+
"length": 73,
128+
"id": 20
129+
},
130+
{
131+
"text": "let mut i = 1\nfor i <= 5; i++ {\n\tprintln(i)\n}",
132+
"source": "Common Concepts - Interations | manual.jule.dev",
133+
"length": 45,
134+
"id": 21
135+
},
136+
{
137+
"text": "type Int: int\n\nimpl Int {\n\tfn IsEven(self): bool { ret self%2 == 0 }\n\tfn IsOdd(self): bool { ret self%2 == 1 }\n}\n\nfn main() {\n\tx := Int(20)\n\tprintln(x.IsEven())\n\tprintln(x.IsOdd())\n}",
138+
"source": "Types - Aliasing | manual.jule.dev",
139+
"length": 182,
140+
"id": 22
141+
},
142+
{
143+
"text": "fn sum[T](a: T, b: T) T {\n\tlet x: T = a + b\n\tret x\n}",
144+
"source": "Types - Generics | manual.jule.dev",
145+
"length": 52,
146+
"id": 23
147+
},
148+
{
149+
"text": "trait Foo {\n fn foo(self)\n}\n\ntrait Bar {\n fn bar(self)\n}\n\ntrait FooBar {\n Foo\n Bar\n}\n\nstruct Baz {}\n\nimpl FooBar for Baz {\n fn foo(self) { println(\"foo\") }\n fn bar(self) { println(\"bar\") }\n}\n\nfn main() {\n let a: FooBar = Baz{}\n a.foo()\n a.bar()\n let b: Foo = a\n b.foo()\n let c: Bar = a\n c.bar()\n}",
150+
"source": "Dynamic Types - Traits | manual.jule.dev",
151+
"length": 335,
152+
"id": 24
153+
},
154+
{
155+
"text": "for {\n\tmatch {\n\t| true:\n\t\tbreak\n\t}\n}",
156+
"source": "Common Concepts - Labels | manual.jule.dev",
157+
"length": 36,
158+
"id": 25
159+
},
160+
{
161+
"text": "fn label() {\nfoo:\n\tfor {\n\t\tmatch {\n\t\t| true:\n\t\t\tbreak foo\n\t\t}\n\t}\n}",
162+
"source": "Common Concepts - Labels | manual.jule.dev",
163+
"length": 66,
164+
"id": 26
165+
},
166+
{
167+
"text": "use \"std/os\"\nuse \"std/strings\"\n\nfn main() {\n\tcontent := str(os::ReadFile(\"data.txt\")!)\n\tos::WriteFile(\"data.txt\", strings::ToLower(content))\n}",
168+
"source": "Basic File I/O Example",
169+
"length": 142,
170+
"id": 27
171+
},
172+
{
173+
"text": "use \"std/os\"\n\nfn main() {\n\ttext := os::Stdin().ReadLine()!\n\n\tprintln(\"You said: \" + text)\n}",
174+
"source": "Basic Standard Input Example",
175+
"length": 91,
176+
"id": 28
177+
}
178+
]
179+
}

0 commit comments

Comments
 (0)