55 lines
2.9 KiB
Plaintext
55 lines
2.9 KiB
Plaintext
#! @file errors.sakura
|
|||
|
|
#! @author John Christman (sorakatadzuma@gmail.com)
|
||
|
|
#! @copyright Malunal Studios, LLC.
|
||
|
|
#! @license MIT
|
||
|
|
#!
|
||
|
|
#! Contains `ec`, the codes of the notes the analyzer makes, which say what kind
|
||
|
|
#! of mistake each note is about.
|
||
|
|
module sakura::analyzer;
|
||
|
|
|
||
|
|
|
||
|
|
#! The codes of the notes the analyzer makes, which say what kind of mistake
|
||
|
|
#! each is about.
|
||
|
|
pub enum ec {
|
||
|
|
# Lexing and parsing
|
||
|
|
syntax, #! Source nested deeper than the parser allows.
|
||
|
|
token, #! A token the parser does not expect where it is.
|
||
|
|
expr, #! An expression missing where one is expected.
|
||
|
|
ident, #! A name missing where one is expected.
|
||
|
|
kind, #! A type missing where one is expected.
|
||
|
|
decl, #! A declaration written wrongly, or missing what it must have.
|
||
|
|
escape, #! An escape that is none of those text and characters allow.
|
||
|
|
char, #! A character literal that is not one character or escape.
|
||
|
|
block, #! A text block, `"""`, laid out wrongly.
|
||
|
|
|
||
|
|
# Checking
|
||
|
|
undefined, #! A name nothing declares where it is used, or a module nothing declares.
|
||
|
|
duplicate, #! A name declared twice in one place.
|
||
|
|
ambiguous, #! A name more than one import declares, or a call more than one overload fits as well.
|
||
|
|
hidden, #! A declaration that is not `pub`, used from outside the modules that see it.
|
||
|
|
not_type, #! A name used as a type that names no type.
|
||
|
|
not_value, #! A name used as a value that names no value.
|
||
|
|
mismatch, #! A value of one type where another is expected.
|
||
|
|
operands, #! An operator applied to what it does not take.
|
||
|
|
overflow, #! A constant outside the range of its type.
|
||
|
|
conversion, #! `as` between types that do not convert.
|
||
|
|
callable, #! A call of what is not a function.
|
||
|
|
arguments, #! Too few or too many arguments, or none fitting any overload.
|
||
|
|
member, #! A member a type does not have.
|
||
|
|
assignable, #! An assignment to what cannot be written.
|
||
|
|
generic, #! Type arguments wrong in number, given where none are taken, or that cannot be inferred.
|
||
|
|
bound, #! A type argument that does not satisfy a bound of its parameter.
|
||
|
|
cycle, #! A declaration that depends on itself.
|
||
|
|
limit, #! Something nested or repeated past what the checker allows.
|
||
|
|
control, #! `break` or `continue` outside a loop, or a function that can end without returning.
|
||
|
|
arms, #! A match missing cases, or with an arm that is not one of them.
|
||
|
|
constant, #! A value that must be known while compiling, and is not.
|
||
|
|
zero_value, #! A variable or field left without a value, whose type has no zero value.
|
||
|
|
invalid, #! A declaration that is not allowed as written, or where it is written.
|
||
|
|
recursive, #! A struct or union that holds itself, other than through a pointer or reference.
|
||
|
|
unhandled, #! What is `@nodiscard`, let go of where it is made.
|
||
|
|
owned, #! A value that closes, copied out of the place holding it.
|
||
|
|
|
||
|
|
# Warnings, which never stop a program
|
||
|
|
lifetime, #! A reference, view, or closure kept past what it refers to.
|
||
|
|
}
|