Hey Devs,
I want to make a utility in python to validate a given input(a function of c code) on the basis of some rules like whether it has proper indentation.
Any Pointers? Tips? Ideas? of how i can do it.
Hey Devs,
I want to make a utility in python to validate a given input(a function of c code) on the basis of some rules like whether it has proper indentation.
Any Pointers? Tips? Ideas? of how i can do it.
For further actions, you may consider blocking this person and/or reporting abuse
Chris Greening -
Kenzo Castañeda -
Engr SoluTion 😍 -
Andy -
Once suspended, ankitbeniwal will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, ankitbeniwal will be able to comment and publish posts again.
Once unpublished, all posts by ankitbeniwal will become hidden and only accessible to themselves.
If ankitbeniwal is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Ankit Beniwal.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag ankitbeniwal:
Unflagging ankitbeniwal will restore default visibility to their posts.
Top comments (12)
Are you trying to do this to learn?
If no, there are linters and formatters for almost every language in which you can put the rules for this to be done.
If yes, what have you tried so far? I mean because you are trying this to learn it would not be a good if someone gives you the answers directly. Trying to figure out solutions to problems is where you actually learn. If you have no idea maybe search how linters and formatters work. That can be a starting point.
Yes trying to learn. I am currently thinking about regex.
Is there any other method? or should I just dive in.
Unless you are very good at regex try just using string methods and usual data structures. You don't want to spend time learning regex as well as about formatters.
Make one of them your goal - regex or formatter. It would reduce the learning curve.
Very well. Thanks!
What about converting the function representation to unicode?
can you please elaborate that?
Well unicode holds values for line feeds, carriage returns and spaces as well as tabs.
With the use of a regular expression and grouping in regular expressions you should be able to test your string to see if it validates as a c function.
Exactly what i was thinking but without unicode. Now you just gave me the missing part. Thanks!!
Run a few tests and let me know how you get on.
sure thing