-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
a3ccbc3
commit a590677
Showing
9 changed files
with
242 additions
and
518 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
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
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
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
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,79 @@ | ||
use std::sync::Arc; | ||
|
||
use bevy_derive::{Deref, DerefMut}; | ||
use bevy_ecs::{component::Component, entity::Entity, schedule::SystemSet, system::Resource}; | ||
use bevy_utils::{HashMap, HashSet}; | ||
use gramatika::{SourceStr, SpannedError, Substr}; | ||
use lsp_types::Url; | ||
use parser::{comment::Comment, scopes::Scope, Span, SyntaxTree, Token}; | ||
use ropey::Rope; | ||
|
||
use crate::pre::{SourceMap, SourceReplacement}; | ||
|
||
// --- Resources --------------------------------------------------------------- | ||
|
||
#[derive(Resource, Clone, Debug, Default, Deref, DerefMut)] | ||
pub struct DocumentsMap(pub HashMap<Url, Entity>); | ||
|
||
#[derive(Resource, Clone, Debug, Default, Deref, DerefMut)] | ||
pub struct ModulePathsMap(pub HashMap<Arc<[Substr]>, Url>); | ||
|
||
/// Document URIs that have not yet been read. | ||
#[derive(Resource, Clone, Debug, Default, Deref, DerefMut)] | ||
pub struct PendingReads(pub HashSet<Url>); | ||
|
||
/// Documents that have been read or updated and require processing | ||
#[derive(Resource, Clone, Debug, Default, Deref, DerefMut)] | ||
pub struct PendingDocs(pub HashMap<Url, SourceStr>); | ||
|
||
// --- Components -------------------------------------------------------------- | ||
|
||
#[derive(Component, Clone, Debug, Deref, DerefMut, Hash)] | ||
pub struct DocumentUri(pub Url); | ||
|
||
#[derive(Component, Clone, Debug, Deref, DerefMut)] | ||
pub struct WgslSource(pub Substr); | ||
|
||
#[derive(Component, Clone, Debug, Deref, DerefMut)] | ||
pub struct WgslPrunedSource(pub Substr); | ||
|
||
#[derive(Component, Clone, Debug, Deref, DerefMut)] | ||
pub struct WgslSourceMap(pub SourceMap); | ||
|
||
#[derive(Component, Clone, Debug, Deref, DerefMut)] | ||
pub struct WgslTokens(pub Vec<Token>); | ||
|
||
#[derive(Component, Debug, Deref, DerefMut)] | ||
pub struct WgslAst(pub SyntaxTree); | ||
|
||
#[derive(Component, Debug, Deref, DerefMut)] | ||
pub struct WgslComments(pub Vec<Comment>); | ||
|
||
#[derive(Component, Debug, Deref, DerefMut)] | ||
pub struct ParseErrors(pub Vec<SpannedError>); | ||
|
||
#[derive(Component, Debug, Deref, DerefMut)] | ||
pub struct PruneErrors(pub Vec<SpannedError>); | ||
|
||
#[derive(Component, Debug, Deref, DerefMut)] | ||
pub struct SourceReplacements(pub Vec<SourceReplacement>); | ||
|
||
#[derive(Component, Debug, Deref, DerefMut)] | ||
pub struct ReplacementErrors(pub Vec<SpannedError>); | ||
|
||
#[derive(Component, Clone, Debug, Deref, DerefMut)] | ||
pub struct WgslRope(pub Rope); | ||
|
||
#[derive(Component, Clone, Debug, Deref, DerefMut)] | ||
pub struct WgslScopes(pub Arc<Scope>); | ||
|
||
#[derive(Component, Clone, Debug, Deref, DerefMut)] | ||
pub struct ImportedSymbols(pub HashMap<Substr, Arc<[Substr]>>); | ||
|
||
#[derive(Component, Clone, Debug, Default, Deref, DerefMut)] | ||
pub struct InactiveRanges(pub Vec<Span>); | ||
|
||
// --- Systems ----------------------------------------------------------------- | ||
|
||
#[derive(SystemSet, Clone, Copy, Debug, PartialEq, Eq, Hash)] | ||
pub struct DocumentIntakeSystem; |
Oops, something went wrong.