-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Benjamin Wilson <[email protected]> Co-authored-by: Markus Rudolph <[email protected]> Signed-off-by: Mark Sujew <[email protected]>
- Loading branch information
1 parent
769e52c
commit cfe3f94
Showing
66 changed files
with
13,611 additions
and
3 deletions.
There are no files selected for viewing
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,13 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
} | ||
} |
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,41 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: CI (${{ matrix.os }}) | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [windows-latest, ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
cache: 'pnpm' | ||
- name: Build | ||
shell: bash | ||
run: | | ||
pnpm install | ||
pnpm build | ||
- name: Test | ||
if: success() || failure() | ||
shell: bash | ||
run: | | ||
pnpm test |
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,11 @@ | ||
.vscode/* | ||
!.vscode/extensions.json | ||
!.vscode/launch.json | ||
!.vscode/tasks.json | ||
node_modules/ | ||
dist/ | ||
out/ | ||
**/src/generated | ||
**/syntaxes/pli.merged.json | ||
*.tsbuildinfo | ||
*.vsix |
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,3 @@ | ||
auto-install-peers = true | ||
lockfile = true | ||
link-workspace-packages = 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,6 @@ | ||
{ | ||
"recommendations": [ | ||
"langium.langium-vscode", | ||
"vitest.explorer" | ||
] | ||
} |
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,88 @@ | ||
// A launch configuration that launches the extension inside a new window | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Run Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}/packages/extension", | ||
"${workspaceFolder}/code_samples" | ||
], | ||
"sourceMaps": true, | ||
"outFiles": [ | ||
"${workspaceFolder}/packages/language/out/**/*.js", | ||
"${workspaceFolder}/packages/extension/out/**/*.js" | ||
] | ||
}, | ||
{ | ||
"name": "Run Web Extension", | ||
"type": "extensionHost", | ||
"debugWebWorkerHost": true, | ||
"request": "launch", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}/packages/extension", | ||
"--extensionDevelopmentKind=web", | ||
"${workspaceFolder}/code_samples" | ||
], | ||
"sourceMaps": true, | ||
"outFiles": [ | ||
"${workspaceFolder}/packages/language/out/**/*.js", | ||
"${workspaceFolder}/packages/extension/out/**/*.js" | ||
] | ||
} | ||
{ | ||
"name": "Attach to Language Server", | ||
"type": "node", | ||
"port": 6009, | ||
"request": "attach", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"sourceMaps": true, | ||
"outFiles": [ | ||
"${workspaceFolder}/packages/language/out/**/*.js", | ||
"${workspaceFolder}/packages/extension/out/**/*.js", | ||
"${workspaceFolder}/node_modules/langium" | ||
] | ||
}, | ||
{ | ||
"name": "Vitest: Run All", | ||
"type": "node", | ||
"request": "launch", | ||
"skipFiles": [ | ||
"<node_internals>/**", | ||
], | ||
"cwd": "${workspaceFolder}", | ||
"runtimeExecutable": "pnpm", | ||
"args": [ | ||
"vitest", | ||
"run", | ||
"--no-watch" | ||
], | ||
"smartStep": true, | ||
"console": "integratedTerminal" | ||
}, | ||
{ | ||
"name": "Vitest: Run Selected File", | ||
"type": "node", | ||
"request": "launch", | ||
"autoAttachChildProcesses": true, | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"runtimeExecutable": "pnpm", | ||
"args": [ | ||
"vitest", | ||
"run", | ||
"${relativeFile}" | ||
], | ||
"smartStep": true, | ||
"console": "integratedTerminal" | ||
} | ||
] | ||
} |
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
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
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
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,3 @@ | ||
TEST: PROCEDURE OPTIONS(MAIN) REORDER; | ||
dcl x(-2) fixed bin; //error: IBM1295IE Sole bound specified is less than 1. An upper bound of 1 is assumed. | ||
END TEST; |
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,2 @@ | ||
0PACK: PACKAGE EXPORTS(TEST, TEST, TEST); //error: TEST has 3 occurences, needed 1 | ||
0END; |
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,3 @@ | ||
0a: proc( x ) options(nodescriptor); //error: The NODESCRIPTOR attribute is invalid when any parameters have the NONCONNECTED attribute. | ||
dcl x(20) fixed bin nonconnected; | ||
0end a; |
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,31 @@ | ||
{ | ||
"name": "pl-one-workspace", | ||
"description": "Base workspace package", | ||
"version": "0.0.1", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"watch": "tsc -b tsconfig.build.json --watch", | ||
"build": "pnpm langium:generate && tsc -b tsconfig.build.json && pnpm --dir packages/extension build && node ./scripts/merge-tmlanguage.mjs", | ||
"build:clean": "pnpm clean && pnpm build", | ||
"lint": "eslint src --ext ts", | ||
"langium:generate": "pnpm --dir packages/language langium:generate", | ||
"langium:watch": "pnpm --dir packages/language langium:watch", | ||
"test": "vitest" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.0.0", | ||
"@typescript-eslint/parser": "~7.13.0", | ||
"@typescript-eslint/eslint-plugin": "~7.13.0", | ||
"eslint": "~8.57.0", | ||
"deepmerge": "^1.5.0", | ||
"langium": "~3.2.0", | ||
"shx": "~0.3.4", | ||
"typescript": "~5.4.5", | ||
"vitest": "^1.6.0" | ||
}, | ||
"volta": { | ||
"node": "18.20.3", | ||
"npm": "10.7.0" | ||
} | ||
} |
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 @@ | ||
# PL1 Language Package |
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,10 @@ | ||
{ | ||
"projectName": "Pl1", | ||
"languages": [{ | ||
"id": "pli", | ||
"grammar": "src/pli.langium", | ||
"fileExtensions": [".pli"], | ||
"caseInsensitive": true | ||
}], | ||
"out": "src/generated" | ||
} |
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,48 @@ | ||
{ | ||
"name": "pl-one-language", | ||
"description": "The language specific package", | ||
"version": "0.0.1", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"files": [ | ||
"out", | ||
"src" | ||
], | ||
"main": "./out/index.js", | ||
"module": "./out/index.js", | ||
"exports": { | ||
".": { | ||
"types": "./out/index.d.ts", | ||
"default": "./out/index.js" | ||
} | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
".": [ | ||
"out/index" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"clean": "shx rm -fr *.tsbuildinfo out", | ||
"build": "echo 'No build step'", | ||
"build:clean": "npm run clean && npm run build", | ||
"langium:generate": "langium generate", | ||
"langium:watch": "langium generate --watch" | ||
}, | ||
"dependencies": { | ||
"chevrotain": "^11.0.3", | ||
"langium": "~3.2.0", | ||
"vscode-languageserver": "~9.0.1", | ||
"vscode-languageserver-types": "^3.17.5" | ||
}, | ||
"devDependencies": { | ||
"langium-cli": "~3.2.0" | ||
}, | ||
"volta": { | ||
"node": "18.20.3", | ||
"npm": "10.7.0" | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
packages/language/src/documentation.ts/pli-documentation-provider.ts
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,63 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import { AstNode, JSDocDocumentationProvider } from 'langium'; | ||
import { isDeclaredVariable, isDoType3Variable, isLabelPrefix, isProcedureStatement, ProcedureStatement } from '../generated/ast'; | ||
|
||
export class PliDocumentationProvider extends JSDocDocumentationProvider { | ||
|
||
override getDocumentation(node: AstNode): string | undefined { | ||
if (isDeclaredVariable(node)) { | ||
const declaredItem = node.$container; | ||
let text = '```\n' + `DECLARE ${node.name} `; | ||
for (const attribute of declaredItem.attributes) { | ||
text += `${attribute.$cstNode?.text} `; | ||
} | ||
text += '\n```'; | ||
return text; | ||
} else if (isLabelPrefix(node) && isProcedureStatement(node.$container)) { | ||
return this.getProcedureHoverContent(node.$container); | ||
} else if (isProcedureStatement(node)) { | ||
return this.getProcedureHoverContent(node); | ||
} else if (isDoType3Variable(node)) { | ||
return '```\nDECLARE' + node.name + '\n```'; | ||
} | ||
return ''; | ||
} | ||
|
||
private getProcedureHoverContent(node: ProcedureStatement): string | undefined { | ||
let text = '```\n'; | ||
for (const label of node.labels) { | ||
text += `${label.name} `; | ||
} | ||
text += 'PROCEDURE '; | ||
if (node.parameters.length > 0) { | ||
text += '(' + node.parameters.map(e => e.id).join(', ') + ') '; | ||
} | ||
if (node.recursive.length > 0) { | ||
text += 'RECURSIVE '; | ||
} | ||
if (node.order.includes('ORDER')) { | ||
text += 'ORDER '; | ||
} else if (node.order.includes('REORDER')) { | ||
text += 'REORDER '; | ||
} | ||
if (node.options.length > 0) { | ||
text += node.options.map(e => e.$cstNode?.text).join(' '); | ||
} | ||
if (node.returns.length > 0) { | ||
text += node.returns.map(e => e.$cstNode?.text).join(' '); | ||
} | ||
text += '\n```'; | ||
return text; | ||
} | ||
|
||
} |
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,17 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
export * from './pli-module.js'; | ||
export * from './validation/pli-validator.js'; | ||
export * from './generated/ast.js'; | ||
export * from './generated/grammar.js'; | ||
export * from './generated/module.js'; | ||
export * from './workspace/pli-builtin-functions.js'; |
Oops, something went wrong.