-
-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(grit): allow parsing alternative engine/language names (#4937)
- Loading branch information
Showing
34 changed files
with
764 additions
and
56 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file. | ||
use crate::prelude::*; | ||
use biome_grit_syntax::AnyGritLanguageName; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatAnyGritLanguageName; | ||
impl FormatRule<AnyGritLanguageName> for FormatAnyGritLanguageName { | ||
type Context = GritFormatContext; | ||
fn fmt(&self, node: &AnyGritLanguageName, f: &mut GritFormatter) -> FormatResult<()> { | ||
match node { | ||
AnyGritLanguageName::GritBogusLanguageName(node) => node.format().fmt(f), | ||
AnyGritLanguageName::GritLanguageName(node) => node.format().fmt(f), | ||
} | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
crates/biome_grit_formatter/src/grit/auxiliary/engine_name.rs
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,10 @@ | ||
use crate::prelude::*; | ||
use biome_formatter::write; | ||
use biome_grit_syntax::GritEngineName; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatGritEngineName; | ||
impl FormatNodeRule<GritEngineName> for FormatGritEngineName { | ||
fn fmt_fields(&self, node: &GritEngineName, f: &mut GritFormatter) -> FormatResult<()> { | ||
write!(f, [node.engine_kind().format()]) | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
crates/biome_grit_formatter/src/grit/bogus/bogus_language_name.rs
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,5 @@ | ||
use crate::FormatBogusNodeRule; | ||
use biome_grit_syntax::GritBogusLanguageName; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatGritBogusLanguageName; | ||
impl FormatBogusNodeRule<GritBogusLanguageName> for FormatGritBogusLanguageName {} |
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
3 changes: 3 additions & 0 deletions
3
crates/biome_grit_formatter/tests/specs/grit/marzano/engine.grit
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,3 @@ | ||
engine marzano(0.1) | ||
|
||
`console.log($var)` => `console.log($var)` |
32 changes: 32 additions & 0 deletions
32
crates/biome_grit_formatter/tests/specs/grit/marzano/engine.grit.snap
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,32 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: grit/marzano/engine.grit | ||
--- | ||
# Input | ||
|
||
```grit | ||
engine marzano(0.1) | ||
`console.log($var)` => `console.log($var)` | ||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
Attribute Position: Auto | ||
----- | ||
|
||
```grit | ||
engine marzano(0.1) | ||
`console.log($var)` => `console.log($var)` | ||
``` |
4 changes: 4 additions & 0 deletions
4
crates/biome_grit_formatter/tests/specs/grit/marzano/python.grit
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,4 @@ | ||
engine biome(0.1) | ||
language python | ||
|
||
`$var in $dict.keys()` => `$var in $dict` |
Oops, something went wrong.