Code Monkey home page Code Monkey logo

lyaaaaa-s-logs-filter's Introduction

Hi there ๐Ÿ‘‹

My stats

Anurag's GitHub stats

I'm currently working on

Readme Card

What I'm coding in

Top Langs

lyaaaaa-s-logs-filter's People

Contributors

lyaaaaaaaaaaaaaaa avatar

Stargazers

 avatar  avatar

Watchers

 avatar

lyaaaaa-s-logs-filter's Issues

Read_Line doesn't read the last line of a file.

Describe the bug
That's not a bug but a misunderstanding. How can I read the last line of a file?
I use While not End_Of_File (file) Loop to repeat a statement.
However, it doesn't do anything for the last line. But, isn't the beginning of the last line not the end of the file?

To Reproduce
Steps to reproduce the behavior:

  1. Download the sources + logfilter.gpr.
  2. Edit in the main the way to the text file, you want to filter, given to Select_File as a parameter
  3. Compile and run the program.
  4. Give only one filter which appears at the last line. The last line won't appear.

Expected behavior
The last line should appear! The program should run the loop in Read_Line even when the last line is reached, which actually doesn't!

Additional context
Code Involved

   
   procedure Read_Line (p_filters           : store_Filter;
                        p_number_of_filters : Natural) is
      
      word_length     : Natural := 0;
      line_to_display : Boolean := False;
      word            : string             (1 .. 40); 
      Filters_State   : store_Filters_State (1.. p_number_of_filters);
      
   begin
      While not  End_Of_File (file) Loop
         
         line := To_Unbounded_String (Get_Line(file));
         initialize_Filters_State (p_value => false,
                                   p_Filters_State => Filters_State);
         
         for I in 1 .. Length(line) loop
            
            
            --  We ignore some opening characters to not miss any information
             --in logs.
              -- Therefore, a user doesn't need to think about logs syntax.
               --  So it avoids [carl not being returned when carl is a filter.
            
            
            if Element (line,I) /= ' ' and End_Of_Line (file) = false then
               
               if    Element (line,I) /= '[' 
                 and Element (line,I) /= '(' 
                 and Element (line,I) /= ''' 
                 and Element (line,I) /= '"' 
                 and Element (line,I) /= '<'
                 and Element (line,I) /= '*'
                 and Element (line,I) /= '{' then
                  
                  word_length        := word_length  +  1;
                  word (word_length) := To_Lower (Element(line,I));
                  
               end if;
                  
            elsif Element (line,I) = ' ' or End_Of_Line (file) = true then
               
               filter_check(p_filters           => p_filters,
                            p_number_of_filters => p_number_of_filters,
                            p_word              => word,
                            p_Filters_State     => Filters_State);
               word_length := 0;
                 
            end if;

           
         end loop;
         
         if are_they_all_true (Filters_State) = true then
            
            display_line;
            
         end if;
         
      end loop;
      
      close (file);
   
   end read_line;  

Filters input error

Describe the bug
If I enter "Bob Attack Crossbow" as filters the "attack" will be ignored because of the 3 spaces after Bob. If there is more than a space between the first and second filter and more than 2 filters, the second is ignored.

Expected behavior
Ignores the multiples spaces.

Additional context
See Set_Filter and Create_Filter in Log_Filter.adb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.