Exemplo n.º 1
0
 public void ParseBlockMethodProducesErrorIfNewlineFollowsTransition()
 {
     ParseBlockTest("@" + Environment.NewLine,
                    new ExpressionBlock(
                        Factory.CodeTransition(),
                        Factory.EmptyCSharp()
                        .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
                        .Accepts(AcceptedCharactersInternal.NonWhiteSpace)),
                    RazorDiagnosticFactory.CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock(
                        new SourceSpan(new SourceLocation(1, 0, 1), Environment.NewLine.Length)));
 }
Exemplo n.º 2
0
 public void InnerImplicitExpressionWithOnlySingleAtAcceptsSingleSpaceOrNewlineAtDesignTime()
 {
     ParseBlockTest("{" + Environment.NewLine
                    + "    @" + Environment.NewLine
                    + "}",
                    new StatementBlock(
                        Factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None),
                        Factory.Code(Environment.NewLine + "    ")
                        .AsStatement()
                        .AutoCompleteWith(autoCompleteString: null),
                        new ExpressionBlock(
                            Factory.CodeTransition(),
                            Factory.EmptyCSharp().AsImplicitExpression(KeywordSet, acceptTrailingDot: true).Accepts(AcceptedCharactersInternal.NonWhiteSpace)
                            ),
                        Factory.Code(Environment.NewLine).AsStatement(),
                        Factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)),
                    /* designTimeParser */ true,
                    RazorDiagnosticFactory.CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock(
                        new SourceSpan(new SourceLocation(6 + Environment.NewLine.Length, 1, 5), Environment.NewLine.Length)));
 }
Exemplo n.º 3
0
 public void ParseBlockMethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpression()
 {
     ParseBlockTest("{" + Environment.NewLine
                    + "    @   {}" + Environment.NewLine
                    + "}",
                    new StatementBlock(
                        Factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None),
                        Factory.Code(Environment.NewLine + "    ")
                        .AsStatement()
                        .AutoCompleteWith(autoCompleteString: null),
                        new ExpressionBlock(
                            Factory.CodeTransition(),
                            Factory.EmptyCSharp()
                            .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true)
                            .Accepts(AcceptedCharactersInternal.NonWhiteSpace)),
                        Factory.Code("   {}" + Environment.NewLine).AsStatement(),
                        Factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)
                        ),
                    RazorDiagnosticFactory.CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock(
                        new SourceSpan(new SourceLocation(6 + Environment.NewLine.Length, 1, 5), contentLength: 3)));
 }