%%%==============================================================================
%% Copyright 2026-present by Alceu Frigeri
%%
%% This work may be distributed and/or modified under the conditions of
%%
%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
%%   version 1.3c (or later), and/or
%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
%%   version 3 (or later)
%%
%% This work has the LPPL maintenance status *maintained*.
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
%% This is version {1.0} {2026/11/27}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/codehighlight
%%
%%%==============================================================================
%%
%% Nota Bene:
%% Some languages 'got' an specific identifier
%%                  like ==> identifier = { pragma } { \# } { }
%%                    or ==> identifier = { texcs }  { \\ } { }
%%      this is a flexible way to declare keywords/pragmas instead
%%      of changing the catcode of some chars to letter
%%          main implication: some keyword/pragma's lists got split.
%%%==============================================================================

%%%%%%%
%%%  This save the current 'expl syntax' state
%%%%%%%
\hlExplFileTest
%%%%%%%
%%%
%%% Just an attempt at having my package's info in a regular way
%%%   \pkginfograb_set:nn {<pkg-name>} { props} sets package info
%%%
%%%   \pkginfograbProvidesExplPackage {<pkg-name>} { props} sets package info
%%%     and calls \ProvidesExplPackage
%%%
%%%%%%%
\RequirePackage{pkginfograb}
\pkginfograbProvidesExplFile {codehighlight-18}
  {
     name        = {codehighlight-18} ,
     prefix      = {codehl} ,
     date        = {2026/11/27} ,
     version     = {1.0} ,
     description = {codehighlight ~language ~definitions ~18}
  }
%%%%%%%
%%% End of cut-n-paste
%%%%%%%

\codehl_lang_def:nn { awk.posix }
  {
    %%%
    info / note  =
     {
       POSIX ~ awk  ~  base ~ Language. ~ Some ~ references~\\
       https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
     }  ,
    %%%

    comment ~ line           =      {1} { \# }            { } ,

    string                   =      {1} { "  }    { \\ }  { }  ,  

    alphanumeric             =      true  ,
    oletter                  =      { \_ }  ,
  }

\codehl_lang_def:nn { awk.gnu }
  {
    %%%
    info / note  =
     {
       GNU  ~ awk ~  base ~ Language. ~ Some ~ references~\\
       https://www.gnu.org/software/gawk/manual/~\\
       https://www.gnu.org/software/gawk/manual/html_node/
     }  ,
    %%%

    based ~ on               =      {  awk.posix }  ,
  }

\codehl_keyset_def:nn { awk.posix }
  {
    %%%
    info / note  =
     {
       POSIX ~ awk  ~  base ~ Language. ~ Some ~ references~\\
       https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
     }  ,
    %%%

    keywd                    =      {1}
      { %% build-in cmds
        BEGIN, END, break, continue, delete, do, else, 
        exit, for, function, getline, if, in, next, 
        print, printf, return, while,
      }  ,
    keywd                    =      {2}      
      {
        %% special variables
        ARGC, ARGV, CONVFMT, ENVIRON, FILENAME, 
        FNR, FS, NF, NR, OFMT, OFS, ORS, 
        RLENGTH, RS, RSTART, SUBSEP,
      }  ,
    keywd                    =      {3}    
      {  
        %% build-in functions
        atan2, close, cos, exp, gsub, index, 
        int, length, log, match, rand, sin, 
        split, sprintf, sqrt, srand, sub, substr, 
        system, tolower, toupper
      }  ,
  }

\codehl_keyset_def:nn { awk.gnu }
  {
    %%%
    info / note  =
     {
       GNU  ~ awk ~  base ~ Language. ~ Some ~ references~\\
       https://www.gnu.org/software/gawk/manual/~\\
       https://www.gnu.org/software/gawk/manual/html_node/
     }  ,
    %%%

    based ~ on               =      {  awk.posix }  ,
    
    keywd                    =      {1}
      { %% build-in cmds
        BEGINFILE, ENDFILE, switch, case, default
      }  ,
    keywd                    =      {2}    
      {  
        %% special variables
        ARGIND, BINMODE, ERRNO, FIELDWIDTHS, FPAT, 
        FUNCTAB, IGNORECASE, LINT, PREC, PROCINFO, 
        ROUNDMODE, RT, SYMTAB, TEXTDOMAIN
      }  ,
    keywd                    =      {3}      
      {
        %% build-in functions
        asort, asorti, bindtextdomain, dcgettext, 
        dcngettext, gensub, isarray, mktime, patsplit, 
        strftime, strtonum, systime, typeof,
        and, compl, lshift, or, rshift, xor
      }  ,    
  }

%%
%% Aliases
%%

%%%%%%%
%%%  This restore the 'expl syntax' state saved (hopefully) at the beginning
%%%%%%%
\hlExplFileOut


