Skip to content

Commit

Permalink
fix: Remove typos
Browse files Browse the repository at this point in the history
  • Loading branch information
MikMuellerDev committed Feb 18, 2024
1 parent 76c44e1 commit 112ed98
Show file tree
Hide file tree
Showing 24 changed files with 57 additions and 57 deletions.
10 changes: 5 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func main() {
success[m.idx]++
} else {
errs[m.idx]++
brokenMap[m.mismatchID] = m.misMatchOutput
brokenMap[m.mismatchID] = m.mismatchOutput
}

// Only print if there is enough (minRefresh) time elapsed.
Expand Down Expand Up @@ -494,7 +494,7 @@ type workerProgress struct {
done bool
success bool
mismatchID string
misMatchOutput string
mismatchOutput string
chunkSize int
idx int
}
Expand Down Expand Up @@ -536,7 +536,7 @@ func worker(chunk []*zip.File, workerIndex int, expectedFileContents string, res
done: false,
success: false,
mismatchID: file.Name,
misMatchOutput: output,
mismatchOutput: output,
chunkSize: len(chunk),
idx: workerIndex,
}
Expand All @@ -550,7 +550,7 @@ func worker(chunk []*zip.File, workerIndex int, expectedFileContents string, res
done: false,
success: true,
mismatchID: "",
misMatchOutput: "",
mismatchOutput: "",
chunkSize: len(chunk),
idx: workerIndex,
}
Expand All @@ -560,7 +560,7 @@ func worker(chunk []*zip.File, workerIndex int, expectedFileContents string, res
done: true,
success: false,
mismatchID: "",
misMatchOutput: "",
mismatchOutput: "",
chunkSize: len(chunk),
idx: workerIndex,
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/testing_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestingRunInterpreter(analyzed map[string]ast.AnalyzedProgram, filename str
analyzed,
filename,
executor,
homescript.TestingInterpeterScopeAdditions(),
homescript.TestingInterpreterScopeAdditions(),
&ctx,
); i != nil {
switch (*i).Kind() {
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestingDebugConsumer(debuggerOutput *chan runtime.DebugOutput, core *runtim
lineIdx := msg.CurrentSpan.Start.Line - 1
hits[lineIdx]++

// Hightlight active line
// Highlight active line
for idx := range lines {
lineHit := hits[uint(idx)]
sumHits := 0
Expand Down
12 changes: 6 additions & 6 deletions homescript/analyzer/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (self *Analyzer) identExpression(node pAst.IdentExpression) ast.AnalyzedIde

params := make([]ast.FunctionTypeParam, 0)
for _, param := range fn.Parameters {
// NOTE: at the intial state, `singletonIdent` MUST be `nil`.
// NOTE: at the initial state, `singletonIdent` MUST be `nil`.
// Otherwise, later analysis steps will falsely report this parameter as a singleton.
var singletonIdent *string = nil
if param.IsSingletonExtractor {
Expand Down Expand Up @@ -349,7 +349,7 @@ func (self *Analyzer) rangeLiteralExpression(node pAst.RangeLiteralExpression) a
//

func (self *Analyzer) listLiteralExpression(node pAst.ListLiteralExpression) ast.AnalyzedListLiteralExpression {
// ensure type equality accross all values
// ensure type equality across all values
listType := ast.NewAnyType(node.Range) // any is the default: the analyzer will enforce type annotations
newValues := make([]ast.AnalyzedExpression, 0)

Expand Down Expand Up @@ -685,7 +685,7 @@ func (self *Analyzer) assignExpression(node pAst.AssignExpression) ast.AnalyzedA
resultType := ast.NewNullType(node.Range)
prevErr := false

// if either the lhs or ths is `never`, use `never`
// if either the lhs or rhs is `never`, use `never`
if lhs.Type().Kind() == ast.NeverTypeKind || rhs.Type().Kind() == ast.NeverTypeKind {
resultType = ast.NewNeverType()
}
Expand Down Expand Up @@ -852,9 +852,9 @@ func (self *Analyzer) callExpression(node pAst.CallExpression) ast.AnalyzedCallE
continue
}

// Sending closures accros threads is UB, prevent this.
// Sending closures across threads is UB, prevent this.
// When sending a closure which captures values to a new thread, the old captured values are not deepcopie'd.
// Therefore, sending these closures accross threads will cause weird memory bugs which must not occur in a Smarthome system.
// Therefore, sending these closures across threads will cause weird memory bugs which must not occur in a Smarthome system.
if node.IsSpawn && argExpr.Type().Kind() == ast.FnTypeKind {
self.error(
"Sending closures across threads is undefined behaviour.",
Expand Down Expand Up @@ -909,7 +909,7 @@ func (self *Analyzer) callExpression(node pAst.CallExpression) ast.AnalyzedCallE

// Sending closures across threads is UB, prevent this.
// When sending a closure which captures values to a new thread, the old captured values are not deepcopie'd.
// Therefore, sending these closures accross threads will cause weird memory bugs which must not occur in a Smarthome system.
// Therefore, sending these closures across threads will cause weird memory bugs which must not occur in a Smarthome system.
if node.IsSpawn && argExpr.Type().Kind() == ast.FnTypeKind {
self.error(
"Sending closures across threads is undefined behaviour.",
Expand Down
8 changes: 4 additions & 4 deletions homescript/analyzer/singleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (self *Analyzer) templateCapabilitiesWithDefault(
implementedCap.Span(),
)

// Ignore this erronous capability
// Ignore this erroneous capability
continue
}

Expand All @@ -64,9 +64,9 @@ func (self *Analyzer) WithCapabilities(

err = false

// Reverse tupel of the conflicts found so far
// Reverse tuple of the conflicts found so far
// If `foo` finds `bar` as a conflict, (`bar`, `foo`) is added to the map for later lookup.
// This way, redundant compatability errors are not shown
// This way, redundant compatibility errors are not shown
conflictsReverse := make(map[string]string)

for capName, capability := range capabilitiesOfImplementation {
Expand All @@ -79,7 +79,7 @@ func (self *Analyzer) WithCapabilities(
capability.Span,
)
if containsErr {
// Prevent redundant compatability errors
// Prevent redundant compatibility errors
if _, found := conflictsReverse[capName]; found {
continue
}
Expand Down
4 changes: 2 additions & 2 deletions homescript/analyzer/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (self *Analyzer) statement(node pAst.Statement) ast.AnalyzedStatement {
//

func (self *Analyzer) typeDefStatement(node pAst.TypeDefinition) ast.AnalyzedTypeDefinition {
// if the conversion fails, use uknown
// if the conversion fails, use unknown
// NOTE: `SetSpan` is not used so that object fields can be shown as `expected`
converted := self.ConvertType(node.RhsType, true)

Expand Down Expand Up @@ -283,7 +283,7 @@ func (self *Analyzer) breakStatement(node pAst.BreakStatement) ast.AnalyzedBreak
// check that this statement is only called inside of a loop
if self.currentModule.LoopDepth == 0 {
self.error(
"Illegal use of 'break' ouside of a loop",
"Illegal use of 'break' outside of a loop",
[]string{"This statement can only be used in loop bodies"},
node.Range,
)
Expand Down
2 changes: 1 addition & 1 deletion homescript/analyzer/topLevel.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ func (self *Analyzer) validateTemplateConstraints(
notes := []string{}
if len(filteredMethod) != len(method.Parameters.List) {
// TODO: dedicated syntax!
notes = append(notes, "Singleton extractions do count as a parameter defintion.")
notes = append(notes, "Singleton extractions do count as a parameter definition.")
}

for _, param := range filteredReq {
Expand Down
22 changes: 11 additions & 11 deletions homescript/analyzer/typing.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ func (self *Analyzer) ConvertType(oldType pAst.HmsType, createErrors bool) ast.T
// Type compatibility
//

type CompabilityError struct {
type CompatibilityError struct {
GotDiagnostic diagnostic.Diagnostic
ExpectedDiagnostic *diagnostic.Diagnostic
}

func newCompabilityErr(lhs diagnostic.Diagnostic, rhs *diagnostic.Diagnostic) *CompabilityError {
return &CompabilityError{
func newCompatibilityErr(lhs diagnostic.Diagnostic, rhs *diagnostic.Diagnostic) *CompatibilityError {
return &CompatibilityError{
GotDiagnostic: lhs,
ExpectedDiagnostic: rhs,
}
Expand Down Expand Up @@ -286,7 +286,7 @@ func (self *Analyzer) CheckAny(typ ast.Type) bool {
}
}

func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTypes bool) *CompabilityError {
func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTypes bool) *CompatibilityError {
// allow the `any` type if it is expected
switch expected.Kind() {
case ast.AnyTypeKind, ast.UnknownTypeKind, ast.NeverTypeKind:
Expand Down Expand Up @@ -354,7 +354,7 @@ func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTy
span = gotObj.ObjFields[len(gotObj.ObjFields)-1].Span
}

return newCompabilityErr(
return newCompatibilityErr(
diagnostic.Diagnostic{
Level: diagnostic.DiagnosticLevelError,
Message: fmt.Sprintf("Field '%s' is missing", expectedField.FieldName.Ident()),
Expand Down Expand Up @@ -389,7 +389,7 @@ func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTy

// this field does not exist on the `expected` object
if !found {
return newCompabilityErr(
return newCompatibilityErr(
diagnostic.Diagnostic{
Level: diagnostic.DiagnosticLevelError,
Message: fmt.Sprintf("Found unexpected field '%s'", gotField.FieldName.Ident()),
Expand Down Expand Up @@ -420,7 +420,7 @@ func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTy
return nil
case ast.FnTypeKind:
if !allowFunctionTypes {
return newCompabilityErr(
return newCompatibilityErr(
diagnostic.Diagnostic{
Level: diagnostic.DiagnosticLevelError,
Message: "Cannot cast a function value at runtime",
Expand Down Expand Up @@ -448,7 +448,7 @@ func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTy
return err
}
if expectedFn.Params.Kind() != gotFn.Params.Kind() {
return newCompabilityErr(
return newCompatibilityErr(
diagnostic.Diagnostic{
Level: diagnostic.DiagnosticLevelError,
Message: fmt.Sprintf("Expected parameter kind '%s', found '%s'", expectedFn.Params.Kind(), gotFn.Params.Kind()),
Expand All @@ -472,7 +472,7 @@ func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTy
}
}
if foundParam == nil {
return newCompabilityErr(
return newCompatibilityErr(
diagnostic.Diagnostic{
Level: diagnostic.DiagnosticLevelError,
Message: fmt.Sprintf("Parameter '%s' is missing", expectedParam.Name.Ident()),
Expand Down Expand Up @@ -502,14 +502,14 @@ func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTy
return nil
}

func (self *Analyzer) checkTypeKindEquality(got ast.Type, expected ast.Type) (err *CompabilityError, proceed bool) {
func (self *Analyzer) checkTypeKindEquality(got ast.Type, expected ast.Type) (err *CompatibilityError, proceed bool) {
if got.Kind() == ast.UnknownTypeKind || got.Kind() == ast.NeverTypeKind ||
expected.Kind() == ast.UnknownTypeKind || expected.Kind() == ast.NeverTypeKind {
return nil, false
}

if expected.Kind() != got.Kind() {
return newCompabilityErr(
return newCompatibilityErr(
diagnostic.Diagnostic{
Level: diagnostic.DiagnosticLevelError,
Message: fmt.Sprintf("Mismatched types: expected '%s', got '%s'", expected.Kind(), got.Kind()),
Expand Down
2 changes: 1 addition & 1 deletion homescript/compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ func (self *Compiler) compileStmt(node ast.AnalyzedStatement) {

self.insert(newOneStringInstruction(Opcode_SetVarImm, headIdentName), node.Range)

// On top of the stack, there will now be a bool describing whether or not to contiue.
// On top of the stack, there will now be a bool describing whether or not to continue.
// Check if there are still values left: if not, break.
self.insert(newOneStringInstruction(Opcode_JumpIfFalse, after_label), node.Range)

Expand Down
4 changes: 2 additions & 2 deletions homescript/fuzzer/nodeHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

// This method is used for determining whether a tree node contains the `break` or `continue` keyword.
// If this is the case, loop obfuscations are not apllied on this node.
// If this is the case, loop obfuscations are not applied on this node.
func (self *Transformer) stmtCanControlLoop(node ast.AnalyzedStatement) bool {
switch node.Kind() {
case ast.TypeDefinitionStatementKind:
Expand Down Expand Up @@ -46,7 +46,7 @@ func (self *Transformer) stmtCanControlLoop(node ast.AnalyzedStatement) bool {
}

// This method is used for determining whether a tree node contains the `break` or `continue` keyword.
// If this is the case, loop obfuscations are not apllied on this node.
// If this is the case, loop obfuscations are not applied on this node.
func (self *Transformer) exprCanControlLoop(node ast.AnalyzedExpression) bool {
switch node.Kind() {
case ast.UnknownExpressionKind:
Expand Down
4 changes: 2 additions & 2 deletions homescript/fuzzer/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -863,10 +863,10 @@ func (self *Transformer) stmtVariants(node ast.AnalyzedStatement) []ast.Analyzed
// return output
// }

// Detect whether the current statment is able to control a parent loop
// Detect whether the current statement is able to control a parent loop
// If so, do not apply loop obfuscations on top of this node.
if self.stmtCanControlLoop(node) {
self.Out += "Statement contains loop control code, not apllying loop obfuscations"
self.Out += "Statement contains loop control code, not applying loop obfuscations"
return output
}

Expand Down
2 changes: 1 addition & 1 deletion homescript/interpreter/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ func (self *Interpreter) castExpression(node ast.AnalyzedCastExpression) (*value
}

// TODO: remove this
// Equal types, or cast from `any` to other -> check internal compatibilty
// Equal types, or cast from `any` to other -> check internal compatibility
// if node.Base.Type().Kind() == ast.AnyTypeKind || node.Base.Type().Kind() == node.AsType.Kind() {
// if i := self.valueIsCompatibleToType(*base, node.AsType, node.Range); i != nil {
// return nil, i
Expand Down
2 changes: 1 addition & 1 deletion homescript/interpreter/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (self *Interpreter) letStatement(node ast.AnalyzedLetStatement) *value.Inte
return i
}

// runtime validation: equal types, or cast from `any` to other -> check internal compatibilty
// runtime validation: equal types, or cast from `any` to other -> check internal compatibility
if !node.NeedsRuntimeTypeValidation {
self.addVar(node.Ident.Ident(), *rhsVal)
return nil
Expand Down
2 changes: 1 addition & 1 deletion homescript/interpreter/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (self *Interpreter) callFunc(span errors.Span, val value.Value, args []ast.

newArgs = append(newArgs, *argVal)
}
// the cancel context of the interpreter is temporarely handed over
// the cancel context of the interpreter is temporarily handed over
// so that expensive / long-running builtin functions (like sleep) can terminate themselves
return fn.Callback(self.Executor, self.cancelCtx, span, newArgs...)
default:
Expand Down
4 changes: 2 additions & 2 deletions homescript/interpreter/value/valueBool.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func (self ValueBool) IsEqual(other Value) (bool, *Interrupt) {
func (self ValueBool) Fields() (map[string]*Value, *Interrupt) {
return map[string]*Value{
"to_string": NewValueBuiltinFunction(func(executor Executor, cancelCtx *context.Context, span errors.Span, args ...Value) (*Value, *Interrupt) {
dispay, i := self.Display()
display, i := self.Display()
if i != nil {
return nil, i
}
return NewValueString(dispay), nil
return NewValueString(display), nil
}),
}, nil
}
Expand Down
4 changes: 2 additions & 2 deletions homescript/interpreter/value/valueList.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ func (self ValueList) IsEqual(other Value) (bool, *Interrupt) {
func (self ValueList) Fields() (map[string]*Value, *Interrupt) {
return map[string]*Value{
"to_string": NewValueBuiltinFunction(func(executor Executor, cancelCtx *context.Context, span errors.Span, args ...Value) (*Value, *Interrupt) {
dispay, i := self.Display()
display, i := self.Display()
if i != nil {
return nil, i
}
return NewValueString(dispay), nil
return NewValueString(display), nil
}),
"len": NewValueBuiltinFunction(func(executor Executor, cancelCtx *context.Context, span errors.Span, args ...Value) (*Value, *Interrupt) {
return NewValueInt(int64(len(*self.Values))), nil
Expand Down
4 changes: 2 additions & 2 deletions homescript/interpreter/value/valueObject.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ func (self ValueObject) IsEqual(other Value) (bool, *Interrupt) {
func (self ValueObject) Fields() (map[string]*Value, *Interrupt) {
fields := map[string]*Value{
"to_string": NewValueBuiltinFunction(func(executor Executor, cancelCtx *context.Context, span errors.Span, args ...Value) (*Value, *Interrupt) {
dispay, i := self.Display()
display, i := self.Display()
if i != nil {
return nil, i
}
return NewValueString(dispay), nil
return NewValueString(display), nil
}),
"keys": NewValueBuiltinFunction(func(executor Executor, cancelCtx *context.Context, span errors.Span, args ...Value) (*Value, *Interrupt) {
rawKeys := make([]string, 0)
Expand Down
2 changes: 1 addition & 1 deletion homescript/parser/topLevel.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (self *Parser) implBlockHead() (ast.ImplBlock, *errors.Error) {
// Span: startLoc.Until(self.CurrentToken.Span.End, self.Filename),
// }, nil
// }
// NOTE: this is depreacted as an impl without a template does not make a lot of sense
// NOTE: this is deprecated as an impl without a template does not make a lot of sense
// considering that you can just extract values directly in `normal` functions.

// In this case, we except a template
Expand Down
4 changes: 2 additions & 2 deletions homescript/runtime/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (self *Core) Run(function string, debuggerOut *chan DebugOutput) {
catchPanic := func() {
if err := recover(); err != nil {
span := self.parent.SourceMap(*self.callFrame())
fmt.Printf("Panic occured in core %d at (%s:%d => l.%d): `%s`\n", self.Corenum, self.callFrame().Function, self.callFrame().InstructionPointer, span.Start.Line, err)
fmt.Printf("Panic occurred in core %d at (%s:%d => l.%d): `%s`\n", self.Corenum, self.callFrame().Function, self.callFrame().InstructionPointer, span.Start.Line, err)
}
}

Expand Down Expand Up @@ -309,7 +309,7 @@ outer:
return
}

// If the exception occured in another function, also pop the call frame of this function
// If the exception occurred in another function, also pop the call frame of this function
// If this was not the case, a function would basically "return twice",
// as the jump to the error-handling code would not pop the most current call frame.
catchLocation := self.ExceptionCatchLabels[len(self.ExceptionCatchLabels)-1]
Expand Down
Loading

0 comments on commit 112ed98

Please sign in to comment.