Autodesk-AutoCAD / AutoLispExt

Visual Studio Code Extension for AutoCAD® AutoLISP
https://marketplace.visualstudio.com/items?itemName=Autodesk.autolispext
Apache License 2.0
83 stars 29 forks source link

DCL Parser with AST Object Encapsulation #173

Closed JD-Howard closed 2 years ago

JD-Howard commented 2 years ago

Objective

One of our big obstacles for truly finishing work with any particular provider has been related to DCL technical debt. This PR adds proper DCL Parsing that fully wraps the document in AST Objects/Interfaces. By itself, it doesn't actually add any new functionality for end users, but is the foundation for various provider enhancements.

Abstractions

This was designed for future reliance on the IDclFragment and its derived IDclContainer interfaces, but there is no actual inheritance between the concrete classes. All DCL AST Objects are fragments, but 2 of the 3 are containers. Both interfaces are defined in the DclInterfaces.ts file and all the concrete objects implement functionality ordered by IDclFragement->IDclContainer->Class

Concrete Classes DclAtom represents single/block comments, strings and generally similar to the LispAtom that holds sequential characters DclAttribute Single line sequence of DclAtoms that are not comments and between { and } brackets DclTile Handles standard and dialog definition tiles, contains attributes, other tiles, comments & initiated by an { bracket

The DCL parser has been tested for malformed syntax and is performing in such a way that it doesn't lose any elements, provides predictable context that will support providers and in the absence of trailing spaces/tabs can read and exactly reproduce a document.

The ReadOnlyDocument has been updated to provide the containerized view of a DCL document in the same way an LSP file would. LSP's used documentContainer property and now has a documentDclContainer property for DCL files.

Also fixed argument bugs in previous tests.

Tests performed

All new functionality covered by this PR is between 95% and 100% on the code coverage; with an above 98% average. The tests could be divided up more than they currently are, but a large effort was made to ensure basic and edge cases all perform exactly as expected. All new tests have been performed on Mac and are working as expected.

Screen shot

Nothing to show because this is an analytical support PR

JD-Howard commented 2 years ago

@Sen-real This should be pretty solid, but please give it a review when you get a chance. I'll get it tested on my Mac later today.

JD-Howard commented 2 years ago

@Sen-real I've resolved all the issues I've found and anything having to do with CodeQL. I also now tested it on my Mac and the only tests failing are the Lisp formatting tests that have always failed on Mac.

Sen-real commented 2 years ago

@Sen-real I've resolved all the issues I've found and anything having to do with CodeQL. I also now tested it on my Mac and the only tests failing are the Lisp formatting tests that have always failed on Mac.

Thank you @JD-Howard , I'm looking at this PR and will have a try locally.