コード例 #1
0
ファイル: GwBasicGrammar.cs プロジェクト: uzbekdev1/Irony-1
 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
コード例 #2
0
ファイル: GrammarBase.cs プロジェクト: Delphi79/UO98-SVN
 void IdentifierToken_ValidateToken(object sender, ParsingEventArgs e)
 {
     if (m_ValidValues != null && !m_ValidValues.Contains(e.Context.CurrentToken.ValueString))
     {
         e.Context.AddParserError(m_ErrorMessage);
     }
 }
コード例 #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");
     }
 }
コード例 #4
0
ファイル: AChannel.cs プロジェクト: tweakch/TweakToolkit
        protected virtual void OnParsing(ParsingEventArgs <TType> e)
        {
            EventHandler <ParsingEventArgs <TType> > handler = Parsing;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #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;
 }
コード例 #6
0
ファイル: RefalGrammar.cs プロジェクト: jmptrader/Irony-2
        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;
            }
        }
コード例 #7
0
        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));
        }
コード例 #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);
            }
        }
コード例 #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));
        }
コード例 #10
0
 private void parseEvent <T1, T2>(object sender, ParsingEventArgs <T1, T2> e)
 {
     Console.WriteLine("Parser {0}, matched {1}", sender, e.Match);
 }