static int Main(string[] args) { SourceUnit unit = new SourceCodeUnit(RB, File.ReadAllText(args[0])); LoggingErrorSink log = new LoggingErrorSink(); new Parser().Parse(new CompilerContext(unit, new RubyCompilerOptions(), log)); return log.ErrorCount + log.FatalErrorCount; }
static int Main(string[] args) { SourceUnit unit = new SourceCodeUnit(RB, File.ReadAllText(args[0])); LoggingErrorSink log = new LoggingErrorSink(); new Parser().Parse(new CompilerContext(unit, new RubyCompilerOptions(), log)); return(log.ErrorCount + log.FatalErrorCount); }
public TransientCompilationUnit(string/*!*/ sourceCode, PhpSourceFile/*!*/ sourceFile, Encoding/*!*/ encoding, NamingContext namingContext, int line, int column, bool client) { Debug.Assert(sourceCode != null && sourceFile != null && encoding != null); Debug.Assert(!client); this.sourceUnit = new SourceCodeUnit(this, sourceCode, sourceFile, encoding, line, column); this.sourceUnit.AddImportedNamespaces(namingContext); }
public TransientCompilationUnit(string/*!*/ sourceCode, PhpSourceFile/*!*/ sourceFile, Encoding/*!*/ encoding, NamingContext namingContext, int line, int column, bool client) { Debug.Assert(sourceCode != null && sourceFile != null && encoding != null); Debug.Assert(!client); this.sourceUnit = new SourceCodeUnit(this, sourceCode, sourceFile, encoding, line, column); this.sourceUnit.Naming = namingContext ?? new NamingContext(null, null); // cant be null }
private static CSharpSyntaxTree CreateSyntaxTree(SourceCodeUnit sourceCodeUnit) { var syntaxTree = CSharpSyntaxTree.ParseText(sourceCodeUnit.SourceCode, null, sourceCodeUnit.FileName) as CSharpSyntaxTree; return(syntaxTree); }
public bool TryExpression(string expression) { CompilerOptions copts = engine.GetDefaultCompilerOptions(); ErrorSink sink = new ErrorSink(); SourceCodeUnit scu = new SourceCodeUnit(engine, expression); CompilerContext cc = new CompilerContext(scu, copts, sink); engine.Compiler.ParseExpressionCode(cc); return !sink.AnyError; }