<commit_before>%{
  /*
    Copyright 2014 <NAME>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  */

  /*
    This is the Lex file for the lexical analysis phase of CPSL.
  */

  /*
    [^\n\t ]*                       { printf("Unknown lexeme detected on line %i: %s .\n", linenum, yytext); }
  */

  /*
    Declare the line counter and initalize it to zero.
  */
  unsigned int linenum = 1;
%}  
%%

'([ -\[]|[\]-~]|(\\[ -~]))'                                     { printf("Character constant detected: %s .\n", yytext); }

\"([ -!]|[#-\[]|[\]-~]|(\\([ -!]|[#-~])))*\"                    { printf("String constant detected: %s .\n", yytext); }

[\t ]+                                                          /* Ignore (consume) whitespace. */ ;

array |
ARRAY                                                           { printf("Keyword detected: ARRAY .\n"); }

begin |
BEGIN                                                           { printf("Keyword detected: BEGIN .\n"); }

chr |
CHR                                                             { printf("Keyword detected: CHR .\n"); }

const |
CONST                                                           { printf("Keyword detected: CONST .\n"); }

do |
DO                                                              { printf("Keyword detected: DO .\n"); }

downto |
DOWNTO                                                          { printf("Keyword detected: DOWNTO .\n"); }

else |
ELSE                                                            { printf("Keyword detected: ELSE .\n"); }

elseif |
ELSEIF                                                          { printf("Keyword detected: ELSEIF .\n"); }

end |
END                                                             { printf("Keyword detected: END .\n"); }

for |
FOR                                                             { printf("Keyword detected: FOR .\n"); }

forward |
FORWARD                                                         { printf("Keyword detected: FORWARD .\n"); }

function |
FUNCTION                                                        { printf("Keyword detected: FUNCTION .\n"); }

if |
IF                                                              { printf("Keyword detected: IF .\n"); }

of |
OF                                                              { printf("Keyword detected: OF .\n"); }

ord |
ORD                                                             { printf("Keyword detected: ORD .\n"); }

pred |
PRED                                                            { printf("Keyword detected: PRED .\n"); }

procedure |
PROCEDURE                                                       { printf("Keyword detected: PROCEDURE .\n"); }

read |
READ                                                            { printf("Keyword detected: READ .\n"); }

record |
RECORD                                                          { printf("Keyword detected: RECORD .\n"); }

repeat |
REPEAT                                                          { printf("Keyword detected: REPEAT .\n"); }

return |
RETURN                                                          { printf("Keyword detected: RETURN .\n"); }

stop |
STOP                                                            { printf("Keyword detected: STOP .\n"); }

succ |
SUCC                                                            { printf("Keyword detected: SUCC .\n"); }

then |
THEN                                                            { printf("Keyword detected: THEN .\n"); }

to |
TO                                                              { printf("Keyword detected: TO .\n"); }

type |
TYPE                                                            { printf("Keyword detected: TYPE .\n"); }

until |
UNTIL                                                           { printf("Keyword detected: UNTIL .\n"); }

var |
VAR                                                             { printf("Keyword detected: VAR .\n"); }

while |
WHILE                                                           { printf("Keyword detected: WHILE .\n"); }

write |
WRITE                                                           { printf("Keyword detected: WRITE .\n"); }

[a-zA-Z][0-9a-zA-Z_]*                                           { printf("Identifier detected: %s .\n", yytext); }

\+                                                              { printf("Operator or delimiter detected: + .\n"); }

\-                                                              { printf("Operator or delimiter detected: - .\n"); }

\*                                                              { printf("Operator or delimiter detected: * .\n"); }

\/                                                              { printf("Operator or delimiter detected: / .\n"); }

&                                                               { printf("Operator or delimiter detected: & .\n"); }

