void identifier_ValidateToken(object sender, ParsingEventArgs e) { if (e.Context.CurrentToken.ValueString.Length > 4) { e.Context.CurrentToken = e.Context.CreateErrorToken("Identifier cannot be longer than 4 characters"); } } //constructor
void IdentifierToken_ValidateToken(object sender, ParsingEventArgs e) { if (m_ValidValues != null && !m_ValidValues.Contains(e.Context.CurrentToken.ValueString)) { e.Context.AddParserError(m_ErrorMessage); } }
void label_ValidateToken(object sender, ParsingEventArgs e) { if (e.Context.CurrentToken.ValueString.Length > 4) { e.Context.CurrentToken = e.Context.CreateErrorToken("labels cannot be longer than 4 characters"); } }
protected virtual void OnParsing(ParsingEventArgs <TType> e) { EventHandler <ParsingEventArgs <TType> > handler = Parsing; if (handler != null) { handler(this, e); } }
private void Term_Shifting(object sender, ParsingEventArgs e) { //Set the values only if we are in the marked state if (!e.Context.CurrentParserState.CustomFlags.IsSet(ParserStateFlags.ImpliedPrecedence)) { return; } e.Context.CurrentParserInput.Associativity = Associativity; e.Context.CurrentParserInput.Precedence = Precedence; }
void LineComment_ValidateToken(object sender, ParsingEventArgs args) { // if "*" is allowed in the current parser state, suppress comments starting with "*" var parserState = args.Context.CurrentParserState; if (parserState.ExpectedTerminals.Contains(ToTerm("*"))) { // rewind input stream and reject the token // args.Context.SetSourceLocation(args.Context.CurrentToken.Location); args.Context.CurrentToken = null; } }
private void MarkdownParsed(object sender, ParsingEventArgs e) { if (string.IsNullOrEmpty(e.File) || e.Snapshot != _buffer.CurrentSnapshot) { return; } // Clear cache if document is updated _errorsCached = null; _errors = e.Document.Validate(e.File); SnapshotSpan span = new SnapshotSpan(_buffer.CurrentSnapshot, 0, _buffer.CurrentSnapshot.Length); TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(span)); }
private static async void MarkdownParsed(object sender, ParsingEventArgs e) { if (!string.IsNullOrEmpty(e.File)) { var errors = e.Document.Validate(e.File); if (!_providers.ContainsKey(e.File) && !errors.Any()) { return; } await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); AddErrors(e.File, errors); } }
private void MarkdownParsed(object sender, ParsingEventArgs e) { if (string.IsNullOrEmpty(e.File) || e.Snapshot != _buffer.CurrentSnapshot) { return; } var errors = e.Document.Validate(e.File); var errorCount = errors.Count(); if (errorCount == 0 && (_errors == null || !_errors.Any())) { return; } _errors = errors; SnapshotSpan span = new SnapshotSpan(_buffer.CurrentSnapshot, 0, _buffer.CurrentSnapshot.Length); TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(span)); }
private void parseEvent <T1, T2>(object sender, ParsingEventArgs <T1, T2> e) { Console.WriteLine("Parser {0}, matched {1}", sender, e.Match); }