Esempio 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));
 }
Esempio 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));
 }
Esempio 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());
        }
Esempio 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
     }));
 }
Esempio n. 5
0
 public SpanConstructor AsStatement()
 {
     return(_self.With(new StatementChunkGenerator()));
 }
Esempio n. 6
0
 public static SpanConstructor Accepts(this SpanConstructor self, AcceptedCharactersInternal accepted)
 {
     return(self.With(eh => eh.AcceptedCharacters = accepted));
 }