Skip to content

Commit edb2d60

Browse files
committed
Separated out nodes with properties from basic nodes.
1 parent 6b92cae commit edb2d60

29 files changed

Lines changed: 775 additions & 248 deletions

doc/.idea/inspectionProfiles/Project_Default.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/MrKWatkins.Ast.tree

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
<toc-element toc-title="Parent" topic="MrKWatkins.Ast.Node-1.Parent.md" />
110110
<toc-element toc-title="PreviousSibling" topic="MrKWatkins.Ast.Node-1.PreviousSibling.md" />
111111
<toc-element toc-title="PreviousSiblings" topic="MrKWatkins.Ast.Node-1.PreviousSiblings.md" />
112-
<toc-element toc-title="Properties" topic="MrKWatkins.Ast.Node-1.Properties.md" />
113112
<toc-element toc-title="Root" topic="MrKWatkins.Ast.Node-1.Root.md" />
114113
<toc-element toc-title="SourcePosition" topic="MrKWatkins.Ast.Node-1.SourcePosition.md" />
115114
<toc-element toc-title="ThisAndAncestors" topic="MrKWatkins.Ast.Node-1.ThisAndAncestors.md" />
@@ -134,7 +133,6 @@
134133
<toc-element toc-title="AddPreviousSibling" topic="MrKWatkins.Ast.Node-1.AddPreviousSibling.md" />
135134
<toc-element toc-title="AddWarning" topic="MrKWatkins.Ast.Node-1.AddWarning.md" />
136135
<toc-element toc-title="AncestorsOfType" topic="MrKWatkins.Ast.Node-1.AncestorsOfType.md" />
137-
<toc-element toc-title="Copy" topic="MrKWatkins.Ast.Node-1.Copy.md" />
138136
<toc-element toc-title="MoveTo" topic="MrKWatkins.Ast.Node-1.MoveTo.md" />
139137
<toc-element toc-title="RemoveFromParent" topic="MrKWatkins.Ast.Node-1.RemoveFromParent.md" />
140138
<toc-element toc-title="RemoveNextSibling" topic="MrKWatkins.Ast.Node-1.RemoveNextSibling.md" />
@@ -165,6 +163,16 @@
165163
<toc-element toc-title="TryGet" topic="MrKWatkins.Ast.Properties.TryGet.md" />
166164
</toc-element>
167165
</toc-element>
166+
<toc-element toc-title="PropertyNode&lt;TNode&gt;">
167+
<toc-element toc-title="PropertyNode&lt;TNode&gt;" topic="MrKWatkins.Ast.PropertyNode-1.md" />
168+
<toc-element toc-title="Constructors" topic="MrKWatkins.Ast.PropertyNode-1.-ctor.md" />
169+
<toc-element toc-title="Properties">
170+
<toc-element toc-title="Properties" topic="MrKWatkins.Ast.PropertyNode-1.Properties.md" />
171+
</toc-element>
172+
<toc-element toc-title="Methods">
173+
<toc-element toc-title="Copy" topic="MrKWatkins.Ast.PropertyNode-1.Copy.md" />
174+
</toc-element>
175+
</toc-element>
168176
</toc-element>
169177
<toc-element toc-title="MrKWatkins.Ast.Listening">
170178
<toc-element toc-title="CompositeListener&lt;TBaseNode&gt;">

doc/cfg/buildprofiles.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<buildprofiles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd">
44

5-
<variables></variables>
65
<build-profile instance="hi">
76
<variables>
87
<noindex-content>true</noindex-content>

doc/topics/API/MrKWatkins.Ast.Node-1.Copy.md

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Node&lt;TNode&gt;.ToString Method
22
## Definition
33

4+
Returns a string that represents the current node. Defaults to the name of the type of the node.
5+
46
```c#
57
public override string ToString();
68
```
79

810
## Returns
911

