Giter Club home page Giter Club logo

Comments (3)

Roald87 avatar Roald87 commented on August 20, 2024

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.

kdorsel avatar kdorsel commented on August 20, 2024

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.

Roald87 avatar Roald87 commented on August 20, 2024

Sounds good. This should be easy to implement with the current composite design pattern which is used.

from tcblack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.