Ejemplo n.º 1
0
        public void Append(TextTokenKind tokenKind, string s)
        {
            if (s == null)
            {
                return;
            }

            int oldCurrentOffset = currentOffset;

            // Newlines could be part of the input string
            int so = 0;

            while (so < s.Length)
            {
                int nlOffs = s.IndexOfAny(newLineChars, so);
                if (nlOffs >= 0)
                {
                    AppendInternal(tokenKind, nlOffs - so);
                    so = nlOffs;
                    int nlLen = s[so] == '\r' && so + 1 < s.Length && s[so + 1] == '\n' ? 2 : 1;
                    currentOffset += nlLen;
                    EndCurrentToken(nlLen);
                    so += nlLen;
                }
                else
                {
                    AppendInternal(tokenKind, s.Length - so);
                    break;
                }
            }

            Debug.Assert(oldCurrentOffset + s.Length == currentOffset);
        }
Ejemplo n.º 2
0
        public void WriteIdentifier(string identifier, TextTokenKind tokenKind)
        {
            var definition = GetCurrentDefinition();

            if (definition != null)
            {
                output.WriteDefinition(IdentifierEscaper.Escape(identifier), definition, tokenKind);
                return;
            }

            object memberRef = GetCurrentMemberReference();

            if (memberRef != null)
            {
                output.WriteReference(IdentifierEscaper.Escape(identifier), memberRef, tokenKind);
                return;
            }

            definition = GetCurrentLocalDefinition();
            if (definition != null)
            {
                output.WriteDefinition(IdentifierEscaper.Escape(identifier), definition, tokenKind);
                return;
            }

            memberRef = GetCurrentLocalReference();
            if (memberRef != null)
            {
                output.WriteReference(IdentifierEscaper.Escape(identifier), memberRef, tokenKind, true);
                return;
            }

            output.Write(IdentifierEscaper.Escape(identifier), tokenKind);
        }
Ejemplo n.º 3
0
        static IThemeColor GetColor(TextTokenKind tokenKind)
        {
            var color = themeManager.Theme.GetTextColor(tokenKind.ToColorType());

            Debug.Assert(color != null);
            return(color);
        }
Ejemplo n.º 4
0
 public void Write(string text, int index, int count, TextTokenKind tokenKind)
 {
     WriteIndent();
     if (index == 0 && text.Length == count)
     {
         writer.Write(text);
     }
     else if (count == 1)
     {
         writer.Write(text[index]);
     }
     else
     {
         int left = count;
         while (left > 0)
         {
             int len = Math.Min(outputBuffer.Length, left);
             text.CopyTo(index, outputBuffer, 0, len);
             writer.Write(outputBuffer, 0, len);
             left  -= len;
             index += len;
         }
     }
     column += count;
 }
Ejemplo n.º 5
0
        public override void WriteToken(Role role, string token, TextTokenKind tokenKind)
        {
            IMemberRef memberRef = GetCurrentMemberReference();
            var        node      = nodeStack.Peek();

            bool addRef = memberRef != null &&
                          (node is BinaryOperatorExpression ||
                           node is UnaryOperatorExpression ||
                           node is AssignmentExpression ||
                           node is IndexerExpression);

            // Add a ref to the method if it's a delegate call
            if (!addRef && node is InvocationExpression && memberRef is IMethod)
            {
                var md = (memberRef as IMethod).Resolve();
                if (md != null && md.DeclaringType.IsDelegate())
                {
                    addRef = true;
                }
            }

            if (addRef)
            {
                output.WriteReference(token, memberRef, tokenKind);
            }
            else
            {
                output.Write(token, tokenKind);
            }
        }
Ejemplo n.º 6
0
 void ITextOutput.Write(string text, int index, int count, TextTokenKind tokenKind)
 {
     if (index == 0 && text.Length == count)
     {
         ((ITextOutput)this).Write(text, tokenKind);
     }
     ((ITextOutput)this).Write(text.Substring(index, count), tokenKind);
 }