\                                                               { printf("Operator or delimiter detected: \\ .\n"); }<commit_msg>Fixed error noted in graded submission, \\ recognized instead of | .<commit_after>%{
  /*
    Copyright 2014 <NAME>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  */

  /*
    This is the Lex file for the lexical analysis phase of CPSL.
  */

  /*
    [^\n\t ]*                       { printf("Unknown lexeme detected on line %i: %s .\n", linenum, yytext); }
  */

  /*
    Declare the line counter and initalize it to zero.
  */
  unsigned int linenum = 1;
%}  
%%

'([ -\[]|[\]-~]|(\\[ -~]))'                                     { printf("Character constant detected: %s .\n", yytext); }

\"([ -!]|[#-\[]|[\]-~]|(\\([ -!]|[#-~])))*\"                    { printf("String constant detected: %s .\n", yytext); }

[\t ]+                                                          /* Ignore (consume) whitespace. */ ;

array |
ARRAY                                                           { printf("Keyword detected: ARRAY .\n"); }

begin |
BEGIN                                                           { printf("Keyword detected: BEGIN .\n"); }

chr |
CHR                                                             { printf("Keyword detected: CHR .\n"); }

const |
CONST                                                           { printf("Keyword detected: CONST .\n"); }

do |
DO                                                              { printf("Keyword detected: DO .\n"); }

downto |
DOWNTO                                                          { printf("Keyword detected: DOWNTO .\n"); }

else |
ELSE                                                            { printf("Keyword detected: ELSE .\n"); }

elseif |
ELSEIF                                                          { printf("Keyword detected: ELSEIF .\n"); }

end |
END                                                             { printf("Keyword detected: END .\n"); }

for |
FOR                                                             { printf("Keyword detected: FOR .\n"); }

forward |
FORWARD                                                         { printf("Keyword detected: FORWARD .\n"); }

function |
FUNCTION                                                        { printf("Keyword detected: FUNCTION .\n"); }

if |
IF                                                              { printf("Keyword detected: IF .\n"); }

of |
OF                                                              { printf("Keyword detected: OF .\n"); }

ord |
ORD                                                             { printf("Keyword detected: ORD .\n"); }

pred |
PRED                                                            { printf("Keyword detected: PRED .\n"); }

procedure |
PROCEDURE                                                       { printf("Keyword detected: PROCEDURE .\n"); }

read |
READ                                                            { printf("Keyword detected: READ .\n"); }

record |
RECORD                                                          { printf("Keyword detected: RECORD .\n"); }

repeat |
REPEAT                                                          { printf("Keyword detected: REPEAT .\n"); }

return |
RETURN                                                          { printf("Keyword detected: RETURN .\n"); }

stop |
STOP                                                            { printf("Keyword detected: STOP .\n"); }

succ |
SUCC                                                            { printf("Keyword detected: SUCC .\n"); }

then |
THEN                                                            { printf("Keyword detected: THEN .\n"); }

to |
TO                                                              { printf("Keyword detected: TO .\n"); }

type |
TYPE                                                            { printf("Keyword detected: TYPE .\n"); }

until |
UNTIL                                                           { printf("Keyword detected: UNTIL .\n"); }

var |
VAR                                                             { printf("Keyword detected: VAR .\n"); }

while |
WHILE                                                           { printf("Keyword detected: WHILE .\n"); }

write |
WRITE                                                           { printf("Keyword detected: WRITE .\n"); }

[a-zA-Z][0-9a-zA-Z_]*                                           { printf("Identifier detected: %s .\n", yytext); }

\+                                                              { printf("Operator or delimiter detected: + .\n"); }

\-                                                              { printf("Operator or delimiter detected: - .\n"); }

\*                                                              { printf("Operator or delimiter detected: * .\n"); }

\/                                                              { printf("Operator or delimiter detected: / .\n"); }

&                                                               { printf("Operator or delimiter detected: & .\n"); }

|                                                               { printf("Operator or delimiter detected: | .\n"); }
{'fraction_non_alphanumeric': 0.10927687062623363, 'fraction_numerical': 0.0019738022609007717, 'mean_word_length': 0.8214052287581699, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 154, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6368337', 'n_tokens_mistral': 2236, 'n_tokens_neox': 2172, 'n_words': 709}