예제 #1
0
 private PartialParseResultInternal HandleInsertion(Span target, char previousChar, SourceChange change)
 {
     // What are we inserting after?
     if (previousChar == '.')
     {
         return(HandleInsertionAfterDot(target, change));
     }
     else if (ParserHelpers.IsIdentifierPart(previousChar) || previousChar == ')' || previousChar == ']')
     {
         return(HandleInsertionAfterIdPart(target, change));
     }
     else
     {
         return(PartialParseResultInternal.Rejected);
     }
 }
예제 #2
0
 private PartialParseResultInternal HandleDeletion(Span target, char previousChar, SourceChange change)
 {
     // What's left after deleting?
     if (previousChar == '.')
     {
         return(TryAcceptChange(target, change, PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional));
     }
     else if (ParserHelpers.IsIdentifierPart(previousChar))
     {
         return(TryAcceptChange(target, change));
     }
     else
     {
         return(PartialParseResultInternal.Rejected);
     }
 }
        private PartialParseResultInternal HandleDeletion(Span target, char previousChar, SourceChange change)
        {
            // What's left after deleting?
            if (previousChar == '.')
            {
                return(TryAcceptChange(target, change, PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional));
            }
            else if (ParserHelpers.IsIdentifierPart(previousChar))
            {
                return(TryAcceptChange(target, change));
            }
            else if (previousChar == '(')
            {
                var changeRelativePosition = change.Span.AbsoluteIndex - target.Start.AbsoluteIndex;
                if (target.Content[changeRelativePosition] == ')')
                {
                    return(PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional);
                }
            }

            return(PartialParseResultInternal.Rejected);
        }