Skip to content

Commit

Permalink
codebase: execute julefmt with latest convensions
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Sep 4, 2024
1 parent 63c51a1 commit 2899f15
Show file tree
Hide file tree
Showing 295 changed files with 61,278 additions and 61,278 deletions.
672 changes: 336 additions & 336 deletions src/julec/compile.jule

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions src/julec/handle/ansi.jule
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
struct AnsiEscape {}

impl AnsiEscape {
const ResetSeq = "\033[0m"
const BoldSeq = "\u001b[1m"
const RedSeq = "\033[31m"
const BrightMagentaSeq = "\033[95m"
const ResetSeq = "\033[0m"
const BoldSeq = "\u001b[1m"
const RedSeq = "\033[31m"
const BrightMagentaSeq = "\033[95m"

// Reset all ANSI formatting.
static fn Reset() {
out(AnsiEscape.ResetSeq)
}
// Reset all ANSI formatting.
static fn Reset() {
out(AnsiEscape.ResetSeq)
}

// Print with ANSI sequence.
// Resets ANSI after print.
static fn Print(escape: str, text: str) {
out(escape)
out(text)
AnsiEscape.Reset()
}
// Print with ANSI sequence.
// Resets ANSI after print.
static fn Print(escape: str, text: str) {
out(escape)
out(text)
AnsiEscape.Reset()
}
}
128 changes: 64 additions & 64 deletions src/julec/handle/logger.jule
Original file line number Diff line number Diff line change
Expand Up @@ -10,73 +10,73 @@ use strings for std::strings
struct Logger {}

impl Logger {
// Prints flag log.
static fn LogFlat(&l: Log) {
outln(l.Text)
}
// Prints flag log.
static fn LogFlat(&l: Log) {
outln(l.Text)
}

// Prints error log.
static fn LogError(&l: Log) {
out(AnsiEscape.RedSeq)
out("error: ")
out(l.Text)
AnsiEscape.Reset()
// Prints error log.
static fn LogError(&l: Log) {
out(AnsiEscape.RedSeq)
out("error: ")
out(l.Text)
AnsiEscape.Reset()

if len(l.Path) != 0 {
out("\n --> ")
out(l.Path)
}
if l.Row != 0 && l.Column != 0 {
out(":")
out(conv::Itoa(l.Row))
out(":")
out(conv::Itoa(l.Column))
}
if len(l.Line) != 0 {
// For correct handling, trim leading and trailing space bytes.
// Also replace tabs with spaces for deterministic size.
mut line := strings::Trim(l.Line, "\r\n\v\b\t ")
line = strings::Replace(line, "\t", " ", -1)
if len(l.Path) != 0 {
out("\n --> ")
out(l.Path)
}
if l.Row != 0 && l.Column != 0 {
out(":")
out(conv::Itoa(l.Row))
out(":")
out(conv::Itoa(l.Column))
}
if len(l.Line) != 0 {
// For correct handling, trim leading and trailing space bytes.
// Also replace tabs with spaces for deterministic size.
mut line := strings::Trim(l.Line, "\r\n\v\b\t ")
line = strings::Replace(line, "\t", " ", -1)

mut offset := len(l.Line) - len(line) + 1
out("\n ")
row := conv::Itoa(l.Row)
out(row)
out(" | ")
out(line)
out("\n ")
out(strings::Repeat(" ", len(row)))
out(" | ")
out(strings::Repeat(" ", l.Column - offset))
out("^")
if len(l.Suggestion) != 0 {
out("\n ")
out(strings::Repeat(" ", len(row)))
out(" | ")
AnsiEscape.Print(AnsiEscape.BrightMagentaSeq, "suggestion: ")
out(l.Suggestion)
}
}
outln("\n")
}
mut offset := len(l.Line) - len(line) + 1
out("\n ")
row := conv::Itoa(l.Row)
out(row)
out(" | ")
out(line)
out("\n ")
out(strings::Repeat(" ", len(row)))
out(" | ")
out(strings::Repeat(" ", l.Column - offset))
out("^")
if len(l.Suggestion) != 0 {
out("\n ")
out(strings::Repeat(" ", len(row)))
out(" | ")
AnsiEscape.Print(AnsiEscape.BrightMagentaSeq, "suggestion: ")
out(l.Suggestion)
}
}
outln("\n")
}

// Log.
static fn Log(&l: Log) {
match l.Kind {
| LogKind.Flat:
Logger.LogFlat(l)
| LogKind.Error:
Logger.LogError(l)
}
}
// Log.
static fn Log(&l: Log) {
match l.Kind {
| LogKind.Flat:
Logger.LogFlat(l)
| LogKind.Error:
Logger.LogError(l)
}
}

// Prints all logs.
static fn PrintLogs(&logs: []Log) {
for _, l in logs {
Logger.Log(l)
}
out("=== ")
out(conv::Itoa(len(logs)))
outln(" error generated ===")
}
// Prints all logs.
static fn PrintLogs(&logs: []Log) {
for _, l in logs {
Logger.Log(l)
}
out("=== ")
out(conv::Itoa(len(logs)))
outln(" error generated ===")
}
}
4 changes: 2 additions & 2 deletions src/julec/handle/throw.jule
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ use process for std::process
const ErrorExitCode = 1

fn Throw(msg: str) {
outln(msg)
process::Exit(ErrorExitCode)
outln(msg)
process::Exit(ErrorExitCode)
}
Loading

0 comments on commit 2899f15

Please sign in to comment.