/// <summary> /// Parses a single term in a comma seperated list of things to expand. /// </summary> /// <returns>A token representing thing to expand.</returns> private ExpandTermToken ParseSingleExpandTerm() { this.isSelect = false; var termParser = new SelectExpandTermParser(this.lexer, this.MaxPathDepth, this.isSelect); PathSegmentToken pathToken = termParser.ParseTerm(); string optionsText = null; if (this.lexer.CurrentToken.Kind == ExpressionTokenKind.OpenParen) { optionsText = this.lexer.AdvanceThroughBalancedParentheticalExpression(); // Move lexer to what is after the parenthesis expression. Now CurrentToken will be the next thing. this.lexer.NextToken(); } if (expandOptionParser == null) { expandOptionParser = new ExpandOptionParser(this.maxRecursiveDepth, enableCaseInsensitiveBuiltinIdentifier) { MaxFilterDepth = MaxFilterDepth, MaxOrderByDepth = MaxOrderByDepth, MaxSearchDepth = MaxSearchDepth }; } return(this.expandOptionParser.BuildExpandTermToken(pathToken, optionsText)); }
public void ExpandTermTokenPathIsSet() { PathSegmentToken pathToken = new NonSystemToken("SomeNavProp", null, null); ExpandOptionParser optionParser = new ExpandOptionParser(5); var termToken = optionParser.BuildExpandTermToken(pathToken, ""); termToken.PathToNavProp.Should().Be(pathToken); }
// TODO: Probably missing more simple test cases // TODO: Write interesting, complex parsing cases private ExpandTermToken ParseExpandOptions(string optionsText, int maxDepth = 100) { PathSegmentToken pathToken = new NonSystemToken("NavProp", null, null); ExpandOptionParser optionParser = new ExpandOptionParser(maxDepth) { MaxFilterDepth = 9, MaxSearchDepth = 9, MaxOrderByDepth = 9 }; return optionParser.BuildExpandTermToken(pathToken, optionsText); }
/// <summary> /// Parses a single term in a comma separated list of things to expand. /// </summary> /// <returns>A token list representing thing to expand, the expand option star will have more than one items in the list.</returns> private List<ExpandTermToken> ParseSingleExpandTerm() { this.isSelect = false; var termParser = new SelectExpandTermParser(this.lexer, this.MaxPathDepth, this.isSelect); PathSegmentToken pathToken = termParser.ParseTerm(allowRef: true); string optionsText = null; if (this.lexer.CurrentToken.Kind == ExpressionTokenKind.OpenParen) { optionsText = this.lexer.AdvanceThroughBalancedParentheticalExpression(); // Move lexer to what is after the parenthesis expression. Now CurrentToken will be the next thing. this.lexer.NextToken(); } if (expandOptionParser == null) { expandOptionParser = new ExpandOptionParser(this.resolver, this.parentEntityType, this.maxRecursiveDepth, enableCaseInsensitiveBuiltinIdentifier) { MaxFilterDepth = MaxFilterDepth, MaxOrderByDepth = MaxOrderByDepth, MaxSearchDepth = MaxSearchDepth }; } return this.expandOptionParser.BuildExpandTermToken(pathToken, optionsText); }