public virtual CompilationUnit VisitCompilationUnitSnippet(CompilationUnitSnippet snippet) { return this.VisitCompilationUnit(snippet); }
public override CompilationUnit VisitCompilationUnitSnippet(CompilationUnitSnippet snippet) { if (snippet == null) return null; return base.VisitCompilationUnitSnippet((CompilationUnitSnippet)snippet.Clone()); }
void ConstructCompilationUnit(){ CompilationUnitSnippet cu = new CompilationUnitSnippet(); this.compilationUnit = cu; this.compilation.CompilationUnits.Add(cu); cu.Compilation = this.compilation; cu.Name = new Identifier(this.inputLine.Substring(5)); string snippetText = this.ReadString(); cu.SourceContext.Document = this.currentDocument = this.compiler.CreateDocument(cu.Name.ToString(), 1, snippetText); cu.SourceContext.EndPos = snippetText.Length; cu.ParserFactory = new Microsoft.SpecSharp.ParserFactory(); }
public override CompilationUnitSnippet CreateCompilationUnitSnippet(string fileName, int lineNumber, DocumentText text, Compilation compilation){ if (fileName == null) return null; SpecSharpCompilerOptions options = compilation == null ? null : (compilation.CompilerParameters as SpecSharpCompilerOptions); if (options != null && options.Compatibility) return base.CreateCompilationUnitSnippet(fileName, lineNumber, text, compilation); #if Xaml if (this.CompileAsXaml || string.Compare(Path.GetExtension(fileName), ".xaml", true, CultureInfo.InvariantCulture) == 0){ Document doc = Microsoft.XamlCompiler.Compiler.CreateXamlDocument(fileName, 1, text); CompilationUnitSnippet cu = new CompilationUnitSnippet(); cu.Name = Identifier.For(doc.Name); cu.SourceContext = new SourceContext(doc); cu.ParserFactory = new XamlParserFactory(); cu.Compilation = compilation; return cu; }else #endif return base.CreateCompilationUnitSnippet(fileName, lineNumber, text, compilation); }
public EventingVisitor(Action<CompilationUnitSnippet> visitCompilationUnitSnippet) { VisitedCompilationUnitSnippet += visitCompilationUnitSnippet; } public event Action<CompilationUnitSnippet> VisitedCompilationUnitSnippet; public override CompilationUnit VisitCompilationUnitSnippet(CompilationUnitSnippet snippet) { if (VisitedCompilationUnitSnippet != null) VisitedCompilationUnitSnippet(snippet); return base.VisitCompilationUnitSnippet(snippet); }
public override CompilationUnitSnippet VisitCompilationUnitSnippet(CompilationUnitSnippet snippet){ System.Compiler.Parser p = this.DefaultCompiler.CreateParser(snippet.SourceContext.Document, this.ErrorNodes); p.ParseCompilationUnit(snippet); return null; }