Skip to content

Commit

Permalink
[Misc] Typos
Browse files Browse the repository at this point in the history
  • Loading branch information
PeyTy committed Feb 10, 2024
1 parent de0bf3b commit 2a3ebf2
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 41 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"Oleh",
"struct",
"structs",
"substr",
"tofita",
"Tofita",
"typeof",
Expand Down Expand Up @@ -82,5 +83,6 @@
"yaml",
"yml",
"hexa"
]
],
"cSpell.maxDuplicateProblems": 2
}
16 changes: 8 additions & 8 deletions library/c/c.hexa
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License
//
// Copyright (C) 2022-2023 Oleh Petrenko
// Copyright (C) 2022-2024 Oleh Petrenko
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -300,7 +300,7 @@ class ClangWideChar {}
//declare
//class ConstVoidPointer extends Pointer<Void> {}

// TODO Cause we cannot Generic<Void>? Or just for conveience (better typecheck and documentation)?
// TODO Cause we cannot Generic<Void>? Or just for convenience (better typecheck and documentation)?
// Generic<Void> in terms of dereferencing to Void is not possible?
// ^ simply no-nop (if `declare`d) or disable deref with `static if`
// otherwise just makes confusion
Expand Down Expand Up @@ -342,7 +342,7 @@ class Pointer<T> {
}
*/
// `arr[]` in C
// TODO ArrayPointer extends Pointerm so `sinlgePtr = arrPtr` like in C
// TODO ArrayPointer extends Pointer, so `singlePtr = arrPtr` like in C
/*declare
class ArrayPointer<T> {
fun pointerOf(): Pointer<T>
Expand Down Expand Up @@ -399,21 +399,21 @@ declare class CString16 {}

/*
#if external_std_dll // or attach different string.hexa/stringdll.hexa|stringlib.hexa
declare private class ExtrenalBuiltinStringPointer {}
declare private fun ExtrenalBuiltinStringPointer_toUpperCase(...)
declare private class ExternalBuiltinStringPointer {}
declare private fun ExternalBuiltinStringPointer_toUpperCase(...)
@inline class String {
let me: ExtrenalBuiltinStringPointer
let me: ExternalBuiltinStringPointer
@inline new () {
}
@inline fun toUpperCase(): String
return ExtrenalBuiltinStringPointer_toUpperCase(me)
return ExternalBuiltinStringPointer_toUpperCase(me)
...
}
#else
class String { ...
#end

TODO syntax `markdonw` in multiline comments?
TODO syntax `markdown` in multiline comments?
*/

class Math {
Expand Down
10 changes: 5 additions & 5 deletions library/c/string.hexa
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License
//
// Copyright (C) 2022-2023 Oleh Petrenko
// Copyright (C) 2022-2024 Oleh Petrenko
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -224,9 +224,9 @@ class String {
}

// TODO arc++? Cause `@weak`
//console.log('deduped: ', now)
// TODO LMAO NONVCALLconsole.logString('deduped: ')
// TODO LMAO NONVCALLconsole.logString(now)
//console.log('deduplicated: ', now)
// TODO NONVCALLconsole.logString('deduplicated: ')
// TODO NONVCALLconsole.logString(now)
//trace(now.bytes as! ConstArrayPointer<ClangWideChar>)
return now
} else {
Expand Down Expand Up @@ -302,7 +302,7 @@ class String {
return "null".concat(b)
}

return "nullnull"
return "null" + "null"
}

