Pseudo.Net Modeler
The Pseudo.Net language is much like C# and other .Net languages, with the exception that it only represents types and members, and that a Pseudo.Net script may only contain one namespace declaration that the entire contents are members of.
Using/Imports You may specify as many using or import statements are you like with the following syntax:
...or...
Namespaces You may specify one namespace declaration with the following syntax:
...or...
1: namespace My.Name.Space;
|
Types
Types and members can be prefix with a number of modifiers such as access mofiders, just like with C# or VB.Net. However, Pseudo.Net allows you to use the C# style modifiers (public, private, etc...) or UML style shorthand modifiers (+, -, etc...). For a list of modifiers and their full-word equivilants, see here.
Classes Class declarations in Pseudo.Net are similar to those of C#. You supply type modifiers, followed by the class indicator ("c" or "class"), followed by member declarations enclosed in curly braces. As with other .Net languages, you may also specify a base class and/or interfaces that the class implements with C# syntax. As an example:
1: +c Thing : IDisposable {
2:
3: }
|
As you might expect, interfaces and structs follow the same rules as other .Net languages, with similar syntax to the Pseudo.Net class. Interfaces are indicated with "i" or "interface", and structs are indicated with "s" or "struct".
Enums Enumerators in Pseudo.Net have basically the same syntax as enums in C#. Pseudo.Net enums are indicated with "e", "enum", "ev", "enumv", "ef", "enumf". Using the "ev" or "enumv" indicators tells Pseudo.Net to generate values for your enum keys. Using the "ef" or "enumf" indicators tells Pseudo.Net to add the [Flags] attribute to your enum and generate values for your keys that are compatible with bit-wise operations. As an example:
1: +ef ThingType : short {
2: One, Two, Three
3: }
|
Delegates Delegates in Pseudo.Net have basically the same syntax as C#, with the exception that you may use the "d" indicator or the "delegate" keyword. As an example:
1: + d void OnThingHandler(object sender, EventArgs e);
|
Collections Pseudo.Net defines another type that represents a strongly typed collection inheriting from the System.Collections.CollectionBase abstract class. To declare a collection, you specify any modifiers, followed by the "col" indicator, followed by the type that the collection will contain, followed optionally by the name of the collection. If you do not supply the collection name, one will be generated for you. The following example creates a typed collection named "Thingies" that holds a list of "Thing" objects.
Members Pseudo.Net supports most of the member types represented by C# or VB.Net, including constructors, destructors, properties, indexers, events, methods and operator overloads.
Constructors Constructors are specified by supplying any member modifiers, followed by optional parameters enclosed in parenthesis. As an example:
1: + c Type {
2: + ();
3: + (string name);
4: + (string name, int number);
5: }
|
Destructors Destructors are specified by including a "destruct" memeber. Since there are no variation of this member, there is no point in including multiples. As an example:
1: + c Type {
2: destruct;
3: }
|
Properties To declare a property, you supply modifiers followed by the type and then the property name. Optionally you may declare your property to be read only by adding "{g}" (for get), or write only by adding "{s}" (for set). Then you may optionally specify the properties private variable's name enclosed in square brackets. If you do not specify a private variable name, one will be generated for you. Below is are examples:
1: +c Type {
2: + string Name;
3: 4: + int Value {g};
5: 6: + bool Is [isSomething];
7: 8: +$ System.Int32[] IDs {g} [intids];
9: }
|
Indexers Indexers are declared just as properties are, with the exception that the name is always "this" and you must follow it with square brackets optionally containing parameters. Example:
1: + c Type {
2: + string this[int ndx];
3: + int this[string ndx];
4: }
|
Events You declare events with modifiers, followed by the event indicator "v" or "event", followed by the event's type, followed by the event's name. Example:
1: +c Type {
2: +v System.EventHandler OnThingy;
3: }
|
Methods Methods in Pseudo.Net follow the C# syntax, with the exception that you may use the short hand modifier symbols, and there is no method body. Example:
1: +c Type {
2: + int DoStuff(string arg, bool flag);
3: +$ Type GetInstance();
4: + System.Object[] Build(StringCollection strings);
5: }
|
Operator Overloads To define an operator overload, you may supply modifiers, followed by the operator indicator "o", followed by the conversion type or a return type and an operator symbol, followed by method parameters. Examples of both situations follow:
1: + s ValueType {
2: +$› o bool(ValueType x);
3: +$‹ o ValueType(bool x);
4: +$ o bool ==(ValueType x, ValueType y);
5: +$ o bool !=(ValueType x, ValueType y);
6: }
|
Parameters Parameters in Pseudo.Net follow C# syntax. You may specify the last parameter as "params". You may declare a parameter as "value" (default), "ref", or "out". Example follows:
1: +c Type {
2: void Do(string name, out int id, params ref int[] ndxs);
3: }
|
|