Ejemplo n.º 7
0
 void ITextOutput.Write(StringBuilder sb, int index, int count, TextTokenKind tokenKind)
 {
     if (index == 0 && sb.Length == count)
     {
         ((ITextOutput)this).Write(sb.ToString(), tokenKind);
     }
     ((ITextOutput)this).Write(sb.ToString(index, count), tokenKind);
 }
Ejemplo n.º 8
0
 void IXmlDocOutput.Write(string s, TextTokenKind tokenKind)
 {
     if (needsNewLine)
     {
         ((IXmlDocOutput)this).WriteNewLine();
     }
     uiSyntaxHighlighter.Output.Write(s, tokenKind);
 }
Ejemplo n.º 9
0
 static void WriteIdentifier(ITextOutput output, string id, TextTokenKind tokenKind)
 {
     if (isKeyword.Contains(id))
     {
         output.Write("@", TextTokenKind.Operator);
     }
     output.Write(IdentifierEscaper.Escape(id), tokenKind);
 }
Ejemplo n.º 10
0
 public void Write(StringBuilder sb, int index, int count, TextTokenKind tokenKind)
 {
     if (index == 0 && sb.Length == count)
     {
         Write(sb.ToString(), tokenKind);
     }
     Write(sb.ToString(index, count), tokenKind);
 }
Ejemplo n.º 11
0
 public void Write(string text, int index, int count, TextTokenKind tokenKind)
 {
     if (index == 0 && text.Length == count)
     {
         Write(text, tokenKind);
     }
     Write(text.Substring(index, count), tokenKind);
 }
Ejemplo n.º 12
0
        /// <summary>Initializes an instance of the <see cref="TextTokenInfo"/> structure.</summary>
        /// <param name="kind">The type of token.</param>
        /// <param name="text">The token text.</param>
        /// <param name="position">The position within the text where the token appears.</param>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="position"/> is less than zero.</exception>
        public TextTokenInfo(TextTokenKind kind, string text, int position)
            : this()
        {
            Verify.Argument("position", position).IsGreaterThanOrEqualToZero();

            Kind         = kind;
            OriginalText = text ?? "";
            Position     = position;
        }
Ejemplo n.º 13
0
        public override void WriteIdentifier(Identifier identifier, TextTokenKind tokenKind)
        {
            if (tokenKind == TextTokenKind.Text)
            {
                tokenKind = TextTokenKindUtils.GetTextTokenType(identifier.AnnotationVT <TextTokenKind>() ?? identifier.Annotation <object>());
            }

            if (tokenKind != TextTokenKind.Keyword && (identifier.IsVerbatim || CSharpOutputVisitor.IsKeyword(identifier.Name, identifier)))
            {
                output.Write("@", TextTokenKind.Operator);
            }

            var definition = GetCurrentDefinition(identifier);

            if (definition != null)
            {
                output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenKind, false);
                return;
            }

            object memberRef = GetCurrentMemberReference();

            if (memberRef != null)
            {
                output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenKind);
                return;
            }

            definition = GetCurrentLocalDefinition();
            if (definition != null)
            {
                output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenKind);
                return;
            }

            memberRef = GetCurrentLocalReference();
            if (memberRef != null)
            {
                output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenKind, true);
                return;
            }

            if (firstUsingDeclaration)
            {
                firstUsingDeclaration = false;
            }

            var s = identifier.Name;

            if (identifier.Annotation <IdentifierFormatted>() == null)
            {
                s = IdentifierEscaper.Escape(s);
            }
            output.Write(s, tokenKind);
        }
Ejemplo n.º 14
0
        public void WriteReference(string text, object reference, TextTokenKind tokenKind, bool isLocal)
        {
            WriteIndent();
            int start = this.TextLength;

            Append(tokenKind, text);
            int end = this.TextLength;

            references.Add(new ReferenceSegment {
                StartOffset = start, EndOffset = end, Reference = reference, IsLocal = isLocal
            });
        }
