Exemplo n.º 1
0
 /// <summary>
 /// Matching tripples are used to highlight in bold a completed statement.  For example
 /// when you type the closing brace on a foreach statement VS highlights in bold the statement
 /// that was closed.  The first two source contexts are the beginning and ending of the statement that
 /// opens the block (for example, the span of the "foreach(...){" and the third source context
 /// is the closing brace for the block (e.g., the "}").
 /// </summary>
 public virtual void MatchTriple( SourceContext startContext, SourceContext middleContext, SourceContext endContext ){
     
   switch(this.reason){
     case ParseReason.MatchBraces: 
     case ParseReason.HighlightBraces:{
       int startLine1 = startContext.StartLine;
       int endLine1 = startContext.EndLine;
       int startCol1 = startContext.StartColumn;
       int endCol1 = startContext.EndColumn;
       int startLine2 = middleContext.StartLine;
       int endLine2 = middleContext.EndLine;
       int startCol2 = middleContext.StartColumn;
       int endCol2 = middleContext.EndColumn;
       int startLine3 = endContext.StartLine;
       int endLine3 = endContext.EndLine;
       int startCol3 = endContext.StartColumn;
       int endCol3 = endContext.EndColumn;
       if (startLine1 < 0 || endLine1 < startLine1 || startCol1 < 0 || (endLine1 == startLine1 && endCol1 < startCol1) ||
         startLine2 < endLine1 || endLine2 < startLine2 || startCol2 < 0 || (endLine2 == startLine2 && endCol2 < startCol2) ||
         startLine3 < endLine2 || endLine3 < startLine3 || startCol3 < 0 || (endLine3 == startLine3 && endCol3 < startCol3)){
         Debug.Assert(false);
         return;
       }
       this.MatchTriple(startLine1, startCol1, endLine1, endCol1, 
         startLine2, startCol2, endLine2, endCol2,
         startLine3, startCol3, endLine3, endCol3);
       break;
     }
   }     
 }
Exemplo n.º 2
0
 /// <summary>
 /// In support of Member Selection, CompleteWord, QuickInfo, 
 /// MethodTip, and Autos, the StartName and QualifyName methods
 /// are called.
 /// StartName is called for each identifier that is parsed (e.g. "Console")
 /// </summary>
 public virtual void StartName(SourceContext context, string name){
   switch(this.reason){
     case ParseReason.MemberSelect:
     case ParseReason.CompleteWord:
     case ParseReason.QuickInfo:
     case ParseReason.MethodTip:
     case ParseReason.Autos:{
       int startLine = context.StartLine;
       int startCol = context.StartColumn;
       if (startLine < 0 || startCol < 0){
         Debug.Assert(false);
         return;
       }
       if (startLine < this.Line || (startLine == this.Line && startCol <= this.Column)){
         this.Names.Add(name);
         this.SourceLocations.Add(context);
       }
       break;
     }
   }
 }
Exemplo n.º 3
0
 protected ErrorNode(int code, SourceContext sourceContext){
   this.Code = code;
   this.SourceContext = sourceContext;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Whenever a matching pair is parsed, e.g. '{' and '}', this method is called
 /// with the text span of both the left and right item. The
 /// information is used when a user types "ctrl-]" in VS
 /// to find a matching brace and when auto-highlight matching
 /// braces is enabled.
 /// </summary>
 public virtual void MatchPair(SourceContext startContext, SourceContext endContext){      
   switch(this.reason){
     case ParseReason.MatchBraces: 
     case ParseReason.HighlightBraces:{
       int startLine1 = startContext.StartLine;
       int endLine1 = startContext.EndLine;
       int startCol1 = startContext.StartColumn;
       int endCol1 = startContext.EndColumn;
       int startLine2 = endContext.StartLine;
       int endLine2 = endContext.EndLine;
       int startCol2 = endContext.StartColumn;
       int endCol2 = endContext.EndColumn;
       if (startLine1 < 0 || endLine1 < startLine1 || startCol1 < 0 || (endLine1 == startLine1 && endCol1 < startCol1) ||
         startLine2 < endLine1 || endLine2 < endLine1 || startCol2 < 0 || (endLine2 == startLine2 && endCol2 < startCol2)){
         Debug.Assert(false);
         return;
       }
       if (startLine1 < endLine1){
         // can't handle multiline .... just move it to the lower line
         startLine1 = endLine1;
         if (startCol1 >= endCol1) startCol1 = 0; // make sure start is to the left of end in case we moved the line
       }
       this.MatchPair(startLine1, startCol1, endLine1, endCol1,startLine2, startCol2, endLine2, endCol2);
       break;
     }
   }
 }
Exemplo n.º 5
0
 public virtual void EndTemplateParameters(SourceContext context){
   switch(this.reason){
     case ParseReason.MethodTip:
     case ParseReason.QuickInfo:{
       int startLine = context.StartLine;
       int startCol = context.StartColumn;
       if (startLine < 0 || startCol < 0){
         Debug.Assert(false);
         return;
       }
       if (startLine < this.Line || (startLine == this.Line && startCol < this.Column)){
         CallInfo call = this.MethodCalls.GetCurrentMethodCall();
         if (call != null){
           this.Names = call.names;
           this.SourceLocations = call.sourceLocations;
         }
         this.MethodCalls.Pop();
       }
       break;
     }
   }
 }
Exemplo n.º 6
0
 public virtual void NextTemplateParameter(SourceContext context){      
   switch(this.reason){
     case ParseReason.MethodTip:
     case ParseReason.QuickInfo:{
       int startLine = context.StartLine;
       int startCol = context.StartColumn;
       if (startLine < 0 || startCol < 0){
         Debug.Assert(false);
         return;
       }
       if (startLine < this.Line || startLine == this.Line && startCol < this.Column)
         this.MethodCalls.NextParameter();
       break;
     }
   }
 }
Exemplo n.º 7
0
 public virtual void StartTemplateParameters(SourceContext context){
   switch(this.reason){
     case ParseReason.MethodTip:
     case ParseReason.QuickInfo:{
       int startLine = context.StartLine;
       int startCol = context.StartColumn;
       if (startLine< 0 || startCol < 0){
         Debug.Assert(false);
         return;
       }
       if (startLine < this.Line || (startLine == this.Line && startCol < this.Column)){ 
         this.MethodCalls.Push(this.Names, this.SourceLocations, true);
         this.Names = new StringCollection();
         this.SourceLocations = new ArrayList();
       }
       break;
     }
   }
 }
Exemplo n.º 8
0
 /// <summary>
 /// CodeSpan is in support of IVsLanguageDebugInfo.ValidateBreakpointLocation.
 /// It is called for each region that contains "executable" code.
 /// This is used to validate breakpoints. Comments are
 /// automatically taken care of based on TokenInfo returned from scanner. 
 /// Normally this method is called when a procedure is started/ended.
 /// </summary>
 public virtual void CodeSpan( SourceContext span ){
 }
Exemplo n.º 9
0
 /// <summary>
 /// AutoExpression is in support of IVsLanguageDebugInfo.GetProximityExpressions.
 /// It is called for each expression that might be interesting for
 /// a user in the "Auto Debugging" window. All names that are
 /// set using StartName and QualifyName are already automatically
 /// added to the "Auto" window! This means that AutoExpression
 /// is rarely used.
 /// </summary>   
 public virtual void AutoExpression( SourceContext expr ){
 }