Skip to content

Commit

Permalink
Add Jule language
Browse files Browse the repository at this point in the history
Co-authored-by: mertcandav <[email protected]>
Signed-off-by: Adam Perkowski <[email protected]>
  • Loading branch information
adamperkowski and mertcandav committed Feb 3, 2025
1 parent 63cfd70 commit edd6441
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,9 @@
[submodule "vendor/grammars/vscode-jest"]
path = vendor/grammars/vscode-jest
url = https://github.com/jest-community/vscode-jest
[submodule "vendor/grammars/vscode-jule"]
path = vendor/grammars/vscode-jule
url = https://github.com/julelang/vscode-jule.git
[submodule "vendor/grammars/vscode-just"]
path = vendor/grammars/vscode-just
url = https://github.com/nefrob/vscode-just.git
Expand Down
2 changes: 2 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,8 @@ vendor/grammars/vscode-janet:
- source.janet
vendor/grammars/vscode-jest:
- source.jest.snap
vendor/grammars/vscode-jule:
- source.jule
vendor/grammars/vscode-just:
- source.just
vendor/grammars/vscode-lean:
Expand Down
10 changes: 10 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3592,6 +3592,16 @@ Jsonnet:
- ".libsonnet"
tm_scope: source.jsonnet
language_id: 664885656
Jule:
type: programming
color: "#5f7489"
aliases:
- julelang
extensions:
- ".jule"
tm_scope: source.jule
ace_mode: text
language_id: 90868683
Julia:
type: programming
extensions:
Expand Down
23 changes: 23 additions & 0 deletions samples/Jule/bigint.jule
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// This work is marked with CC0 1.0 Universal
// https://creativecommons.org/publicdomain/zero/1.0

use "std/fmt"
use "std/math/big"
use "std/os"

fn main() {
fmt::Println("This program computes size of the big integers.")
for {
fmt::Print("Integer: ")
line := os::Stdin().ReadLine()!
i := big::Int.Parse(line, 0) else {
fmt::Println("error: conversion failed, please write a valid integer")
continue
}
bits := i.BitLen()
fmt::Println("Bits: ", bits)
fmt::Println("Bytes: ", bits/8)
fmt::Println("Fits in 64-bit signed int: ", i.IsI64())
fmt::Println("Fits in 64-bit unsigned int: ", i.IsU64())
}
}
42 changes: 42 additions & 0 deletions samples/Jule/generic.jule
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// This work is marked with CC0 1.0 Universal
// https://creativecommons.org/publicdomain/zero/1.0

use "std/math/rand"
use "std/time"

fn Max[S: []E, E: ordered](mut s: S): E {
if len(s) == 0 {
panic("Max: empty slice")
}
mut m := s[0]
for _, e in s[1:] {
if m < e {
m = e
}
}
ret m
}

fn Min[S: []E, E: ordered](mut s: S): E {
if len(s) == 0 {
panic("Min: empty slice")
}
mut m := s[0]
for _, e in s[1:] {
if m > e {
m = e
}
}
ret m
}

fn main() {
rand := rand::Rand.New(rand::NewSource(u64(time::Now().Nanosecond())))
mut s := make([]int, 10)
for i in s {
s[i] = rand.Intn(100)
}
println(s)
println(Max(s))
println(Min(s))
}
28 changes: 28 additions & 0 deletions samples/Jule/json.jule
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// This work is marked with CC0 1.0 Universal
// https://creativecommons.org/publicdomain/zero/1.0

use "std/encoding/json"
use "std/math"

struct Foo {
Bar: str
Baz: i64
Buz: bool
Fiz: f64
}

fn main() {
mut f := Foo{
Bar: "foobarbaz",
Baz: 89,
Buz: true,
Fiz: math::Pi,
}
println(f)
bytes := json::Encode(f)!
println(str(bytes))
f = Foo{}
println(f)
json::Decode(bytes, f)!
println(f)
}
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Jison Lex:** [cdibbs/language-jison](https://github.com/cdibbs/language-jison)
- **Jolie:** [fmontesi/language-jolie](https://github.com/fmontesi/language-jolie)
- **Jsonnet:** [google/language-jsonnet](https://github.com/google/language-jsonnet)
- **Jule:** [julelang/vscode-jule](https://github.com/julelang/vscode-jule)
- **Julia:** [JuliaEditorSupport/atom-language-julia](https://github.com/JuliaEditorSupport/atom-language-julia)
- **Julia REPL:** [JuliaEditorSupport/atom-language-julia](https://github.com/JuliaEditorSupport/atom-language-julia)
- **Jupyter Notebook:** [Nixinova/NovaGrammars](https://github.com/Nixinova/NovaGrammars)
Expand Down
1 change: 1 addition & 0 deletions vendor/grammars/vscode-jule
Submodule vscode-jule added at 27662b
42 changes: 42 additions & 0 deletions vendor/licenses/git_submodule/vscode-jule.dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: vscode-jule
version: 27662b2519b6780c86314e0c3e7ba6be21f3ff03
type: git_submodule
homepage: https://github.com/julelang/vscode-jule.git
license: bsd-3-clause
licenses:
- sources: LICENSE
text: |
BSD 3-Clause License
Copyright (c) 2022, Mertcan DAVULCU
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- sources: README.md
text: |-
The extension is distributed under the terms of the BSD 3-Clause license. <br>
[See License Details](LICENSE)
notices: []

0 comments on commit edd6441

Please sign in to comment.