<commit_before>/* lexer1.lex            see license.txt for copyright and terms of use
   flex scanner for Lexer 1 of C++ compiler
   see lexer1.txt for specification */

/******************/
/* C declarations */
/******************/

  #include "lexer1.h"        /* Lexer 1 stuff */


/****************/
/* flex options */
/****************/

%option noyywrap
%option nounput
%option outfile="lexer1yy.cc"
%option prefix="lexer1_"


/********************/
/* C++ declarations */
/********************/

  #include "growbuf.h"       // GrowBuffer
  GrowBuffer collector;      // place to assemble big tokens

  // used for 2nd and 3rd arguments to lexer1Emit
  #define COLLECTOR (char*)collector.getDataC(), collector.getDataLen()
  
  // declare the interface to the lexer
  #define YY_DECL int lexer1_inner_lex(Lexer1 &lexer)
  
  // this works around a problem with cygwin & fileno
  #define YY_NEVER_INTERACTIVE 1


/***************/
/* sub-regexps */
/***************/

/* newline */
NL            "\n"

/* anything but newline */
NOTNL         .

/* any of 256 source characters */
ANY           ({NOTNL}|{NL})

/* backslash */
BACKSL        "\\"

/* beginnging of line (must be start of a pattern) */
BOL           ^

/* end of line (would like EOF to qualify also, but flex doesn't allow it */
EOL           {NL}

/* letter or underscore */
LETTER        [A-Za-z_]

/* letter or underscore or digit */
ALNUM         [A-Za-z_0-9]

/* decimal digit */
DIGIT         [0-9]

/* sequence of decimal digits */
DIGITS        ({DIGIT}+)

/* sign of a number */
SIGN          ("+"|"-")

/* integer suffix */
INT_SUFFIX    ([uU][lL]?|[lL][uU]?)

/* floating-point suffix letter */
FLOAT_SUFFIX  [flFL]

/* normal string character: any but quote, newline, or backslash */
STRCHAR       [^\"\n\\]

/* (start of) an escape sequence */
ESCAPE        ({BACKSL}{ANY})

/* double quote */
QUOTE         [\"]

/* normal character literal character: any but single-quote, newline, or backslash */
CCCHAR        [^\'\n\\]

/* single quote */
TICK          [\']

/* space or tab */
SPTAB         [ \t]

/* preprocessor "character" -- any but escaped newline */
PPCHAR        ([^\\\n]|{BACKSL}{NOTNL})


/********************/
/* start conditions */
/********************/

%x ST_C_COMMENT<commit_msg>extended lexer to allow "1LL" syntax for long long literals<commit_after>/* lexer1.lex            see license.txt for copyright and terms of use
   flex scanner for Lexer 1 of C++ compiler
   see lexer1.txt for specification */

/******************/
/* C declarations */
/******************/

  #include "lexer1.h"        /* Lexer 1 stuff */


/****************/
/* flex options */
/****************/

%option noyywrap
%option nounput
%option outfile="lexer1yy.cc"
%option prefix="lexer1_"


/********************/
/* C++ declarations */
/********************/

  #include "growbuf.h"       // GrowBuffer
  GrowBuffer collector;      // place to assemble big tokens

  // used for 2nd and 3rd arguments to lexer1Emit
  #define COLLECTOR (char*)collector.getDataC(), collector.getDataLen()
  
  // declare the interface to the lexer
  #define YY_DECL int lexer1_inner_lex(Lexer1 &lexer)
  
  // this works around a problem with cygwin & fileno
  #define YY_NEVER_INTERACTIVE 1


/***************/
/* sub-regexps */
/***************/

/* newline */
NL            "\n"

/* anything but newline */
NOTNL         .

/* any of 256 source characters */
ANY           ({NOTNL}|{NL})

/* backslash */
BACKSL        "\\"

/* beginnging of line (must be start of a pattern) */
BOL           ^

/* end of line (would like EOF to qualify also, but flex doesn't allow it */
EOL           {NL}

/* letter or underscore */
LETTER        [A-Za-z_]

/* letter or underscore or digit */
ALNUM         [A-Za-z_0-9]

/* decimal digit */
DIGIT         [0-9]

/* sequence of decimal digits */
DIGITS        ({DIGIT}+)

/* sign of a number */
SIGN          ("+"|"-")

/* integer suffix */
/* added 'LL' option for GNU long long compatibility.. */
ELL_SUFFIX    [lL]([lL]?)
INT_SUFFIX    ([uU]{ELL_SUFFIX}?|{ELL_SUFFIX}[uU]?)

/* floating-point suffix letter */
FLOAT_SUFFIX  [flFL]

/* normal string character: any but quote, newline, or backslash */
STRCHAR       [^\"\n\\]

/* (start of) an escape sequence */
ESCAPE        ({BACKSL}{ANY})

/* double quote */
QUOTE         [\"]

/* normal character literal character: any but single-quote, newline, or backslash */
CCCHAR        [^\'\n\\]

/* single quote */
TICK          [\']

/* space or tab */
SPTAB         [ \t]

/* preprocessor "character" -- any but escaped newline */
PPCHAR        ([^\\\n]|{BACKSL}{NOTNL})


/********************/
/* start conditions */
/********************/

%x ST_C_COMMENT
{'fraction_non_alphanumeric': 0.2108050847457627, 'fraction_numerical': 0.008686440677966102, 'mean_word_length': 2.504825538233111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5167413', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1516, 'n_words': 452}