public CommandLineHighlightingOptions(bool defaults = true)
 {
     if (defaults)
     {
         Palette = CommandLineHighlightingPalette.Default;
     }
 }
        private StyledSpan <TStyle> GetStyledSpan(
            CommandLineStyleName @class, TextSpan span,
            HighlightingPalette <CommandLineStyleName, TStyle> palette)
        {
            var style = palette.Get(@class);

            return(new StyledSpan <TStyle>(span, style));
        }
        private void AddSpans(
            List <StyledSpan <TStyle> > spans,
            SyntaxToken token,
            CommandLineStyleName @class,
            HighlightingPalette <CommandLineStyleName, TStyle> palette)
        {
            if (token.HasLeadingTrivia)
            {
                spans.Add(GetDefaultSpan(token.LeadingTrivia.Span, palette));
            }

            spans.Add(GetStyledSpan(@class, token.Span, palette));

            if (token.HasTrailingTrivia)
            {
                spans.Add(GetDefaultSpan(token.TrailingTrivia.Span, palette));
            }
        }
        private void AddSpans(
            List <StyledSpan <TStyle> > spans,
            ValueSyntax valueSyntax,
            CommandLineStyleName @class,
            HighlightingPalette <CommandLineStyleName, TStyle> palette)
        {
            var valueTokens = valueSyntax.Tokens;
            var first       = valueTokens[0];
            var last        = valueTokens[valueTokens.Count - 1];

            if (first.HasLeadingTrivia)
            {
                spans.Add(GetDefaultSpan(first.LeadingTrivia.Span, palette));
            }

            spans.Add(GetStyledSpan(@class, valueSyntax.Span, palette));

            if (last.HasTrailingTrivia)
            {
                spans.Add(GetDefaultSpan(last.TrailingTrivia.Span, palette));
            }
        }
 private StyledSpan <TStyle> GetDefaultSpan(
     TextSpan span,
     HighlightingPalette <CommandLineStyleName, TStyle> palette)
 {
     return(new StyledSpan <TStyle>(span, palette.DefaultStyle));
 }
 public CommandLineHighlightingVisitorParams(List <StyledSpan <TStyle> > spans,
                                             HighlightingPalette <CommandLineStyleName, TStyle> palette)
 {
     Spans   = spans;
     Palette = palette;
 }