srcML v1.0.0 C# Documentation

Base Elements XML Element Subelements
comment <comment type="block|line" format="javadoc|doxygen">
escape <escape char="0xXX">
literal <literal type="number|char|string|boolean|null">
name <name> <name>, <operator>
Statements XML Element Subelements
block <block> <block_content>
break statement <break>
case statement <case> <expr>
continue statement <continue>
default statement <default>
do while statement <do> <block> <condition>
empty statement <empty_stmt>
expr_stmt <expr_stmt> <expr>
fixed statement <fixed> <parameter_list> <block>
for statement <for> <control> <block>
foreach .. in statement <foreach> <control> <block>
goto statement <goto> <name>
if statement <if_stmt> <if> <else> <if type="elseif">
label <label> <name>
lock statement <lock> <init> <block>
return statement <return> <expr>
switch statement <switch> <condition> <case> <block>
unsafe statement <unsafe> <block>
using statement <using> <init> <block>
while statement <while> <condition> <block>
Statement Subelements XML Element Subelements
block_content <block_content>
condition <condition> <expr>
control <control> <init> <condition> <incr>
else <else> <block>
else if <else type="elsif> <condition> <block>
expression <expr> <name>, <operator>, <call>, <ternary>
if <if> <condition> <block>
incr <incr> <expr>
then <then> <expr>
type <type> <specifier>, <name>
Specifiers XML Element Subelements
async <specifier>
const <specifier>
explicit <specifier>
extern specifier <specifier>
implicit <specifier>
internal <specifier>
named parameters <call> <name> <argument_list>
new <specifier>
out (output parameter) <modifier>
override <specifier>
params <specifier>
partial <specifier>
private <specifier>
protected <specifier>
protected internal <specifier>
public <specifier>
readonly <specifier>
ref <modifier>
sealed <specifier>
stackalloc <operator>
static <specifier>
static <specifier>
this (extension methods) <specifier>
virtual <specifier>
volatile <specifier>
yield <specifier>
Declarations, Definitions, and Initializations XML Element Subelements
anonymous methods <lambda> <parameter_list> <block>
array declaration <decl> <name>, <index>
default parameters <init> <expr>
delegate type definition <delegate> <type> <name> <parameter_list>
explicit conversion operator definition <function> <type> <name> <parameter_list>
extern alias <extern>
function declaration <function_decl> <type> <name> <parameter_list>
function definition <function> <type> <name> <parameter_list> <block>
implicit conversion operator definition <function> <name> <parameter_list> <block>
indexer property <function_decl> <type> <name> <parameter_list>
lambda <lambda> <parameter_list> <block>
namespace <namespace> <name> <block>
nullable variable modifier <decl> <name> <init>
operator false <function> <type> <name> <parameter_list>
operator overloading <function> <type> <name> <parameter_list>
operator true <function> <type> <name> <parameter_list>
pointer declaration <modifier>
using directive <using> <name> <init>
variable declaration <decl> <name> <init>
variable declaration statement <decl_stmt> <decl>
Classes, Structs, Interfaces, and Enums XML Element Subelements
add <function> <name> <block>
anonymous type <expr> <name>
base (constructor selection) <name>
class <class> <name> <super_list> <block>
constructor <constructor> <name> <parameter_list> <block>
destructor <destructor> <name>
disambiguating function override <function> <type> <name> <parameter_list> <block>
enum <enum> <name> <block>
event <event> <type> <name> <block>
get <function> <name> <block>
get (default implementation) <function_decl> <name>
inheritance list <super_list> <super>
interface <interface> <name> <super> <block>
object initializer <decl> <name> <init>
property <decl_stmt> <type> <name> <block>
remove <function> <name> <block>
set <function> <name> <block>
set (default implementation) <function_decl> <name>
struct <struct> <name> <super_list> <block>
this (constructor forwarding) <name>
Expressions XML Element Subelements
array index <index> <expr>
base (object) <name>
dereference member access <expr> <name>, <operator>
function call <call> <name> <argument_list>
member and scope access <expr> <name>, <operator>
new <operator>
ternary operator <ternary> <condition> <then> <else>
this (object) <name>
Other XML Element Subelements
attribute <attribute> <expr>
cast <operator> <name>
checked <checked> <block>
default (object construction) <default> <argument_list>
dynamic <name>
global <name> <name>, <operator>
object <name>
sizeof <sizeof> <argument_list>, <name>
string keyword <name>
typeof <typeof> <argument_list>
typeof <typeof> <argument_list>
unchecked <unchecked> <block>
var <name>
Generics XML Element Subelements
class (constraint) <constraint>
generic class <class> <specifier> <name> <block>
generic method <function> <type> <name> <parameter_list> <block>
generic variable declaration <decl> <name>
in (generic parameter constraint) <specifier>
new (constraint) <name>
out (generic parameter constraint) <specifier>
struct (constraint) <constraint>
where (constraint) <where> <name>
Exceptions XML Element Subelements
catch <catch> <parameter_list> <block>
finally <finally> <block>
throw <throw> <expr>
try <try> <block> <catch>
LINQ XML Element Subelements
by <by>
equals <equals>
from <from> <expr>, <in>
group <group> <by>, <into>
in <in>
into <into>
join <join> <in>, <true>, <equals>, <into>
let <let> <expr>
linq <linq> <from>, <where>, <let>, <orderby>, <select>, <group>, <join>
on <on>
orderby <orderby> <expr> <name>
select <select> <expr>
where (clause) <where> <expr>
C# Preprocessor XML Element Subelements
#define <cpp:define> <cpp:directive> <expr>
#elif <cpp:elif> <cpp:directive> <expr>
#else <cpp:else> <cpp:directive>
#endif <cpp:endif> <cpp:directive>
#endregion <cpp:endregion> <cpp:directive>
#error <cpp:error> <cpp:directive>
#if <cpp:if> <cpp:directive> <expr>
#line <cpp:line> <cpp:directive> <cpp:number> <cpp:file>
#pragma <cpp:pragma> <cpp:directive> <name>
#region <cpp:region> <cpp:directive> <name>
#undef <cpp:undef> <cpp:directive> <cpp:macro>
#warning <cpp:warning> <cpp:directive>

#define


Element

  • <cpp:define>

Subelements

  • <cpp:directive>
  • <expr>

XPath Query

  • define directives

    //cpp:define

Example

#define DEBUG
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>DEBUG</name></cpp:macro></cpp:define>

#elif


Element

  • <cpp:elif>

Subelements

  • <cpp:directive>
  • <expr>

XPath Query

  • elif directives

    //cpp:elif

Example

#if (DEBUG && !MYTEST)
        Console.WriteLine("DEBUG is defined");
#elif (!DEBUG && MYTEST)
        Console.WriteLine("MYTEST is defined");
#elif (DEBUG && MYTEST)
        Console.WriteLine("DEBUG and MYTEST are defined");
#else
        Console.WriteLine("DEBUG and MYTEST are not defined");
#endif
<cpp:if>#<cpp:directive>if</cpp:directive> <expr><operator>(</operator><name>DEBUG</name> <operator>&amp;&amp;</operator> <operator>!</operator><name>MYTEST</name><operator>)</operator></expr></cpp:if>
        <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"DEBUG is defined"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>
<cpp:elif>#<cpp:directive>elif</cpp:directive> <expr><operator>(</operator><operator>!</operator><name>DEBUG</name> <operator>&amp;&amp;</operator> <name>MYTEST</name><operator>)</operator></expr></cpp:elif>
        <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"MYTEST is defined"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>
<cpp:elif>#<cpp:directive>elif</cpp:directive> <expr><operator>(</operator><name>DEBUG</name> <operator>&amp;&amp;</operator> <name>MYTEST</name><operator>)</operator></expr></cpp:elif>
        <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"DEBUG and MYTEST are defined"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>
<cpp:else>#<cpp:directive>else</cpp:directive></cpp:else>
        <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"DEBUG and MYTEST are not defined"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>

#endif


Element

  • <cpp:endif>

Subelement

  • <cpp:directive>

XPath Query

  • endif directives

    //cpp:endif

Example

#if (DEBUG && !MYTEST)
        Console.WriteLine("DEBUG is defined");
#elif (!DEBUG && MYTEST)
        Console.WriteLine("MYTEST is defined");
#elif (DEBUG && MYTEST)
        Console.WriteLine("DEBUG and MYTEST are defined");
#else
        Console.WriteLine("DEBUG and MYTEST are not defined");
#endif
<cpp:if>#<cpp:directive>if</cpp:directive> <expr><operator>(</operator><name>DEBUG</name> <operator>&amp;&amp;</operator> <operator>!</operator><name>MYTEST</name><operator>)</operator></expr></cpp:if>
        <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"DEBUG is defined"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>
<cpp:elif>#<cpp:directive>elif</cpp:directive> <expr><operator>(</operator><operator>!</operator><name>DEBUG</name> <operator>&amp;&amp;</operator> <name>MYTEST</name><operator>)</operator></expr></cpp:elif>
        <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"MYTEST is defined"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>
<cpp:elif>#<cpp:directive>elif</cpp:directive> <expr><operator>(</operator><name>DEBUG</name> <operator>&amp;&amp;</operator> <name>MYTEST</name><operator>)</operator></expr></cpp:elif>
        <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"DEBUG and MYTEST are defined"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>
<cpp:else>#<cpp:directive>else</cpp:directive></cpp:else>
        <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"DEBUG and MYTEST are not defined"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>

#endregion


Element

  • <cpp:endregion>

Subelement

  • <cpp:directive>

XPath Query

  • endregion directives

    //cpp:endregion

Example

#region MyClass definition
public class MyClass 
{
    static void Main() 
    {
    }
}
#endregion
<cpp:region>#<cpp:directive>region</cpp:directive> <name>MyClass</name> <name>definition</name></cpp:region>
<class><specifier>public</specifier> class <name>MyClass</name> 
<block>{
    <function><type><specifier>static</specifier> <name>void</name></type> <name>Main</name><parameter_list>()</parameter_list> 
    <block>{<block_content>
    </block_content>}</block></function>
}</block></class>
<cpp:endregion>#<cpp:directive>endregion</cpp:directive></cpp:endregion>

#error


Element

  • <cpp:error>

Subelement

  • <cpp:directive>

XPath Query

  • error directives

    //cpp:error

Example

#error Deprecated code in this method.
<cpp:error>#<cpp:directive>error</cpp:directive> Deprecated code in this method.</cpp:error>

#line


Element

  • <cpp:line>

Subelements

  • <cpp:directive>
  • <cpp:number>
  • <cpp:file>

XPath Query

  • line directives

    //cpp:line

Examples

#line 200 "Special"
<cpp:line>#<cpp:directive>line</cpp:directive> <cpp:number>200</cpp:number> <cpp:file>"Special"</cpp:file></cpp:line>
#line default
<cpp:line>#<cpp:directive>line</cpp:directive> <name>default</name></cpp:line>
#line hidden 
<cpp:line>#<cpp:directive>line</cpp:directive> <name>hidden</name></cpp:line> 