Ejemplo n.º 15
0
 static TextTokenKind GetTextTokenType(MethodDef method, TextTokenKind staticValue, TextTokenKind instanceValue)
 {
     if (method == null)
     {
         return(instanceValue);
     }
     if (method.IsStatic)
     {
         return(staticValue);
     }
     return(instanceValue);
 }
Ejemplo n.º 16
0
        // Gets called to add one token. No newlines are allowed
        void AppendInternal(TextTokenKind tokenKind, int length)
        {
            Debug.Assert(length >= 0);
            if (length == 0)
            {
                return;
            }

redo:
            if (isAppendingDefaultText)
            {
                if (tokenKind == TextTokenKind.Text)
                {
                    int newLength = currentDefaultTextLength + length;
                    while (newLength > TEXT_TOKEN_LENGTH_MAX)
                    {
                        currentDefaultTextLength = Math.Min(newLength, TEXT_TOKEN_LENGTH_MAX);
                        EndCurrentToken(0);
                        newLength -= TEXT_TOKEN_LENGTH_MAX;
                    }
                    currentDefaultTextLength = newLength;
                    currentOffset           += length;
                    return;
                }
                isAppendingDefaultText = false;
                currentTokenType       = tokenKind;
            }

            if (currentTokenType != tokenKind)
            {
                EndCurrentToken(0);
                goto redo;
            }

            {
                int newLength = currentTokenLength + length;
                while (newLength > TOKEN_LENGTH_MAX)
                {
                    currentTokenLength = Math.Min(newLength, TOKEN_LENGTH_MAX);
                    EndCurrentToken(0);
                    newLength -= TOKEN_LENGTH_MAX;
                    isAppendingDefaultText = false;
                    currentTokenType       = tokenKind;
                }
                currentTokenLength = newLength;
                if (currentTokenLength == 0)
                {
                    isAppendingDefaultText = true;
                }
                currentOffset += length;
            }
        }
		void ITextOutput.Write(string text, TextTokenKind tokenKind) {
			if (col == 1 && indent > 0)
				output.Write(new string('\t', indent), TextTokenKind.Text);
			output.Write(text, tokenKind);
			int index = text.LastIndexOfAny(newLineChars);
			if (index >= 0) {
				line += text.Split(lineFeedChar).Length - 1;	// good enough for our purposes
				col = text.Length - (index + 1) + 1;
				indent = 0;
			}
			else
				col += text.Length;
		}
Ejemplo n.º 18
0
        public void WriteDefinition(string text, object definition, TextTokenKind tokenKind, bool isLocal)
        {
            WriteIndent();
            int start = this.TextLength;

            Append(tokenKind, text);
            int end = this.TextLength;

            this.DefinitionLookup.AddDefinition(definition, this.TextLength);
            references.Add(new ReferenceSegment {
                StartOffset = start, EndOffset = end, Reference = definition, IsLocal = isLocal, IsLocalTarget = true
            });
        }
Ejemplo n.º 19
0
        public void WriteToken(string token, TextTokenKind tokenKind)
        {
            // Attach member reference to token only if there's no identifier in the current node.
            IMemberRef memberRef = GetCurrentMemberReference();

            if (memberRef != null && nodeStack.Peek().GetChildByRole(AstNode.Roles.Identifier).IsNull)
            {
                output.WriteReference(token, memberRef, tokenKind);
            }
            else
            {
                output.Write(token, tokenKind);
            }
        }
