Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Extracted PLI Compiler Messages/Codes #6

Open
wants to merge 2 commits into
base: feature/langium-project
Choose a base branch
from

Conversation

montymxb
Copy link
Member

@montymxb montymxb commented Dec 5, 2024

Adds in what was extracted from the 6.1 compiler messages & codes document. Much in the same fashion as tests were extracted, there's over 1k codes, along with detailed messages & explanations. This pulls it all together into a TS file that we can reference with full information intact, ideally making it easier as we start to work these into validations.

Heads-up, the synthesized codes file is over 18k lines long. It's a bit large up front, but we're going to, eventually, need all of these for full support down the road.

One validation is updated to show how this works in practice, the rest can be trivially updated as well. I was also able to auto-detect when params were likely needing to be substituted, and modified those cases to be parametric pli code objects. In that way, usage requires you to provide the params to complete the message as intended.

msujew and others added 2 commits November 26, 2024 18:37
Co-authored-by: Benjamin Wilson <[email protected]>
Co-authored-by: Markus Rudolph <[email protected]>
Signed-off-by: Mark Sujew <[email protected]>
@montymxb montymxb requested a review from msujew December 5, 2024 16:08
@msujew msujew force-pushed the feature/langium-project branch from cfcd5bf to 6b5d434 Compare December 11, 2024 13:19
export const Info = {

/**
* This message is used in building the options listing.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be helpful to have the explanation also embedded as a string.
Both message and explanation have a value for the user. The page number could be also stored as a number for a goto feature if someone wants this (just an idea).

@@ -0,0 +1,18347 @@
/**
* Generated by process-codes-into-ts.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the generator? Are there reasons to hide it? Would be great if we would be able to make the file also for future or other versions of the documentation.

node: bound,
property: "bound1",
code: "IBM1295IE"
code: code.fullCode
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need the full code here, because VS Code has also a severity which could be mapped to the PL/I severities... but not entirely, I guess.


export function IBM1295IE_sole_bound_specified(bound: DimensionBound, accept: ValidationAcceptor): void {
if(bound.bound2 !== undefined) {
return;
}
const upper = bound.bound1;
if(isBoundNegative(upper) || isBoundZero(upper)) {
accept("error", "Sole bound specified is less than 1. An upper bound of 1 is assumed.", {
const code = Error.IBM1295I;
accept("error", code.message, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Accepting" the message code could be a one-liner using a helper method. That can be done in a follow-up PR I think...
Just writing it down because of code redundancy reasons: If we do it like this all the time, we are doing too much again and again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants