Requirements¶
Source: examples/requirements
requirements is the example to study once one language is no longer enough.
It shows how Pegium behaves when several related file types belong to the same
workspace and are served by the same runtime.
What it shows¶
- two related languages served by one workspace
- cross-file and cross-language behavior
- references and scoping beyond a single document
- a shared LSP server for
.reqand.tst
Useful entry points¶
- CLI:
./build/examples/requirements/pegium-example-requirements-cli - LSP:
./build/examples/requirements/pegium-example-requirements-lsp
What to read first¶
The clearest reading path is:
examples/requirements/src/RequirementsModule.cppfor multi-language registrationexamples/requirements/src/Language.cppfor the language definitionsexamples/requirements/src/validation/RequirementsValidator.cppandexamples/requirements/src/validation/TestsValidator.cppfor language-specific validation on both sides of the workspaceexamples/requirements/src/lsp/RequirementsFormatter.cppfor shared editor-facing behavior
Why start here¶
Use this example when your real project spans several related grammars or file types.
Use this example when¶
- several file types belong to one logical workspace
- references cross file or language boundaries
- you need a more realistic document/index pipeline than a single-file example