Skip to content

The well-known Artistic Style code beautifier, "compiled" to JavaScript

License

Notifications You must be signed in to change notification settings

tzikis/astyle.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

astyle.js

The well-known Artistic Style code beautifier, "compiled" to JavaScript.

Usage

Include the javacsript file:

<script src="path/to/astyle.js"></script>

Define a js function to call the c function:

js_format_string = Module.cwrap('js_format_string', 'string', ['string']);

call the function:

formatted_string = js_format_string("#include<stdio.h>\n int main(void) {\n           sleep(0);\nsleep(0);\n\t\tsleep(0);\n }");

output:

console.log(formatted_string);
#include<stdio.h>
int main(void)
{
	sleep(0);
	sleep(0);
	sleep(0);
} 

Note that, right now, it's hardcoded to use hard tabs, and one indentation style (you know, the right one! :P).

About

The well-known Artistic Style code beautifier, "compiled" to JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published