Ejemplo n.º 20
0
		void UpdateTextEditorResource(TextTokenKind colorType, string name) {
			var theme = themeManager.Theme;

			var color = theme.GetTextColor(colorType.ToColorType());
			Application.Current.Resources[GetTextInheritedForegroundResourceKey(name)] = GetBrush(color.Foreground);
			Application.Current.Resources[GetTextInheritedBackgroundResourceKey(name)] = GetBrush(color.Background);
			Application.Current.Resources[GetTextInheritedFontStyleResourceKey(name)] = color.FontStyle ?? FontStyles.Normal;
			Application.Current.Resources[GetTextInheritedFontWeightResourceKey(name)] = color.FontWeight ?? FontWeights.Normal;

			color = theme.GetColor(colorType.ToColorType());
			Application.Current.Resources[GetInheritedForegroundResourceKey(name)] = GetBrush(color.Foreground);
			Application.Current.Resources[GetInheritedBackgroundResourceKey(name)] = GetBrush(color.Background);
			Application.Current.Resources[GetInheritedFontStyleResourceKey(name)] = color.FontStyle ?? FontStyles.Normal;
			Application.Current.Resources[GetInheritedFontWeightResourceKey(name)] = color.FontWeight ?? FontWeights.Normal;
		}
Ejemplo n.º 21
0
        void UpdateTextEditorResource(TextTokenKind colorType, string name)
        {
            var theme = themeManager.Theme;

            var color = theme.GetTextColor(colorType.ToColorType());

            Application.Current.Resources[GetTextInheritedForegroundResourceKey(name)] = GetBrush(color.Foreground);
            Application.Current.Resources[GetTextInheritedBackgroundResourceKey(name)] = GetBrush(color.Background);
            Application.Current.Resources[GetTextInheritedFontStyleResourceKey(name)]  = color.FontStyle ?? FontStyles.Normal;
            Application.Current.Resources[GetTextInheritedFontWeightResourceKey(name)] = color.FontWeight ?? FontWeights.Normal;

            color = theme.GetColor(colorType.ToColorType());
            Application.Current.Resources[GetInheritedForegroundResourceKey(name)] = GetBrush(color.Foreground);
            Application.Current.Resources[GetInheritedBackgroundResourceKey(name)] = GetBrush(color.Background);
            Application.Current.Resources[GetInheritedFontStyleResourceKey(name)]  = color.FontStyle ?? FontStyles.Normal;
            Application.Current.Resources[GetInheritedFontWeightResourceKey(name)] = color.FontWeight ?? FontWeights.Normal;
        }
Ejemplo n.º 22
0
		public void Write(string text, int index, int count, TextTokenKind tokenKind) {
			WriteIndent();
			if (index == 0 && text.Length == count)
				writer.Write(text);
			else if (count == 1)
				writer.Write(text[index]);
			else {
				int left = count;
				while (left > 0) {
					int len = Math.Min(outputBuffer.Length, left);
					text.CopyTo(index, outputBuffer, 0, len);
					writer.Write(outputBuffer, 0, len);
					left -= len;
					index += len;
				}
			}
			column += count;
		}
Ejemplo n.º 23
0
		public override void WriteIdentifier(Identifier identifier, TextTokenKind tokenKind)
		{
			if (tokenKind == TextTokenKind.Text)
				tokenKind = TextTokenKindUtils.GetTextTokenType(identifier.AnnotationVT<TextTokenKind>() ?? identifier.Annotation<object>());

			if (tokenKind != TextTokenKind.Keyword && (identifier.IsVerbatim || CSharpOutputVisitor.IsKeyword(identifier.Name, identifier))) {
				output.Write("@", TextTokenKind.Operator);
			}
			
			var definition = GetCurrentDefinition(identifier);
			if (definition != null) {
				output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenKind, false);
				return;
			}
			
			object memberRef = GetCurrentMemberReference();

			if (memberRef != null) {
				output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenKind);
				return;
			}

			definition = GetCurrentLocalDefinition();
			if (definition != null) {
				output.WriteDefinition(IdentifierEscaper.Escape(identifier.Name), definition, tokenKind);
				return;
			}

			memberRef = GetCurrentLocalReference();
			if (memberRef != null) {
				output.WriteReference(IdentifierEscaper.Escape(identifier.Name), memberRef, tokenKind, true);
				return;
			}

			if (firstUsingDeclaration) {
				firstUsingDeclaration = false;
			}

			var s = identifier.Name;
			if (identifier.Annotation<IdentifierFormatted>() == null)
				s = IdentifierEscaper.Escape(s);
			output.Write(s, tokenKind);
		}
