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