示例#1
0
 private static void MainTest2( CodeStatement code )
 {
     MainTest( code, " ", false );
     MainTest( code, "\r\n\t", false );
     MainTest( code, " ", true );
     MainTest( code, "\r\n\t", true );
 }
示例#2
0
        private static void MainTest( CodeStatement code, string spaces, bool isStart )
        {
            bool actualIsStart;
            var codeStatementText = CodeToString( code, spaces, isStart );
            var actualCodeStatement = ParserHelper.ParseCode( codeStatementText, out actualIsStart );

            AssertHelper.AssertCode( code, actualCodeStatement, isStart, actualIsStart );
        }
        public CodeWriter Statement( CodeStatement code, string writerName )
        {
            var writer = new CodeWriter();

            writer.AppendText( code.Value );

            return writer;
        }
示例#4
0
        public static string CodeToString( CodeStatement codeStatement, string spaces, bool isStart )
        {
            var builder = new StringBuilder();

            builder.Append( "<%$" );
            builder.Append( spaces );
            builder.Append( codeStatement.Value );
            builder.Append( spaces );
            if (isStart) builder.Append( "$-%>" );
            else builder.Append( "$%>" );

            return builder.ToString();
        }
示例#5
0
 void Code(out CodeStatement codeStatement, ref bool isStart)
 {
     while (!(la.kind == 0 || la.kind == 13)) {SynErr(47); Get();}
     Expect(13);
     Token start = t; int startPos = t.pos + t.val.Length;
     while (StartOf(9)) {
     Get();
     }
     string value = scanner.buffer.GetString( startPos, la.pos );
     if (la.kind == 14) {
     ExpectWeak(14, 10);
     } else if (la.kind == 15) {
     ExpectWeak(15, 10);
     isStart = true;
     } else SynErr(48);
     codeStatement = new CodeStatement( new StatementPosition( start, t ), value.Trim() );
 }