COCOR-LSP.md 1.4 KB

Coco/R diagnostics through LSP

Version 0.1.7 adds the first real Language Server connection. The Theia/VS Code extension starts out/server.js through vscode-languageclient; the server invokes a configured executable containing the generated Coco/R parser/validator.

Pascal dialects (.pas / .pp / .p)

The same server validates Pascal files with the pilot validators from grammars/. Each pilot binary takes the source file as its single argument and writes a .LST listing next to it; the server parses the listing's ***** ^ message lines (positions are caret-relative to the code after the listing prefix, zero-based columns).

"modula2.pascal.dialect": "freepascal",
"modula2.pascal.validators": {
  "p2": "<root>/grammars/P2/build/P2",
  "p4": "<root>/grammars/P4/build/P4",
  "p6": "<root>/grammars/P6/build/P6",
  "pascal": "<root>/grammars/Pascal/build/PStd",
  "turbopascal3": "<root>/grammars/TurboPascal3/build/TP3",
  "freepascal": "<root>/grammars/FreePascal/build/FPC",
  "blaise": "<root>/grammars/Blaise/build/BlaiseV",
  "pascals": "<root>/grammars/PascalS/build/PascalS"
}

Build each binary first with its pilot build.sh (needs CR and gm2 -fiso). The local Modula-2 analysis never runs on Pascal text. With no command configured for the active dialect the server publishes no diagnostics. Never point these at the pcom/psc oracle compilers — they can hang on invalid input.