Exemplo 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));
 }
Exemplo n.º 2
0
 public SpanConstructor(SpanKindInternal kind, SourceLocation location, IEnumerable <IToken> tokens)
 {
     Builder             = new SpanBuilder(location);
     Builder.Kind        = kind;
     Builder.EditHandler = SpanEditHandler.CreateDefault((content) => SpanConstructor.TestTokenizer(content));
     foreach (IToken sym in tokens)
     {
         Builder.Accept(sym);
     }
 }
Exemplo n.º 3
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));
 }
Exemplo 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
     }));
 }
Exemplo n.º 5
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());
        }
Exemplo n.º 6
0
 public SpanConstructor AsImplicitExpression(ISet <string> keywords, bool acceptTrailingDot)
 {
     return(_self
            .With(new ImplicitExpressionEditHandler((content) => SpanConstructor.TestTokenizer(content), keywords, acceptTrailingDot))
            .With(new ExpressionChunkGenerator()));
 }
Exemplo n.º 7
0
 public UnclassifiedCodeSpanConstructor(SpanConstructor self)
 {
     _self = self;
 }
Exemplo n.º 8
0
 public static SpanConstructor AutoCompleteWith(this SpanConstructor self, string autoCompleteString)
 {
     return(AutoCompleteWith(self, autoCompleteString, atEndOfSpan: false));
 }
Exemplo n.º 9
0
 public static SpanConstructor Accepts(this SpanConstructor self, AcceptedCharactersInternal accepted)
 {
     return(self.With(eh => eh.AcceptedCharacters = accepted));
 }