37 references to LicenseTokenType
NuGet.Packaging (37)
Licenses\LicenseExpressionToken.cs (2)
17
internal
LicenseTokenType
TokenType { get; }
24
internal LicenseExpressionToken(string value,
LicenseTokenType
tokenType)
Licenses\LicenseExpressionTokenizer.cs (4)
92
return new LicenseExpressionToken(bracket.ToString(CultureInfo.CurrentCulture),
LicenseTokenType
.OPENING_BRACKET);
96
return new LicenseExpressionToken(bracket.ToString(CultureInfo.CurrentCulture),
LicenseTokenType
.CLOSING_BRACKET);
110
var expressionToken = Enum.TryParse(value: token, result: out
LicenseTokenType
result);
118
return new LicenseExpressionToken(token,
LicenseTokenType
.IDENTIFIER);
Licenses\LicenseTokenTypeExtensions.cs (17)
8
public static bool IsOperator(this
LicenseTokenType
tokenType)
10
return tokenType ==
LicenseTokenType
.WITH || tokenType ==
LicenseTokenType
.AND || tokenType ==
LicenseTokenType
.OR;
13
public static bool IsValidPrecedingToken(this
LicenseTokenType
current,
LicenseTokenType
precedingToken)
17
case
LicenseTokenType
.OPENING_BRACKET: // Legal preceding tokens: None, Operator, OpeningBracket
19
case
LicenseTokenType
.CLOSING_BRACKET: // Legal preceding tokens: ClosingBracket, Identifier
20
return precedingToken ==
LicenseTokenType
.IDENTIFIER || precedingToken ==
LicenseTokenType
.CLOSING_BRACKET;
21
case
LicenseTokenType
.IDENTIFIER: // Legal preceding tokens: None, Operator, OpeningBracket
22
return precedingToken.IsOperator() || precedingToken ==
LicenseTokenType
.OPENING_BRACKET;
23
case
LicenseTokenType
.AND: // Legal preceding tokens: Identifier, ClosingBracket
24
case
LicenseTokenType
.WITH:
25
case
LicenseTokenType
.OR:
26
return precedingToken ==
LicenseTokenType
.IDENTIFIER || precedingToken ==
LicenseTokenType
.CLOSING_BRACKET;
Licenses\NuGetLicenseExpressionParser.cs (14)
39
var
lastTokenType =
LicenseTokenType
.IDENTIFIER;
44
var
currentTokenType = token.TokenType;
47
case
LicenseTokenType
.IDENTIFIER:
56
case
LicenseTokenType
.OPENING_BRACKET:
64
case
LicenseTokenType
.CLOSING_BRACKET:
71
while (operatorStack.Count > 0 && operatorStack.Peek().TokenType !=
LicenseTokenType
.OPENING_BRACKET)
87
case
LicenseTokenType
.WITH:
88
case
LicenseTokenType
.AND:
89
case
LicenseTokenType
.OR:
95
operatorStack.Peek().TokenType ==
LicenseTokenType
.OPENING_BRACKET || // The last token is an opening bracket (treat it the same as empty
117
if (operatorStack.Peek().TokenType !=
LicenseTokenType
.OPENING_BRACKET)
171
if (op.TokenType ==
LicenseTokenType
.WITH)
187
var logicalOperator = op.TokenType ==
LicenseTokenType
.AND ? LogicalOperatorType.And : LogicalOperatorType.Or;