1012
[String](https://learn.microsoft.com/en-gb/dotnet/api/System.String)
13+
14+
A string that represents the current node.

doc/topics/API/MrKWatkins.Ast.Node-1.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public abstract class Node<TNode>
5151
| [Parent](MrKWatkins.Ast.Node-1.Parent.md) | The parent of this node. |
5252
| [PreviousSibling](MrKWatkins.Ast.Node-1.PreviousSibling.md) | The previous sibling, i.e. the child from the same [Parent](MrKWatkins.Ast.Node-1.Parent.md) at the previous positional index. Returns `null` if this node is the first child. |
5353
| [PreviousSiblings](MrKWatkins.Ast.Node-1.PreviousSiblings.md) | Lazily enumerates over the previous siblings, i.e. the children from the same [Parent](MrKWatkins.Ast.Node-1.Parent.md) at precedent positional indices in descending index order. |
54-
| [Properties](MrKWatkins.Ast.Node-1.Properties.md) | The [Properties](MrKWatkins.Ast.Properties.md) associated with this node. |
5554
| [Root](MrKWatkins.Ast.Node-1.Root.md) | The root node, i.e. the highest parent above this node. Returns this node if it is the root, i.e. it has no parents. |
5655
| [SourcePosition](MrKWatkins.Ast.Node-1.SourcePosition.md) | The position of the node in the source code. |
5756
| [ThisAndAncestors](MrKWatkins.Ast.Node-1.ThisAndAncestors.md) | Lazily enumerates over this node and its [Ancestors](MrKWatkins.Ast.Node-1.Ancestors.md), i.e. this node, the [Parent](MrKWatkins.Ast.Node-1.Parent.md), grandparent, great-grandparent and so on up to the root node. |
@@ -84,14 +83,12 @@ public abstract class Node<TNode>
8483
| [AddWarning(String)](MrKWatkins.Ast.Node-1.AddWarning.md#mrkwatkins-ast-node-1-addwarning(system-string)) | Adds a [Message](MrKWatkins.Ast.Message.md) with [Level](MrKWatkins.Ast.Message.Level.md) [Warning](MrKWatkins.Ast.MessageLevel.Warning.md) and the specified text to this node. |
8584
| [AddWarning(String, String)](MrKWatkins.Ast.Node-1.AddWarning.md#mrkwatkins-ast-node-1-addwarning(system-string-system-string)) | Adds a [Message](MrKWatkins.Ast.Message.md) with [Level](MrKWatkins.Ast.Message.Level.md) [Warning](MrKWatkins.Ast.MessageLevel.Warning.md) and the specified text to this node. |
8685
| [AncestorsOfType()](MrKWatkins.Ast.Node-1.AncestorsOfType.md) | Lazily enumerates over this node and its [Ancestors](MrKWatkins.Ast.Node-1.Ancestors.md), returning only ancestors of the specified type. |
87-
| [Copy()](MrKWatkins.Ast.Node-1.Copy.md#mrkwatkins-ast-node-1-copy) | Copies this node using the [DefaultNodeFactory&lt;TNode&gt;](MrKWatkins.Ast.DefaultNodeFactory-1.md). |
88-
| [Copy(INodeFactory&lt;TNode&gt;)](MrKWatkins.Ast.Node-1.Copy.md#mrkwatkins-ast-node-1-copy(mrkwatkins-ast-inodefactory((-0)))) | Copies this node using the specified [INodeFactory&lt;TNode&gt;](MrKWatkins.Ast.INodeFactory-1.md). |
8986
| [MoveTo(TNode)](MrKWatkins.Ast.Node-1.MoveTo.md) | Moves this node to a new parent. |
9087
| [RemoveFromParent()](MrKWatkins.Ast.Node-1.RemoveFromParent.md) | Removes this node from its [Parent](MrKWatkins.Ast.Node-1.Parent.md). |
9188
| [RemoveNextSibling()](MrKWatkins.Ast.Node-1.RemoveNextSibling.md) | Removes the [NextSibling](MrKWatkins.Ast.Node-1.NextSibling.md) from [Parent](MrKWatkins.Ast.Node-1.Parent.md) if it exists. |
9289
| [RemovePreviousSibling()](MrKWatkins.Ast.Node-1.RemovePreviousSibling.md) | Removes the [PreviousSibling](MrKWatkins.Ast.Node-1.PreviousSibling.md) from [Parent](MrKWatkins.Ast.Node-1.Parent.md) if it exists. |
9390
| [ReplaceWith(Node&lt;TNode&gt;)](MrKWatkins.Ast.Node-1.ReplaceWith.md) | Removes this node from it&#39;s parent and puts another node in its place. |
9491
| [ThisAnd(IEnumerable&lt;TNode&gt;)](MrKWatkins.Ast.Node-1.ThisAnd.md) | Lazily enumerates over this node and then the specified enumeration of nodes. |
9592
| [ThisAndAncestorsOfType()](MrKWatkins.Ast.Node-1.ThisAndAncestorsOfType.md) | Lazily enumerates over the [Ancestors](MrKWatkins.Ast.Node-1.Ancestors.md) of this node, returning only ancestors of the specified type. |
96-
| [ToString()](MrKWatkins.Ast.Node-1.ToString.md) | |
93+
| [ToString()](MrKWatkins.Ast.Node-1.ToString.md) | Returns a string that represents the current node. Defaults to the name of the type of the node. |
9794

doc/topics/API/MrKWatkins.Ast.Properties.GetOrThrow.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
| ---- | ----------- |
66
| [GetOrThrow(String)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string)) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. |
77
| [GetOrThrow(String, T)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string-0@)) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance. |
8+
| [GetOrThrow(String, T?)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@)) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance. |
89
| [GetOrThrow(String, Func&lt;Exception&gt;)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string-system-func((system-exception)))) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. |
910
| [GetOrThrow(String, T, Func&lt;Exception&gt;)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string-0@-system-func((system-exception)))) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance. |
11+
| [GetOrThrow(String, T?, Func&lt;Exception&gt;)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-exception)))) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance. |
1012
| [GetOrThrow(String, Func&lt;String, Exception&gt;)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string-system-func((system-string-system-exception)))) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. |
1113
| [GetOrThrow(String, T, Func&lt;String, Exception&gt;)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string-0@-system-func((system-string-system-exception)))) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance. |
14+
| [GetOrThrow(String, T?, Func&lt;String, Exception&gt;)](MrKWatkins.Ast.Properties.GetOrThrow.md#mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-string-system-exception)))) | Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance. |
1215

1316
## GetOrThrow&lt;T&gt;(string) {id="mrkwatkins-ast-properties-getorthrow-1(system-string)"}
1417

@@ -65,6 +68,36 @@ T
6568
The value of the property.
6669
## Remarks {id="remarks-mrkwatkins-ast-properties-getorthrow-1(system-string-0@)"}
6770

71+
Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use [Set(String, T, T)](MrKWatkins.Ast.Properties.Set.md#mrkwatkins-ast-properties-set-1(system-string-0-0@)) to update the cached field.
72+
## GetOrThrow&lt;T&gt;(string, T?) {id="mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@)"}
73+
74+
Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.
75+
76+
```c#
77+
public T GetOrThrow<T>(string key, ref T? cached)
78+
where T : ValueType, new();
79+
```
80+
81+
### Type Parameters {id="type-parameters-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@)"}
82+
83+
| Name | Description |
84+
| ---- | ----------- |
85+
| T | The type of the property. |
86+
87+
## Parameters {id="parameters-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@)"}
88+
89+
| Name | Type | Description |
90+
| ---- | ---- | ----------- |
91+
| key | [String](https://learn.microsoft.com/en-gb/dotnet/api/System.String) | The key of the property. |
92+
| cached | [T?](https://learn.microsoft.com/en-gb/dotnet/api/System.Nullable-1) | The key of the property. |
93+
94+
## Returns {id="returns-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@)"}
95+
96+
T
97+
98+
The value of the property.
99+
## Remarks {id="remarks-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@)"}
100+
68101
Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use [Set(String, T, T)](MrKWatkins.Ast.Properties.Set.md#mrkwatkins-ast-properties-set-1(system-string-0-0@)) to update the cached field.
69102
## GetOrThrow&lt;T&gt;(string, Func&lt;Exception&gt;) {id="mrkwatkins-ast-properties-getorthrow-1(system-string-system-func((system-exception)))"}
70103

@@ -123,6 +156,37 @@ T
123156
The value of the property.
124157
## Remarks {id="remarks-mrkwatkins-ast-properties-getorthrow-1(system-string-0@-system-func((system-exception)))"}
125158

159+
Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use [Set(String, T, T)](MrKWatkins.Ast.Properties.Set.md#mrkwatkins-ast-properties-set-1(system-string-0-0@)) to update the cached field.
160+
## GetOrThrow&lt;T&gt;(string, T?, Func&lt;Exception&gt;) {id="mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-exception)))"}
161+
162+
Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.
163+
164+
```c#
165+
public T GetOrThrow<T>(string key, ref T? cached, Func<Exception> exceptionCreator)
166+
where T : ValueType, new();
167+
```
168+
169+
### Type Parameters {id="type-parameters-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-exception)))"}
170+
171+
| Name | Description |
172+
| ---- | ----------- |
173+
| T | The type of the property. |
174+
175+
## Parameters {id="parameters-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-exception)))"}
176+
177+
| Name | Type | Description |
178+
| ---- | ---- | ----------- |
179+
| key | [String](https://learn.microsoft.com/en-gb/dotnet/api/System.String) | The key of the property. |
180+
| cached | [T?](https://learn.microsoft.com/en-gb/dotnet/api/System.Nullable-1) | The key of the property. |
181+
| exceptionCreator | [Func&lt;Exception&gt;](https://learn.microsoft.com/en-gb/dotnet/api/System.Func-1) | Function to create an exception to throw if the no property with the specified `key` exists. |
182+
183+
## Returns {id="returns-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-exception)))"}
184+
185+
T
186+
187+
The value of the property.
188+
## Remarks {id="remarks-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-exception)))"}
189+
126190
Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use [Set(String, T, T)](MrKWatkins.Ast.Properties.Set.md#mrkwatkins-ast-properties-set-1(system-string-0-0@)) to update the cached field.
127191
## GetOrThrow&lt;T&gt;(string, Func&lt;String, Exception&gt;) {id="mrkwatkins-ast-properties-getorthrow-1(system-string-system-func((system-string-system-exception)))"}
128192

@@ -182,3 +246,34 @@ The value of the property.
182246
## Remarks {id="remarks-mrkwatkins-ast-properties-getorthrow-1(system-string-0@-system-func((system-string-system-exception)))"}
183247

184248
Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use [Set(String, T, T)](MrKWatkins.Ast.Properties.Set.md#mrkwatkins-ast-properties-set-1(system-string-0-0@)) to update the cached field.
249+
## GetOrThrow&lt;T&gt;(string, T?, Func&lt;String, Exception&gt;) {id="mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-string-system-exception)))"}
250+
251+
Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.
252+
253+
```c#
254+
public T GetOrThrow<T>(string key, ref T? cached, Func<String, Exception> exceptionCreator)
255+
where T : ValueType, new();
256+
```
257+
258+
### Type Parameters {id="type-parameters-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-string-system-exception)))"}
259+
260+
| Name | Description |
261+
| ---- | ----------- |
262+
| T | The type of the property. |
263+
264+
## Parameters {id="parameters-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-string-system-exception)))"}
265+
266+
| Name | Type | Description |
267+
| ---- | ---- | ----------- |
268+
| key | [String](https://learn.microsoft.com/en-gb/dotnet/api/System.String) | The key of the property. |
269+
| cached | [T?](https://learn.microsoft.com/en-gb/dotnet/api/System.Nullable-1) | The key of the property. |
270+
| exceptionCreator | [Func&lt;String, Exception&gt;](https://learn.microsoft.com/en-gb/dotnet/api/System.Func-2) | Function to create an exception to throw if the no property with the specified `key` exists. |
271+
272+
## Returns {id="returns-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-string-system-exception)))"}
273+
274+
T
275+
276+
The value of the property.
277+
## Remarks {id="remarks-mrkwatkins-ast-properties-getorthrow-1(system-string-system-nullable((-0))@-system-func((system-string-system-exception)))"}
278+
279+
Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use [Set(String, T, T)](MrKWatkins.Ast.Properties.Set.md#mrkwatkins-ast-properties-set-1(system-string-0-0@)) to update the cached field.

0 commit comments

Comments
 (0)