misc improvements

This commit is contained in:
Anton-4 2024-03-26 16:38:09 +01:00
parent ef68183a92
commit 59ab438c1e
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
8 changed files with 402 additions and 367 deletions

View file

@ -4,8 +4,8 @@ use crate::ast::{
use crate::blankspace::space0_e;
use crate::expr::merge_spaces;
use crate::ident::{lowercase_ident, UppercaseIdent};
use crate::parser::{byte, specialize_err, EPackageEntry, EPackageName, Parser};
use crate::parser::{optional, then};
use crate::parser::{specialize, word1, EPackageEntry, EPackageName, Parser};
use crate::string_literal;
use roc_module::symbol::{ModuleId, Symbol};
use roc_region::all::Loc;
@ -346,14 +346,14 @@ pub fn package_entry<'a>() -> impl Parser<'a, Spaced<'a, PackageEntry<'a>>, EPac
optional(and!(
skip_second!(
and!(
specialize(|_, pos| EPackageEntry::Shorthand(pos), lowercase_ident()),
specialize_err(|_, pos| EPackageEntry::Shorthand(pos), lowercase_ident()),
space0_e(EPackageEntry::IndentPackage)
),
word1(b':', EPackageEntry::Colon)
byte(b':', EPackageEntry::Colon)
),
space0_e(EPackageEntry::IndentPackage)
)),
loc!(specialize(EPackageEntry::BadPackage, package_name()))
loc!(specialize_err(EPackageEntry::BadPackage, package_name()))
),
move |arena, (opt_shorthand, package_or_path)| {
let entry = match opt_shorthand {
@ -380,7 +380,7 @@ pub fn package_entry<'a>() -> impl Parser<'a, Spaced<'a, PackageEntry<'a>>, EPac
pub fn package_name<'a>() -> impl Parser<'a, PackageName<'a>, EPackageName<'a>> {
then(
loc!(specialize(
loc!(specialize_err(
EPackageName::BadPath,
string_literal::parse_str_literal()
)),