Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Experiments / Attic / Rook / Castle.Rook.Compiler / Services / Default / RookParser.cs
blobbc2211c90163a7df3834cc3e21fc58401ca9c2a5
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Rook.Compiler.Services.Default
17 using System;
18 using System.IO;
20 using Castle.Rook.Compiler.Parser;
21 using Castle.Rook.Compiler.AST;
24 public class RookParser : IParser
26 public IErrorReport errorReport;
28 public RookParser(IErrorReport errorReport)
30 this.errorReport = errorReport;
33 #region IParser Members
35 public SourceUnit Parse(CompilationUnit unit, TextReader reader)
37 RookLexer lexer = new RookLexer(reader);
39 RookBaseParser parser = new RookBaseParser(lexer);
40 parser.ErrorReport = errorReport;
42 return parser.sourceUnit(unit);
45 public SourceUnit Parse(CompilationUnit unit, String contents)
47 return Parse(unit, new StringReader(contents + "\r\n"));
50 /// <summary>
51 /// Handy for the test cases
52 /// </summary>
53 public SourceUnit Parse(String contents)
55 CompilationUnit unit = new CompilationUnit();
57 return Parse(unit, new StringReader(contents));
60 #endregion