Ejemplo n.º 1
0
 public static SpanConstructor AsDirectiveToken(this SpanConstructor self, DirectiveTokenDescriptor descriptor)
 {
     return(self
            .With(new DirectiveTokenChunkGenerator(descriptor))
            .With(new DirectiveTokenEditHandler((content) => SpanConstructor.TestTokenizer(content)))
            .Accepts(AcceptedCharactersInternal.NonWhiteSpace));
 }
Ejemplo n.º 2
0
 public static SpanConstructor AsCodeMarkup(this SpanConstructor self)
 {
     return(self
            .With(new ImplicitExpressionEditHandler(
                      (content) => SpanConstructor.TestTokenizer(content),
                      CSharpCodeParser.DefaultKeywords,
                      acceptTrailingDot: true))
            .With(new MarkupChunkGenerator())
            .Accepts(AcceptedCharactersInternal.AnyExceptNewline));
 }
Ejemplo n.º 3
0
        internal virtual Block ConfigureAndAddSpanToBlock(BlockBuilder block, SpanConstructor span)
        {
            switch (block.Type)
            {
            case BlockKindInternal.Markup:
                span.With(new MarkupChunkGenerator());
                break;

            case BlockKindInternal.Statement:
                span.With(new StatementChunkGenerator());
                break;

            case BlockKindInternal.Expression:
                block.ChunkGenerator = new ExpressionChunkGenerator();
                span.With(new ExpressionChunkGenerator());
                break;
            }
            block.Children.Add(span);
            return(block.Build());
        }
Ejemplo n.º 4
0
 public static SpanConstructor AutoCompleteWith(
     this SpanConstructor self,
     string autoCompleteString,
     bool atEndOfSpan)
 {
     return(self.With(new AutoCompleteEditHandler(
                          (content) => SpanConstructor.TestTokenizer(content),
                          autoCompleteAtEndOfSpan: atEndOfSpan)
     {
         AutoCompleteString = autoCompleteString
     }));
 }
Ejemplo n.º 5
0
 public SpanConstructor AsStatement()
 {
     return(_self.With(new StatementChunkGenerator()));
 }
Ejemplo n.º 6
0
 public static SpanConstructor Accepts(this SpanConstructor self, AcceptedCharactersInternal accepted)
 {
     return(self.With(eh => eh.AcceptedCharacters = accepted));
 }