-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
330 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use crate::Spanned; | ||
|
||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | ||
pub enum Definition { | ||
Component(fastn_p1::Section), | ||
Variable(fastn_p1::Section), | ||
Function(fastn_p1::Section), | ||
TypeAlias(fastn_p1::Section), | ||
Record(fastn_p1::Section), | ||
OrType(fastn_p1::Section), | ||
Module(fastn_p1::Section), | ||
} | ||
|
||
#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] | ||
pub struct Import { | ||
pub module: fastn_p1::ModuleName, | ||
pub exports: Option<Export>, | ||
pub exposing: Option<Export>, | ||
} | ||
|
||
#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] | ||
pub enum Export { | ||
All, | ||
Things(Vec<fastn_p1::AliasableIdentifier>), | ||
} | ||
|
||
#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] | ||
pub struct Document { | ||
pub module_doc: Option<fastn_p1::Span>, | ||
pub imports: Vec<fastn_p1::Import>, | ||
pub definitions: std::collections::HashMap<fastn_p1::Identifier, Definition>, | ||
pub content: Vec<fastn_p1::Section>, | ||
pub errors: Vec<Spanned<fastn_p1::SingleError>>, | ||
pub comments: Vec<fastn_p1::Span>, | ||
pub line_starts: Vec<usize>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)] | ||
pub enum SingleError { | ||
/// doc comments should either come at the beginning of the file as a contiguous chunk | ||
/// or right before a section or a header. | ||
UnexpectedDocComment, | ||
/// we found some text when we were not expecting, e.g., at the beginning of the file before | ||
/// any section started, or inside a section that does not expect any text. this second part, | ||
/// I am not sure right now as we are planning to convert all text to text nodes inside a | ||
/// section. so by the end, maybe this will only contain the first part. | ||
UnwantedTextFound, | ||
/// we found something like `-- list<> foo:`, type is not specified | ||
EmptyAngleText, | ||
/// we are looking for dash-dash, but found something else | ||
DashDashNotFound, | ||
KindedNameNotFound, | ||
ColonNotFound, | ||
SectionNameNotFoundForEnd, | ||
EndContainsData, | ||
EndWithoutStart, | ||
// SectionNotFound(&'a str), | ||
// MoreThanOneCaption, | ||
// ParseError, | ||
// MoreThanOneHeader, | ||
// HeaderNotFound, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.