private PathToken FromContext(string input, PathTokenType type, PathLexerContext tokenContext)
 => new PathToken(
     input,
     input.Substring(tokenContext.StartPosition, tokenContext.EndPosition - tokenContext.StartPosition),
     type,
     tokenContext.StartPosition,
     tokenContext.EndPosition);
Beispiel #2
0
 public PathTokenDefinition(PathTokenType type, Predicate <PathLexerContext> matching)
 {
     if (matching == null)
     {
         throw new ArgumentNullException(nameof(matching));
     }
     _matching = matching;
     Type      = type;
 }
 public PathToken(string inputString, string value, PathTokenType type, int startIndex, int endIndex)
 {
     if (string.IsNullOrEmpty(inputString))
     {
         throw new ArgumentException(nameof(inputString));
     }
     if (value == null)
     {
         throw new ArgumentNullException(nameof(value));
     }
     if (0 > startIndex || startIndex > inputString.Length)
     {
         throw new ArgumentException(nameof(startIndex));
     }
     if (0 > endIndex || endIndex > inputString.Length || startIndex > endIndex)
     {
         throw new ArgumentException(nameof(startIndex));
     }
     InputString = inputString;
     Value       = value;
     Type        = type;
     StartIndex  = startIndex;
     EndIndex    = endIndex;
 }
Beispiel #4
0
 public PathTokenId(PathTokenType pathType, string value)
 {
     PathType = pathType;
     Value    = value;
 }