static fun fromInt32(value: Int): String {
Expand Down
3 changes: 1 addition & 2 deletions source/cli/args.hexa
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The Hexa Compiler
// Copyright (C) 2023 Oleh Petrenko
// Copyright (C) 2023-2024 Oleh Petrenko
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -15,7 +15,6 @@

/// Ignores some parts like leading .exe and .js
class ArgumentsParsingEngine {

/// Do this before any parsing
static fun cleanupArgv() {
if process.argv[0].endsWith('node.exe') || process.argv[0].endsWith('node') {
Expand Down
4 changes: 2 additions & 2 deletions source/cli/help.hexa
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The Hexa Compiler
// Copyright (C) 2021-2023 Oleh Petrenko
// Copyright (C) 2021-2024 Oleh Petrenko
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -82,7 +82,7 @@ fun printHelp() {
// TODO hexa stop 3978 to stop server
// TODO hexa app.hexa to execute file directly

// TODO use APEngine
// TODO use ArgumentsParsingEngine
process.argv.shift()

ignoreRestArguments()
Expand Down
11 changes: 6 additions & 5 deletions source/compiler/typer.hexa
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The Hexa Compiler
// Copyright (C) 2021-2023 Oleh Petrenko
// Copyright (C) 2021-2024 Oleh Petrenko
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -1422,7 +1422,7 @@ class Typer {
}

if to == typeUInt16, [
typeUInt8 // TODO LMAO just one case? is it useful?
typeUInt8 // TODO just one case? is it useful?
].includes(fromValue) {
return to // Larger type
}
Expand Down Expand Up @@ -3003,7 +3003,7 @@ class Typer {
fail('Cannot find type with name `\(name)`', node)
}
if parents.get(node) != null, parents.get(node) != subj {
fail('Parent overwitten from \(parents.get(node)) to \(subj) for node \(node)' + never, node)
fail('Parent overwritten from \(parents.get(node)) to \(subj) for node \(node)' + never, node)
}
parents.set(node, subj)
if let type = types.get(subj) {
Expand Down Expand Up @@ -3656,6 +3656,7 @@ class Typer {
if not insideClassMethod {
fail('Cannot access `this` outside of class method', node)
}

if thisType == null {
fail('Cannot access `this` in class method', node)
}
Expand Down Expand Up @@ -3806,7 +3807,7 @@ class Typer {
let etype = unwrapUnknownAndNullable(types.get(exprs[0]))

if etype == null {
fail('Value of switch `\(Node.stringify(exprs[0]))` must have a known type at this postition', exprs[0])
fail('Value of switch `\(Node.stringify(exprs[0]))` must have a known type at this position', exprs[0])
}

var enumType: EnumType? = null
Expand Down Expand Up @@ -3857,7 +3858,7 @@ class Typer {
// complex enums may break readability... but helpful for
// shader langs? meh.. they require some computations
// (like case normalization)
// between mattern matching anyway
// between pattern matching anyway

// TODO guards
// let expr = if (let expr = exprs[0]) expr else return
Expand Down
4 changes: 2 additions & 2 deletions source/data/data.hexa
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The Hexa Compiler
// Copyright (C) 2021-2023 Oleh Petrenko
// Copyright (C) 2021-2024 Oleh Petrenko
// Copyright (C) 2018 Bogdan Danylchenko
//
// This program is free software: you can redistribute it and/or modify
Expand All @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// TODO refactor to nodes.
// TODO refactor to nodes.hexa
// TODO move to nodes.hexa
/// Syntax tree
// TODO unindent
Expand Down
4 changes: 2 additions & 2 deletions source/data/nice.hexa
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The Hexa Compiler
// Copyright (C) 2018-2023 Oleh Petrenko
// Copyright (C) 2018-2024 Oleh Petrenko
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -186,7 +186,7 @@ class NiceLink {
// TODO this is a workaround until proper underscores in normalizer
// TODO `@as`
var rename String?
/// `@linkName` sets `asm("un mangled name")`
/// `@linkName` sets `asm("non mangled name")`
var linkName String?
/// `@dllExport` sets `__declspec(dllexport)`
var dllExport = false
Expand Down
4 changes: 2 additions & 2 deletions source/main.hexa
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The Hexa Compiler
// Copyright (C) 2018-2022 Oleh Petrenko
// Copyright (C) 2018-2024 Oleh Petrenko
// Copyright (C) 2018 Bogdan Danylchenko
//
// This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -794,7 +794,7 @@ class Main {

var typecheckProject: Project = new Project()

fun typecheck(dir: String): CompilerErrors {
fun typeCheck(dir: String): CompilerErrors {
// Spawn project
try {

Expand Down
14 changes: 7 additions & 7 deletions source/server.hexa
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The Hexa Compiler
// Copyright (C) 2021-2023 Oleh Petrenko
// Copyright (C) 2021-2024 Oleh Petrenko
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -245,7 +245,7 @@ class Server {
if project.found == true {
try {
let main = new Main()
main.typecheck(project.dir)
main.typeCheck(project.dir)
let typecheckProject: Project = main.typecheckProject

for mod in typecheckProject.moduleInfo {
Expand Down Expand Up @@ -438,7 +438,7 @@ class Server {
// TODO `extends` (with "s" on end)
// TODO `declare`
var detail = 'class'
// TODO shortcut `if let extend {}` musthave
// TODO shortcut `if let extend {}` must have
if let extend = extend {
detail = 'extends ' + NodeType.stringify(extend)
}
Expand Down Expand Up @@ -504,9 +504,9 @@ class Server {
let project = findProjectFile(fsPath)

if project.found == true {
// TODO try-catch `typecheck`
// TODO try-catch `typeCheck`
try {
let e: CompilerErrors = new Main().typecheck(project.dir)
let e: CompilerErrors = new Main().typeCheck(project.dir)

let errors: [CompilerError] = e.errors
for error in errors {
Expand Down Expand Up @@ -546,10 +546,10 @@ class Server {
let project = findProjectFile(fsPath)

if project.found == true {
// TODO try-catch `typecheck`
// TODO try-catch `typeCheck`
try {
let main = new Main()
let e: CompilerErrors = main.typecheck(project.dir)
let e: CompilerErrors = main.typeCheck(project.dir)
let completes = []

let errors: [CompilerError] = e.errors
Expand Down
10 changes: 5 additions & 5 deletions source/tests/testTyper.hexa
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The Hexa Compiler
// Copyright (C) 2021-2023 Oleh Petrenko
// Copyright (C) 2021-2024 Oleh Petrenko
// Copyright (C) 2018 Bogdan Danylchenko
//
// This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -510,14 +510,14 @@ class TestTyper {
static var library = Fs.readFileSync(__dirname + '/library/js/js.hexa')

static fun didError(input: String): String? {
let lexeLibrary = Lexer.tokenize(library, "library/js/js.hexa")
let lexeInput = Lexer.tokenize(Buffer.from(input), "TEST")
let tokenizedLibrary = Lexer.tokenize(library, "library/js/js.hexa")
let tokenizedInput = Lexer.tokenize(Buffer.from(input), "TEST")
let project = new Project()
let typer = new Typer(project)

try {
let lib = Parser.parseNodes(lexeLibrary, project)
let code = Parser.parseNodes(lexeInput, project)
let lib = Parser.parseNodes(tokenizedLibrary, project)
let code = Parser.parseNodes(tokenizedInput, project)
let info = new Module()
for node in lib {
info.nodes.push(node)
Expand Down

0 comments on commit 2a3ebf2

Please sign in to comment.