Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Moved compiler parser to cocopa package for better testability and ma…
Browse files Browse the repository at this point in the history
…intainability
  • Loading branch information
elektronikworkshop authored and adiazulay committed Jan 19, 2021
1 parent d337295 commit 0865c97
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 374 deletions.
6 changes: 3 additions & 3 deletions BRANCHNOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Provide a configuration flag which allows the user to turn this feature off - th
| | :white_check_mark: Option to backup old configurations? |
| **Configuration flags** | :heavy_check_mark: Provide global disable flag for IntelliSense auto-config |
| | :white_check_mark: Provide project specific override for the global flag - most users will likely use the default setup and disable auto-generation for very specific projects |
| **Unit tests** | :white_check_mark: Basic parser (known boards, match/no match)|
| | :white_check_mark: Querying of compiler built-in includes |
| **Unit tests** | :heavy_check_mark: Basic parser (known boards, match/no match)|
| | :heavy_check_mark: Querying of compiler built-in includes (Note: to be changed to generic compiler such that Arduino is not necessary for unit testing) |
| | :white_check_mark: Throwing arbitrary data at parser engines |
| | :white_check_mark: JSON input |
| | :white_check_mark: JSON output |
Expand All @@ -47,7 +47,7 @@ Provide a configuration flag which allows the user to turn this feature off - th
| | :white_check_mark: Document configuration settings in [README.md](README.md) |
| | :white_check_mark: Document features in [README.md](README.md) |
| | :white_check_mark: How to handle compilation failure? Only set if more comprehensive |
| | :white_check_mark: Extract compiler command parser from vscode-arduino and [publish](https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c) it as a separate package which will allow reusage and tests can be run without the heavy vscode-arduino rucksack |
| | :heavy_check_mark: Extract compiler command parser from vscode-arduino and [publish](https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c) it as a separate package which will allow reusage and easy testing without heavy vscode-arduino rucksack. Done, see [cocopa](https://www.npmjs.com/package/cocopa) |
| | :white_check_mark: Finally: go through my code and look for TODOs |

`*` not committed to branch yet
Expand Down
45 changes: 42 additions & 3 deletions package-lock.json

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

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,18 @@
"plugin-error": "^1.0.1",
"tslint": "^5.20.1",
"typemoq": "^1.6.0",
"typescript": "^2.2.1",
"typescript": "^3.7.5",
"vscode-test": "^1.4.0",
"webpack": "^4.44.1"
},
"dependencies": {
"body-parser": "^1.16.1",
"child_process": "^1.0.2",
"cocopa": "0.0.3",
"compare-versions": "^3.4.0",
"eventemitter2": "^4.1.0",
"express": "^4.14.1",
"fs": "0.0.1-security",
"glob": "^7.1.1",
"iconv-lite": "^0.4.18",
"impor": "^0.1.1",
Expand Down
8 changes: 4 additions & 4 deletions src/arduino/arduino.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

import * as ccp from "cocopa";
import * as fs from "fs";
import * as glob from "glob";
import * as os from "os";
Expand All @@ -22,7 +23,6 @@ import { arduinoChannel } from "../common/outputChannel";
import { ArduinoWorkspace } from "../common/workspace";
import { SerialMonitor } from "../serialmonitor/serialMonitor";
import { UsbDetector } from "../serialmonitor/usbDetector";
import { CCppProperties, CompilerCmdParser, CompilerCmdParserEngineGcc } from "./intellisense";
import { ProgrammerManager } from "./programmerManager";

/**
Expand Down Expand Up @@ -808,8 +808,8 @@ export class ArduinoApp {
if (!VscodeSettings.getInstance().disableIntelliSenseAutoGen) {

// setup the parser with its engines
const gccParserEngine = new CompilerCmdParserEngineGcc(dc.sketch);
const compilerParser = new CompilerCmdParser([gccParserEngine]);
const gccParserEngine = new ccp.ParserGcc(dc.sketch);
const compilerParser = new ccp.Runner([gccParserEngine]);

// set up the function to be called after parsing
const _conclude = () => {
Expand All @@ -821,7 +821,7 @@ export class ArduinoApp {
}
};
return {
callback: compilerParser.callback,
callback: compilerParser.callback(),
conclude: _conclude,
};
}
Expand Down
Loading

0 comments on commit 0865c97

Please sign in to comment.