-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add CancelationToken Support * fix tests build warnings * GridifyMapper ToString returns field list * add GridifyMapper ToString summary comment * remove the position from SyntaxToken * add Index mapping feature. fix issue #29 * update to v2.3.0
- Loading branch information
1 parent
179c5ab
commit eed8985
Showing
15 changed files
with
164 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
using System.Collections.Generic; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Gridify.Syntax | ||
{ | ||
internal sealed class FieldExpressionSyntax : ExpressionSyntax | ||
{ | ||
internal FieldExpressionSyntax(SyntaxToken fieldToken) | ||
{ | ||
FieldToken = fieldToken; | ||
// for performance reason we simply check the last character first | ||
if (fieldToken.Text.EndsWith("]")) | ||
{ | ||
// checking indexes from the field names | ||
var regex = new Regex(@"(\w+)\[(\d+)\]"); | ||
var match = regex.Match(fieldToken.Text); | ||
if (!match.Success) throw new ArgumentException($"Invalid filed name '{fieldToken.Text}'"); | ||
IsCollection = true; | ||
Index = int.Parse(match.Groups[2].Value); | ||
FieldToken = new SyntaxToken(SyntaxKind.FieldToken, 0, match.Groups[1].Value); | ||
} | ||
else | ||
FieldToken = fieldToken; | ||
} | ||
|
||
|
||
public override SyntaxKind Kind => SyntaxKind.FieldExpression; | ||
|
||
public override IEnumerable<SyntaxNode> GetChildren() | ||
{ | ||
yield return FieldToken; | ||
} | ||
|
||
public bool IsCollection { get; } | ||
public int Index { get; } | ||
public SyntaxToken FieldToken { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.