Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Types | Static Public Member Functions | List of all members
Loyc.Ecs.EcsValidators Class Reference

A class filled with methods for checking whether a node has the correct LNode.Name and structure. For example, IsPropertyDefinition(node) checks whether node meets the requirements for being a property definition, such as having a Name equal to #property, and having name and return value that are complex identifiers. More...


Source file:

Remarks

A class filled with methods for checking whether a node has the correct LNode.Name and structure. For example, IsPropertyDefinition(node) checks whether node meets the requirements for being a property definition, such as having a Name equal to #property, and having name and return value that are complex identifiers.

This class also has useful helper functions, such as KeyNameComponentOf(LNode).

Public Types

enum  Pedantics { IgnoreWeirdAttributes = 1, IgnoreIllegalParentheses = 2, Lax = IgnoreWeirdAttributes | IgnoreIllegalParentheses }
 This is needed by the EC# node printer, but perhaps no one else. More...
 
enum  EventDef { Invalid, WithBody, List }
 

Static Public Member Functions

static Symbol SpaceStatementKind (LNode n, Pedantics p=Pedantics.Lax)
 Returns true iff the specified node has one of the names #struct, #class, #enum, #interface, #namespace, #alias, #trait and its tree structure is valid for a space statement. More...
 
static bool IsMethodDefinition (LNode n, bool orDelegate, Pedantics p=Pedantics.Lax)
 Returns true iff the given node has a valid syntax tree for a method definition, a constructor, or (when orDelegate is true) a delegate definition. More...
 
static bool IsPropertyDefinition (LNode n, Pedantics p=Pedantics.Lax)
 
static bool IsEventDefinition (LNode n, Pedantics p)
 
static bool IsVariableDecl (LNode _n, bool allowMultiple, bool allowNoAssignment, Pedantics p)
 
static bool IsSimpleIdentifier (LNode n, Pedantics p)
 
static bool IsComplexIdentifier (LNode n, ICI f=ICI.Default, Pedantics p=Pedantics.Lax)
 
static bool IsPrintableTypeParam (LNode n, Pedantics p=Pedantics.Lax)
 Checks if 'n' is a legal type parameter definition. More...
 
static bool IsExecutableBlockStmt (LNode _n, Pedantics p=Pedantics.Lax)
 
static Symbol ExecutableBlockStmtType (LNode _n, Pedantics p=Pedantics.Lax)
 
static bool IsBracedBlock (LNode n)
 
static bool IsLabelStmt (LNode _n, Pedantics p=Pedantics.Lax)
 
static bool IsNamedArgument (LNode _n, Pedantics p=Pedantics.Lax)
 
static bool IsResultExpr (LNode n, Pedantics p=Pedantics.Lax)
 
static bool IsForwardedProperty (LNode _n, Pedantics p=Pedantics.Lax)
 
static Symbol KeyNameComponentOf (LNode name)
 Given a complex name such as global::Foo<int>.Bar<T>, this method identifies the base name component, which in this example is Bar. This is used, for example, to identify the expected name for a constructor based on the class name, e.g. Foo<T> => Foo. More...
 

Member Enumeration Documentation

This is needed by the EC# node printer, but perhaps no one else.

Member Function Documentation

static bool Loyc.Ecs.EcsValidators.IsMethodDefinition ( LNode  n,
bool  orDelegate,
Pedantics  p = Pedantics.Lax 
)
inlinestatic

Returns true iff the given node has a valid syntax tree for a method definition, a constructor, or (when orDelegate is true) a delegate definition.

static bool Loyc.Ecs.EcsValidators.IsPrintableTypeParam ( LNode  n,
Pedantics  p = Pedantics.Lax 
)
inlinestatic

Checks if 'n' is a legal type parameter definition.

A type parameter definition must be a simple symbol with at most one #in or #out attribute, and at most one #where attribute with an argument list consisting of complex identifiers.

References Loyc.Syntax.LNode.Attrs.

static Symbol Loyc.Ecs.EcsValidators.KeyNameComponentOf ( LNode  name)
inlinestatic

Given a complex name such as global::Foo<int>.Bar<T>, this method identifies the base name component, which in this example is Bar. This is used, for example, to identify the expected name for a constructor based on the class name, e.g. Foo<T> => Foo.

It is not verified that name is a complex identifier. There is no error detection but in some cases an empty name may be returned, e.g. for input like Foo."Hello".

References Loyc.Syntax.LNode.Args, and Loyc.Syntax.LNode.Target.

static Symbol Loyc.Ecs.EcsValidators.SpaceStatementKind ( LNode  n,
Pedantics  p = Pedantics.Lax 
)
inlinestatic

Returns true iff the specified node has one of the names #struct, #class, #enum, #interface, #namespace, #alias, #trait and its tree structure is valid for a space statement.

References Loyc.Syntax.LNode.Args.