Ejemplo n.º 24
0
 public void Write(StringBuilder sb, int index, int count, TextTokenKind tokenKind)
 {
     WriteIndent();
     if (count == 1)
     {
         writer.Write(sb[index]);
     }
     else
     {
         int left = count;
         while (left > 0)
         {
             int len = Math.Min(outputBuffer.Length, left);
             sb.CopyTo(index, outputBuffer, 0, len);
             writer.Write(outputBuffer, 0, len);
             left -= len;
         }
     }
     column += count;
 }
Ejemplo n.º 25
0
        void ITextOutput.Write(string text, TextTokenKind tokenKind)
        {
            if (col == 1 && indent > 0)
            {
                output.Write(new string('\t', indent), TextTokenKind.Text);
            }
            output.Write(text, tokenKind);
            int index = text.LastIndexOfAny(newLineChars);

            if (index >= 0)
            {
                line  += text.Split(lineFeedChar).Length - 1;                   // good enough for our purposes
                col    = text.Length - (index + 1) + 1;
                indent = 0;
            }
            else
            {
                col += text.Length;
            }
        }
Ejemplo n.º 26
0
        public bool Find(int offset, out int defaultTextLength, out TextTokenKind tokenKind, out int tokenLength)
        {
            Debug.Assert(tokenInfos != null, "You must call Finish() before you call this method");
            int index;

            if (!offsetToTokenInfoIndex.TryGetValue(offset, out index))
            {
                defaultTextLength = 0;
                tokenKind         = TextTokenKind.Last;
                tokenLength       = 0;
                return(false);
            }

            ushort val = tokenInfos[index];

            defaultTextLength = (val >> TEXT_TOKEN_LENGTH_BIT) & TEXT_TOKEN_LENGTH_MAX;
            tokenKind         = (TextTokenKind)((val >> TOKEN_TYPE_BIT) & TOKEN_TYPE_MAX);
            tokenLength       = (val >> TOKEN_LENGTH_BIT) & TOKEN_LENGTH_MAX;
            return(true);
        }
Ejemplo n.º 27
0
        void EndCurrentToken(int lengthTillNextToken)
        {
            Debug.Assert(currentTokenLength == 0 || !isAppendingDefaultText);
            int totalLength = currentDefaultTextLength + currentTokenLength;

            if (totalLength != 0)
            {
                offsetToTokenInfoIndex.Add(currentTokenOffset, tokenInfosList.Count);
                Debug.Assert((int)currentTokenType <= TOKEN_TYPE_MAX);
                Debug.Assert((int)currentTokenLength <= TOKEN_LENGTH_MAX);
                Debug.Assert((int)currentDefaultTextLength <= TEXT_TOKEN_LENGTH_MAX);
                ushort compressedValue = (ushort)(
                    ((int)currentTokenType << TOKEN_TYPE_BIT) |
                    (currentTokenLength << TOKEN_LENGTH_BIT) |
                    (currentDefaultTextLength << TEXT_TOKEN_LENGTH_BIT));
                tokenInfosList.Add(compressedValue);
            }

            currentTokenOffset      += totalLength + lengthTillNextToken;
            currentDefaultTextLength = 0;
            currentTokenLength       = 0;
            currentTokenType         = TextTokenKind.Last;
            isAppendingDefaultText   = true;
        }
Ejemplo n.º 28
0
        public static AstType FromName(string fullName, TextTokenKind tokenKind)
        {
            if (string.IsNullOrEmpty(fullName))
            {
                throw new ArgumentNullException("fullName");
            }
            fullName = fullName.Trim();
            if (!fullName.Contains("."))
            {
                return(new SimpleType(tokenKind, fullName));
            }
            string[] parts = fullName.Split('.');

            AstType type = new SimpleType(TextTokenKind.NamespacePart, parts.First());

            for (int i = 1; i < parts.Length; i++)
            {
                var part = parts[i];
                var tt   = i + 1 == parts.Length ? tokenKind : TextTokenKind.NamespacePart;
                type = new QualifiedType(type, Identifier.Create(tt, part));
            }

            return(type);
        }
		void ITextOutput.Write(StringBuilder sb, int index, int count, TextTokenKind tokenKind) {
			if (index == 0 && sb.Length == count)
				((ITextOutput)this).Write(sb.ToString(), tokenKind);
			((ITextOutput)this).Write(sb.ToString(index, count), tokenKind);
		}
