Exemple #1
0
 private static void HandleCurrentPositionInIntIndexer(OPathParseResult parseResult, char opathChar)
 {
     if (IsNumericChar(opathChar))
     {
         parseResult.AppendToIntIndexer(opathChar);
     }
     else if (IsIndexerEndChar(opathChar))
     {
         parseResult.CurrentPosition = OPathParsePosition.InVariableOPath;
         parseResult.AddOPathIntIndexerPart();
     }
     else if (IsWhitespaceChar(opathChar))
     {
         parseResult.CurrentPosition = OPathParsePosition.PostIndexerValue;
     }
     else
     {
         throw new OPathException("Invalid character in indexer starting at position " + (parseResult.IndexerStartIndex + 1));
     }
 }
Exemple #2
0
        private static void HandleCurrentPositionPostIndexerValue(OPathParseResult parseResult, char opathChar)
        {
            if (IsWhitespaceChar(opathChar))
            {
                // Ignore
            }
            else if (IsIndexerEndChar(opathChar))
            {
                parseResult.CurrentPosition = OPathParsePosition.InVariableOPath;

                if (parseResult.IsInIntIndexer())
                {
                    parseResult.AddOPathIntIndexerPart();
                }
                else
                {
                    parseResult.AddOPathStringKeyPart();
                }
            }
            else
            {
                throw new OPathException("Invalid character in indexer starting at position " + (parseResult.IndexerStartIndex + 1));
            }
        }