-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated ODataUriParser to allow select and expand property names that… #2437
base: release-7.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -83,6 +83,11 @@ internal class ExpressionLexer | |||||||
/// <summary>Whether the lexer is being used to parse function parameters. If true, will allow/recognize parameter aliases and typed nulls.</summary> | ||||||||
private readonly bool parsingFunctionParameters; | ||||||||
|
||||||||
/// <summary> | ||||||||
/// Whether or not to interpret the semantics of a token that appears to be an identifier (i.e. consider if it is a keyword instead of an identifier) | ||||||||
/// </summary> | ||||||||
private readonly bool applySemanticsToIdentifiers; | ||||||||
|
||||||||
/// <summary>Lexer ignores whitespace</summary> | ||||||||
private bool ignoreWhitespace; | ||||||||
|
||||||||
|
@@ -108,6 +113,19 @@ internal ExpressionLexer(string expression, bool moveToFirstToken, bool useSemic | |||||||
/// <param name="useSemicolonDelimiter">If true, the lexer will tokenize based on semicolons as well.</param> | ||||||||
/// <param name="parsingFunctionParameters">Whether the lexer is being used to parse function parameters. If true, will allow/recognize parameter aliases and typed nulls.</param> | ||||||||
internal ExpressionLexer(string expression, bool moveToFirstToken, bool useSemicolonDelimiter, bool parsingFunctionParameters) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is internal -- how many places do we call this existing method from? Would it be easier to add the parameter to the existing overload and explicitly pass "true", rather than define a new overload? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something unrelated -- |
||||||||
: this(expression, moveToFirstToken, useSemicolonDelimiter, parsingFunctionParameters, true) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For better legibility:
Suggested change
|
||||||||
{ | ||||||||
} | ||||||||
|
||||||||
/// <summary>Initializes a new <see cref="ExpressionLexer"/>.</summary> | ||||||||
/// <param name="expression">Expression to parse.</param> | ||||||||
/// <param name="moveToFirstToken">If true, this constructor will call NextToken() to move to the first token.</param> | ||||||||
/// <param name="useSemicolonDelimiter">If true, the lexer will tokenize based on semicolons as well.</param> | ||||||||
/// <param name="parsingFunctionParameters">Whether the lexer is being used to parse function parameters. If true, will allow/recognize parameter aliases and typed nulls.</param> | ||||||||
/// <param name="applySemanticsToIdentifiers"> | ||||||||
/// Whether or not to interpret the semantics of a token that appears to be an identifier (i.e. consider if it is a keyword instead of an identifier) | ||||||||
/// </param> | ||||||||
internal ExpressionLexer(string expression, bool moveToFirstToken, bool useSemicolonDelimiter, bool parsingFunctionParameters, bool applySemanticsToIdentifiers) | ||||||||
{ | ||||||||
Debug.Assert(expression != null, "expression != null"); | ||||||||
|
||||||||
|
@@ -116,6 +134,7 @@ internal ExpressionLexer(string expression, bool moveToFirstToken, bool useSemic | |||||||
this.TextLen = this.Text.Length; | ||||||||
this.useSemicolonDelimiter = useSemicolonDelimiter; | ||||||||
this.parsingFunctionParameters = parsingFunctionParameters; | ||||||||
this.applySemanticsToIdentifiers = applySemanticsToIdentifiers; | ||||||||
this.parsingDoubleQuotedString = false; | ||||||||
|
||||||||
this.SetTextPos(0); | ||||||||
|
@@ -810,7 +829,7 @@ private void HandleTypePrefixedLiterals() | |||||||
|
||||||||
this.HandleQuotedValues(); | ||||||||
} | ||||||||
else | ||||||||
else if (this.applySemanticsToIdentifiers) | ||||||||
{ | ||||||||
// Handle keywords. | ||||||||
// Get built in type literal prefix. | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -81,7 +81,7 @@ public SelectExpandParser( | |||||||
|
||||||||
// Sets up our lexer. We don't turn useSemicolonDelimiter on since the parsing code for expand options, | ||||||||
// which is the only thing that needs it, is in a different class that uses it's own lexer. | ||||||||
this.lexer = clauseToParse != null ? new ExpressionLexer(clauseToParse, false /*moveToFirstToken*/, false /*useSemicolonDelimiter*/) : null; | ||||||||
this.lexer = clauseToParse != null ? new ExpressionLexer(clauseToParse, false, false, false, false) : null; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a lot going on here. For There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard to tell what all these
Suggested change
|
||||||||
|
||||||||
this.enableCaseInsensitiveBuiltinIdentifier = enableCaseInsensitiveBuiltinIdentifier; | ||||||||
|
||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are we setting this?
I think we should have this in the
ODataUriParserSettings
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can customer config this?