#pragma


Element

  • <cpp:pragma>

Subelements

  • <cpp:directive>
  • <name>

XPath Query

  • pragma directives

    //cpp:pragma

Example

#pragma warning disable warning-list
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <name>warning</name> <name>disable</name> <name>warning</name><name>-</name><name>list</name></cpp:pragma>

#region


Element

  • <cpp:region>

Subelements

  • <cpp:directive>
  • <name>

XPath Query

  • region directives

    //cpp:region

Example

#region MyClass definition
public class MyClass 
{
    static void Main() 
    {
    }
}
#endregion
<cpp:region>#<cpp:directive>region</cpp:directive> <name>MyClass</name> <name>definition</name></cpp:region>
<class><specifier>public</specifier> class <name>MyClass</name> 
<block>{
    <function><type><specifier>static</specifier> <name>void</name></type> <name>Main</name><parameter_list>()</parameter_list> 
    <block>{<block_content>
    </block_content>}</block></function>
}</block></class>
<cpp:endregion>#<cpp:directive>endregion</cpp:directive></cpp:endregion>

#undef


Element

  • <cpp:undef>

Subelements

  • <cpp:directive>
  • <cpp:macro>

XPath Query

  • undef directives

    //cpp:undef

Example

#undef TRACE
<cpp:undef>#<cpp:directive>undef</cpp:directive> <name>TRACE</name></cpp:undef>

#warning


Element

  • <cpp:warning>

Subelement

  • <cpp:directive>

XPath Query

  • warning directives

    //cpp:warning

Example

#warning Deprecated code in this method.
<cpp:warning>#<cpp:directive>warning</cpp:directive> Deprecated code in this method.</cpp:warning>

add


Element

  • <function>

Subelements

  • <name>
  • <block>

XPath Query

  • add definitions

    //src:function[src:name='add']

Example

add {
    otherEvent += value;
}
<function><name>add</name> <block>{<block_content>
    <expr_stmt><expr><name>otherEvent</name> <operator>+=</operator> <name>value</name></expr>;</expr_stmt>
</block_content>}</block></function>

anonymous type


Element

  • <expr>

Subelement

  • <name>

XPath Query

  • expressions that contain an anonymous class

    //src:expr[src:operator[.='new']/following-sibling::src:block]

Example

var v = new { Amount = 108, Message = "Hello" };
<decl_stmt><decl><type><name>var</name></type> <name>v</name> <init>= <expr><operator>new</operator> <block>{ <expr><name>Amount</name> <operator>=</operator> <literal type="number">108</literal></expr>, <expr><name>Message</name> <operator>=</operator> <literal type="string">"Hello"</literal></expr> }</block></expr></init></decl>;</decl_stmt>

array declaration


Element

  • <decl>

Subelements

  • <name>
  • <index>

XPath Query

  • explicit array declarations

    //src:decl[src:type/src:name/src:index]

Examples

int[] numbers = new int[5];
<decl_stmt><decl><type><name><name>int</name><index>[]</index></name></type> <name>numbers</name> <init>= <expr><operator>new</operator> <name><name>int</name><index>[<expr><literal type="number">5</literal></expr>]</index></name></expr></init></decl>;</decl_stmt>
string[] names = new string[3] {"Matt", "Joanne", "Robert"};
<decl_stmt><decl><type><name><name>string</name><index>[]</index></name></type> <name>names</name> <init>= <expr><operator>new</operator> <name><name>string</name><index>[<expr><literal type="number">3</literal></expr>]</index></name> <block>{<expr><literal type="string">"Matt"</literal></expr>, <expr><literal type="string">"Joanne"</literal></expr>, <expr><literal type="string">"Robert"</literal></expr>}</block></expr></init></decl>;</decl_stmt>
string[,] siblings = new string[2, 2] { {"Mike","Amy"}, {"Mary","Albert"} };
<decl_stmt><decl><type><name><name>string</name><index>[<expr/>,<expr/>]</index></name></type> <name>siblings</name> <init>= <expr><operator>new</operator> <name><name>string</name><index>[<expr><literal type="number">2</literal></expr>, <expr><literal type="number">2</literal></expr>]</index></name> <block>{ <expr><block>{<expr><literal type="string">"Mike"</literal></expr>,<expr><literal type="string">"Amy"</literal></expr>}</block></expr>, <expr><block>{<expr><literal type="string">"Mary"</literal></expr>,<expr><literal type="string">"Albert"</literal></expr>}</block></expr> }</block></expr></init></decl>;</decl_stmt>
int[][] numbers = new int[2][] { new int[] {2,3,4}, new int[] {5,6,7,8,9} };
<decl_stmt><decl><type><name><name>int</name><index>[]</index><index>[]</index></name></type> <name>numbers</name> <init>= <expr><operator>new</operator> <name><name>int</name><index>[<expr><literal type="number">2</literal></expr>]</index><index>[]</index></name> <block>{ <expr><operator>new</operator> <name><name>int</name><index>[]</index></name> <block>{<expr><literal type="number">2</literal></expr>,<expr><literal type="number">3</literal></expr>,<expr><literal type="number">4</literal></expr>}</block></expr>, <expr><operator>new</operator> <name><name>int</name><index>[]</index></name> <block>{<expr><literal type="number">5</literal></expr>,<expr><literal type="number">6</literal></expr>,<expr><literal type="number">7</literal></expr>,<expr><literal type="number">8</literal></expr>,<expr><literal type="number">9</literal></expr>}</block></expr> }</block></expr></init></decl>;</decl_stmt>
int[][] numbers = { new int[] {2,3,4}, new int[] {5,6,7,8,9} };
<decl_stmt><decl><type><name><name>int</name><index>[]</index><index>[]</index></name></type> <name>numbers</name> <init>= <expr><block>{ <expr><operator>new</operator> <name><name>int</name><index>[]</index></name> <block>{<expr><literal type="number">2</literal></expr>,<expr><literal type="number">3</literal></expr>,<expr><literal type="number">4</literal></expr>}</block></expr>, <expr><operator>new</operator> <name><name>int</name><index>[]</index></name> <block>{<expr><literal type="number">5</literal></expr>,<expr><literal type="number">6</literal></expr>,<expr><literal type="number">7</literal></expr>,<expr><literal type="number">8</literal></expr>,<expr><literal type="number">9</literal></expr>}</block></expr> }</block></expr></init></decl>;</decl_stmt>

implicitly typed arrays

var b = new[] { "hello", null, "world" };
<decl_stmt><decl><type><name>var</name></type> <name>b</name> <init>= <expr><operator>new</operator><index>[]</index> <block>{ <expr><literal type="string">"hello"</literal></expr>, <expr><literal type="null">null</literal></expr>, <expr><literal type="string">"world"</literal></expr> }</block></expr></init></decl>;</decl_stmt>

async


Element

  • <specifier>

XPath Query

  • async methods

    //src:function[src:type/src:specifier ='async']

Example

async Task ExampleMethodAsync();
<function_decl><type><specifier>async</specifier> <name>Task</name></type> <name>ExampleMethodAsync</name><parameter_list>()</parameter_list>;</function_decl>

base (constructor selection)


Element

  • <name>

XPath Query

  • constructors which forward to a base classes constructor

    //src:constructor[src:member_list/src:call/src:name = 'base']

Example

class Foo {
    Foo()
        :base("")
    {
    }
}
<class>class <name>Foo</name> <block>{
    <constructor><name>Foo</name><parameter_list>()</parameter_list>
        <member_init_list>:<call><name>base</name><argument_list>(<argument><expr><literal type="string">""</literal></expr></argument>)</argument_list></call>
    </member_init_list><block>{<block_content>
    </block_content>}</block></constructor>
}</block></class>

base (object)


Element

  • <name>

XPath Query

  • uses of base

    //src:name[.='base']

Example

base.Invoke();
<expr_stmt><expr><call><name><name>base</name><operator>.</operator><name>Invoke</name></name><argument_list>()</argument_list></call></expr>;</expr_stmt>

block


Element

  • <block>

Subelement

  • <block_content>

XPath Queries

  • blocks

    //src:block
  • variable declarations in a block

    //src:block//src:decl_stmt
  • top-level variable declarations in a block

    //src:block/src:block_content/src:decl_stmt

Example

 {
    line[i] = x;
    x++;
    i--;
}
 <block>{<block_content>
    <expr_stmt><expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>=</operator> <name>x</name></expr>;</expr_stmt>
    <expr_stmt><expr><name>x</name><operator>++</operator></expr>;</expr_stmt>
    <expr_stmt><expr><name>i</name><operator>--</operator></expr>;</expr_stmt>
</block_content>}</block>

block_content


Element

  • <block_content>

XPath Queries

  • block contents

    //src:block_content
  • declaration block_contents

    //src:decl/src:block/src:block_content
  • function block_contents

    //src:function/src:block/src:block_content

by


Element

  • <by>

XPath Query

  • by clauses

    //src:by

case statement


Element

  • <case>

Subelement

  • <expr>

XPath Queries

  • case labels

    //src:case
  • case labels that use SATURDAY

    //src:case[.//src:name = 'SATURDAY']
  • switch statements with a case that uses SATURDAY

    //src:switch[src:block/src:block_content/src:case//src:name='SATURDAY']

Example

case SATURDAY:
<case>case <expr><name>SATURDAY</name></expr>:</case>

cast


Element

  • <operator>

Subelement

  • <name>

XPath Query

  • casts

    //src:cast

Example

a = (int)x;
<expr_stmt><expr><name>a</name> <operator>=</operator> <operator>(</operator><name>int</name><operator>)</operator><name>x</name></expr>;</expr_stmt>

checked


Element

  • <checked>

Subelement

  • <block>

XPath Queries

  • uses of checked, in both a statement and expression form

    //src:checked
  • uses of checked when used as an expression

    //src:checked[not(src:block)]
  • uses of the checked statement

    //src:checked[src:block]

Examples

checked {
    int i3 = 2147483647 + ten;
    Console.WriteLine(i3);
}
<checked>checked <block>{<block_content>
    <decl_stmt><decl><type><name>int</name></type> <name>i3</name> <init>= <expr><literal type="number">2147483647</literal> <operator>+</operator> <name>ten</name></expr></init></decl>;</decl_stmt>
    <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><name>i3</name></expr></argument>)</argument_list></call></expr>;</expr_stmt>
</block_content>}</block></checked>
z = checked(maxIntValue + 10);
<expr_stmt><expr><name>z</name> <operator>=</operator> <checked>checked<argument_list>(<argument><expr><name>maxIntValue</name> <operator>+</operator> <literal type="number">10</literal></expr></argument>)</argument_list></checked></expr>;</expr_stmt>

class


Element

  • <class>

Subelements

  • <name>
  • <super_list>
  • <block>

