/// <summary>Read a Grammar definition from text. </summary> /// <param name="Grammar">Grammar text.</param> /// <returns>Grammar is Ok.</returns> /// <exclude/> private void SetGrammar(string Grammar) { CodeDocument grammarDoc = null; TextBuffer buffer = new FlatBuffer(Grammar); grammarDoc = MetaParser.Instance.ParseString(buffer); if (buffer.Status.Error != null || !ParserBuilder.BuildRules(this, grammarDoc, buffer.Status)) { // only place to throw exception is CodeDocument.Load and Parser.SetGrammar (and MetaGrammar) var error = new ParserException(buffer.Status.Error.Message); error.AllErrors.AddRange(buffer.Status.AllErrors); throw error; } }