Ejemplo n.º 30
0
 static IThemeColor GetColor(TextTokenKind tokenKind)
 {
     var color = themeManager.Theme.GetTextColor(tokenKind.ToColorType());
     Debug.Assert(color != null);
     return color;
 }
		void ITextOutput.Write(string text, int index, int count, TextTokenKind tokenKind) {
			if (index == 0 && text.Length == count)
				((ITextOutput)this).Write(text, tokenKind);
			((ITextOutput)this).Write(text.Substring(index, count), tokenKind);
		}
Ejemplo n.º 32
0
 public void Write(string text, TextTokenKind tokenKind)
 {
     WriteIndent();
     writer.Write(text);
     column += text.Length;
 }
Ejemplo n.º 33
0
 HighlightingColor GetColor(TextTokenKind tokenKind)
 {
     return textEditor.themeManager.Theme.GetTextColor(tokenKind.ToColorType()).ToHighlightingColor();
 }
Ejemplo n.º 34
0
		public void WriteIdentifier(string ident, TextTokenKind tokenKind)
		{
			WriteIndentation();
			textWriter.Write(ident);
		}
Ejemplo n.º 35
0
		public override void WritePrimitiveValue(object value, TextTokenKind? tokenKind = null, string literalValue = null)
		{
			int column = 0;
			TextWriterTokenWriter.WritePrimitiveValue(value, tokenKind, literalValue, ref column, (a, b) => output.Write(a, b), WriteToken);
		}
Ejemplo n.º 36
0
		public void Write(string text, int index, int count, TextTokenKind tokenKind) {
			if (index == 0 && text.Length == count)
				Write(text, tokenKind);
			Write(text.Substring(index, count), tokenKind);
		}
Ejemplo n.º 37
0
		public void Write(StringBuilder sb, int index, int count, TextTokenKind tokenKind) {
			if (index == 0 && sb.Length == count)
				Write(sb.ToString(), tokenKind);
			Write(sb.ToString(index, count), tokenKind);
		}
Ejemplo n.º 38
0
 public void Write(string s, TextTokenKind tokenKind)
 {
     uiSyntaxHighlighter.Output.Write(s, tokenKind);
 }
Ejemplo n.º 39
0
		static void WriteIdentifier(ITextOutput output, string id, TextTokenKind tokenKind) {
			if (isKeyword.Contains(id))
				output.Write("@", TextTokenKind.Operator);
			output.Write(IdentifierEscaper.Escape(id), tokenKind);
		}
Ejemplo n.º 40
0
 void IXmlDocOutput.Write(string s, TextTokenKind tokenKind)
 {
     ret.Append(s);
 }
Ejemplo n.º 41
0
		public static void WriteOffsetReference(ITextOutput writer, Instruction instruction, MethodDef method, TextTokenKind tokenKind = TextTokenKind.Label)
		{
			var r = instruction == null ? null : method == null ? (object)instruction : new InstructionReference(method, instruction);
			writer.WriteReference(DnlibExtensions.OffsetToString(instruction.GetOffset()), r, tokenKind);
		}
Ejemplo n.º 42
0
 static TextTokenKind GetTextTokenType(MethodDef method, TextTokenKind staticValue, TextTokenKind instanceValue)
 {
     if (method == null)
         return instanceValue;
     if (method.IsStatic)
         return staticValue;
     return instanceValue;
 }
Ejemplo n.º 43
0
 public void Write(string s, TextTokenKind tokenKind)
 {
     sb.Append(s);
 }
Ejemplo n.º 44
0
		public void Write(string text, TextTokenKind tokenKind) {
			WriteIndent();
			Append(tokenKind, text);
		}
		void ITextOutput.WriteDefinition(string text, object definition, TextTokenKind tokenKind, bool isLocal) {
			((ITextOutput)this).Write(text, tokenKind);
		}
Ejemplo n.º 46
0
		public void WriteDefinition(string text, object definition, TextTokenKind tokenKind, bool isLocal) {
			WriteIndent();
			int start = this.TextLength;
			Append(tokenKind, text);
			int end = this.TextLength;
			this.DefinitionLookup.AddDefinition(definition, this.TextLength);
			references.Add(new ReferenceSegment { StartOffset = start, EndOffset = end, Reference = definition, IsLocal = isLocal, IsLocalTarget = true });
		}
Ejemplo n.º 47
0
		public void WriteToken(string token, TextTokenKind tokenKind)
		{
			WriteIndentation();
			textWriter.Write(token);
		}
Ejemplo n.º 48
0
		public void WriteReference(string text, object reference, TextTokenKind tokenKind, bool isLocal) {
			WriteIndent();
			int start = this.TextLength;
			Append(tokenKind, text);
			int end = this.TextLength;
			references.Add(new ReferenceSegment { StartOffset = start, EndOffset = end, Reference = reference, IsLocal = isLocal });
		}
Ejemplo n.º 49
0
 public void WriteReference(string text, object reference, TextTokenKind tokenKind, bool isLocal)
 {
     Write(text, TextTokenKind.Text);
 }
Ejemplo n.º 50
0
		void Append(TextTokenKind tokenKind, string s) {
			tokens.Append(tokenKind, s);
			b.Append(s);
			Debug.Assert(b.Length == tokens.Length);
		}
Ejemplo n.º 51
0
 public void WriteDefinition(string text, object definition, TextTokenKind tokenKind, bool isLocal)
 {
     Write(text, TextTokenKind.Text);
 }
		void ITextOutput.WriteReference(string text, object reference, TextTokenKind tokenKind, bool isLocal) {
			((ITextOutput)this).Write(text, tokenKind);
		}
Ejemplo n.º 53
0
 public void WriteDefinition(string text, object definition, TextTokenKind tokenKind, bool isLocal)
 {
     Write(text, TextTokenKind.Text);
 }
Ejemplo n.º 54
0
 public void WriteReference(string text, object reference, TextTokenKind tokenKind, bool isLocal)
 {
     Write(text, TextTokenKind.Text);
 }
Ejemplo n.º 55
0
 public void Write(string text, TextTokenKind tokenKind)
 {
     WriteIndent();
     writer.Write(text);
     column += text.Length;
 }
Ejemplo n.º 56
0
 public ErrorMessage(string msg, TextTokenKind type)
 {
     this.msg  = msg;
     this.type = type;
 }
Ejemplo n.º 57
0
 public void Write(string s, TextTokenKind tokenKind)
 {
     tokens.Append(tokenKind, s);
     sb.Append(s);
     Debug.Assert(sb.Length == tokens.Length);
 }
Ejemplo n.º 58
0
 public MessageSearchResult(string msg, TextTokenKind type, bool first)
 {
     this.msg        = msg;
     this.NameObject = new ErrorMessage(msg, type);
     this.order      = first ? int.MinValue : int.MaxValue;
 }
Ejemplo n.º 59
0
 public static void WriteLine(this ITextOutput output, string text, TextTokenKind tokenKind)
 {
     output.Write(text, tokenKind);
     output.WriteLine();
 }
Ejemplo n.º 60
0
 public void Write(StringBuilder sb, int index, int count, TextTokenKind tokenKind)
 {
     WriteIndent();
     if (count == 1)
         writer.Write(sb[index]);
     else {
         int left = count;
         while (left > 0) {
             int len = Math.Min(outputBuffer.Length, left);
             sb.CopyTo(index, outputBuffer, 0, len);
             writer.Write(outputBuffer, 0, len);
             left -= len;
         }
     }
     column += count;
 }