/// <summary> /// スクリプトをコンパイルする /// </summary> /// <exception cref="VsaCompileErrorException"> /// コンパイルエラーが発生した場合はこの例外を投げる /// </exception> public void Compile() { errors.Clear(); if (!vsaEngine.Compile()) { // IVsaError[] cei = (IVsaError[])errors.ToArray(typeof(IVsaError)); // 何故か例外が発生するときがある int size = 0; for (int i = 0; i < errors.Count; ++i) { // ありえないはずだけど、何故かエラーが発生するので念のため if (errors[i] is IVsaError) { ++size; } } IVsaError[] cei = new IVsaError[size]; for (int i = 0, j = 0; i < cei.Length; ++i, ++j) { // ありえないはずだけど、何故かエラーが発生するので念のため if (errors[i] is IVsaError) { cei[j] = (IVsaError)errors[i]; } } throw new VsaCompileErrorException(cei); } }
/// <summary> /// Called when there's a compiler error. /// </summary> /// <param name="error"></param> /// <returns></returns> public bool OnCompilerError(IVsaError error) { _exception = new ExternalException(error.Description, error.Number); _exception.Source = error.LineText; return(true); }
bool IVsaSite.OnCompilerError(IVsaError e) { Console.WriteLine( String.Format("Error of severity {0} on line {1}: {2}", e.Severity, e.Line, e.Description)); //((IScriptableSvgWindow)scriptGlobal).alert(String.Format("Compilation Error of severity {0} on line {1}: {2}", e.Severity, e.Line, e.Description)); // Continue to report errors return true; }
bool IVsaSite.OnCompilerError(IVsaError e) { Console.WriteLine( String.Format("Error of severity {0} on line {1}: {2}", e.Severity, e.Line, e.Description)); //((IScriptableSvgWindow)scriptGlobal).alert(String.Format("Compilation Error of severity {0} on line {1}: {2}", e.Severity, e.Line, e.Description)); // Continue to report errors return(true); }
protected virtual void OnCompileError(IVsaError vsaerr) { if (CompileError != null) { CompileError(this, vsaerr); } else { MessageBox.Show("line " + vsaerr.Line + ": " + vsaerr.Description, "Compile Error"); } }
public bool OnCompilerError(IVsaError error) { lastCompileError = error.Description; lastCompileErrorLineText = error.LineText; lastCompileErrorLineNumber = error.Line; lastCompileErrorColNumber = error.StartColumn; lastCompileErrorLineText = lastCompileErrorLineText.Split('\n')[lastCompileErrorLineNumber - 1]; return(false); }
// === IVsaSite === public virtual bool OnCompilerError(IVsaError error){ // Errors have severity 0, warnings have severities 1-4. Setting // nWarnLevel to 0 results in all warnings being masked. int nSeverity = error.Severity; if (nSeverity > this.options.nWarningLevel) return true; bool isWarning = (0 != nSeverity) && !this.options.fTreatWarningsAsErrors; JScriptCompiler.PrintError(error.SourceMoniker, error.Line, error.StartColumn, isWarning, error.Number, error.Description); // We want to keep on going as long as we can since it makes debugging easier, // thus we will never abort compilation (never return false) return true; }
private void OnCompileError(object obSender, IVsaError vsaerr) { WriteLine("({0},{1}): sev {4}, {5} {2:x}: {3}", vsaerr.Line, vsaerr.StartColumn, vsaerr.Number, vsaerr.Description, vsaerr.Severity, vsaerr.Severity > 0 ? "warning" : "error"); int ichSelStart = rtbEdit.SelectionStart; int ichSelLength = rtbEdit.SelectionLength; int ichT = GetCharIndexFromLine(rtbEdit.Text, vsaerr.Line - 1); rtbEdit.SelectionStart = ichT + vsaerr.StartColumn - 1; // columns are numbered starting at 1 rtbEdit.SelectionLength = vsaerr.EndColumn - vsaerr.StartColumn; rtbEdit.SelectionColor = Color.FromArgb(255, 0, 128); rtbEdit.SelectionStart = ichSelStart; rtbEdit.SelectionLength = ichSelLength; }
public override bool OnCompilerError(IVsaError error) { // Errors have severity 0, warnings have severities 1-4. Setting // this.warningLevel to 0 results in all warnings being masked. int severity = error.Severity; if (severity > this.warningLevel) { return(true); } bool isWarning = (0 != severity) && !this.treatWarningsAsErrors; this.PrintError(error.SourceMoniker, error.Line, error.StartColumn, isWarning, error.Number, error.Description); // Report as many errors as possible (never return false) return(true); }
internal void NotifyOfCompilerError(IVsaError e) { if (this._RulesCompileFailed == null) { string lineText; string[] strArray = e.LineText.Split(new char[] { '\n' }); if ((e.Line >= 2) && (e.Line < strArray.Length)) { lineText = "\t\t" + strArray[e.Line - 2].Trim() + "\nERROR LINE -->\t" + strArray[e.Line - 1].Trim() + "\n\t\t" + strArray[e.Line].Trim(); } else { lineText = e.LineText; } FiddlerApplication.DoNotifyUser(string.Format("FiddlerScript compilation failed on line {0}:\n\n---------------------- SOURCE -------------------------------\n\n{1}\n\n-------------------------------------------------------------------\n\n{2}", e.Line, lineText, e.Description), "FiddlerScript Error", MessageBoxIcon.Hand); } else { this._RulesCompileFailed(e.Description, e.Line, e.StartColumn, e.EndColumn); } }
public virtual bool OnCompilerError(IVsaError error) { return false; }
public override bool OnCompilerError(IVsaError error){ // We expect only JScriptExceptions here, and we throw them to be caught by the host throw (JScriptException)error; }
public bool OnCompilerError (IVsaError error) { throw new NotImplementedException (); }
private void OnCompileError(object obSender, IVsaError vsaerr) { WriteLine("({0},{1}): sev {4}, {5} {2:x}: {3}", vsaerr.Line, vsaerr.StartColumn, vsaerr.Number, vsaerr.Description, vsaerr.Severity, vsaerr.Severity > 0 ? "warning" : "error"); int ichSelStart = rtbEdit.SelectionStart; int ichSelLength = rtbEdit.SelectionLength; int ichT = GetCharIndexFromLine(rtbEdit.Text, vsaerr.Line - 1); rtbEdit.SelectionStart = ichT + vsaerr.StartColumn - 1; // columns are numbered starting at 1 rtbEdit.SelectionLength = vsaerr.EndColumn - vsaerr.StartColumn; rtbEdit.SelectionColor = Color.FromArgb(255, 0, 128); rtbEdit.SelectionStart = ichSelStart; rtbEdit.SelectionLength = ichSelLength; }
public bool OnCompilerError(IVsaError vsaerr) { OnCompileError(vsaerr); // throw new Exception("line " + vsaerr.Line + ": " + vsaerr.Description + "\n" + vsaerr.LineText); return true; }
/// <summary> /// コンパイルエラー発生時に呼ばれるメソッド /// </summary> /// <param name="err">コンパイルエラー</param> /// <returns>コンパイルエラーを継続して報告するかどうか</returns> bool IVsaSite.OnCompilerError(IVsaError err) { errors.Add(err); return(true); }
// === IVsaSite === public virtual bool OnCompilerError(IVsaError error){ // Errors have severity 0, warnings have severities 1-4. Setting // nWarnLevel to 0 results in all warnings being masked. int nSeverity = error.Severity; if (nSeverity > this.options.nWarningLevel) return true; bool isWarning = (0 != nSeverity) && !this.options.fTreatWarningsAsErrors; JScriptCompiler.PrintError(error.SourceMoniker, error.Line, error.StartColumn, isWarning, error.Number, error.Description); // We want to keep on going as long as we can since it makes debugging easier, // thus we will never abort compilation (never return false) return true; }
public virtual bool OnCompilerError(IVsaError error) {}
public virtual bool OnCompilerError(IVsaError error) { }
public virtual bool OnCompilerError(IVsaError error) { throw new NotImplementedException(); }
public VsaScriptingHostCompilerExceptionEventArgs(IVsaError exception) : base() { _exception = exception; }
public bool OnCompilerError(IVsaError vsaerr) { OnCompileError(vsaerr); // throw new Exception("line " + vsaerr.Line + ": " + vsaerr.Description + "\n" + vsaerr.LineText); return(true); }
protected virtual void OnCompileError(IVsaError vsaerr) { if (CompileError != null) CompileError(this, vsaerr); else MessageBox.Show("line " + vsaerr.Line + ": " + vsaerr.Description, "Compile Error"); }
public override bool OnCompilerError(IVsaError error) { throw (Exception)error; }
public virtual bool OnCompilerError(IVsaError error) { return(false); }
public override bool OnCompilerError(IVsaError error){ // Errors have severity 0, warnings have severities 1-4. Setting // this.warningLevel to 0 results in all warnings being masked. int severity = error.Severity; if (severity > this.warningLevel) return true; bool isWarning = (0 != severity) && !this.treatWarningsAsErrors; this.PrintError(error.SourceMoniker, error.Line, error.StartColumn, isWarning, error.Number, error.Description); // Report as many errors as possible (never return false) return true; }
bool IVsaSite.OnCompilerError(IVsaError e) { this._myOwner.NotifyOfCompilerError(e); return(false); }
public bool OnCompilerError(IVsaError error) { this.OnCompilerException(this, new VsaScriptingHostCompilerExceptionEventArgs(error)); return true; }
public override bool OnCompilerError(IVsaError error) { throw (Exception)error; }