mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-19 03:20:14 +00:00
Switch to always encoding package names / paths as strings
This will simplify parsing and make it possible to have a uniform lexer for the language. Previously unquoted package names were allowed to include '-'s, which aren't valid identifiers. In the future, we'll distinguish local paths from packages in the package-manager by looking for a ".roc" suffix, which should only be present in local paths.
This commit is contained in:
parent
f680b83b9e
commit
8b58d5cbc7
31 changed files with 120 additions and 293 deletions
|
@ -79,7 +79,7 @@ pub enum EHeader<'a> {
|
|||
Start(Position),
|
||||
ModuleName(Position),
|
||||
AppName(EString<'a>, Position),
|
||||
PlatformName(EPackageName, Position),
|
||||
PlatformName(EPackageName<'a>, Position),
|
||||
IndentStart(Position),
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ pub enum EProvides<'a> {
|
|||
ListStart(Position),
|
||||
ListEnd(Position),
|
||||
Identifier(Position),
|
||||
Package(EPackageOrPath<'a>, Position),
|
||||
Package(EPackageName<'a>, Position),
|
||||
Space(BadInputError, Position),
|
||||
}
|
||||
|
||||
|
@ -151,25 +151,19 @@ pub enum EPackages<'a> {
|
|||
PackageEntry(EPackageEntry<'a>, Position),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum EPackageName {
|
||||
MissingSlash(Position),
|
||||
Account(Position),
|
||||
Pkg(Position),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum EPackageOrPath<'a> {
|
||||
pub enum EPackageName<'a> {
|
||||
BadPath(EString<'a>, Position),
|
||||
BadPackage(EPackageName, Position),
|
||||
Escapes(Position),
|
||||
Multiline(Position),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum EPackageEntry<'a> {
|
||||
BadPackageOrPath(EPackageOrPath<'a>, Position),
|
||||
BadPackage(EPackageName<'a>, Position),
|
||||
Shorthand(Position),
|
||||
Colon(Position),
|
||||
IndentPackageOrPath(Position),
|
||||
IndentPackage(Position),
|
||||
Space(BadInputError, Position),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue