Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
iSorp committed May 6, 2020
2 parents 64276dd + 9302174 commit c1c8ba5
Show file tree
Hide file tree
Showing 26 changed files with 399 additions and 314 deletions.
13 changes: 12 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@
"port": 6011,
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/server/out/**/*.js"]
}
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/client/out/test/index"
],
"outFiles": ["${workspaceFolder}client/out/test/**/*.js"]
}
],
"compounds": [
{
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.6 (May 06, 2020)
- Performance update

## 0.1.5 (May 04, 2020)
- Node package issue

## 0.1.4 (May 02, 2020)
- Opening links with capital letters issue fixed
- Duplicate label statement warning
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<img src="./resources/icon.png" alt="drawing" width="100"/>

![release](https://img.shields.io/github/v/release/iSorp/macro-executor)
![maintained](https://img.shields.io/maintenance/yes/2020.svg)
[![open issues](https://img.shields.io/github/issues/iSorp/macro-executor.svg?)](https://github.com/iSorp/macro-executor/issues)
[![license](https://img.shields.io/github/license/iSorp/macro-executor)](https://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -38,8 +39,13 @@ Fanuc Macro Executor syntax highlighting, validating and project building
![Definition](./resources/codelens.png)

## Required file extension
* Macro files `.src`
* Macro files`.src`
* Include files `.def`
* Link files `.lnk`

## Coding conventions
* Uppercase for constants: `@MY_CONSTANT` 100
* Space between statements: `N9000 G01 X1`


## Default Commands
Expand Down Expand Up @@ -95,13 +101,13 @@ project
│ file2.src
└───def
file1.def
file1.def
│ file1.def
│ file1.def
└───lnk
file1.lnk
file1.lnk
F30iA_01.MEX
F30iA_01.MEX
```

Expand Down
2 changes: 2 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
- Symbol search for NC Statemets
- Parsing of .lnk files (read declarated "FILE=" properties validate only these files)
- Improve bild system (read properties of .lnk files)
- Improve lint: constant checking,..
- GOTO -> goto implementation
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Fanuc Macro-Executor Programming Language",
"author": "iSorp",
"license": "MIT",
"version": "0.0.1",
"version": "0.1.0",
"publisher": "iSorp",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path';
import { ExtensionContext, workspace, commands, window, Selection } from 'vscode';
import {
LanguageClient, LanguageClientOptions,
ServerOptions, TransportKind, RevealOutputChannelOn, Position,
ServerOptions, TransportKind, RevealOutputChannelOn,
} from 'vscode-languageclient';
import registerCommands from './common/commands';

Expand Down Expand Up @@ -45,7 +45,7 @@ export function activate(context: ExtensionContext) {

synchronize: {
// Notify the server about file changes
fileEvents: workspace.createFileSystemWatcher('**/*.{src,def}')
fileEvents: workspace.createFileSystemWatcher('**/*.{src,def,lnk}')
},
diagnosticCollectionName: 'macro',
progressOnInitialization: true,
Expand Down
43 changes: 0 additions & 43 deletions client/src/test/completion.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion client/src/test/diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as assert from 'assert';
import { getDocUri, activate } from './helper';

suite('Should get diagnostics', () => {
const docUri = getDocUri('diagnostics.txt');
const docUri = getDocUri('src/test.src');

test('Diagnoses uppercase texts', async () => {
await testDiagnostics(docUri, [
Expand Down
4 changes: 2 additions & 2 deletions client/src/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export let platformEol: string;
*/
export async function activate(docUri: vscode.Uri) {
// The extensionId is `publisher.name` from package.json
const ext = vscode.extensions.getExtension('vscode-samples.lsp-sample')!;
const ext = vscode.extensions.getExtension('iSorp.macro-executor')!;
await ext.activate();
try {
doc = await vscode.workspace.openTextDocument(docUri);
Expand All @@ -32,7 +32,7 @@ async function sleep(ms: number) {
}

export const getDocPath = (p: string) => {
return path.resolve(__dirname, '../../testFixture', p);
return path.resolve(__dirname, '../../testSource', p);
};
export const getDocUri = (p: string) => {
return vscode.Uri.file(getDocPath(p));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
$INCLUDE def/Test.def
@CONST 1000
@adr 1000
@var #1000

>Label 10
@functions 1
@operators 2
@conditionals 3
@statements 4
@CALL M98P
@RETURN M99

O functions
#c1=ATAN[#j]/[#k]
>LOOP_I 10

@FUNCTIONS 1
@OPERATORS 2
@CONDITIONALS 3
@STATEMENTS 4

@i 200
@k 200
@j 200


O FUNCTIONS
#i=ATAN[#j]/[#k]
#i=ABS[#j]
#i=BIN[#j]
#i=BCD[#j]
Expand All @@ -33,7 +44,7 @@ O functions

ENDIF

O operators
O OPERATORS
#i=#j
#i=#j+#k
#i=#j-#k
Expand All @@ -45,22 +56,24 @@ O operators
#i=#j MOD #k


O conditionals
Label
O CONDITIONALS
>L_Label 10

L_Label

GOTO Label
GOTO L_Label

IF [#VAR] THEN #VAR = 1
ELSE #VAR = 1
IF [#var] THEN #var = 1
ELSE #var = 1

IF [#VAR] THEN
#VAR = 1
ELSE #VAR = 1
IF [#var] THEN
#var = 1
ELSE #var = 1

IF [#VAR] THEN #VAR = 1
IF [#var] THEN #var = 1

ELSE
#VAR = 1
#var = 1
ENDIF

IF [#k] THEN
Expand All @@ -69,13 +82,13 @@ O conditionals
ENDIF
ENDIF

WHILE [#VAR LT CONST] DO LOOP_I
WHILE [#var LT CONST] DO LOOP_I
GOTO L_Label
END LOOP_I


O statements
N100 G01 G4.1 G[1] G#VAR X1 Y-[#1+1] F360.
N100 G01 X-#1 F360.1
O STATEMENTS
N100 G01 G4.1 G[1] G#var X1 Y-[#1+1] F360.
N110 G01 X-#1 F360.1

RETURN
14 changes: 0 additions & 14 deletions client/testSource/def/Test.def

This file was deleted.

5 changes: 0 additions & 5 deletions client/testSource/lnk/Test.lnk

This file was deleted.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "macro-executor",
"displayName": "Macro Executor Language",
"description": "Fanuc Macro-Executor Programming Language",
"version": "0.1.4",
"version": "0.1.6",
"author": "iSorp",
"publisher": "iSorp",
"license": "MIT",
Expand Down Expand Up @@ -41,7 +41,8 @@
],
"extensions": [
".src",
".def"
".def",
".lnk"
],
"configuration": "./syntaxes/macro.configuration.json"
}
Expand Down Expand Up @@ -208,8 +209,8 @@
"@types/mocha": "^7.0.1",
"@types/node": "^12.11.7",
"@typescript-eslint/parser": "^2.3.0",
"eslint": "^6.4.0",
"mocha": "^7.0.1",
"typescript": "^3.8.3",
"eslint": "^6.4.0"
"typescript": "^3.8.3"
}
}
2 changes: 1 addition & 1 deletion scripts/e2e.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

export CODE_TESTS_PATH="$(pwd)/client/out/test"
export CODE_TESTS_WORKSPACE="$(pwd)/client/testFixture"
export CODE_TESTS_WORKSPACE="$(pwd)/client/testSource"

node "$(pwd)/client/out/test/runTest"
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lsp-macro-server",
"description": "Fanuc Macro-Executor Programming Language",
"version": "0.0.1",
"version": "0.1.0",
"author": "iSorp",
"publisher": "iSorp",
"license": "MIT",
Expand Down
10 changes: 5 additions & 5 deletions server/src/macroLanguageService/macroLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export interface LanguageService {
findDefinition(document: TextDocument, position: Position, macroFile: Macrofile): Location | null;
findReferences(document: TextDocument, position: Position, macroFile: Macrofile): Location[];
findImplementations(document: TextDocument, position: Position, macroFile: Macrofile): Location[];
findDocumentLinks(document: TextDocument, stylesheet: Macrofile, documentContext: DocumentContext): DocumentLink[];
findDocumentSymbols(document: TextDocument, stylesheet: Macrofile): SymbolInformation[];
findCodeLenses(document: TextDocument, stylesheet: Macrofile): CodeLens[];
findDocumentLinks(document: TextDocument, macrofile: Macrofile, documentContext: DocumentContext): DocumentLink[];
findDocumentSymbols(document: TextDocument, macrofile: Macrofile): SymbolInformation[];
findCodeLenses(document: TextDocument, macrofile: Macrofile): CodeLens[];
}

function createFacade(parser: Parser, hover: MacroHover, navigation: MacroNavigation, validation: MacroValidation): LanguageService {
Expand All @@ -41,11 +41,11 @@ function createFacade(parser: Parser, hover: MacroHover, navigation: MacroNaviga
findImplementations: navigation.findImplementations.bind(navigation),
findDocumentLinks: navigation.findDocumentLinks.bind(navigation),
findDocumentSymbols: navigation.findDocumentSymbols.bind(navigation),
findCodeLenses: navigation.findCodeLenses.bind(navigation),
findCodeLenses: navigation.findCodeLenses.bind(navigation)
};
}

export function getMacroLanguageService(options?: LanguageServiceOptions): LanguageService {
export function getMacroLanguageService(options: LanguageServiceOptions): LanguageService {

return createFacade(
new Parser(options && options.fileProvider),
Expand Down
2 changes: 1 addition & 1 deletion server/src/macroLanguageService/macroLanguageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface FindDocumentLinks {

export interface LanguageServiceOptions {

fileProvider?: MacroFileProvider;
fileProvider: MacroFileProvider;
}

export interface MacroFileType {
Expand Down
1 change: 1 addition & 0 deletions server/src/macroLanguageService/parser/macroErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const ParseError = {
OperatorExpected: new MacroIssueType('macro-operatorexpected', localize('expected.operator', 'operator expected')),
IdentifierExpected: new MacroIssueType('macro-identifierexpected', localize('expected.ident', 'identifier expected')),
AddressExpected: new MacroIssueType('macro-addressexpected', localize('expected.address', 'address expected')),
ValueExpected: new MacroIssueType('macro-valueexpected', localize('expected.value', 'value expected')),
BodyExpected: new MacroIssueType('macro-bodyexpected', localize('expected.body', 'body expected')),
LabelExpected: new MacroIssueType('macro-labelexpected', localize('expected.label', 'label expected')),
TermExpected: new MacroIssueType('macro-termexpected', localize('expected.term', 'term expected')),
Expand Down
Loading

0 comments on commit c1c8ba5

Please sign in to comment.