1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
8
namespace ICSharpCode.NRefactory.Parser
10
public class SpecialTracker
12
List<ISpecial> currentSpecials = new List<ISpecial>();
14
CommentType currentCommentType;
15
StringBuilder sb = new StringBuilder();
16
Location startPosition;
17
bool commentStartsLine;
19
public List<ISpecial> CurrentSpecials {
21
return currentSpecials;
26
/// Gets the specials from the SpecialTracker and resets the lists.
28
public List<ISpecial> RetrieveSpecials()
30
List<ISpecial> tmp = currentSpecials;
31
currentSpecials = new List<ISpecial>();
35
public void AddEndOfLine(Location point)
37
currentSpecials.Add(new BlankLine(point));
40
public void AddPreprocessingDirective(PreprocessingDirective directive)
42
if (directive == null)
43
throw new ArgumentNullException("directive");
44
currentSpecials.Add(directive);
47
// used for comment tracking
48
public void StartComment(CommentType commentType, bool commentStartsLine, Location startPosition)
50
this.currentCommentType = commentType;
51
this.startPosition = startPosition;
53
this.commentStartsLine = commentStartsLine;
56
public void AddChar(char c)
61
public void AddString(string s)
66
public void FinishComment(Location endPosition)
68
currentSpecials.Add(new Comment(currentCommentType, sb.ToString(), commentStartsLine, startPosition, endPosition));