Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 void IdentifierToken_ValidateToken(object sender, ParsingEventArgs e)
 {
     if (m_ValidValues != null && !m_ValidValues.Contains(e.Context.CurrentToken.ValueString))
     {
         e.Context.AddParserError(m_ErrorMessage);
     }
 }
Ejemplo n.º 3
0
 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");
     }
 }
Ejemplo n.º 4
0
        protected virtual void OnParsing(ParsingEventArgs <TType> e)
        {
            EventHandler <ParsingEventArgs <TType> > handler = Parsing;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 8
0
        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);
            }
        }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
 private void parseEvent <T1, T2>(object sender, ParsingEventArgs <T1, T2> e)
 {
     Console.WriteLine("Parser {0}, matched {1}", sender, e.Match);
 }