Home / Examples
Name Modified Size InfoDownloads / Week
Parent folder
divisby11.c 2015-12-30 380 Bytes
divisby11switch.c 2015-12-30 443 Bytes
sum100.c 2015-12-30 387 Bytes
sum100dw.c 2015-12-30 362 Bytes
sum100w.c 2015-12-30 368 Bytes
Totals: 5 Items   1.9 kB 0
styler50.py
Nathaniel Kim
n8kim1@yahoo.com
December 29, 2015
youtu.be/1zRCMX7pGjM

_____________________________

This is styler50, a Python 3 program which stylizes C code following the guidelines of style50 and CS50's style website (https://manual.cs50.net/style/).
styler50 takes in code from a given file and tokenizes it, breaking it down into a list of words, numbers, and symbols.
Then, it proceeds to write these tokens to a string, adding space where needed in order to stylize the code correctly.
Finally, it overwrites the original code on said file with the new, stylized code.

styler50 is not perfect, as it is impossible to implement every little detail of stylizing C code.
However, in most cases, code outputted by styler50 will pass style50 checks and adhere to the guidelines on the website.

_____________________________

In order to use styler50, make sure to install Python 3 first, of course.
Next, run styler50, and in the shell, execute styler50(your_file_name).
your_file_name should be the path of the file relative to the folder in which styler50 is also located.
Make sure the path also includes an extension.
I.e., if styler50 is located in a folder called Folder and you wish to stylize input.c, also found directly in Folder,
execute styler50(input.c).
However, if input.c is located in a folder called Inputs, which itself is located in Folder,
execute styler50(Inputs/input.c).
The file need not be a .c file, but should be a raw text file such as .c or .txt.
The output will overwrite your input file, so make sure to save a copy of the input file if desired.

_____________________________

Other files found in this folder:
    CS50 Style Guide: The HTML and related files of https://manual.cs50.net/style/.
    Examples: Five poorly stylized simple programs which demonstrate some of styler50's features.
    Old Versions: Old versions of styler50, as well as my notes while developing.
Source: README.txt, updated 2015-12-30