Beispiel #1
0
 private Action <SpanBuilder> StatementBlockSpanConfiguration(SpanCodeGenerator codeGenerator)
 {
     return(span =>
     {
         span.Kind = SpanKind.Code;
         span.CodeGenerator = codeGenerator;
         span.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString);
     });
 }
Beispiel #2
0
        protected virtual Func <bool> EndTerminatedDirective(
            string directive,
            BlockType blockType,
            SpanCodeGenerator codeGenerator,
            bool allowMarkup
            )
        {
            return(() =>
            {
                SourceLocation blockStart = CurrentLocation;
                Context.CurrentBlock.Type = blockType;
                AssertDirective(directive);
                AcceptAndMoveNext();

                Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None;
                Span.CodeGenerator = SpanCodeGenerator.Null;
                Output(SpanKind.MetaCode);

                using (PushSpanConfig(StatementBlockSpanConfiguration(codeGenerator)))
                {
                    AutoCompleteEditHandler editHandler = new AutoCompleteEditHandler(
                        Language.TokenizeString
                        );
                    Span.EditHandler = editHandler;

                    if (!EndTerminatedDirectiveBody(directive, blockStart, allowMarkup))
                    {
                        editHandler.AutoCompleteString = String.Concat(
                            SyntaxConstants.VB.EndKeyword,
                            " ",
                            directive
                            );
                        return false;
                    }
                    return true;
                }
            });
        }