Skip to content

Commit

Permalink
style standards, reformatting, fix # comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehvix committed Dec 8, 2022
1 parent 178fa79 commit dfac502
Show file tree
Hide file tree
Showing 16 changed files with 4,486 additions and 547 deletions.
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"indent": [ "error", 4 ],
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,38 @@

This is a [Visual Studio Code](https://code.visualstudio.com/) extension for the NOME3 language used for **3D-computer-aided-design** on the **[JIPCAD](https://jipcad.github.io/docs/)** software, supervised by Prof. Carlo Sequin and developed by the JIPCAD group.

# Release Notes:
This extension supports files with both the (.nom, .jipcad $*$) endings.
Enjoy!

## 0.0.0
Initial Release of the **Visual Studio Code NOME language extension**.
## Features
### 1. Autocompletion of commands
![](.github/images/autocompletion.gif)

# Features
1. **Autocompletion of commands**
<img src="https://raw.githubusercontent.com/JIPCAD/JIPCAD-vs-code/master/images/autocompletion.gif">
### 2. Syntax coloring
![](.github/images/syntax_highlight.png)

2. **Syntax coloring**
<img src="https://raw.githubusercontent.com/JIPCAD/JIPCAD-vs-code/master/images/syntax_highlight.png">
### 3. Commenting
![](.github/images/toggle_block_comment.gif)

3. **Commenting**
<img src="https://raw.githubusercontent.com/JIPCAD/JIPCAD-vs-code/master/images/toggle_block_comment.gif">
### 4. Running of Nome Executable
![](.github/images/run_nome.gif)

4. **Running of Nome Executable**
<img src="https://raw.githubusercontent.com/JIPCAD/JIPCAD-vs-code/master/images/run_nome.gif">
### 5. Customize directory of NOME executable
![](.github/images/remote_running.gif)

5. **Customize directory of NOME executable**
<img src="https://raw.githubusercontent.com/JIPCAD/JIPCAD-vs-code/master/images/remote_running.gif">

# Intended Updates/Improvements
## Intended Updates/Improvements

1) **Semantic highlighting**
- [ ] Semantic highlighting
- [ ] Syntax error reporting

2) **Syntax error reporting**

# Footnotes
This extension supports files with both the (.nom, .jipcad $*$) endings.
Enjoy!
## Development


```bash
$ git clone https://github.com/JIPCAD/JIPCAD-vs-code
$ npm ci
```

Pressing `F5` will compile and run the extension in a new 'Extension Development Host' window.
118 changes: 59 additions & 59 deletions customstyling.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,74 +9,74 @@ const tokens = fileContent.replace(/[\s\n\t\r]+/g, ' ').trim().split(' ');
const memory = {};

const program = async (input) => {
await statement_list(input);
}
await statement_list(input);
};

const statement_list = async (input) => {
const statementFound = await statement(input)
if (statementFound) {
await statement_list(input)
}
}
const statementFound = await statement(input);
if (statementFound) {
await statement_list(input);
}
};

const statement = async (input) => {
const token = input.shift();
if (token === 'point') {
const next = input.shift();
console.log(memory[next]);
return true;
} else if (token === 'surface') {
const fileName = input.shift();
input.shift();
const variableName = input.shift();
const fileRead = fs.readFileSync(fileName, 'utf-8');
memory[variableName] = fileRead;
return true;
} else if (token === 'polyline') {
const variableName = input.shift();
const filterType = input.shift();
const filter = input.shift();
input.shift();
const into = input.shift();
const splitByLine = memory[variableName].split('\n');
const filtered = splitByLine.filter(line => line.indexOf(filter) !== -1);
const joined = filtered.join('\n');
memory[into] = joined;
return true;
} else if (token === 'LOOP') {
await loop(input);
return true;
} else if (token === 'GET') {
await GET(input);
return true;
}
input.unshift(token);
return false;
}
const token = input.shift();
if (token === 'point') {
const next = input.shift();
console.log(memory[next]);
return true;
} else if (token === 'surface') {
const fileName = input.shift();
input.shift();
const variableName = input.shift();
const fileRead = fs.readFileSync(fileName, 'utf-8');
memory[variableName] = fileRead;
return true;
} else if (token === 'polyline') {
const variableName = input.shift();
const filterType = input.shift();
const filter = input.shift();
input.shift();
const into = input.shift();
const splitByLine = memory[variableName].split('\n');
const filtered = splitByLine.filter(line => line.indexOf(filter) !== -1);
const joined = filtered.join('\n');
memory[into] = joined;
return true;
} else if (token === 'LOOP') {
await loop(input);
return true;
} else if (token === 'GET') {
await GET(input);
return true;
}
input.unshift(token);
return false;
};

const loop = async (input) => {
const amount = parseInt(input.shift());
const amount = parseInt(input.shift());

let i = 0;
while (i++ < amount) {
if (i === amount) {
await statement_list(input)
} else {
await statement_list([...input])
}
if (input[0] === 'STOP') {
input.shift();
let i = 0;
while (i++ < amount) {
if (i === amount) {
await statement_list(input);
} else {
await statement_list([...input]);
}
if (input[0] === 'STOP') {
input.shift();
}
}
}
}
};

const GET = async (input) => {
const url = input.shift();
input.shift();
variableName = input.shift();
await fetch(url)
.then(response => response.text())
.then(text => memory[variableName] = text);
}
const url = input.shift();
input.shift();
variableName = input.shift();
await fetch(url)
.then(response => response.text())
.then(text => memory[variableName] = text);
};

program(tokens);
2 changes: 1 addition & 1 deletion language-configuration.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "###",
"lineComment": "#",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": ["(*","*)"],
"include": "#comments-inline",
Expand Down
Loading

0 comments on commit dfac502

Please sign in to comment.