private ExpressionGroup Parse(string input) { var tokenizer = Tokenizer.CreateTokenizer(input); var parser = new AchievementScriptParser(); return(parser.Parse(tokenizer)); }
protected override void OnUpdateSyntax(ContentChangedEventArgs e) { var parser = new AchievementScriptParser(); _parsedContent = parser.Parse(Tokenizer.CreateTokenizer(e.Content)); if (e.IsAborted) { return; } var interpreter = new AchievementScriptInterpreter(); interpreter.Run(_parsedContent, out _scope); if (e.IsAborted) { return; } ServiceRepository.Instance.FindService <IBackgroundWorkerService>().InvokeOnUiThread(() => { ErrorsToolWindow.References.Clear(); foreach (var error in _parsedContent.Errors) { string message = error.Message; var innerError = error; if (innerError.InnerError != null) { do { innerError = innerError.InnerError; } while (innerError.InnerError != null); if (error.Line != innerError.Line || error.Column != innerError.Column) { message += String.Format(" (called from {0}:{1})", error.Line, error.Column); } } ErrorsToolWindow.References.Add(new CodeReferenceViewModel { StartLine = innerError.Line, StartColumn = innerError.Column, EndLine = innerError.EndLine, EndColumn = innerError.EndColumn, Message = message }); } }); if (e.IsAborted) { return; } if (e.IsWhitespaceOnlyChange) { return; } // wait a short while before updating the editor list ServiceRepository.Instance.FindService <ITimerService>().Schedule(() => { if (e.IsAborted) { return; } _owner.PopulateEditorList(interpreter); }, TimeSpan.FromMilliseconds(700)); base.OnUpdateSyntax(e); }