I have the following tree:
.
├── Cargo.lock
├── Cargo.toml
└── src
├── main.rs
├── parse
│ ├── grammar.rs
│ └── internals
│ ├── base.pest
│ ├── command_substitution.pest
│ ├── strings.pest
│ └── variables.pest
└── parse.rs
In src/parse/grammar.rs I have the following code:
use pest_derive::Parser;
#[derive(Parser)]
#[grammar = "parse/internals/strings.pest"]
#[grammar = "parse/internals/variables.pest"]
#[grammar = "parse/internals/command_substitution.pest"]
#[grammar = "parse/internals/base.pest"]
pub struct ElviParser;
Notice the placement of strings.pest and variables.pest: how variables.pest is defined after strings.pest.
If I edit variables.pest, I get the following error:
// Main rules
normalVariable = @{ variableIdent ~ "=" ~ anyString } ■ Rule anyString is undefined
variableIdent = { !ASCII_DIGIT ~ (ASCII_ALPHANUMERIC | "_")+ }
Where anyString is defined in strings.pest. It compiles correctly, it's just the LSP not understanding this.
I have the following tree:
In
src/parse/grammar.rsI have the following code:Notice the placement of
strings.pestandvariables.pest: howvariables.pestis defined afterstrings.pest.If I edit
variables.pest, I get the following error:Where
anyStringis defined instrings.pest. It compiles correctly, it's just the LSP not understanding this.