2
// <copyright see="prj:///doc/copyright.txt"/>
3
// <license see="prj:///doc/license.txt"/>
4
// <owner name="none" email=""/>
5
// <version>$Revision: 4482 $</version>
9
using System.Collections.Generic;
12
namespace ICSharpCode.OldNRefactory.Parser
14
public class SpecialTracker
16
List<ISpecial> currentSpecials = new List<ISpecial>();
18
CommentType currentCommentType;
19
StringBuilder sb = new StringBuilder();
20
Location startPosition;
21
bool commentStartsLine;
23
public List<ISpecial> CurrentSpecials {
25
return currentSpecials;
29
public void InformToken(int kind)
35
/// Gets the specials from the SpecialTracker and resets the lists.
37
public List<ISpecial> RetrieveSpecials()
39
List<ISpecial> tmp = currentSpecials;
40
currentSpecials = new List<ISpecial>();
44
public void AddEndOfLine(Location point)
46
currentSpecials.Add(new BlankLine(point));
49
public void AddPreprocessingDirective(PreprocessingDirective directive)
51
if (directive == null)
52
throw new ArgumentNullException("directive");
53
currentSpecials.Add(directive);
56
// used for comment tracking
57
public void StartComment(CommentType commentType, bool commentStartsLine, Location startPosition)
59
this.currentCommentType = commentType;
60
this.startPosition = startPosition;
62
this.commentStartsLine = commentStartsLine;
65
public void AddChar(char c)
70
public void AddString(string s)
75
public void FinishComment(Location endPosition)
77
currentSpecials.Add(new Comment(currentCommentType, sb.ToString(), commentStartsLine, startPosition, endPosition));