%%%==============================================================================
%% 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-08}
  {
     name        = {codehighlight-08} ,
     prefix      = {codehl} ,
     date        = {2026/11/27} ,
     version     = {1.0} ,
     description = {codehighlight ~language ~definitions ~08}
  }
%%%%%%%
%%% End of cut-n-paste
%%%%%%%

\codehl_lang_def:nn { php.8 }
  {
    %%%
    info / note  =
     {
       php ~ 8 ~  base ~ Language. ~ Some ~ references~\\
        https://www.php.net/~\\
        NOTE: php ~ definitions ~ extent ~ html.~ php ~ is ~ defined ~ as ~ case ~ sensitive
     }  ,
    %%%

     
    based ~ on               =      { html }  ,
    
    comment ~ line           =      {2} { // }                 { tagged }  ,
    comment ~ line           =      {2} { \# }                 { tagged }  ,
    comment                  =      {3} { /* }  { */ }         { tagged }  ,

%    string                   =      {3} { '  }          { \\ } { tagged }  ,
%    string                   =      {3} { "  }          { \\ } { tagged }  ,

    tagged ~ area            =      { php }  { <?    } { ?> } { nestable }  ,  %%% err, this is a 'echo' shortcut ... 
    tagged ~ area            =      { php }  { <?php } { ?> } { nestable }  ,

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

    case ~ sensitive         =      true  ,
  }
%%% TODO:
%%% heredoc <<'something'
%%% hint: $, @, %, & * => letter ??  

\codehl_keyset_def:nn { php.8 }
  {
    %%%
    info / note  =
     {
       php ~ 8 ~  base ~ Language. ~ Some ~ references~\\
        https://www.php.net/
     }  ,
    %%%

     
    php                      =      {1}
      {  %%% elements
        abstract, and, array, as, break, callable, case, catch, 
        class, clone, const, continue, declare, default, die, 
        do, echo, else, elseif, empty, enddeclare, endfor, 
        endforeach, endif, endswitch, endwhile, eval, exit, extends, 
        final, finally, fn, for, foreach, function, global, goto, if, 
        implements, include, include_once, instanceof, insteadof, interface, 
        isset, list, match, namespace, new, or, print, private, protected, 
        public, readonly, require, require_once, return, static, switch, 
        throw, trait, try, unset, use, var, while, xor, yield, yield from
      }  ,
    php                      =      {2}
      {  %%% magic constants
        __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, 
        __TRAIT__, __METHOD__, __PROPERTY__, __NAMESPACE__, 
      }  ,
    php                      =      {3}
      {  %%% supper globals
        $GLOBALS, $_SERVER, $_GET, $_POST, $_FILES, 
        $_REQUEST, $_SESSION, $_ENV, $_COOKIE, 
        $argc, $argv, $http_response_header, $php_errormsg,
      }  ,
  }

\codehl_keyset_def:nn { php.mysqli }
  {
    %%%
    info / note  =
     {
       php ~  MySQLi ~ extention 
     }  ,
    %%%

     
    php                      =      {1}
      {
        mysqli_affected_rows,  mysqli_autocommit,  mysqli_begin_transaction,  
        mysqli_change_user,  mysqli_character_set_name,  mysqli_close,  
        mysqli_commit,  mysqli_connect,  mysqli_connect_errno,  
        mysqli_connect_error,  mysqli_data_seek,  mysqli_dump_debug_info,  
        mysqli_debug,  mysqli_errno,  mysqli_error,  mysqli_error_list,  
        mysqli_stmt_execute,  mysqli_execute,  mysqli_fetch_field,  
        mysqli_fetch_fields,  mysqli_fetch_field_direct,  mysqli_fetch_lengths,  
        mysqli_fetch_all,  mysqli_fetch_array,  mysqli_fetch_assoc,  
        mysqli_fetch_object,  mysqli_fetch_row,  mysqli_field_count,  
        mysqli_field_seek,  mysqli_field_tell,  mysqli_free_result,  
        mysqli_get_connection_stats,  mysqli_get_client_stats,  
        mysqli_get_charset,  mysqli_get_client_info,  mysqli_get_client_version,  
        mysqli_get_links_stats,  mysqli_get_host_info,  mysqli_get_proto_info,  
        mysqli_get_server_info,  mysqli_get_server_version,  mysqli_get_warnings,  
        mysqli_init,  mysqli_info,  mysqli_insert_id,  mysqli_kill,  
        mysqli_more_results,  mysqli_multi_query,  mysqli_next_result,  
        mysqli_num_fields,  mysqli_num_rows,  mysqli_options,  mysqli_ping,  
        mysqli_poll,  mysqli_prepare,  mysqli_report,  mysqli_query,  
        mysqli_real_connect,  mysqli_real_escape_string,  mysqli_real_query,  
        mysqli_reap_async_query,  mysqli_release_savepoint,  mysqli_rollback,  
        mysqli_savepoint,  mysqli_select_db,  mysqli_set_charset,  
        mysqli_stmt_affected_rows,  mysqli_stmt_attr_get,  mysqli_stmt_attr_set,  
        mysqli_stmt_bind_param,  mysqli_stmt_bind_result,  mysqli_stmt_close,  
        mysqli_stmt_data_seek,  mysqli_stmt_errno,  mysqli_stmt_error,  
        mysqli_stmt_error_list,  mysqli_stmt_fetch,  mysqli_stmt_field_count,  
        mysqli_stmt_free_result,  mysqli_stmt_get_result,  mysqli_stmt_get_warnings,  
        mysqli_stmt_init,  mysqli_stmt_insert_id,  mysqli_stmt_more_results,  
        mysqli_stmt_next_result,  mysqli_stmt_num_rows,  mysqli_stmt_param_count,  
        mysqli_stmt_prepare,  mysqli_stmt_reset,  mysqli_stmt_result_metadata,  
        mysqli_stmt_send_long_data,  mysqli_stmt_store_result,  
        mysqli_stmt_sqlstate,  mysqli_sqlstate,  mysqli_ssl_set,  mysqli_stat,  
        mysqli_store_result,  mysqli_thread_id,  mysqli_thread_safe,  
        mysqli_use_result,  mysqli_warning_count,  mysqli_refresh,  
        mysqli_escape_string,  mysqli_set_opt,  
      }
  }

\codehl_keyset_def:nn { php.pgsql }
  {
    %%%
    info / note  =
      {
        php ~   PostgreSQL ~ extention 
      }  ,
    %%%

    php                      =      {1}
      {
        pg_connect,  pg_pconnect,  pg_connect_poll,  pg_close,  
        pg_connection_status,  pg_connection_busy,  pg_connection_reset, 
        pg_host,  pg_dbname,  pg_port,  pg_tty,  pg_options,  
        pg_version,  pg_ping,  pg_parameter_status,  pg_transaction_status,  
        pg_query,  pg_query_params,  pg_prepare,  pg_execute,  pg_send_query,  
        pg_send_query_params,  pg_send_prepare,  pg_send_execute,  
        pg_cancel_query,  pg_fetch_result,  pg_fetch_row,  pg_fetch_assoc,  
        pg_fetch_array,  pg_fetch_object,  pg_fetch_all,  pg_fetch_all_columns,  
        pg_affected_rows,  pg_get_result,  pg_result_seek,  pg_result_status,  
        pg_free_result,  pg_last_oid,  pg_num_rows,  pg_num_fields,  
        pg_field_name,  pg_field_num,  pg_field_size,  pg_field_type,  
        pg_field_type_oid,  pg_field_prtlen,  pg_field_is_null,  pg_field_table,  
        pg_get_notify,  pg_socket,  pg_consume_input,  pg_flush,  pg_get_pid,  
        pg_result_error,  pg_result_error_field,  pg_last_error,  pg_last_notice,  
        pg_put_line,  pg_end_copy,  pg_copy_to,  pg_copy_from,  pg_trace,  
        pg_untrace,  pg_lo_create,  pg_lo_unlink,  pg_lo_open,  pg_lo_close,  
        pg_lo_read,  pg_lo_write,  pg_lo_read_all,  pg_lo_import,  pg_lo_export,  
        pg_lo_seek,  pg_lo_tell,  pg_lo_truncate,  pg_escape_string,  
        pg_escape_bytea,  pg_unescape_bytea,  pg_escape_literal,  
        pg_escape_identifier,  pg_set_error_verbosity,  pg_client_encoding,  
        pg_set_client_encoding,  pg_meta_data,  pg_convert,  pg_insert,  
        pg_update,  pg_delete,  pg_select,  pg_exec,  pg_getlastoid,  
        pg_cmdtuples,  pg_errormessage,  pg_numrows,  pg_numfields,  
        pg_fieldname,  pg_fieldsize,  pg_fieldtype,  pg_fieldnum,  
        pg_fieldprtlen,  pg_fieldisnull,  pg_freeresult,  pg_result,  
        pg_loreadall,  pg_locreate,  pg_lounlink,  pg_loopen,  pg_loclose,  
        pg_loread,  pg_lowrite,  pg_loimport,  pg_loexport,  pg_clientencoding,  
        pg_setclientencoding,  
      }
  }

\codehl_keyset_def:nn { php.xml-json }
  {
    %%%
    info / note  =
      {
        php ~  XML ~ JSON ~ extentions
      }  ,
    %%%

    php                      =      {1}
      {  %% JSON
        json_encode,  json_decode,  json_last_error,  json_last_error_msg,  
      }  ,
    php                      =      {1}
      {  %% XML
        xml_parser_create,  xml_parser_create_ns,  xml_set_object,  
        xml_set_element_handler,  xml_set_character_data_handler,  
        xml_set_processing_instruction_handler,  xml_set_default_handler,  
        xml_set_unparsed_entity_decl_handler,  xml_set_notation_decl_handler,  
        xml_set_external_entity_ref_handler,  xml_set_start_namespace_decl_handler,  
        xml_set_end_namespace_decl_handler,  xml_parse,  xml_parse_into_struct,  
        xml_get_error_code,  xml_error_string,  xml_get_current_line_number,  
        xml_get_current_column_number,  xml_get_current_byte_index,  
        xml_parser_free,  xml_parser_set_option,  
        xml_parser_get_option,  
      }
  }

\codehl_keyset_def:nn { php.date }
  {
    %%%
    info / note  =
      {
        php ~  date ~ extention
      }  ,
    %%%

    php                      =      {1}
      {  %% date
        strtotime,  date,  idate,  gmdate,  mktime,  gmmktime,  checkdate,  
        strftime,  gmstrftime,  time,  localtime,  getdate,  date_create,  
        date_create_immutable,  date_create_from_format,  
        date_create_immutable_from_format,  date_parse,  
        date_parse_from_format,  date_get_last_errors,  date_format,  
        date_modify,  date_add,  date_sub,  date_timezone_get,  
        date_timezone_set,  date_offset_get,  date_diff,  date_time_set,  
        date_date_set,  date_isodate_set,  date_timestamp_set,  
        date_timestamp_get,  timezone_open,  timezone_name_get,  
        timezone_name_from_abbr,  timezone_offset_get,  
        timezone_transitions_get,  timezone_location_get,  
        timezone_identifiers_list,  timezone_abbreviations_list,  
        timezone_version_get,  date_interval_create_from_date_string,  
        date_interval_format,  date_default_timezone_set,  
        date_default_timezone_get,  date_sunrise,  date_sunset,  
        date_sun_info,  
      }  ,
  }

%%
%% Aliases
%%

\codehl_lang_alias:nn   { php } { php.8 }
\codehl_keyset_alias:nn { php } { php.8 }

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


