<commit_before>#include "../common.h"

/* From the Ragel manual:
        "To guard against this kind of problem one must ensure that the machine
         specification is divided up using boundaries that do not allow 
         ambiguities from one portion of the machine to the next."
*/


char *mark;

%%{
  machine email_fst;
  action mark {
         mark = p;
  }
  action print {
    fprintf(stdout, "%s", mark);
  }

  estr = /[a-z0-9!#$%&'*+/=?^_`{|}~\-]/;
  beforeAt = estr+ ('.' estr+)*;
  az09 = /[a-z0-9]/;
  az09dash = /[a-z0-9\-]*[a-z0-9]/;
  part = az09 az09dash? '.';
  afterAt = part+ az09 az09dash?;

  email = beforeAt '@' afterAt;  

  fb = /[^\n]*/;
  
  main := ((email > 10 >mark %print | (fb > 5)) '\n')* ;
}%%
/*
Call "mark" upon entry to the sub-machine "email".
Call "print" when exiting the sub-maching "email".
*/
%% write data;



int main(int argc, char **argv) {

  PRE

  while(fgets(buffer, sizeof(buffer), stdin)) {
    INIT_LINE;
    %% write init;
    %% write exec;
  }

  POST

  return 0;
}<commit_msg>Add proper check to ragel email program<commit_after>#include "../common.h"

/* From the Ragel manual:
        "To guard against this kind of problem one must ensure that the machine
         specification is divided up using boundaries that do not allow 
         ambiguities from one portion of the machine to the next."
*/


char *mark;

%%{
  machine email_fst;
  action mark {
         mark = p;
  }
  action print {
    fprintf(stdout, "%s", mark);
  }

  estr = /[a-z0-9!#$%&'*+/=?^_`{|}~\-]/;
  beforeAt = estr+ ('.' estr+)*;
  az09 = /[a-z0-9]/;
  az09dash = /[a-z0-9\-]*[a-z0-9]/;
  part = az09 az09dash? '.';
  afterAt = part+ az09 az09dash?;

  email = beforeAt '@' afterAt;  

  fb = /[^\n]*/;
  
  main := ((email >mark %print | (fb - email)) '\n')* ;
}%%
/*
Call "mark" upon entry to the sub-machine "email".
Call "print" when exiting the sub-maching "email".
*/
%% write data;



int main(int argc, char **argv) {

  PRE

  while(fgets(buffer, sizeof(buffer), stdin)) {
    INIT_LINE;
    %% write init;
    %% write exec;

    if (p != pe) {
      FAIL;
    }
  }

  POST

  return 0;
}
{'fraction_non_alphanumeric': 0.17732151189920672, 'fraction_numerical': 0.020998600093327113, 'mean_word_length': 2.469255663430421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4704882', 'n_tokens_mistral': 855, 'n_tokens_neox': 794, 'n_words': 239}