Bundle Miscellaneous runtime utilities: UUID generation, date string parsing and formatting, command-line parameter handling, network time retrieval, and console spinner animations. Included in lang.obl.
CodeFormatter
Code formatter
Operations
Format # native
method : public : native : Format(source:String, is_color:Bool) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| source | String | source code |
| is_color | Bool | true for ascii color formatting, false otherwise |
Return
| Type | Description |
|---|---|
| String | formatted code |
Example
opts := Map->New()<String, String>;
opts->Insert("ident-space", "3");
formatter := CodeFormatter->New(opts);
src := "class Foo{method:public:Bar()~Nil{x:=1;}}";
formatter->Format(src, false)->PrintLine();New # constructor
Constructor
New(options:Map<String,String>)Parameters
| Name | Type | Description |
|---|---|---|
| options | Map<String,String> | options Support for following options:
|
Example
opts := Map->New()<String, String>;
opts->Insert("ident-space", "2");
opts->Insert("trim-trailing", "true");
formatter := CodeFormatter->New(opts);