-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
116 changed files
with
11,017 additions
and
110 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.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 10 additions & 20 deletions
30
crates/biome_grit_factory/src/generated/syntax_factory.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[package] | ||
authors.workspace = true | ||
categories.workspace = true | ||
description = "Biome's GritQL parser" | ||
edition.workspace = true | ||
homepage.workspace = true | ||
keywords.workspace = true | ||
license.workspace = true | ||
name = "biome_grit_parser" | ||
repository.workspace = true | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
biome_console = { workspace = true } | ||
biome_diagnostics = { workspace = true } | ||
biome_grit_factory = { workspace = true } | ||
biome_grit_syntax = { workspace = true } | ||
biome_parser = { workspace = true } | ||
biome_rowan = { workspace = true } | ||
bitflags = { workspace = true } | ||
schemars = { workspace = true, optional = true } | ||
serde = { workspace = true, features = ["derive"] } | ||
serde_json = { workspace = true } | ||
smallvec = { workspace = true } | ||
tracing = { workspace = true } | ||
unicode-bom = { workspace = true } | ||
|
||
[dev-dependencies] | ||
insta = { workspace = true } | ||
quickcheck = { workspace = true } | ||
quickcheck_macros = { workspace = true } | ||
tests_macros = { workspace = true } | ||
|
||
[features] | ||
schemars = ["dep:schemars"] | ||
serde = ["biome_grit_syntax/serde"] | ||
tests = [] | ||
|
||
# cargo-workspaces metadata | ||
[package.metadata.workspaces] | ||
independent = true | ||
|
||
[lints] | ||
workspace = true |
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,61 @@ | ||
use biome_grit_syntax::GritSyntaxKind::{self, *}; | ||
use biome_grit_syntax::T; | ||
use biome_parser::{token_set, TokenSet}; | ||
|
||
// See the precedence rules defined in the Grit grammar: | ||
// https://github.com/getgrit/tree-sitter-gritql/blob/main/grammar.js#L7 | ||
pub(crate) const PRECEDENCE_NOT: isize = 0; | ||
pub(crate) const PRECEDENCE_PATTERN_AS: isize = 10; | ||
pub(crate) const PRECEDENCE_MUL: isize = 8; | ||
pub(crate) const PRECEDENCE_DIV: isize = 8; | ||
pub(crate) const PRECEDENCE_MOD: isize = 8; | ||
pub(crate) const PRECEDENCE_ADD: isize = 7; | ||
pub(crate) const PRECEDENCE_SUB: isize = 7; | ||
pub(crate) const PRECEDENCE_REWRITE: isize = 3; | ||
pub(crate) const PRECEDENCE_ACCUMULATE: isize = 3; | ||
pub(crate) const PRECEDENCE_PATTERN_LIMIT: isize = 1; | ||
pub(crate) const PRECEDENCE_PATTERN_WHERE: isize = 1; | ||
pub(crate) const PRECEDENCE_PATTERN: isize = -20; | ||
|
||
// Recovery sets. | ||
pub(crate) const ARG_LIST_RECOVERY_SET: TokenSet<GritSyntaxKind> = token_set!(T![,], T![')']); | ||
|
||
pub(crate) const DEFINITION_LIST_RECOVERY_SET: TokenSet<GritSyntaxKind> = token_set!(EOF); | ||
|
||
pub(crate) const ELEMENT_LIST_RECOVERY_SET: TokenSet<GritSyntaxKind> = token_set!(T![,], T!['}']); | ||
|
||
pub(crate) const PATTERN_RECOVERY_SET: TokenSet<GritSyntaxKind> = token_set!(T![')'], T!['}'], EOF); | ||
|
||
pub(crate) const PATTERN_ELSE_RECOVERY_SET: TokenSet<GritSyntaxKind> = | ||
token_set!(T![')'], T!['}'], UNTIL_KW, EOF); | ||
|
||
pub(crate) const PATTERN_LIST_RECOVERY_SET: TokenSet<GritSyntaxKind> = token_set!(T![,], T![']']); | ||
|
||
pub(crate) const PATTERN_UNTIL_RECOVERY_SET: TokenSet<GritSyntaxKind> = | ||
token_set!(T![')'], T!['}'], UNTIL_KW, EOF); | ||
|
||
pub(crate) const PREDICATE_RECOVERY_SET: TokenSet<GritSyntaxKind> = | ||
token_set!(T![')'], T!['}'], T![,], ELSE_KW); | ||
|
||
// Other sets. | ||
pub(crate) const BOOLEAN_VALUE_SET: TokenSet<GritSyntaxKind> = token_set![TRUE_KW, FALSE_KW]; | ||
|
||
pub(crate) const CODE_SNIPPET_SET: TokenSet<GritSyntaxKind> = | ||
SUPPORTED_LANGUAGE_SET.union(token_set![GRIT_BACKTICK_SNIPPET, GRIT_RAW_BACKTICK_SNIPPET]); | ||
|
||
pub(crate) const CONTAINER_SET: TokenSet<GritSyntaxKind> = | ||
token_set![GRIT_VARIABLE, GRIT_MAP_ACCESSOR, GRIT_LIST_ACCESSOR]; | ||
|
||
pub(crate) const NOT_SET: TokenSet<GritSyntaxKind> = token_set![NOT_KW, T![!]]; | ||
|
||
pub(crate) const REGEX_SET: TokenSet<GritSyntaxKind> = token_set![GRIT_REGEX, GRIT_SNIPPET_REGEX]; | ||
|
||
pub(crate) const SUPPORTED_LANGUAGE_SET: TokenSet<GritSyntaxKind> = | ||
token_set![T![js], T![json], T![css], T![grit], T![html]]; | ||
|
||
pub(crate) const SUPPORTED_LANGUAGE_SET_STR: &[&str] = &["js", "json", "css", "grit", "html"]; | ||
|
||
pub(crate) const SUPPORTED_LANGUAGE_FLAVOR_SET: TokenSet<GritSyntaxKind> = | ||
token_set![T![typescript], T![jsx]]; | ||
|
||
pub(crate) const SUPPORTED_LANGUAGE_FLAVOR_SET_STR: &[&str] = &["typescript", "jsx"]; |
Oops, something went wrong.