Comments (3)
I haven't thought about it a lot, but it is probably going to be challenging since statements are often spread out over multiple lines. It will be quite challenging to format with taking the line length into account. That is why I didn't plan to implement the line length based formatting until the version 0.5. So for the implementation part it is maybe a good idea to focus on the correct identification of statements first. After correct identification you could implement some simple formatting, like indentation and spacing around the equal sings.
Do you have any ideas on how to approach this?
from tcblack.
I'm thinking recursive parsing approach. Initially loop through the full implementation and create blocks with start line(s), content and end line.
Start line examples:
If mybool1 and mybool2 then
case state of
content anything in between
End line:
end_case
end_if`
Then recursively call the same function with the body content. Each block would be associated with a number defining the level of indent.
As you said first step would be to correctly find the start/end of these blocks. I'll start something up and make a WIP PR so you can give your input.
from tcblack.
Sounds good. This should be easy to implement with the current composite design pattern which is used.
from tcblack.
Related Issues (20)
- Do not remove spaces from strings in FB_init of a function block
- How to insert a tab in windows command prompt when you want to use tabs for indentation
- Visual Studio Development Tools Environment (DTE) build method is slower than devenv solution HOT 2
- GUI/Integration into Visual Studio for TcBlack HOT 3
- Add undo functionality to TcBlackExtension HOT 2
- Replace complex regex in Tokenize
- File shouldn't have to be saved before doing a format
- TcBlackCore can not be build HOT 5
- VSIX support for VS2019 HOT 2
- Only run pipeline when there are changes in src folder HOT 1
- Pipeline should notify in case of static code analyses warnings HOT 1
- Seperate pipeline into a build and test part
- Remove assembly signing HOT 5
- Also include TcBlackExtension in build pipeline
- VAR CONSTANT, VAR PERSISTENT and VAR RETAIN not recognized
- Use 2 spaces between code and comment HOT 1
- Assignment := is placed after array of pointers
- Extra AT inserted for AT%Q* if there is no space behind AT
- Add auto formatter for C# code HOT 2
- Use external parser
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tcblack.