Ejemplo n.º 1
0
            /// <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);
                }
            }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 protected virtual void OnCompileError(IVsaError vsaerr)
 {
     if (CompileError != null)
     {
         CompileError(this, vsaerr);
     }
     else
     {
         MessageBox.Show("line " + vsaerr.Line + ": " + vsaerr.Description, "Compile Error");
     }
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
Archivo: jsc.cs Proyecto: ydunk/masters
 // === 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;            
 }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 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);
     }
 }
Ejemplo n.º 11
0
	public virtual bool OnCompilerError(IVsaError error)
			{
				return false;
			}
Ejemplo n.º 12
0
 public override bool OnCompilerError(IVsaError error){
   // We expect only JScriptExceptions here, and we throw them to be caught by the host
   throw (JScriptException)error;
 }
Ejemplo n.º 13
0
Archivo: mjs.cs Proyecto: nobled/mono
		public bool OnCompilerError (IVsaError error)
		{
			throw new NotImplementedException ();
		}
Ejemplo n.º 14
0
 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;
 }
Ejemplo n.º 15
0
 public bool OnCompilerError(IVsaError vsaerr)
 {
     OnCompileError(vsaerr);
     //			throw new Exception("line " + vsaerr.Line + ": " + vsaerr.Description + "\n" + vsaerr.LineText);
     return true;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// コンパイルエラー発生時に呼ばれるメソッド
 /// </summary>
 /// <param name="err">コンパイルエラー</param>
 /// <returns>コンパイルエラーを継続して報告するかどうか</returns>
 bool IVsaSite.OnCompilerError(IVsaError err)
 {
     errors.Add(err);
     return(true);
 }
Ejemplo n.º 17
0
 // === 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) {}
Ejemplo n.º 19
0
 public virtual bool OnCompilerError(IVsaError error)
 {
 }
Ejemplo n.º 20
0
 public virtual bool OnCompilerError(IVsaError error)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 21
0
 public VsaScriptingHostCompilerExceptionEventArgs(IVsaError exception)
     : base()
 {
     _exception = exception;
 }
Ejemplo n.º 22
0
        public bool OnCompilerError(IVsaError vsaerr)
        {
            OnCompileError(vsaerr);
//			throw new Exception("line " + vsaerr.Line + ": " + vsaerr.Description + "\n" + vsaerr.LineText);
            return(true);
        }
Ejemplo n.º 23
0
 protected virtual void OnCompileError(IVsaError vsaerr)
 {
     if (CompileError != null)
         CompileError(this, vsaerr);
     else
         MessageBox.Show("line " + vsaerr.Line + ": " + vsaerr.Description, "Compile Error");
 }
Ejemplo n.º 24
0
	public override bool OnCompilerError(IVsaError error)
			{
				throw (Exception)error;
			}
Ejemplo n.º 25
0
 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;            
 }
Ejemplo n.º 27
0
 bool IVsaSite.OnCompilerError(IVsaError e)
 {
     this._myOwner.NotifyOfCompilerError(e);
     return(false);
 }
Ejemplo n.º 28
0
 public bool OnCompilerError(IVsaError error)
 {
     this.OnCompilerException(this, new VsaScriptingHostCompilerExceptionEventArgs(error));
     return true;
 }
Ejemplo n.º 29
0
 public override bool OnCompilerError(IVsaError error)
 {
     throw (Exception)error;
 }