XPath Queries

  • class definitions

    //src:class
  • classes with the name foo

    //src:class[src:name='foo']
  • function definitions in classes

    //src:class//src:function
  • function declarations in classes

    //src:class//src:function_decl

Examples

class TestClass
{
}
<class>class <name>TestClass</name>
<block>{
}</block></class>
class TestClass2
    :BaseClass, IInterface1, IInterface2
{
}
<class>class <name>TestClass2</name>
    <super_list>:<super><name>BaseClass</name></super>, <super><name>IInterface1</name></super>, <super><name>IInterface2</name></super></super_list>
<block>{
}</block></class>

class (constraint)


Element

  • <constraint>

XPath Query

  • classes with a class constraint

    //src:class[src:where/src:constraint.='class']

Example

class Foo<T> where T : class
{}
<class>class <name><name>Foo</name><argument_list type="generic">&lt;<argument><name>T</name></argument>&gt;</argument_list></name> <where>where <name>T</name> : <constraint>class</constraint></where>
<block>{}</block></class>

comment


Element

  • <comment type="block|line" format="javadoc|doxygen">

XPath Queries

  • comments

    //src:comment
  • block comments

    //src:comment[@type='block']
  • line comments

    //src:comment[@type='line']
  • javadoc comments

    //src:comment[@format='javadoc']
  • doxygen comments

    //src:comment[@format='doxygen']
  • line Javadoc comments

    //src:comment[@type='line'][@format='javadoc']

condition


Element

  • <condition>

Subelement

  • <expr>

XPath Queries

  • conditions, including ternary conditions

    //src:condition
  • condition expressions

    //src:condition/src:expr
  • if conditions

    //src:if/src:condition
  • while conditions

    //src:while/src:condition
  • do while conditions

    //src:do/src:condition
  • ternary conditions

    //src:do/src:condition

const


Element

  • <specifier>

XPath Query

  • const variables

    //src:decl[src:type/src:specifier ='const']

Example

const int i = 6;
<decl_stmt><decl><type><specifier>const</specifier> <name>int</name></type> <name>i</name> <init>= <expr><literal type="number">6</literal></expr></init></decl>;</decl_stmt>

constructor


Element

  • <constructor>

Subelements

  • <name>
  • <parameter_list>
  • <block>

XPath Queries

  • constructors

    //src:constuctor
  • constructors with no parameters

    //src:constuctor[not(src:parameter_list/src:parameter)]
  • possible default constructors, including constructors with all default parameters

    //src:constructor[src:parameter_list[not(src:parameter)] or (count(src:parameter_list/src:parameter) = count(src:parameter_list/src:parameter/src:decl/src:init))]
  • possible copy constructors, including those which are not defined with the body of class and those with default parameters

    //src:constructor[ (src:name | src:name/src:name[last()]) = (src:parameter_list/src:parameter[1]/src:decl/src:type/src:name | src:parameter_list/src:parameter[1]/src:decl/src:type/src:name[last()])][( (count(src:parameter_list/src:parameter) - 1) = count(src:parameter_list/src:parameter/src:decl/src:init))]

Example

class Foo {
    Foo() {
    }
}
<class>class <name>Foo</name> <block>{
    <constructor><name>Foo</name><parameter_list>()</parameter_list> <block>{<block_content>
    </block_content>}</block></constructor>
}</block></class>

control


Element

  • <control>

Subelements

  • <init>
  • <condition>
  • <incr>

XPath Query

  • initialization, condition, and increment of for loops

    //src:control

default (object construction)


Element

  • <default>

Subelement

  • <argument_list>

XPath Query

  • uses of default to default construct an object

    //src:default[src:argument_list]

Example

T temp = default(T);
<decl_stmt><decl><type><name>T</name></type> <name>temp</name> <init>= <expr><default>default<argument_list>(<argument><expr><name>T</name></expr></argument>)</argument_list></default></expr></init></decl>;</decl_stmt>

default parameters


Element

  • <init>

Subelement

  • <expr>

XPath Query

  • function declarations with default parameters

    //src:function_decl[src:parameter_list/src:parameter/src:decl/src:init]

Example

