Testing My New Code Formatter

I am using the Crayon Code Highlighter.  Let’s see how it works:

procedure ConfigureOptions;
var
  Option : IOptionDefintion;
begin
  Option := TOptionsRegistry.RegisterUnNamedOption<string>('The file to be processed',
    procedure(value : string)
    begin
        TSampleOptions.FileToProcess:= value;
    end);
  Option.Required := true;

  Option := TOptionsRegistry.RegisterOption<Boolean>('OutputInUpperCase','o', 'The output should be in upper case',
    procedure(value : Boolean)
    begin
        TSampleOptions.OutputInUpperCase:= value;
    end);
  Option.Required := true;  Option.HasValue := False;

  Option := TOptionsRegistry.RegisterOption<integer>('NumberOfIterations','n','The number of times the file should be processed',
    procedure(value : integer)
    begin
        TSampleOptions.NumberofIterations := value;
    end);
  Option.Required := False;
  Option.HasValue := True;
end;

Looks pretty good I think.

 

8 Replies to “Testing My New Code Formatter”

  1. Hey mate,

    Does this deal with greater/less than signs sensibly? I find I have to walk this careful path where I type all the text in to the visual editor (because I’m a wus and like my WYSIWYG editor), then flip to the Text Editor to enter all the code, then remember not to flip back to the visual editor lest it screw up all my generics snippets.

    Cheers
    Malcolm

  2. Mal – I believe it does. It plugs right in to the WYSIWYG editor, allow you to enter code directly, so you can have your editor and eat it, too. 😉

    • Any tips on how to get pascal code highlighted on this site?

      I just posted something as JavaScript, because it has // comments, single qoated strings, and the “var” and “function” keywords get highlighted. 🙂

  3. I will note, in passing, that the Delphi support is credited to Chris McClenny, a colleague of mine. So if there are issues, I am sure he would be pleased to hear of them.

Comments are closed.