Child pages
  • Path Accessors

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Consider syntax for using block at the beginning of a file:

Code Block
syntax CompilationUnit = s ExternAliasDirective* UsingDirectives=(UsingDirective*) GlobalAttributes NamespaceMemberDeclaration* !Any;
syntax UsingDirective
{
 | UsingAliasDirective  = "using"sm Name sm "=" sm QualifiedName ";" nl;
 | UsingNamespaceDirective = "using"sm QualifiedName ";" nl;
}

It is convenient to have using aliases as a collection on CompilationUnit level, like "file.UsingAliasDirectives".
There are many places like this in ReSharper PSI, where accessors are published at a level higher than immediate parent. Here "alias" keyword is much more suitable.

Code Block
syntax CompilationUnit = s ExternAliasDirective* UsingDirective* GlobalAttributes NamespaceMemberDeclaration* !Any;
{
 alias UsingAliasDirectives = UsingDirectives::UsingAliasDirective; 
}

If any syntax in path is a list, the type of alias is a list and collect specified items on all paths.