Showing posts with the label Notepad

PowerBuilder Code Beautifier / Formatter

A new code beautifier for PowerBuilder (PowerScript) code has been added to NotepadPB: This is the first and initial version which uses a very simple approach to formatting the code. NotepadPB will use multiple passes to adjust spacing, casing, and indenting of the script. The process works as follows:Start by tokenizing the script by splitting everything into words or characters (characters for things like quotes). We then loop through each token and determine if it's a keyword, datatype, quote, comment, carriage return, or user defined text (like variable names). We change the case on keywords and datatypes, and track indent level if the keyword is an indent-able keyword (e.g. IF, FOR, CHOOSE, etc). Comments and quoted text are ignored, we don't want to modify them. At the end, we reassemble our script.

In our second pass, we parse our script by line. We will apply some formatting on a line by line bases. The second pass is meant to…