feat: add module constants

This commit is contained in:
rvcas
2022-12-01 15:15:06 -05:00
committed by Lucas
parent 34c8a58391
commit fedafed845
8 changed files with 298 additions and 54 deletions

View File

@@ -5,7 +5,7 @@ use miette::Diagnostic;
use crate::{ast::Span, parser::token::Token};
#[derive(Debug, Diagnostic, thiserror::Error)]
#[error("{kind}")]
#[error("{kind}\n")]
pub struct ParseError {
pub kind: ErrorKind,
#[label]
@@ -104,12 +104,17 @@ pub enum Pattern {
TermIdent,
#[error("Unexpected end of input")]
End,
#[error("Bad list spread pattern")]
#[error("Malformed list spread pattern")]
#[diagnostic(help("List spread in matches can\nuse have a discard or var"))]
Match,
#[error("Bad byte literal")]
#[error("Malformed byte literal")]
#[diagnostic(help("Bytes must be between 0-255"))]
Byte,
#[error("Unexpected pattern")]
#[diagnostic(help(
"If no label is provided then only variables\nmatching a field name are allowed"
))]
RecordPunning,
}
impl From<char> for Pattern {