示例#1
0
        public void ReadToEndFromStringTextContentProvider()
        {
            string text = "abc";
            StringTextContentProvider provider = new StringTextContentProvider(text);

            using (SourceCodeReader reader = provider.GetReader()) {
                Assert.AreEqual("abc", reader.ReadToEnd());
            }
        }
示例#2
0
        public override ScriptCode CompileSourceCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink)
        {
            using (SourceCodeReader reader = sourceUnit.GetReader())
            {
                switch (sourceUnit.Kind)
                {
                case SourceCodeKind.File:
                case SourceCodeKind.AutoDetect:
                // TODO: add a different kind here!
                case SourceCodeKind.Expression:
                case SourceCodeKind.InteractiveCode:
                case SourceCodeKind.SingleStatement:
                case SourceCodeKind.Statements:
                    return(new AplusScriptCode(this.aplus,
                                               reader.ReadToEnd(),
                                               sourceUnit));

                case SourceCodeKind.Unspecified:
                default:

                    throw new Exception("SourceKind fail..");
                }
            }
        }