void ExampleMethod(int required, string optionalstr = "default string", int optionalint = 10) {
}
<function><type><name>void</name></type> <name>ExampleMethod</name><parameter_list>(<parameter><decl><type><name>int</name></type> <name>required</name></decl></parameter>, <parameter><decl><type><name>string</name></type> <name>optionalstr</name> <init>= <expr><literal type="string">"default string"</literal></expr></init></decl></parameter>, <parameter><decl><type><name>int</name></type> <name>optionalint</name> <init>= <expr><literal type="number">10</literal></expr></init></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></function>

default statement


Element

  • <default>

XPath Queries

  • default labels

    //src:default
  • switch statements with a default label

    //src:switch[src:block/src:block_content/src:default]

Example

default:
<default>default:</default>

delegate type definition


Element

  • <delegate>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Queries

  • delegate definitions

    //src:delegate
  • delegate types

    //src:delegate/src:type
  • delegate name

    //src:delegate/src:name
  • delegate parameters

    //src:delegate/src:parameter_list/src:parameter

Example

delegate int PerformCalculation(int x, int y);
<delegate>delegate <type><name>int</name></type> <name>PerformCalculation</name><parameter_list>(<parameter><decl><type><name>int</name></type> <name>x</name></decl></parameter>, <parameter><decl><type><name>int</name></type> <name>y</name></decl></parameter>)</parameter_list>;</delegate>

dereference member access


Element

  • <expr>

Subelements

  • <name>
  • <operator>

XPath Query

  • uses of the -> operator

    //src:operator[.='->']

Example

 t->tm_sec;
 <expr_stmt><expr><name><name>t</name><operator>-&gt;</operator><name>tm_sec</name></name></expr>;</expr_stmt>

destructor


Element

  • <destructor>

Subelement

  • <name>

XPath Query

  • destructors

    //src:destructor

Example

~Foo()
{
}
<destructor><name>~Foo</name><parameter_list>()</parameter_list>
<block>{<block_content>
</block_content>}</block></destructor>

disambiguating function override


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>
  • <block>

XPath Query

  • disambiguating function overrides

    //src:function[src:name[src:name][src:operator='.']]

Example

int IComparable.CompareTo(object other) {
}
<function><type><name>int</name></type> <name><name>IComparable</name><operator>.</operator><name>CompareTo</name></name><parameter_list>(<parameter><decl><type><name>object</name></type> <name>other</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></function>

else


Element

  • <else>

Subelement

  • <block>

XPath Query

  • all elses

    //src:else

else if


Element

  • <else type="elsif>

Subelements

  • <condition>
  • <block>

XPath Query

  • all else ifs

    //src:else[type="elsif"]

empty statement


Element

  • <empty_stmt>

XPath Query

  • empty statements

    //src:empty_stmt

Example

;
<empty_stmt>;</empty_stmt>

equals


Element

  • <equals>

XPath Query

  • equals clauses

    //src:equals

escape


Element

  • <escape char="0xXX">

event


Element

  • <event>

Subelements

  • <type>
  • <name>
  • <block>

XPath Query

  • events

    //src:event

Examples

public event SampleEventHandler SampleEvent;
<expr_stmt><expr><specifier>public</specifier> event <name>SampleEventHandler</name> <name>SampleEvent</name></expr>;</expr_stmt>
event EventHandler IDrawingObject.OnDraw
{
    add
    {
        PreDrawEvent += value;
    }
    remove
    {
        PreDrawEvent -= value;
    }
}
<event>event <type><name>EventHandler</name></type> <name><name>IDrawingObject</name><operator>.</operator><name>OnDraw</name></name>
<block>{<block_content>
    <function><name>add</name>
    <block>{<block_content>
        <expr_stmt><expr><name>PreDrawEvent</name> <operator>+=</operator> <name>value</name></expr>;</expr_stmt>
    </block_content>}</block></function>
    <function><name>remove</name>
    <block>{<block_content>
        <expr_stmt><expr><name>PreDrawEvent</name> <operator>-=</operator> <name>value</name></expr>;</expr_stmt>
    </block_content>}</block></function>
</block_content>}</block></event>

explicit


Element

  • <specifier>

XPath Query

  • explicit conversion operators

    //src:function[src:type/src:specifier ='explicit']

Example

static explicit operator Celsius(Fahrenheit fahr) {
}
<function type="operator"><type><specifier>static</specifier> <specifier>explicit</specifier></type> <name>operator <name>Celsius</name></name><parameter_list>(<parameter><decl><type><name>Fahrenheit</name></type> <name>fahr</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></function>

explicit conversion operator definition


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Query

  • explicit conversion operator overloads

    //src:function[src:type='operator'][src:type/src:specifier='explicit']

Example

public static explicit operator Celsius(Fahrenheit fahr)
{
}
<function type="operator"><type><specifier>public</specifier> <specifier>static</specifier> <specifier>explicit</specifier></type> <name>operator <name>Celsius</name></name><parameter_list>(<parameter><decl><type><name>Fahrenheit</name></type> <name>fahr</name></decl></parameter>)</parameter_list>
<block>{<block_content>
</block_content>}</block></function>

expr_stmt


Element

  • <expr_stmt>

Subelement

  • <expr>

expression


Element

  • <expr>

Subelements

  • <name>
  • <operator>
  • <call>
  • <ternary>

XPath Query

  • expressions

    //src:expr

extern alias


Element

  • <extern>

XPath Query

  • external alias declarations

    //src:extern[src:specifier='alias']

Example

extern alias GridV1;
<extern>extern <specifier>alias</specifier> <name>GridV1</name>;</extern>

extern specifier


Element

  • <specifier>

XPath Query

  • extern functions declarations

    //src:function_decl[src:type/src:specifier ='extern']

Example

[DllImport("avifil32.dll")]
private static extern void AVIFileInit();
<function_decl><attribute>[<expr><call><name>DllImport</name><argument_list>(<argument><expr><literal type="string">"avifil32.dll"</literal></expr></argument>)</argument_list></call></expr>]</attribute>
<type><specifier>private</specifier> <specifier>static</specifier> <specifier>extern</specifier> <name>void</name></type> <name>AVIFileInit</name><parameter_list>()</parameter_list>;</function_decl>

finally


Element

  • <finally>

Subelement

  • <block>

XPath Query

  • finally blocks

    //src:finally

Example

try { }
finally { }
<try>try <block>{<block_content> </block_content>}</block>
<finally>finally <block>{<block_content> </block_content>}</block></finally></try>

for statement


Element

  • <for>

Subelements

  • <control>
  • <block>

XPath Queries

  • for loops

    //src:for
  • for-loop initialization statements

    //src:for/src:control/src:init
  • for-loop conditions

    //src:for/src:control/src:condition
  • for-loop increments

    //src:for/src:control/src:incr
  • for loops that declare a variable with a single character name (e.g. x, i or y)

    //src:for[string-length(src:control/src:init/src:decl/src:name) = 1]
  • for loops with post-increment in the increment expression

    //src:for[src:control/src:incr/src:expr//following-sibling::src:operator= '++']

Examples

for( ;; ) { }
<for>for<control>( <init>;</init><condition>;</condition> <incr/>)</control> <block>{<block_content> </block_content>}</block></for>
for (i = 0; i < max; i++ ) 
{
  if ( line[i] == ' ' )
  {
      space++;
  }
  if ( line[i] == '\t' )
  {
      tab++;
  }
}
<for>for <control>(<init><expr><name>i</name> <operator>=</operator> <literal type="number">0</literal></expr>;</init> <condition><expr><name>i</name> <operator>&lt;</operator> <name>max</name></expr>;</condition> <incr><expr><name>i</name><operator>++</operator></expr></incr> )</control> 
<block>{<block_content>
  <if_stmt><if>if <condition>( <expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>==</operator> <literal type="char">' '</literal></expr> )</condition>
  <block>{<block_content>
      <expr_stmt><expr><name>space</name><operator>++</operator></expr>;</expr_stmt>
  </block_content>}</block></if></if_stmt>
  <if_stmt><if>if <condition>( <expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>==</operator> <literal type="char">'\t'</literal></expr> )</condition>
  <block>{<block_content>
      <expr_stmt><expr><name>tab</name><operator>++</operator></expr>;</expr_stmt>
  </block_content>}</block></if></if_stmt>
</block_content>}</block></for>
for(int i =0; i < 10;++i)
	a += x[i];
<for>for<control>(<init><decl><type><name>int</name></type> <name>i</name> <init>=<expr><literal type="number">0</literal></expr></init></decl>;</init> <condition><expr><name>i</name> <operator>&lt;</operator> <literal type="number">10</literal></expr>;</condition><incr><expr><operator>++</operator><name>i</name></expr></incr>)</control><block type="pseudo"><block_content>
	<expr_stmt><expr><name>a</name> <operator>+=</operator> <name><name>x</name><index>[<expr><name>i</name></expr>]</index></name></expr>;</expr_stmt></block_content></block></for>

function call


Element

  • <call>

Subelements

  • <name>
  • <argument_list>

XPath Query

  • function calls

    //src:call

Example

Console.WriteLine("out");
<expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><literal type="string">"out"</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>

function declaration


Element

  • <function_decl>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Queries

  • function declarations

    //src:function_decl
  • function-declaration return types

    //src:function_decl/src:type
  • function-declaration parameters

    //src:function_decl/src:parameter_list/src:parameter
  • function declarations with only two parameters

    //src:function_decl[count(src:parameter_list/src:parameter) = 2]
  • function declaration names

    //src:function_decl/src:name
  • function declarations that have variadic arguments

    //src:function_decl[src:parameter_list/src:parameter/src:decl/src:type/src:modifier='...']

Example

void doWork();
<function_decl><type><name>void</name></type> <name>doWork</name><parameter_list>()</parameter_list>;</function_decl>

function definition


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>
  • <block>

XPath Queries

  • function definitions

    //src:function
  • function-definition return types

    //src:function/src:type
  • function-definition parameters

    //src:function/src:parameter_list/src:parameter
  • function definitions with only two parameters

    //src:function[count(src:parameter_list/src:parameter) = 2]
  • //src:function/src:name

Example

void doWork() {
}
<function><type><name>void</name></type> <name>doWork</name><parameter_list>()</parameter_list> <block>{<block_content>
</block_content>}</block></function>

generic class


Element

  • <class>

Subelements

  • <specifier>
  • <name>
  • <block>

XPath Query

  • generic classes

    //src:class[src:name/src:argument_list]

Example

class NodeConcrete<T> { }
<class>class <name><name>NodeConcrete</name><argument_list type="generic">&lt;<argument><name>T</name></argument>&gt;</argument_list></name> <block>{ }</block></class>

generic method


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>
  • <block>

XPath Query

  • generic methods

    //src:function[src:name/src:argument_list]

Example

void foo<T>(T x) { }
<function><type><name>void</name></type> <name><name>foo</name><argument_list type="generic">&lt;<argument><name>T</name></argument>&gt;</argument_list></name><parameter_list>(<parameter><decl><type><name>T</name></type> <name>x</name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function>

generic variable declaration


Element

  • <decl>

Subelement

  • <name>

XPath Query

  • declarations of generic variables

    //src:decl[src:type/src:name/src:argument_list]

Example

List<int> x;
<decl_stmt><decl><type><name><name>List</name><argument_list type="generic">&lt;<argument><name>int</name></argument>&gt;</argument_list></name></type> <name>x</name></decl>;</decl_stmt>

get


Element

  • <function>

Subelements

  • <name>
  • <block>

XPath Query

  • get functions with their own implementation

    //src:function[src:name='get']

Example

get {
    return x;
}
<function><name>get</name> <block>{<block_content>
    <return>return <expr><name>x</name></expr>;</return>
</block_content>}</block></function>

get (default implementation)


Element

  • <function_decl>

Subelement

  • <name>

XPath Query

  • get declarations with default implementions

    //src:function_decl[src:name='get']

Example

get;
<function_decl><name>get</name>;</function_decl>

global


Element

  • <name>

Subelements

  • <name>
  • <operator>

XPath Query

  • uses of global as part of a complex name

    //src:name[src:name='global']

Example

global::TestApp app;
<decl_stmt><decl><type><name><name>global</name><operator>::</operator><name>TestApp</name></name></type> <name>app</name></decl>;</decl_stmt>

goto statement


Element

  • <goto>

Subelement

  • <name>

XPath Query

  • goto statements

    //src:goto

Examples

goto stop;
<goto>goto <name>stop</name>;</goto>
goto case 1;
<goto>goto <name>case <literal type="number">1</literal></name>;</goto>
goto default;
<goto>goto default;</goto>

group


Element

  • <group>

Subelements

  • <by>
  • <into>

XPath Query

  • group clauses

    //src:group

Examples

var studentQuery1 =
    from student in students
    group student by student.Last[0];
<decl_stmt><decl><type><name>var</name></type> <name>studentQuery1</name> <init>=
    <expr><linq><from>from <expr><name>student</name></expr> <in>in <expr><name>students</name></expr></in></from>
    <group>group <expr><name>student</name></expr> <by>by <expr><name><name>student</name><operator>.</operator><name>Last</name><index>[<expr><literal type="number">0</literal></expr>]</index></name></expr></by></group></linq></expr></init></decl>;</decl_stmt>
var studentQuery2 =
    from student in students
    group student by student.Last[0] into g
    orderby g.Key
    select g;
<decl_stmt><decl><type><name>var</name></type> <name>studentQuery2</name> <init>=
    <expr><linq><from>from <expr><name>student</name></expr> <in>in <expr><name>students</name></expr></in></from>
    <group>group <expr><name>student</name></expr> <by>by <expr><name><name>student</name><operator>.</operator><name>Last</name><index>[<expr><literal type="number">0</literal></expr>]</index></name></expr></by> <into>into <expr><name>g</name></expr></into></group>
    <orderby>orderby <expr><name><name>g</name><operator>.</operator><name>Key</name></name></expr></orderby>
    <select>select <expr><name>g</name></expr></select></linq></expr></init></decl>;</decl_stmt>
group student by student.Last[0] into g
<decl><type><name>group</name> <name>student</name> <name>by</name> <name><name>student</name><operator>.</operator><name>Last</name><index>[<expr><literal type="number">0</literal></expr>]</index></name> <name>into</name></type> <name>g</name></decl>

if


Element

  • <if>

Subelements

  • <condition>
  • <block>

XPath Query

  • all ifs

    //src:if

if statement


Element

  • <if_stmt>

Subelements

  • <if>
  • <else>
  • <if type="elseif">

XPath Queries

  • if conditions

    //src:if/src:condition
  • then

    //src:if/src:block
  • else

    //src:else/src:block
  • if statements without an else

    //src:if_stmt[not(src:else)]
  • else-if

    //src:if[@type="elseif"]
  • First if in a nested if statement

    //src:if_stmt/src:if[1]
  • Second if in a nested if statement

    //src:if_stmt/src:if[2]
  • Last if in a nested if statement

    //src:if_stmt/src:if[last()]

Examples

if then

if (A)
    B;
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if></if_stmt>

if then else

if (A)
    B;
else
    C;
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content>
    <expr_stmt><expr><name>C</name></expr>;</expr_stmt></block_content></block></else></if_stmt>

if then elseif

if (A)
    B;
else if (A2)
    C;
else
    D:
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if>
<if type="elseif">else if <condition>(<expr><name>A2</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>C</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content>
    <label><name>D</name>:</label></block_content></block></else></if_stmt>
if(x > 5)
    y+=4;
<if_stmt><if>if<condition>(<expr><name>x</name> <operator>&gt;</operator> <literal type="number">5</literal></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>y</name><operator>+=</operator><literal type="number">4</literal></expr>;</expr_stmt></block_content></block></if></if_stmt>
if ( i > 0 ) {
    y = x / i;
}
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <name>x</name> <operator>/</operator> <name>i</name></expr>;</expr_stmt>
</block_content>}</block></if></if_stmt>
if ( i > 0 )
    y = x / i;
else 
{
    x = i;
    y = f( x );
}
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <name>x</name> <operator>/</operator> <name>i</name></expr>;</expr_stmt></block_content></block></if>
<else>else 
<block>{<block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <call><name>f</name><argument_list>( <argument><expr><name>x</name></expr></argument> )</argument_list></call></expr>;</expr_stmt>
</block_content>}</block></else></if_stmt>

Without braces

if ( i > 0 )
    if ( j > i )
        x = j;
    else
        x = i;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition><block type="pseudo"><block_content>
    <if_stmt><if>if <condition>( <expr><name>j</name> <operator>&gt;</operator> <name>i</name></expr> )</condition><block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></if>
    <else>else<block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt></block_content></block></else></if_stmt></block_content></block></if></if_stmt>

With braces

if ( i > 0 ) 
{
    if ( j > i )
        x = j;
}
else
    x = i;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> 
<block>{<block_content>
    <if_stmt><if>if <condition>( <expr><name>j</name> <operator>&gt;</operator> <name>i</name></expr> )</condition><block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></if></if_stmt>
</block_content>}</block></if>
<else>else<block type="pseudo"><block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt></block_content></block></else></if_stmt>
if ( i > 0 ) 
{
 	x = i;   
}
else if( i < 0)
	x = q;
else 
    x = j;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> 
<block>{<block_content>
 	<expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt>   
</block_content>}</block></if>
<if type="elseif">else if<condition>( <expr><name>i</name> <operator>&lt;</operator> <literal type="number">0</literal></expr>)</condition><block type="pseudo"><block_content>
	<expr_stmt><expr><name>x</name> <operator>=</operator> <name>q</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content> 
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></else></if_stmt>

implicit


Element

  • <specifier>

XPath Query

  • implicit conversion operators

    //src:function[src:type/src:specifier ='implicit']

Example

static implicit operator byte(Digit d) {
}
<function type="operator"><type><specifier>static</specifier> <specifier>implicit</specifier></type> <name>operator <name>byte</name></name><parameter_list>(<parameter><decl><type><name>Digit</name></type> <name>d</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></function>

implicit conversion operator definition


Element

  • <function>

Subelements

  • <name>
  • <parameter_list>
  • <block>

XPath Query

  • implicit conversion operator definition overloads

    //src:function[src:type='operator'][src:type/src:specifier='implicit']

Examples

public static implicit operator Digit(double d)
{
}
<function type="operator"><type><specifier>public</specifier> <specifier>static</specifier> <specifier>implicit</specifier></type> <name>operator <name>Digit</name></name><parameter_list>(<parameter><decl><type><name>double</name></type> <name>d</name></decl></parameter>)</parameter_list>
<block>{<block_content>
</block_content>}</block></function>
public static implicit operator double(Digit d)
{
}
<function type="operator"><type><specifier>public</specifier> <specifier>static</specifier> <specifier>implicit</specifier></type> <name>operator <name>double</name></name><parameter_list>(<parameter><decl><type><name>Digit</name></type> <name>d</name></decl></parameter>)</parameter_list>
<block>{<block_content>
</block_content>}</block></function>

in


Element

  • <in>

XPath Query

  • in clauses

    //src:in

in (generic parameter constraint)


Element

  • <specifier>

XPath Query

  • generic parameters constrained with in

    //src:argument[src:specifier='in'][parent::src:argument_list/src:type='template']

Example

interface IContravariant<in A> { }
<interface>interface <name><name>IContravariant</name><argument_list type="generic">&lt;<argument><specifier>in</specifier> <name>A</name></argument>&gt;</argument_list></name> <block>{ }</block></interface>

incr


Element

  • <incr>

Subelement

  • <expr>

XPath Query

  • increment of for loops

    //src:incr

indexer property


Element

  • <function_decl>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Queries

  • indexer method declarations

    //src:property[src:parameter_list]
  • indexer method declarations with more then one dimension

    //src:property[count(src:parameter_list/src:parameter) > 1]

Examples

public T this[int i]
{
    get
    {
        return arr[i];
    }
    set
    {
        arr[i] = value;
    }
}
<property><type><specifier>public</specifier> <name>T</name></type> <name>this</name><parameter_list type="indexer">[<parameter><decl><type><name>int</name></type> <name>i</name></decl></parameter>]</parameter_list>
<block>{
    <function><name>get</name>
    <block>{<block_content>
        <return>return <expr><name><name>arr</name><index>[<expr><name>i</name></expr>]</index></name></expr>;</return>
    </block_content>}</block></function>
    <function><name>set</name>
    <block>{<block_content>
        <expr_stmt><expr><name><name>arr</name><index>[<expr><name>i</name></expr>]</index></name> <operator>=</operator> <name>value</name></expr>;</expr_stmt>
    </block_content>}</block></function>
}</block></property>
public T this[int x, int y]
{
    get;
    set;
}
<property><type><specifier>public</specifier> <name>T</name></type> <name>this</name><parameter_list type="indexer">[<parameter><decl><type><name>int</name></type> <name>x</name></decl></parameter><operator>,</operator> <parameter><decl><type><name>int</name></type> <name>y</name></decl></parameter>]</parameter_list>
<block>{
    <function_decl><name>get</name>;</function_decl>
    <function_decl><name>set</name>;</function_decl>
}</block></property>

inheritance list


Element

  • <super_list>

Subelement

  • <super>

XPath Queries

  • classes with at least one super class

    //src:class[src:super_list/src:super]
  • classes that inherit from bar

    //src:class[src:super_list/src:super/src:name = 'bar']

Example

class Foo
    :Bar
{
}
<class>class <name>Foo</name>
    <super_list>:<super><name>Bar</name></super></super_list>
<block>{
}</block></class>

interface


Element

  • <interface>

Subelements

  • <name>
  • <super>
  • <block>

XPath Query

  • interfaces

    //src:interface

Examples

interface IInterfaceExample
{
}
<interface>interface <name>IInterfaceExample</name>
<block>{
}</block></interface>
interface IInterfaceExample
    :ISortable, IComparable
{
}
<interface>interface <name>IInterfaceExample</name>
    <super_list>:<super><name>ISortable</name></super>, <super><name>IComparable</name></super></super_list>
<block>{
}</block></interface>

into


Element

  • <into>

XPath Query

  • into clauses

    //src:into

join


Element

  • <join>

Subelements

  • <in>
  • <true>
  • <equals>
  • <into>

XPath Query

  • clauses

    //src:join

Examples

inner join

var innerJoinQuery =
    from category in categories
    join prod in products on category.ID equals prod.CategoryID
    select new { ProductName = prod.Name, Category = category.Name };
<decl_stmt><decl><type><name>var</name></type> <name>innerJoinQuery</name> <init>=
    <expr><linq><from>from <expr><name>category</name></expr> <in>in <expr><name>categories</name></expr></in></from>
    <join>join <expr><name>prod</name></expr> <in>in <expr><name>products</name></expr></in> <on>on <expr><name><name>category</name><operator>.</operator><name>ID</name></name></expr></on> <equals>equals <expr><name><name>prod</name><operator>.</operator><name>CategoryID</name></name></expr></equals></join>
    <select>select <expr><operator>new</operator> <block>{ <expr><name>ProductName</name> <operator>=</operator> <name><name>prod</name><operator>.</operator><name>Name</name></name></expr>, <expr><name>Category</name> <operator>=</operator> <name><name>category</name><operator>.</operator><name>Name</name></name></expr> }</block></expr></select></linq></expr></init></decl>;</decl_stmt>

group join

var innerGroupJoinQuery =
    from category in categories
    join prod in products on category.ID equals prod.CategoryID into prodGroup
    select new { CategoryName = category.Name, Products = prodGroup };
<decl_stmt><decl><type><name>var</name></type> <name>innerGroupJoinQuery</name> <init>=
    <expr><linq><from>from <expr><name>category</name></expr> <in>in <expr><name>categories</name></expr></in></from>
    <join>join <expr><name>prod</name></expr> <in>in <expr><name>products</name></expr></in> <on>on <expr><name><name>category</name><operator>.</operator><name>ID</name></name></expr></on> <equals>equals <expr><name><name>prod</name><operator>.</operator><name>CategoryID</name></name></expr></equals> <into>into <expr><name>prodGroup</name></expr></into></join>
    <select>select <expr><operator>new</operator> <block>{ <expr><name>CategoryName</name> <operator>=</operator> <name><name>category</name><operator>.</operator><name>Name</name></name></expr>, <expr><name>Products</name> <operator>=</operator> <name>prodGroup</name></expr> }</block></expr></select></linq></expr></init></decl>;</decl_stmt>

subquery join

var innerGroupJoinQuery2 =
    from category in categories
    join prod in products on category.ID equals prod.CategoryID into prodGroup
    from prod2 in prodGroup
    where prod2.UnitPrice > 2.50M
    select prod2;
<decl_stmt><decl><type><name>var</name></type> <name>innerGroupJoinQuery2</name> <init>=
    <expr><linq><from>from <expr><name>category</name></expr> <in>in <expr><name>categories</name></expr></in></from>
    <join>join <expr><name>prod</name></expr> <in>in <expr><name>products</name></expr></in> <on>on <expr><name><name>category</name><operator>.</operator><name>ID</name></name></expr></on> <equals>equals <expr><name><name>prod</name><operator>.</operator><name>CategoryID</name></name></expr></equals> <into>into <expr><name>prodGroup</name></expr></into></join>
    <from>from <expr><name>prod2</name></expr> <in>in <expr><name>prodGroup</name></expr></in></from>
    <where>where <expr><name><name>prod2</name><operator>.</operator><name>UnitPrice</name></name> <operator>&gt;</operator> <literal type="number">2.50M</literal></expr></where>
    <select>select <expr><name>prod2</name></expr></select></linq></expr></init></decl>;</decl_stmt>

left outer join

var leftOuterJoinQuery =
    from category in categories
    join prod in products on category.ID equals prod.CategoryID into prodGroup
    from item in prodGroup.DefaultIfEmpty(new Product { Name = String.Empty, CategoryID = 0 })
    select new { CatName = category.Name, ProdName = item.Name };
<decl_stmt><decl><type><name>var</name></type> <name>leftOuterJoinQuery</name> <init>=
    <expr><linq><from>from <expr><name>category</name></expr> <in>in <expr><name>categories</name></expr></in></from>
    <join>join <expr><name>prod</name></expr> <in>in <expr><name>products</name></expr></in> <on>on <expr><name><name>category</name><operator>.</operator><name>ID</name></name></expr></on> <equals>equals <expr><name><name>prod</name><operator>.</operator><name>CategoryID</name></name></expr></equals> <into>into <expr><name>prodGroup</name></expr></into></join>
    <from>from <expr><name>item</name></expr> <in>in <expr><macro><name>prodGroup</name></macro><operator>.</operator><macro><name>DefaultIfEmpty</name><argument_list>(<argument>new Product { Name = String.Empty</argument>, <argument>CategoryID = <literal type="number">0</literal> }</argument>)</argument_list></macro></expr></in></from>
    <select>select <expr><operator>new</operator> <block>{ <expr><name>CatName</name> <operator>=</operator> <name><name>category</name><operator>.</operator><name>Name</name></name></expr>, <expr><name>ProdName</name> <operator>=</operator> <name><name>item</name><operator>.</operator><name>Name</name></name></expr> }</block></expr></select></linq></expr></init></decl>;</decl_stmt>

label


Element

  • <label>

Subelement

  • <name>

XPath Queries

  • labels

    //src:label
  • label names

    //src:label/src:name
  • labels with a goto statement

    //src:label[src:name = //src:goto/src:name]
  • labels without a goto statement

    //src:label[not(src:name[. = //src:goto/src:name])]

Example

stop:
<label><name>stop</name>:</label>

let


Element

  • <let>

Subelement

  • <expr>

XPath Query

  • let clauses

    //src:let

Example

var earlyBirdQuery =
    from sentence in strings
    let words = sentence.Split(' ')
    from word in words
    let w = word.ToLower()
    where w[0] == 'a' || w[0] == 'e'
        || w[0] == 'i' || w[0] == 'o'
        || w[0] == 'u'
    select word;
<decl_stmt><decl><type><name>var</name></type> <name>earlyBirdQuery</name> <init>=
    <expr><linq><from>from <expr><name>sentence</name></expr> <in>in <expr><name>strings</name></expr></in></from>
    <let>let <expr><name>words</name> <operator>=</operator> <call><name><name>sentence</name><operator>.</operator><name>Split</name></name><argument_list>(<argument><expr><literal type="char">' '</literal></expr></argument>)</argument_list></call></expr></let>
    <from>from <expr><name>word</name></expr> <in>in <expr><name>words</name></expr></in></from>
    <let>let <expr><name>w</name> <operator>=</operator> <call><name><name>word</name><operator>.</operator><name>ToLower</name></name><argument_list>()</argument_list></call></expr></let>
    <where>where <expr><name><name>w</name><index>[<expr><literal type="number">0</literal></expr>]</index></name> <operator>==</operator> <literal type="char">'a'</literal> <operator>||</operator> <name><name>w</name><index>[<expr><literal type="number">0</literal></expr>]</index></name> <operator>==</operator> <literal type="char">'e'</literal>
        <operator>||</operator> <name><name>w</name><index>[<expr><literal type="number">0</literal></expr>]</index></name> <operator>==</operator> <literal type="char">'i'</literal> <operator>||</operator> <name><name>w</name><index>[<expr><literal type="number">0</literal></expr>]</index></name> <operator>==</operator> <literal type="char">'o'</literal>
        <operator>||</operator> <name><name>w</name><index>[<expr><literal type="number">0</literal></expr>]</index></name> <operator>==</operator> <literal type="char">'u'</literal></expr></where>
    <select>select <expr><name>word</name></expr></select></linq></expr></init></decl>;</decl_stmt>

linq


Element

  • <linq>

Subelements

  • <from>
  • <where>
  • <let>
  • <orderby>
  • <select>
  • <group>
  • <join>

XPath Query

  • linq usages

    //src:linq

lock statement


Element

  • <lock>

Subelements

  • <init>
  • <block>

XPath Query

  • lock statements

    //src:lock

Example

lock (thisLock) {
}
<lock>lock <init>(<expr><name>thisLock</name></expr>)</init> <block>{<block_content>
</block_content>}</block></lock>

member and scope access


Element

  • <expr>

Subelements

  • <name>
  • <operator>

XPath Query

  • uses of the . operator

    //src:operator[.='.']

Example

t.tm_sec;
<expr_stmt><expr><name><name>t</name><operator>.</operator><name>tm_sec</name></name></expr>;</expr_stmt>

named parameters


Element

  • <call>

Subelements

  • <name>
  • <argument_list>

XPath Query

  • function calls with named parameters

    //src:call[src:argument_list/src:argument/src:name]

Example

CalculateBMI(height: 64, weight: 123);
<expr_stmt><expr><call><name>CalculateBMI</name><argument_list>(<argument><name>height</name>: <expr><literal type="number">64</literal></expr></argument>, <argument><name>weight</name>: <expr><literal type="number">123</literal></expr></argument>)</argument_list></call></expr>;</expr_stmt>

namespace


Element

  • <namespace>

Subelements

  • <name>
  • <block>

XPath Query

  • namespaces

    //src:namespace

Example

namespace SampleNamespace
{
}
<namespace>namespace <name>SampleNamespace</name>
<block>{
}</block></namespace>

new


Element

  • <specifier>

XPath Query

  • functions which hide a previous implementation using new

    //src:function[src:type/src:specifier ='new']

Example

public new void Invoke() { }
<function><type><specifier>public</specifier> <specifier>new</specifier> <name>void</name></type> <name>Invoke</name><parameter_list>()</parameter_list> <block>{<block_content> </block_content>}</block></function>

new (constraint)


Element

  • <name>

XPath Queries

  • uses of the new constraint

    //src:constraint[src:name = 'new']
  • classes which specify the new constraint

    //src:class[src:where/src:constraint/src:name = 'new']

Example

class Foo<T> where T : new()
{}
<class>class <name><name>Foo</name><argument_list type="generic">&lt;<argument><name>T</name></argument>&gt;</argument_list></name> <where>where <name>T</name> : <constraint><name>new</name>()</constraint></where>
<block>{}</block></class>

nullable variable modifier


Element

  • <decl>

Subelements

  • <name>
  • <init>

XPath Query

  • nullable variable declarations

    //src:decl[src:type/src:modifier='?']

Example

int? i = null;
<decl_stmt><decl><type><name>int</name><modifier>?</modifier></type> <name>i</name> <init>= <expr><literal type="null">null</literal></expr></init></decl>;</decl_stmt>

object initializer


Element

  • <decl>

Subelements

  • <name>
  • <init>

XPath Query

  • object initializations, this excludes array initialization

    //src:decl[src:init/src:expr/src:block]

Example

Cat cat = new Cat { Age = 10, Name = "Fluffy" };
<decl_stmt><decl><type><name>Cat</name></type> <name>cat</name> <init>= <expr><operator>new</operator> <name>Cat</name> <block>{ <expr><name>Age</name> <operator>=</operator> <literal type="number">10</literal></expr>, <expr><name>Name</name> <operator>=</operator> <literal type="string">"Fluffy"</literal></expr> }</block></expr></init></decl>;</decl_stmt>

on


Element

  • <on>

XPath Query

  • on clauses

    //src:on

operator false


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Query

  • false operator overloads

    //src:function[src:type='operator'][src:name/src:name='false']

Example

public static bool operator false(DBBool x) {
}
<function type="operator"><type><specifier>public</specifier> <specifier>static</specifier> <name>bool</name></type> <name>operator <name>false</name></name><parameter_list>(<parameter><decl><type><name>DBBool</name></type> <name>x</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></function>

operator overloading


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Query

  • operator declarations

    //src:function_decl[src:type='operator']

Example

public static Complex operator +(Complex c1, Complex c2) 
{
}
<function type="operator"><type><specifier>public</specifier> <specifier>static</specifier> <name>Complex</name></type> <name>operator <name>+</name></name><parameter_list>(<parameter><decl><type><name>Complex</name></type> <name>c1</name></decl></parameter>, <parameter><decl><type><name>Complex</name></type> <name>c2</name></decl></parameter>)</parameter_list> 
<block>{<block_content>
</block_content>}</block></function>

operator true


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Query

  • true operator overloads

    //src:function[src:type='operator'][src:name/src:name='true']

Example

public static bool operator true(DBBool x) {
}
<function type="operator"><type><specifier>public</specifier> <specifier>static</specifier> <name>bool</name></type> <name>operator <name>true</name></name><parameter_list>(<parameter><decl><type><name>DBBool</name></type> <name>x</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></function>

orderby


Element

  • <orderby>

Subelements

  • <expr>
  • <name>

XPath Queries

  • orderby clauses

    //src:orderby
  • orderby clauses which sort in descending order

    //src:orderby[src:name='descending']
  • orderby clauses which sort in ascending order

    //src:orderby[src:name='ascending'] or not(src:name)

Examples

IEnumerable<string> sortAscendingQuery =
    from fruit in fruits
    orderby fruit
    select fruit;
<decl_stmt><decl><type><name><name>IEnumerable</name><argument_list type="generic">&lt;<argument><name>string</name></argument>&gt;</argument_list></name></type> <name>sortAscendingQuery</name> <init>=
    <expr><linq><from>from <expr><name>fruit</name></expr> <in>in <expr><name>fruits</name></expr></in></from>
    <orderby>orderby <expr><name>fruit</name></expr></orderby>
    <select>select <expr><name>fruit</name></expr></select></linq></expr></init></decl>;</decl_stmt>
IEnumerable<string> sortDescendingQuery =
    from w in fruits
    orderby w descending 
    select w;
<decl_stmt><decl><type><name><name>IEnumerable</name><argument_list type="generic">&lt;<argument><name>string</name></argument>&gt;</argument_list></name></type> <name>sortDescendingQuery</name> <init>=
    <expr><linq><from>from <expr><name>w</name></expr> <in>in <expr><name>fruits</name></expr></in></from>
    <orderby>orderby <expr><name>w</name></expr> <name>descending</name></orderby> 
    <select>select <expr><name>w</name></expr></select></linq></expr></init></decl>;</decl_stmt>
IEnumerable<string> sortDescendingQuery =
    from w in fruits
    orderby w ascending 
    select w;  
<decl_stmt><decl><type><name><name>IEnumerable</name><argument_list type="generic">&lt;<argument><name>string</name></argument>&gt;</argument_list></name></type> <name>sortDescendingQuery</name> <init>=
    <expr><linq><from>from <expr><name>w</name></expr> <in>in <expr><name>fruits</name></expr></in></from>
    <orderby>orderby <expr><name>w</name></expr> <name>ascending</name></orderby> 
    <select>select <expr><name>w</name></expr></select></linq></expr></init></decl>;</decl_stmt>  

out (generic parameter constraint)


Element

  • <specifier>

XPath Query

  • generic parameters constrained with out

    //src:argument[src:specifier='out'][parent::src:argument_list/src:type='template']

Example

class Conversion<out A> { }
<class>class <name><name>Conversion</name><argument_list type="generic">&lt;<argument><specifier>out</specifier> <name>A</name></argument>&gt;</argument_list></name> <block>{ }</block></class>

override


Element

  • <specifier>

XPath Query

  • overridden functions

    //src:function[src:type/src:specifier ='override']

Example

override double area() {
}
<function><type><specifier>override</specifier> <name>double</name></type> <name>area</name><parameter_list>()</parameter_list> <block>{<block_content>
</block_content>}</block></function>

params


Element

  • <specifier>

XPath Query

  • functions with a variable number of arguments

    //src:function[src:parameter_list/src:parameter/src:decl/src:type/src:specifier='params']

Example

void F(params int[] args) {
}
<function><type><name>void</name></type> <name>F</name><parameter_list>(<parameter><decl><type><specifier>params</specifier> <name><name>int</name><index>[]</index></name></type> <name>args</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></function>

partial


Element

  • <specifier>

XPath Queries

  • partial classes

    //src:class[src:specifier ='partial']
  • partial functions

    //src:function[src:type/src:specifier ='partial']
  • partial function declarations

    //src:function_decl[src:type/src:specifier ='partial']

Examples

partial class Employee;
<class_decl><specifier>partial</specifier> class <name>Employee</name>;</class_decl>
partial void OnSomethingHappened(String s);

partial void OnSomethingHappened(String s) {
}
<function_decl><type><specifier>partial</specifier> <name>void</name></type> <name>OnSomethingHappened</name><parameter_list>(<parameter><decl><type><name>String</name></type> <name>s</name></decl></parameter>)</parameter_list>;</function_decl>

<function><type><specifier>partial</specifier> <name>void</name></type> <name>OnSomethingHappened</name><parameter_list>(<parameter><decl><type><name>String</name></type> <name>s</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></function>

pointer declaration


Element

  • <modifier>

XPath Query

  • of the declarations of pointers

    //src:decl[src:type/src:modifier='*']

Example

int* i = &x;
<decl_stmt><decl><type><name>int</name><modifier>*</modifier></type> <name>i</name> <init>= <expr><operator>&amp;</operator><name>x</name></expr></init></decl>;</decl_stmt>

private


Element

  • <specifier>

XPath Queries

  • private methods

    //src:function[src:type/src:specifier='private']
  • private properties

    //src:property[src:type/src:specifier='private']

Examples

private int field = 1;
<decl_stmt><decl><type><specifier>private</specifier> <name>int</name></type> <name>field</name> <init>= <expr><literal type="number">1</literal></expr></init></decl>;</decl_stmt>
private class Foo
{ 
}
<class><specifier>private</specifier> class <name>Foo</name>
<block>{ 
}</block></class>
private void doWork()
{
}
<function><type><specifier>private</specifier> <name>void</name></type> <name>doWork</name><parameter_list>()</parameter_list>
<block>{<block_content>
</block_content>}</block></function>
private string Name {
    get;
    set;
}
<property><type><specifier>private</specifier> <name>string</name></type> <name>Name</name> <block>{
    <function_decl><name>get</name>;</function_decl>
    <function_decl><name>set</name>;</function_decl>
}</block></property>

protected


Element

  • <specifier>

XPath Queries

  • protected methods

    //src:function[src:type/src:specifier='protected']
  • protected properties

    //src:property[src:type/src:specifier='protected']

Examples

protected int field = 1;
<decl_stmt><decl><type><specifier>protected</specifier> <name>int</name></type> <name>field</name> <init>= <expr><literal type="number">1</literal></expr></init></decl>;</decl_stmt>
protected class Foo
{ 
}
<class><specifier>protected</specifier> class <name>Foo</name>
<block>{ 
}</block></class>
protected void doWork()
{
}
<function><type><specifier>protected</specifier> <name>void</name></type> <name>doWork</name><parameter_list>()</parameter_list>
<block>{<block_content>
</block_content>}</block></function>
protected string Name {
    get;
    set;
}
<property><type><specifier>protected</specifier> <name>string</name></type> <name>Name</name> <block>{
    <function_decl><name>get</name>;</function_decl>
    <function_decl><name>set</name>;</function_decl>
}</block></property>

protected internal


Element

  • <specifier>

XPath Query

  • protected internal fields

    //src:decl_stmt[src:decl[not(src:block)]/src:type[src:specifier='protected'][src:specifier='internal']]

Example

protected internal int field = 1;
<decl_stmt><decl><type><specifier>protected</specifier> <specifier>internal</specifier> <name>int</name></type> <name>field</name> <init>= <expr><literal type="number">1</literal></expr></init></decl>;</decl_stmt>

public


Element

  • <specifier>

XPath Queries

  • public classes

    //src:class[src:specifier ='public']
  • public methods

    //src:function[src:type/src:specifier ='public']
  • public properties

    //src:property[src:type/src:specifier ='public']

Examples

public int field = 1;
<decl_stmt><decl><type><specifier>public</specifier> <name>int</name></type> <name>field</name> <init>= <expr><literal type="number">1</literal></expr></init></decl>;</decl_stmt>
public class Foo
{ 
}
<class><specifier>public</specifier> class <name>Foo</name>
<block>{ 
}</block></class>
public void doWork()
{
}
<function><type><specifier>public</specifier> <name>void</name></type> <name>doWork</name><parameter_list>()</parameter_list>
<block>{<block_content>
</block_content>}</block></function>
public string Name {
    get;
    set;
}
<property><type><specifier>public</specifier> <name>string</name></type> <name>Name</name> <block>{
    <function_decl><name>get</name>;</function_decl>
    <function_decl><name>set</name>;</function_decl>
}</block></property>

readonly


Element

  • <specifier>

XPath Query

  • readonly variables

    //src:decl[src:type/src:specifier ='readonly']

Example

readonly int i = 4;
<decl_stmt><decl><type><specifier>readonly</specifier> <name>int</name></type> <name>i</name> <init>= <expr><literal type="number">4</literal></expr></init></decl>;</decl_stmt>

ref


Element

  • <modifier>

XPath Query

  • functions with ref parameters

    //src:function[src:parameter_list/src:parameter/src:decl/src:type/src:modifier='ref']

Example

void Swap(ref int x, ref int y){
}
<function><type><name>void</name></type> <name>Swap</name><parameter_list>(<parameter><decl><type><modifier>ref</modifier> <name>int</name></type> <name>x</name></decl></parameter>, <parameter><decl><type><modifier>ref</modifier> <name>int</name></type> <name>y</name></decl></parameter>)</parameter_list><block>{<block_content>
</block_content>}</block></function>

remove


Element

  • <function>

Subelements

  • <name>
  • <block>

XPath Query

  • remove definitions

    //src:function[src:name='remove']

Example

remove {
    otherEvent -= value;
}
<function><name>remove</name> <block>{<block_content>
    <expr_stmt><expr><name>otherEvent</name> <operator>-=</operator> <name>value</name></expr>;</expr_stmt>
</block_content>}</block></function>

return statement


Element

  • <return>

Subelement

  • <expr>

XPath Queries

  • return statements

    //src:return
  • return expressions

    //src:return/src:expr
  • return statements that return true

    //src:return[src:expr='true']
  • functions with more then one return

    //src:function[count(.//src:return) > 1]

Examples

return;
<return>return;</return>
return true;
<return>return <expr><name>true</name></expr>;</return>
return( s * (long long)s );
<return>return<expr><operator>(</operator> <name>s</name> <operator>*</operator> <operator>(</operator><name>long</name> <name>long</name><operator>)</operator><name>s</name> <operator>)</operator></expr>;</return>

sealed


Element

  • <specifier>

XPath Queries

  • sealed classes

    //src:class[src:specifier ='sealed']
  • sealed methods

    //src:function[src:type/src:specifier ='sealed']

Examples

sealed class Foo {
}
<class><specifier>sealed</specifier> class <name>Foo</name> <block>{
}</block></class>
sealed override double area() {  }
<function><type><specifier>sealed</specifier> <specifier>override</specifier> <name>double</name></type> <name>area</name><parameter_list>()</parameter_list> <block>{<block_content>  </block_content>}</block></function>

set


Element

  • <function>

Subelements

  • <name>
  • <block>

XPath Query

  • set definitions

    //src:function[src:name='set']

Example

set {
    x = value;
}
<function><name>set</name> <block>{<block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>value</name></expr>;</expr_stmt>
</block_content>}</block></function>

set (default implementation)


Element

  • <function_decl>

Subelement

  • <name>

XPath Query

  • set definitions with default implementations

    //src:function_decl[src:name='set']

Example

set;
<function_decl><name>set</name>;</function_decl>

sizeof


Element

  • <sizeof>

Subelements

  • <argument_list>
  • <name>

XPath Query

  • uses of sizeof

    //src:sizeof

Example

int i = sizeof(x);
<decl_stmt><decl><type><name>int</name></type> <name>i</name> <init>= <expr><sizeof>sizeof<argument_list>(<argument><expr><name>x</name></expr></argument>)</argument_list></sizeof></expr></init></decl>;</decl_stmt>

stackalloc


Element

  • <operator>

XPath Query

  • expressions which call stackalloc

    //src:expr[.//src:operator ='stackalloc']

Example

int* block = stackalloc int[100];
<decl_stmt><decl><type><name>int</name><modifier>*</modifier></type> <name>block</name> <init>= <expr><operator>stackalloc</operator> <name><name>int</name><index>[<expr><literal type="number">100</literal></expr>]</index></name></expr></init></decl>;</decl_stmt>

static


Element

  • <specifier>

XPath Queries

  • static classes

    //src:class[src:specifier ='static']
  • static function

    //src:function[src:type/src:specifier ='static']
  • static fields

    //src:decl_stmt[src:decl/src:type/src:specifier ='static']
  • static events

    //src:event[src:type/src:specifier = 'static']
  • static properties

    //src:property[src:type/src:specifier = 'static']
  • static constructors

    //src:constructor[src:specifier ='static']

Examples

static class Foo {
}
<class><specifier>static</specifier> class <name>Foo</name> <block>{
}</block></class>
static void initialize() {
}
<function><type><specifier>static</specifier> <name>void</name></type> <name>initialize</name><parameter_list>()</parameter_list> <block>{<block_content>
</block_content>}</block></function>
static int counter = 5;
<decl_stmt><decl><type><specifier>static</specifier> <name>int</name></type> <name>counter</name> <init>= <expr><literal type="number">5</literal></expr></init></decl>;</decl_stmt>
class Foo {
    static event ReadHandler OnRead;
}
<class>class <name>Foo</name> <block>{
    <expr_stmt><expr><specifier>static</specifier> event <name>ReadHandler</name> <name>OnRead</name></expr>;</expr_stmt>
}</block></class>
static string Name {
    get;
    set;
}
<property><type><specifier>static</specifier> <name>string</name></type> <name>Name</name> <block>{
    <function_decl><name>get</name>;</function_decl>
    <function_decl><name>set</name>;</function_decl>
}</block></property>
class foo {
    static foo() { 
    }
}
<class>class <name>foo</name> <block>{
    <constructor><specifier>static</specifier> <name>foo</name><parameter_list>()</parameter_list> <block>{<block_content> 
    </block_content>}</block></constructor>
}</block></class>

static


Element

  • <specifier>

XPath Queries

  • static classes

    //src:class[src:specifier ='static']
  • static function

    //src:function[src:type/src:specifier ='static']
  • static fields

    //src:decl_stmt[src:decl/src:type/src:specifier ='static']
  • static events

    //src:event[src:type/src:specifier = 'static']
  • static properties

    //src:property[src:type/src:specifier = 'static']
  • static constructors

    //src:constructor[src:specifier ='static']

Examples

static class Foo {
}
<class><specifier>static</specifier> class <name>Foo</name> <block>{
}</block></class>
static void initialize() {
}
<function><type><specifier>static</specifier> <name>void</name></type> <name>initialize</name><parameter_list>()</parameter_list> <block>{<block_content>
</block_content>}</block></function>
static int counter = 5;
<decl_stmt><decl><type><specifier>static</specifier> <name>int</name></type> <name>counter</name> <init>= <expr><literal type="number">5</literal></expr></init></decl>;</decl_stmt>
class Foo {
    static event ReadHandler OnRead;
}
<class>class <name>Foo</name> <block>{
    <expr_stmt><expr><specifier>static</specifier> event <name>ReadHandler</name> <name>OnRead</name></expr>;</expr_stmt>
}</block></class>
static string Name {
    get;
    set;
}
<property><type><specifier>static</specifier> <name>string</name></type> <name>Name</name> <block>{
    <function_decl><name>get</name>;</function_decl>
    <function_decl><name>set</name>;</function_decl>
}</block></property>
class foo {
    static foo() { 
    }
}
<class>class <name>foo</name> <block>{
    <constructor><specifier>static</specifier> <name>foo</name><parameter_list>()</parameter_list> <block>{<block_content> 
    </block_content>}</block></constructor>
}</block></class>

string keyword


Element

  • <name>

XPath Query

  • uses of the string keyword

    //src:name[.='string']

Example

string x = "banana";
<decl_stmt><decl><type><name>string</name></type> <name>x</name> <init>= <expr><literal type="string">"banana"</literal></expr></init></decl>;</decl_stmt>

struct


Element

  • <struct>

Subelements

  • <name>
  • <super_list>
  • <block>

XPath Queries

  • structs

    //src:struct
  • struct members

    //src:struct/src:block/src:decl_stmt

Examples

struct Book
{
}
<struct>struct <name>Book</name>
<block>{
}</block></struct>
struct Book
    :ISortable<Book>
{
}
<struct>struct <name>Book</name>
    <super_list>:<super><name><name>ISortable</name><argument_list type="generic">&lt;<argument><name>Book</name></argument>&gt;</argument_list></name></super></super_list>
<block>{
}</block></struct>

struct (constraint)


Element

  • <constraint>

XPath Query

  • generic methods that specify a struct constraint

    //src:function[src:where/src:constraint.='struct']

Example

void foo<X>(X x) where X : struct
{ }
<function><type><name>void</name></type> <name><name>foo</name><argument_list type="generic">&lt;<argument><name>X</name></argument>&gt;</argument_list></name><parameter_list>(<parameter><decl><type><name>X</name></type> <name>x</name></decl></parameter>)</parameter_list> <where>where <name>X</name> : <constraint>struct</constraint></where>
<block>{<block_content> </block_content>}</block></function>

switch statement


Element

  • <switch>

Subelements

  • <condition>
  • <case>
  • <block>

XPath Queries

  • switch statements

    //src:switch
  • switch-statement conditions

    //src:switch/src:condition

Examples

switch (c) {

    case 'A':
        ++capa;
    case 'a':
        ++lettera;
    default :
        ++total;
}
<switch>switch <condition>(<expr><name>c</name></expr>)</condition> <block>{<block_content>

    <case>case <expr><literal type="char">'A'</literal></expr>:</case>
        <expr_stmt><expr><operator>++</operator><name>capa</name></expr>;</expr_stmt>
    <case>case <expr><literal type="char">'a'</literal></expr>:</case>
        <expr_stmt><expr><operator>++</operator><name>lettera</name></expr>;</expr_stmt>
    <default>default :</default>
        <expr_stmt><expr><operator>++</operator><name>total</name></expr>;</expr_stmt>
</block_content>}</block></switch>
switch (i) {

    case -1:
        ++n;
        break;
    case 0 :
        ++z;
        break;
    case 1 :
        ++p;
        break;
}
<switch>switch <condition>(<expr><name>i</name></expr>)</condition> <block>{<block_content>

    <case>case <expr><operator>-</operator><literal type="number">1</literal></expr>:</case>
        <expr_stmt><expr><operator>++</operator><name>n</name></expr>;</expr_stmt>
        <break>break;</break>
    <case>case <expr><literal type="number">0</literal></expr> :</case>
        <expr_stmt><expr><operator>++</operator><name>z</name></expr>;</expr_stmt>
        <break>break;</break>
    <case>case <expr><literal type="number">1</literal></expr> :</case>
        <expr_stmt><expr><operator>++</operator><name>p</name></expr>;</expr_stmt>
        <break>break;</break>
</block_content>}</block></switch>

ternary operator


Element

  • <ternary>

Subelements

  • <condition>
  • <then>
  • <else>

XPath Query

  • ternary operators

    //src:ternary

Example

a ? x : y;
<expr_stmt><expr><ternary><condition><expr><name>a</name></expr> ?</condition><then> <expr><name>x</name></expr> </then><else>: <expr><name>y</name></expr></else></ternary></expr>;</expr_stmt>

then


Element

  • <then>

Subelement

  • <expr>

XPath Query

  • then parts of ternary

    //src:then

this (constructor forwarding)


Element

  • <name>

XPath Query

  • constructors which forward to the another constructor using this

    //src:constructor[src:member_list/src:call/src:name = 'this']

Example

class Foo {
    Foo()
        :this("")
    {
    }
}
<class>class <name>Foo</name> <block>{
    <constructor><name>Foo</name><parameter_list>()</parameter_list>
        <member_init_list>:<call><name>this</name><argument_list>(<argument><expr><literal type="string">""</literal></expr></argument>)</argument_list></call>
    </member_init_list><block>{<block_content>
    </block_content>}</block></constructor>
}</block></class>

this (extension methods)


Element

  • <specifier>

XPath Query

  • extension methods

    //src:function[src:parameter_list/src:parameter/src:decl/src:type/src:specifier='this']

Example

static int WordCount(this String str)
{
}
<function><type><specifier>static</specifier> <name>int</name></type> <name>WordCount</name><parameter_list>(<parameter><decl><type><specifier>this</specifier> <name>String</name></type> <name>str</name></decl></parameter>)</parameter_list>
<block>{<block_content>
</block_content>}</block></function>

this (object)


Element

  • <name>

XPath Query

  • uses of this

    //src:name[.='this']

Example

this.x = 5;
<expr_stmt><expr><name><name>this</name><operator>.</operator><name>x</name></name> <operator>=</operator> <literal type="number">5</literal></expr>;</expr_stmt>

throw


Element

  • <throw>

Subelement

  • <expr>

XPath Query

  • uses of throw

    //src:throw

Examples

throw new MyException();
<throw>throw <expr><operator>new</operator> <call><name>MyException</name><argument_list>()</argument_list></call></expr>;</throw>
throw;
<throw>throw;</throw>

try


Element

  • <try>

Subelements

  • <block>
  • <catch>

XPath Query

  • try block

    //src:try

Example

try
{
}
<try>try
<block>{<block_content>
</block_content>}</block></try>

type


Element

  • <type>

Subelements

  • <specifier>
  • <name>

XPath Queries

  • types

    //src:type
  • declaration types

    //src:decl/src:type
  • function types

    //src:function/src:type
  • function declaration types

    //src:function_decl/src:type

typeof


Element

  • <typeof>

Subelement

  • <argument_list>

XPath Query

  • uses of typeof

    //src:typeof

Example

System.Type type = typeof(int);
<decl_stmt><decl><type><name><name>System</name><operator>.</operator><name>Type</name></name></type> <name>type</name> <init>= <expr><typeof>typeof<argument_list>(<argument><expr><name>int</name></expr></argument>)</argument_list></typeof></expr></init></decl>;</decl_stmt>

typeof


Element

  • <typeof>

Subelement

  • <argument_list>

XPath Query

  • uses of typeof

    //src:typeof

unchecked


Element

  • <unchecked>

Subelement

  • <block>

XPath Queries

  • uses of unchecked, in both statement and expression form

    //src:unchecked
  • uses of unchecked used as an expression

    //src:unchecked[not(src:block)]
  • uses of the unchecked statement

    //src:unchecked[src:block]

Examples

unchecked {
    int i3 = 2147483647 + ten;
    Console.WriteLine(i3);
}
<unchecked>unchecked <block>{<block_content>
    <decl_stmt><decl><type><name>int</name></type> <name>i3</name> <init>= <expr><literal type="number">2147483647</literal> <operator>+</operator> <name>ten</name></expr></init></decl>;</decl_stmt>
    <expr_stmt><expr><call><name><name>Console</name><operator>.</operator><name>WriteLine</name></name><argument_list>(<argument><expr><name>i3</name></expr></argument>)</argument_list></call></expr>;</expr_stmt>
</block_content>}</block></unchecked>
z = unchecked(maxIntValue + 10);
<expr_stmt><expr><name>z</name> <operator>=</operator> <unchecked>unchecked<argument_list>(<argument><expr><name>maxIntValue</name> <operator>+</operator> <literal type="number">10</literal></expr></argument>)</argument_list></unchecked></expr>;</expr_stmt>

unsafe statement


Element

  • <unsafe>

Subelement

  • <block>

XPath Query

  • unsafe statements

    //src:unsafe

Example

unsafe
{
}
<unsafe>unsafe
<block>{<block_content>
</block_content>}</block></unsafe>

using directive


Element

  • <using>

Subelements

  • <name>
  • <init>

XPath Query

  • using directives

    //src:using

Examples

using System.Text;
<using>using <name><name>System</name><operator>.</operator><name>Text</name></name>;</using>
using Project = PC.MyCompany.Project;
<using>using <name>Project</name> <init>= <expr><name><name>PC</name><operator>.</operator><name>MyCompany</name><operator>.</operator><name>Project</name></name></expr></init>;</using>

var


Element

  • <name>

XPath Query

  • var types

    //src:type[src:name='var']

Example

var x = 5;
<decl_stmt><decl><type><name>var</name></type> <name>x</name> <init>= <expr><literal type="number">5</literal></expr></init></decl>;</decl_stmt>

virtual


Element

  • <specifier>

XPath Query

  • virtual functions

    //src:function[src:type/src:specifier ='virtual']

Example

virtual double Area() 
{
}
<function><type><specifier>virtual</specifier> <name>double</name></type> <name>Area</name><parameter_list>()</parameter_list> 
<block>{<block_content>
</block_content>}</block></function>

volatile


Element

  • <specifier>

XPath Query

  • volatile variables

    //src:decl[src:type/src:specifier='volatile']

Example

volatile int foo; 
int volatile foo;
<decl_stmt><decl><type><specifier>volatile</specifier> <name>int</name></type> <name>foo</name></decl>;</decl_stmt> 
<decl_stmt><decl><type><name>int</name> <specifier>volatile</specifier></type> <name>foo</name></decl>;</decl_stmt>

while statement


Element

  • <while>

Subelements

  • <condition>
  • <block>

XPath Queries

  • while loops

    //src:while
  • while-loop conditions

    //src:while/src:condition
  • while loops with a condition containing the variable i

    //src:while[src:condition//src:name = 'i']

Example

while ( i >= 0 ) 
{
    string1[i] = string2[i];
    i--;
}
<while>while <condition>( <expr><name>i</name> <operator>&gt;=</operator> <literal type="number">0</literal></expr> )</condition> 
<block>{<block_content>
    <expr_stmt><expr><name><name>string1</name><index>[<expr><name>i</name></expr>]</index></name> <operator>=</operator> <name><name>string2</name><index>[<expr><name>i</name></expr>]</index></name></expr>;</expr_stmt>
    <expr_stmt><expr><name>i</name><operator>--</operator></expr>;</expr_stmt>
</block_content>}</block></while>

yield


Element

  • <specifier>

XPath Queries

  • yield statements

    //src:specifier[.='yield']
  • yield-return statements

    //src:return[src:specifier='yield']
  • yield-break statements

    //src:break[src:specifier='yield']

Examples

yield return result;
<return><specifier>yield</specifier> return <expr><name>result</name></expr>;</return>
yield break;
<break><specifier>yield</specifier> break;</break>