Skip to content

Commit

Permalink
source: execute julefmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Aug 12, 2024
1 parent f36d404 commit ad2706e
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 60 deletions.
2 changes: 1 addition & 1 deletion src/julec/main.jule
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn help(&args: []str) {
}

mut s := StrBuilder.New(1 << 5)
const Space = 5 // Space of between command name and description.
const Space = 5 // Space of between command name and description.
for i, part in HelpMap {
s.WriteStr(part[0])
s.WriteStr(strings::Repeat(" ", (max - len(part[0])) + Space))
Expand Down
2 changes: 1 addition & 1 deletion src/julec/obj/cxx/expr.jule
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type PrimKind: types::TypeKind
// Common group of semantic analysis expression model types and optimizer specific types.
enum compExprModel: type {
ExprModel: ExprModel,
str, // For built-in expressions.
str, // For built-in expressions.
&UnsafeBinaryExprModel,
&UnsafeIndexingExprModel,
&StrCompExprModel,
Expand Down
4 changes: 2 additions & 2 deletions src/julec/obj/cxx/object.jule
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct SerializationInfo {

struct traitHash {
t: &Trait
ti: str // ASCII-safe identifier of trait.
ti: str // ASCII-safe identifier of trait.
s: &StructIns
i: int
}
Expand Down Expand Up @@ -660,7 +660,7 @@ impl ObjectCoder {
ret
}

unary := len(f.Params) == 1 // Just self parameter.
unary := len(f.Params) == 1 // Just self parameter.
assignment := f.Decl.IsVoid()

self.indent()
Expand Down
3 changes: 2 additions & 1 deletion src/julec/obj/cxx/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ impl scopeCoder {
self.oc.write(", &" + anyTypeIdent)
self.oc.write(conv::Itoa(self.oc.pushAnyType(tup.Types[i])))
self.oc.write(")")
|: // It should be trait.
|:
// It should be trait.
self.oc.write(" = ")
if tup.Types[i].Trait() != nil { // Different traits, cast.
mut t1 := l.Kind.Trait()
Expand Down
2 changes: 1 addition & 1 deletion src/julec/opt/deadcode/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct scopeDeadCode {
parent: &scopeDeadCode
s: &Scope
stmts: *[]Stmt
i: int // Position.
i: int // Position.
labels: &[]&Label
gotos: &[]&GotoSt
except: bool
Expand Down
2 changes: 1 addition & 1 deletion std/conv/ftoa.jule
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ fn roundShortest(mut &d: decimal, mant: u64, exp: int, &flt: floatInfo) {
break
}
li := ui - upper.dp + lower.dp
mut l := byte('0') // lower digit
mut l := byte('0') // lower digit
if li >= 0 && li < lower.nd {
l = lower.d[li]
}
Expand Down
2 changes: 1 addition & 1 deletion std/conv/itoa.jule
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn fmtBits(mut dst: []byte, mut u: u64, base: int, neg: bool, append_: bool): (d
// the compiler to generate better code for the shift operation.
shift := uint(bits::TrailingZeros(uint(base))) & 0b111
b := u64(base)
m := uint(base) - 1 // == 1<<shift - 1
m := uint(base) - 1 // == 1<<shift - 1
for u >= b {
i--
a[i] = digits[uint(u)&m]
Expand Down
10 changes: 5 additions & 5 deletions std/encoding/ascii85/ascii85.jule
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ fn Decode(mut dest: []byte, src: []byte, flush: bool)!: (ndst: int, nsrc: int) {

struct encoder {
w: io::Writer
buf: []byte // buffered data waiting to be encoded
nbuf: int // number of bytes in buf
out: []byte // output buffer
buf: []byte // buffered data waiting to be encoded
nbuf: int // number of bytes in buf
out: []byte // output buffer
}

impl io::WriterCloser for encoder {
Expand Down Expand Up @@ -266,9 +266,9 @@ impl encoder {

struct decoder {
r: io::Reader
buf: []byte // leftover input
buf: []byte // leftover input
nbuf: int
out: []byte // leftover decoded output
out: []byte // leftover decoded output
outbuf: []byte
}

Expand Down
2 changes: 1 addition & 1 deletion std/encoding/csv/reader.jule
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl Reader {
// Parse each field in the record.
const QuoteLen = len(`"`)
commaLen := utf8::RuneLen(self.Comma)
mut recLine := self.numLine // Starting line for record
mut recLine := self.numLine // Starting line for record
self.recordBuffer = self.recordBuffer[:0]
self.fieldIndexes = self.fieldIndexes[:0]
self.fieldPositions = self.fieldPositions[:0]
Expand Down
32 changes: 16 additions & 16 deletions std/jule/ast/node.jule
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl FieldExprPair {
struct StructLit {
End: &Token
Kind: &TypeDecl
Exprs: []&Expr // Possible types: &FieldExprPair, and other expressions.
Exprs: []&Expr // Possible types: &FieldExprPair, and other expressions.
}

// Anonymous brace instiating expression.
Expand Down Expand Up @@ -324,17 +324,17 @@ impl SliceExpr {
struct IndexingExpr {
Token: &Token
End: &Token
Expr: &Expr // Value expression to indexing.
Index: &Expr // Index value expression.
Expr: &Expr // Value expression to indexing.
Index: &Expr // Index value expression.
}

// Slicing expression.
struct SlicingExpr {
Token: &Token
End: &Token
Expr: &Expr // Value expression to slicing.
Start: &Expr // Start index value expression.
To: &Expr // To index value expression.
Expr: &Expr // Value expression to slicing.
Start: &Expr // Start index value expression.
To: &Expr // To index value expression.
}

// Constraint.
Expand Down Expand Up @@ -466,7 +466,7 @@ impl FnDecl {

// Variable declaration.
struct VarDecl {
Scope: &ScopeTree // nil for global scopes
Scope: &ScopeTree // nil for global scopes
Token: &Token
Setter: &Token
Ident: str
Expand All @@ -477,7 +477,7 @@ struct VarDecl {
Statically: bool
Reference: bool
Directives: []&Directive
Kind: &TypeDecl // nil for type inferred
Kind: &TypeDecl // nil for type inferred
Expr: &Expr
}

Expand Down Expand Up @@ -522,7 +522,7 @@ impl WhileKind {

// Range iteration kind.
struct RangeKind {
InToken: &Token // Token of "in" keyword
InToken: &Token // Token of "in" keyword
Expr: &Expr
KeyA: &VarDecl // first key of range
KeyB: &VarDecl // second key of range
Expand Down Expand Up @@ -594,19 +594,19 @@ struct MatchCase {
// Use declaration statement.
struct UseDecl {
Token: &Token
LinkPath: str // Use declaration path string.
LinkPath: str // Use declaration path string.
Alias: str
Full: bool // Full implicit import.
Full: bool // Full implicit import.
Selected: []&Token
Binded: bool // Bind use declaration.
Std: bool // Standard package use declaration.
Binded: bool // Bind use declaration.
Std: bool // Standard package use declaration.
}

// Enum item.
struct EnumItemDecl {
Token: &Token
Ident: str
Expr: &Expr // Nil for auto expression.
Expr: &Expr // Nil for auto expression.
}

impl EnumItemDecl {
Expand Down Expand Up @@ -653,10 +653,10 @@ struct TypeEnumDecl {
struct FieldDecl {
Token: &Token
Public: bool
Mutable: bool // Interior mutability.
Mutable: bool // Interior mutability.
Ident: str
Kind: &TypeDecl
Default: &Expr // Nil if not given.
Default: &Expr // Nil if not given.
}

// Structure declaration.
Expand Down
8 changes: 4 additions & 4 deletions std/jule/sema/eval.jule
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ struct Value {

// Evaluator.
struct Eval {
s: &Sema // Used for error logging.
s: &Sema // Used for error logging.
lookup: Lookup
prefix: &TypeKind
unsafety: bool
immutable: bool // This expression will assigned to immutable memory.
ignored: bool // Evaluated expression is not for assignment or something else.
disBuiltin: bool // Disallow/suppress Jule's built-in defines.
immutable: bool // This expression will assigned to immutable memory.
ignored: bool // Evaluated expression is not for assignment or something else.
disBuiltin: bool // Disallow/suppress Jule's built-in defines.
owner: &Var
field: &FieldIns // Field of this default expression. Used for checking cycles.
arg: bool // This expression evaluating for argument.
Expand Down
8 changes: 4 additions & 4 deletions std/jule/sema/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ struct Assign {

// Multi-declarative assignment.
struct MultiAssign {
L: []&Data // Nil Model:s represents ingored expressions.
L: []&Data // Nil Model:s represents ingored expressions.
R: ExprModel
}

Expand Down Expand Up @@ -434,13 +434,13 @@ struct scopeGoto {
struct scopeChecker {
calledFrom: &Token
s: &Sema
owner: &FnIns // See developer reference (1).
owner: &FnIns // See developer reference (1).
parent: &scopeChecker
childIndex: int // Index of child scope.
childIndex: int // Index of child scope.
table: &SymbolTable
scope: &Scope
tree: &ScopeTree
result: &FnIns // Result type for last statement.
result: &FnIns // Result type for last statement.
it: uintptr
cse: uintptr
labels: &[]&scopeLabel // All labels of all scopes.
Expand Down
4 changes: 2 additions & 2 deletions std/jule/sema/sema.jule
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ impl commonSemaMeta {
// Accepts tables as files of package.
struct Sema {
errors: []Log
files: []&SymbolTable // Package files.
file: &SymbolTable // Current package file.
files: []&SymbolTable // Package files.
file: &SymbolTable // Current package file.
flags: SemaFlag
meta: &commonSemaMeta
}
Expand Down
8 changes: 4 additions & 4 deletions std/jule/sema/struct.jule
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ struct Field {
Owner: &Struct
Token: &Token
Public: bool
Mutable: bool // Interior mutability.
Mutable: bool // Interior mutability.
Ident: str
Kind: &TypeSymbol
Default: &Expr // Nil if not given.
Default: &Expr // Nil if not given.
}

impl Field {
Expand Down Expand Up @@ -215,7 +215,7 @@ impl Struct {
struct FieldIns {
Decl: &Field
Kind: &TypeKind
Default: &Data // Nil if not given.
Default: &Data // Nil if not given.
}

// Structure instance.
Expand All @@ -226,7 +226,7 @@ struct StructIns {
Fields: []&FieldIns
Statics: []&Var
Methods: []&Fn
Mutable: bool // This structure has mutable defines.
Mutable: bool // This structure has mutable defines.
Comparable: bool
Refers: &ReferenceStack
Operators: Operators
Expand Down
2 changes: 1 addition & 1 deletion std/jule/sema/type.jule
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ impl Kind for Map {

// Array type.
struct Arr {
Auto: bool // Auto-sized array.
Auto: bool // Auto-sized array.
N: int
Elem: &TypeKind
}
Expand Down
10 changes: 5 additions & 5 deletions std/jule/sema/type2.jule
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn intAssignable(kind: str, &d: &Data): bool {
}

struct typeCompatibilityChecker {
s: &Sema // Used for error logging.
s: &Sema // Used for error logging.
dest: &TypeKind
src: &TypeKind
errorToken: &Token
Expand Down Expand Up @@ -244,7 +244,7 @@ impl typeCompatibilityChecker {

// Checks value and type compatibility for assignment.
struct assignTypeChecker {
s: &Sema // Used for error logging and type checking.
s: &Sema // Used for error logging and type checking.
dest: &TypeKind
d: &Data
errorToken: &Token
Expand Down Expand Up @@ -379,7 +379,7 @@ struct dynamicTypeAnnotation {
errorToken: &Token
k: *&TypeKind
c: &ast::TypeDecl
ignored: []&TypeKind // Ignored generics.
ignored: []&TypeKind // Ignored generics.
}

impl dynamicTypeAnnotation {
Expand Down Expand Up @@ -1301,8 +1301,8 @@ impl rangeChecker {
struct retTypeChecker {
sc: &scopeChecker
f: &FnIns
types: []&TypeKind // Return types.
exprs: []&Expr // Return expressions.
types: []&TypeKind // Return types.
exprs: []&Expr // Return expressions.
errorToken: &Token
model: ExprModel
}
Expand Down
4 changes: 2 additions & 2 deletions std/math/erf.jule
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ fn Erf(mut x: f64): f64 {
R = ra0 + s * (rb1 + s * (rb2 + s * (rb3 + s * (rb4 + s * (rb5 + s * rb6)))))
S = 1 + s * (sb1 + s * (sb2 + s * (sb3 + s * (sb4 + s * (sb5 + s * (sb6 + s * sb7))))))
}
z := F64FromBits(F64Bits(x) & 0xffffffff00000000) // pseudo-single (20-bit) precision x
z := F64FromBits(F64Bits(x) & 0xffffffff00000000) // pseudo-single (20-bit) precision x
r := Exp(-z * z - 0.5625) * Exp((z - x) * (z + x) + R / S)
if sign {
ret r / x - 1
Expand Down Expand Up @@ -353,7 +353,7 @@ fn Erfc(mut x: f64): f64 {
R = rb0 + s * (rb1 + s * (rb2 + s * (rb3 + s * (rb4 + s * (rb5 + s * rb6)))))
S = 1 + s * (sb1 + s * (sb2 + s * (sb3 + s * (sb4 + s * (sb5 + s * (sb6 + s * sb7))))))
}
z := F64FromBits(F64Bits(x) & 0xffffffff00000000) // pseudo-single (20-bit) precision x
z := F64FromBits(F64Bits(x) & 0xffffffff00000000) // pseudo-single (20-bit) precision x
r := Exp(-z * z - 0.5625) * Exp((z - x) * (z + x) + R / S)
if sign {
ret 2 - r / x
Expand Down
2 changes: 1 addition & 1 deletion std/math/exp.jule
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn Exp(x: f64): f64 {

const Overflow = 7.09782712893383973096e+02
const Underflow = -7.45133219101941108420e+02
const NearZero = 1.0 / (1 << 28) // 2**-28
const NearZero = 1.0 / (1 << 28) // 2**-28

// special cases
match {
Expand Down
2 changes: 1 addition & 1 deletion std/math/lgamma.jule
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ fn Lgamma(mut x: f64): (lgamma: f64, sign: int) {
| 1:
z := y * y
w := z * y
p1 := _LGAM_T[0] + w * (_LGAM_T[3] + w * (_LGAM_T[6] + w * (_LGAM_T[9] + w * _LGAM_T[12]))) // parallel comp
p1 := _LGAM_T[0] + w * (_LGAM_T[3] + w * (_LGAM_T[6] + w * (_LGAM_T[9] + w * _LGAM_T[12]))) // parallel comp
p2 := _LGAM_T[1] + w * (_LGAM_T[4] + w * (_LGAM_T[7] + w * (_LGAM_T[10] + w * _LGAM_T[13])))
p3 := _LGAM_T[2] + w * (_LGAM_T[5] + w * (_LGAM_T[8] + w * (_LGAM_T[11] + w * _LGAM_T[14])))
p := z * p1 - (TT - w * (p2 + y * p3))
Expand Down
4 changes: 2 additions & 2 deletions std/math/sqrt.jule
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ fn Sqrt(x: f64): f64 {
exp >>= 1 // exp = exp/2, exponent of square root
// generate sqrt(x) bit by bit
ix <<= 1
let mut q: u64 = 0 // q = sqrt(x)
let mut s: u64 = 0
mut q := u64(0) // q = sqrt(x)
mut s := u64(0)
mut r := u64(1 << (shift + 1)) // r = moving bit from MSB to LSB
for r != 0 {
t := s + r
Expand Down
Loading

0 comments on commit ad2706e

Please sign in to comment.