Ejemplo n.º 1
0
        private void UpdateHtmlPrettyPrint()
        {
            _needUpdateHtmlPrettyPrint = false;

            if (_parseResult == null)
            {
                return;
            }
            if (IsSplicable(_parseResult))
            {
                return;
            }

            if (_ast == null)
            {
                _ast = _parseResult.CreateAst();
            }

            var htmlWriter = new HtmlPrettyPrintWriter(PrettyPrintOptions.DebugIndent | PrettyPrintOptions.MissingNodes, "missing", "debug", "garbage");

            _ast.PrettyPrint(htmlWriter, 0, null);
            var html = Properties.Resources.PrettyPrintDoughnut.Replace("{prettyprint}", htmlWriter.ToString());

            prettyPrintViewer.NavigateToString(html);
        }
Ejemplo n.º 2
0
        private void UpdateHtmlPrettyPrint()
        {
            _needUpdateHtmlPrettyPrint = false;

              if (_parseResult == null)
            return;
              if (IsSplicable(_parseResult))
            return;

              if (_ast == null)
            _ast = _parseResult.CreateAst();

              var htmlWriter = new HtmlPrettyPrintWriter(PrettyPrintOptions.DebugIndent | PrettyPrintOptions.MissingNodes, "missing", "debug", "garbage");
              _ast.PrettyPrint(htmlWriter, 0);
              var html = Properties.Resources.PrettyPrintDoughnut.Replace("{prettyprint}", htmlWriter.ToString());
              prettyPrintViewer.NavigateToString(html);
        }
Ejemplo n.º 3
0
    private void UpdateHtmlPrettyPrint()
    {
      _needUpdateHtmlPrettyPrint = false;

      if (_parseResult == null)
        return;

      if (_parseTree == null)
        _parseTree = _parseResult.CreateParseTree();

      var htmlWriter = new HtmlPrettyPrintWriter(PrettyPrintOptions.DebugIndent | PrettyPrintOptions.MissingNodes, "missing", "debug", "garbage");
      _parseTree.PrettyPrint(htmlWriter, 0, null);

      var spanStyles = new StringBuilder();
      foreach (var style in _highlightingStyles)
      {
        var brush = style.Value.Foreground as SimpleHighlightingBrush;
        if (brush == null)
          continue;
        var color = brush.Brush.Color;
        spanStyles.Append('.').Append(style.Key.Replace('.', '-')).Append("{color:rgb(").Append(color.R).Append(',').Append(color.G).Append(',').Append(color.B).AppendLine(");}");
      }
      var html = Properties.Resources.PrettyPrintDoughnut.Replace("{spanclasses}", spanStyles.ToString()).Replace("{prettyprint}", htmlWriter.ToString());
      prettyPrintViewer.NavigateToString(html);
    }