-
Notifications
You must be signed in to change notification settings - Fork 100
Add feature to add spans tracking source positions in AST nodes #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ertanic
wants to merge
13
commits into
projectfluent:main
Choose a base branch
from
Ertanic:span
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c4fa6ad
feat(fluent-bundle,fluent-syntax): Add source location spans to AST n…
Ertanic 57df84d
refactor(fluent-syntax): Derive `PartialEq`, drop manual implementation
Ertanic 0756bd1
refactor(fluent-syntax): Use pre-formatted messages for `roundtrip_un…
Ertanic ed45428
Merge branch 'projectfluent:main' into span
Ertanic 1d41394
refactor(fluent-syntax): Make `Span` a wrapper around `std::ops::Rang…
Ertanic 7346a0f
test(fluent-syntax): Update test handling to support spans
Ertanic fc263b7
Merge branch 'master' into span
alerque 61eadef
docs: Add changelog entries covering spans PR
alerque f73665a
Revert "refactor(fluent-syntax): Use pre-formatted messages for `roun…
alerque 1a16d2c
fixup! wrap Range...use clone to keep serializing working without Cop…
alerque c7c120a
fixup! Create generic ftl serializer (#241)
alerque cf2c427
Fix parse_fixtures_compare test
Ertanic adae4a0
Fix parse_bench_fixtures test
Ertanic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,25 +1,49 @@ | ||
use super::Comment; | ||
#[cfg(feature = "spans")] | ||
use super::Span; | ||
#[cfg(feature = "serde")] | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::Comment; | ||
// This is a helper struct used to properly deserialize referential | ||
// JSON comments which are single continuous String, into a vec of | ||
// content slices. | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
#[cfg_attr(feature = "serde", serde(untagged))] | ||
pub enum CommentDef<S> { | ||
Single { content: S }, | ||
Multi { content: Vec<S> }, | ||
Single { | ||
content: S, | ||
#[cfg(feature = "spans")] | ||
span: Span, | ||
}, | ||
Multi { | ||
content: Vec<S>, | ||
#[cfg(feature = "spans")] | ||
span: Span, | ||
}, | ||
} | ||
|
||
impl<S> From<CommentDef<S>> for Comment<S> { | ||
fn from(input: CommentDef<S>) -> Self { | ||
match input { | ||
CommentDef::Single { content } => Self { | ||
CommentDef::Single { | ||
content, | ||
#[cfg(feature = "spans")] | ||
span, | ||
} => Self { | ||
content: vec![content], | ||
#[cfg(feature = "spans")] | ||
span, | ||
}, | ||
CommentDef::Multi { | ||
content, | ||
#[cfg(feature = "spans")] | ||
span, | ||
} => Self { | ||
content, | ||
#[cfg(feature = "spans")] | ||
span, | ||
}, | ||
CommentDef::Multi { content } => Self { content }, | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ertanic Why do you still think this exclusion is necessary given that
spans
is no longer a default feature?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the test task is started with the
--all-features
flag.