public void Convert(string script, StringBuilder sb) { var validatorServices = new LSLCodeValidatorStrategies(); var errorListener = new ErrorListener(); var warningListener = new WarningListener(this); validatorServices.ExpressionValidator = ExpressionValidator; validatorServices.LibraryDataProvider = _libraryData; validatorServices.StringLiteralPreProcessor = new LSLDefaultStringPreProcessor(); validatorServices.SyntaxErrorListener = errorListener; validatorServices.SyntaxWarningListener = warningListener; var validator = new LSLCodeValidator(validatorServices); ILSLCompilationUnitNode syntaxTree; using (var m = new MemoryStream(Encoding.Unicode.GetBytes(script))) { syntaxTree = validator.Validate(new StreamReader(m, Encoding.Unicode)); } _warnings = warningListener.Warnings; /* * An exception will be thrown from the ErrorListener defined at the top of this file in case of syntax errors, so skip this check. * * if (validator.HasSyntaxErrors) * { * return; * } */ var outStream = new MemoryStream(); var compiler = new LSLOpenSimCompiler(_libraryData, CompilerSettings); compiler.Compile(syntaxTree, new StreamWriter(outStream, Encoding.Unicode)); sb.Append(Encoding.Unicode.GetString(outStream.ToArray())); }