Fedora Linux Support Community & Resources Center
Prev Previous Post   Next Post Next
  #1  
Old 7th November 2010, 05:51 AM
hellork's Avatar
hellork Offline
Registered User
 
Join Date: Dec 2007
Posts: 244
linuxfedorafirefox
Post Automatically fix brackets, semicolons free, not spam

So this tiny, free, GPLv3 program I wrote is a Lua-style or Python-style syntax pre-processor for C. Essentially, if you indent your code it removes the need for much of the punctuation. Pretend you are writing Lua while actually writing C, Java, or PHP. The new version also works on code that already has brackets and semicolons. It is just a simple flex parser that removes extra punctuation and adds it back. Frankly, I'd be surprised if someone hasn't come up with it before, but I can't find anything like it that's free and open-source. It prevents me from getting lost at "C" so I am calling it "Anchor."

For example. The following program will compile on gcc by piping it through Anchor:
Code:
#include <stdio.h>
int main  int c, char **v
    while  c--
        printf  "Argument %i is \"%s\"\n",c,v[c]
    return 0
It is mostly for C, but should work with PHP and Java as well, since it actually has no clue about the underlying language. It just puts {brackets} around indented sections and adds semicolons everywhere else. Two spaces " " is equivalent to a left paren (and it will add a right paren at an appropriate place at the end of the line even if it continues past several linebreaks). The latter functionality is flaky. You may have to put whitespace at the end of a line to force the parser to ignore that line in a program. Then again, putting accidental whitespace at the end of a line will screw things up. The programmer is only human!

Again, Anchor is free, but because my writing style is that of a marketer and the spam filter is so huge around here. You will have to find it yourself.

Just get on Freshmeat DOT net and look around for Anchor and let me know what you think. Improvements (patches) welcome!
Reply With Quote
 

Tags
automatically, brackets, fix, free, semicolons, spam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Format Download Free - (Not spam) caf4926 Linux Chat 2 4th March 2009 11:46 AM
RPM Fusion Free & Non-Free Repositories for Fedora 10 Available- Thorsten Leemhuis bob News 0 25th November 2008 04:57 PM
What do those brackets mean when using the "ps" command? SharpyWarpy Using Fedora 8 30th January 2008 02:41 AM


Current GMT-time: 09:18 (Sunday, 19-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat