private void WriteSourceMap(SyntaxNodeOrToken node, Position pos, string str) { if (node.Kind() == SyntaxKind.IdentifierName || node.Kind() == SyntaxKind.IdentifierToken || node.Kind() == SyntaxKind.ObjectCreationExpression) { System.Diagnostics.Debug.WriteLine($"{node} ---> [{node.Kind()} | {pos}] ---> {str}"); _sourceMapOutput.AddMapping(node, pos); } }
public void AddMapping(SyntaxNodeOrToken node, Position pos) { var srcPos = node.GetLocation().GetLineSpan().StartLinePosition; if (_line == pos.Line) { if (_mapping.Length > 0 && _mapping[_mapping.Length - 1] != ';') _mapping.Append(','); } else { while (_line < pos.Line) { _mapping.Append(';'); _line++; } } _mapping.Append(Base64VLQEncoding.Encode(pos.Column)); _mapping.Append(Base64VLQEncoding.Encode(_srcIdx)); _mapping.Append(Base64VLQEncoding.Encode(srcPos.Line)); _mapping.Append(Base64VLQEncoding.Encode(srcPos.Character)); }
public Position Write(char ch) { if (_newLine) { this.WriteIndent(); _column += IndentLength; } Position start = new Position(_line, _column); this.WriteContent(ch); if (System.Environment.NewLine.Length == 1 && System.Environment.NewLine[0] == ch) { this._newLine = true; _line++; _column = 0; } else { this._newLine = false; _column += 1; } return start; }
public Position WriteLine(string str) { if (_newLine) { this.WriteIndent(); _column += IndentLength; } Position start = new Position(_line, _column); this.WriteContent(str); this.Correction(str); if (!str.EndsWith(System.Environment.NewLine)) this.WriteContent(System.Environment.NewLine); this._newLine = true; _line++; _column = 0; return start; }
public Position WriteLine() { Position start = new Position(_line, _column); this.WriteContent(System.Environment.NewLine); this._newLine = true; _line++; _column = 0; return start; }
public Position Write(string str) { if (_newLine) { this.WriteIndent(); _column += IndentLength; } Position start = new Position(_line, _column); this.WriteContent(str); int colCorrection = Correction(str); if (str.EndsWith(System.Environment.NewLine)) { this._newLine = true; _line++; _column = 0; } else { this._newLine = false; _column += colCorrection; } return start; }