% consult('D:/Cellular Information/Source Code/Prolog/PDF/PostScript__scanner.pl').

% -------------------------------------

% Copyright Eric G. Taucher 2019

% -------------------------------------

% Adobe and PostScript are either registered trademarks
% or trademarks of Adobe Systems Incorporated in the United States and/or other countries.

% All other trademarks are the property of their respective owners.

% -------------------------------------

:- module(postscript_scanner,
    [
        postscript_scanner_token//1,
        postscript_scanner_object/3
    ]).

% -------------------------------------

:- use_module(library(clpfd)).

% -------------------------------------

% NB
% phrase_from_file/3 returns the data as character codes.
% To allow using strings for the patterns in the DCG,
% the strings need to be converted to character codes.
% The conversion of the strings in the DCG to character codes when the
% source code is loaded is accomplished with
% the directive set_prolog_flag(double_quotes, codes).
%
% See: SWI-Prolog - Adapting code for double quoted strings - http://www.swi-prolog.org/pldoc/man?section=ext-dquotes-port
:- set_prolog_flag(double_quotes, codes).
:- set_prolog_flag(back_quotes, string).

% -------------------------------------

% The test cases for the scanner are in a PostScript__scanner.plt
% After this file is consulted, the test in the other file can be loaded from the command line using:
%
% ?- load_test_files([]).
%
% and run from the command as normal using
%
% ?- run_tests.
%

% If a change is made in the plt file then from the command line run to load the change
%
% ?- make.

% -------------------------------------

% References

% PostScript Language Reference third edition - https://www.adobe.com/content/dam/acom/en/devnet/actionscript/articles/PLRM.pdf
% Postscript language program design - https://www-cdf.fnal.gov/offline/PostScript/GREENBK.PDF
% A First Guide to PostScript - http://www.tailrecursive.org/postscript/postscript.html
% PostScript Languages Tutorial and Cookbook - https://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF
% Parameters for Opening PDF Files - https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
% Example for Ascii85 - https://en.wikipedia.org/wiki/Ascii85#Example_for_Ascii85

% Debugging PostScript - StackOverflow Q&A - https://stackoverflow.com/q/12379122/1243762 - Chapter 4 give much more detail about how errors are handled than PostScript reference manual.

% -------------------------------------

% Various utility predicates.
% TODO: Near project completion move these into appropriate modules. Most likely making new modules.

% peek_1,[C1] -->
%     [C1],
%     {
%         char_code(Ch1,C1),
%         format('Lookahead code : `~d'', char : `~w''~n',[C1,Ch1])
%     }.

% peek_3,[C1,C2,C3] -->
%     [C1,C2,C3],
%     {
%         string_codes(Lookahead,[C1,C2,C3]),
%         format('Lookahead codes : `~d,~d,~d''~n',[C1,C2,C3]),
%         char_code(Ch1,C1),
%         char_code(Ch2,C2),
%         char_code(Ch3,C3),
%         format('Lookahead chars : `~w'',`~w'',`~w''~n',[Ch1,Ch2,Ch3]),
%         format('Lookahead string: `~w''~n',[Lookahead])
%     }.

% peek_5,[C1,C2,C3,C4,C5] -->
%     [C1,C2,C3,C4,C5],
%     {
%         string_codes(Lookahead,[C1,C2,C3,C4,C5]),
%         format('Lookahead codes: `~d,~d,~d,~d,~d''~n',[C1,C2,C3,C4,C5]),
%         format('Lookahead: `~w''~n',[Lookahead])
%     }.

% Used to spy on arguments passed to predicate.
% Place at start of clauses for predicate.
%
% Example; needs to be changed accrodingly.
%
% s100(type_codes(Type,Codes)) -->
%     { format('~nType: ~w, Codes: ~w~n',[Type,Codes]) },
%     peek_1,
%     { fail }.

% https://stackoverflow.com/a/33543199/1243762

% Ds is a list of digits where each digit is an integer number less than base,
% e.g. for base 16 [3, 15, 10, 6] which is 0x3FA6
% Ds can not have any leading 0

n_base_digits(Expr, Base, Ds) :-
    Base #> 1,
    Ds = [_|_],
    N #=  Expr,
    N #>= 0,                                   % N is non-negative
    n_base_ref_acc_digits(N, Base, Ds, [], Ds).

 n_base_ref_acc_digits(N, Base, Ref, Ds0, Ds) :-
    zcompare(Order, N, Base),
    order_n_base_ref_acc_digits(Order, N, Base, Ref, Ds0, Ds).

 order_n_base_ref_acc_digits(<, N,    _, [_]   , Ds0,   [N|Ds0]).
 order_n_base_ref_acc_digits(=, _,    _, [_,_] , Ds0, [1,0|Ds0]).
 order_n_base_ref_acc_digits(>, N, Base, [_|Rs], Ds0, Ds) :-
    N0 #= N //  Base,
    N1 #= N mod Base,
    n_base_ref_acc_digits(N0, Base, Rs, [N1|Ds0], Ds).

% -------------------------------------

% PLRM.pdf Chapter 3 - Language
% Book page: 23 - PDF index page: 37
%
% Like all programming languages, the PostScript language builds on elements and
% ideas from several of the great programming languages. The syntax most closely
% resembles that of the programming language FORTH. It incorporates a postfix
% notation in which operators are preceded by their operands. The number of special
% characters is small and there are no reserved words.

% PLRM.pdf Section 3.1 - Interpreter
% Book page: 24 - PDF index page: 38
%
% The interpreter manipulates entities called PostScript objects. Some objects are
% data, such as numbers, boolean values, strings, and arrays. Other objects are elements
% of programs to be executed, such as names, operators, and procedures.
% However, there is not a distinction between data and programs; any PostScript
% object may be treated as data or be executed as part of a program.
%
% The interpreter operates by executing a sequence of objects. The effect of executing
% a particular object depends on that object’s type, attributes, and value. For
% example, executing a number object causes the interpreter to push a copy of that
% object on the operand stack (to be described shortly). Executing a name object
% causes the interpreter to look up the name in a dictionary, fetch the associated
% value, and execute it. Executing an operator object causes the interpreter to
% perform a built-in action, such as adding two numbers or painting characters in
% raster memory.
%
% The objects to be executed by the interpreter come from two principal sources:
%
% • A character stream may be scanned according to the syntax rules of the Post-
% Script language, producing a sequence of new objects. As each object is
% scanned, it is immediately executed. The character stream may come from an
% external source, such as a file or a communication channel, or it may come
% from a string object previously stored in the PostScript interpreter’s memory.
%
% • Objects previously stored in an array in memory may be executed in sequence.
% Such an array is known as a procedure.
%
% The interpreter can switch back and forth between executing a procedure and
% scanning a character stream. For example, if the interpreter encounters a name in
% a character stream, it executes that name by looking it up in a dictionary and retrieving
% the associated value. If that value is a procedure object, the interpreter
% suspends scanning the character stream and begins executing the objects in the
% procedure. When it reaches the end of the procedure, it resumes scanning the
% character stream where it left off. The interpreter maintains an execution stack for
% remembering all of its suspended execution contexts.

% PLRM.pdf Section 3.2 - Syntax
% Book page: 25 - PDF index page: 39
%
% There are three encodings for the PostScript language: ASCII, binary token, and
% binary object sequence.
% • The ASCII encoding is preferred for expository purposes
% (such as this book), for archiving documents, and for transmission via communications
% facilities, because it is easy to read and does not rely on any special characters
% that might be reserved for communications use.
% • The two binary encodings are usable in controlled environments to improve
% the efficiency of representation or execution;
% they are intended exclusively for machine generation. Detailed information
% on the binary encodings is provided in Section 3.14, “Binary Encoding
% Details.”

% PLRM.pdf Section 3.2.1 - Scanner
% Book page: 25 - PDF index page: 39
%
% The PostScript language differs from most other programming languages in that
% it does not have any syntactic entity for a “program,” nor is it necessary for an entire
% “program” to exist in one place at one time. There is no notion of “reading in”
% a program before executing it. Instead, the PostScript interpreter consumes a program
% by reading and executing one syntactic entity at a time. From the interpreter’s
% point of view, the program has no permanent existence. Execution of the
% program may have side effects in the interpreter’s memory or elsewhere. These
% side effects may include the creation of procedure objects in memory that are intended
% to be invoked later in the program; their execution is deferred.
%
% It is not correct to think that the PostScript interpreter “executes” the character
% stream directly. Rather, a scanner groups characters into tokens according to the
% PostScript language syntax rules. It then assembles one or more tokens to create a
% PostScript object—in other words, a data value in the interpreter’s memory.
% Finally, the interpreter executes the object.

% -------------------------------------

% PLRM.pdf Section 3.14.2 - Binary Object Sequences
% Book page: 168 - PDF index page: 182
%
% When a syntaxerror occurs, the PostScript interpreter pushes the object that
% caused the error onto the operand stack. For an error detected by the scanner,
% however, there is no such object, because the error occurs before the scanner has
% finished creating one. Instead, the scanner fabricates a string object consisting of
% the characters encountered so far in the current token. If a binary token or binary
% object sequence was being scanned, the string object produced is a description of
% the token, such as
%
% (bin obj seq, type=128, elements=23, size=234, array out of bounds)
%
% rather than the literal characters, which would be gibberish if printed as part of
% an error message.

% DO NOT DELETE.
% dict_create(Syntax_error_messages,postscript_interpreter, [
%     01:'Found `)`, expected start of PostScript object. Skipping to next object.',
%     02:'Found `]`, expected start of PostScript object. Skipping to next object.',    % Not used
%     03:'Found `}`, expected start of PostScript object. Skipping to next object.',
%     04:'Found `>`, expected start of PostScript object. Skipping to next object.',
%     05:'Dictionary key is missing a matching value.',                                 % Not used
%     06:'ASCII base-85 string is missing a matching ending ~>.',
%     07:'Literal string is missing a matching ending ).',
%     08:'Dictionary is missing a matching ending >>.',                                 % Not used
%     09:'Hexadecimal string is missing a matching ending >.',
%     10:'Array is missing a matching ending ].',                                       % Not used
%     11:'Procedure is missing a matching ending }.',
%     12:'Invalid hexadecimal character.',
%     13:'Invalid ASCII base-85 character.'
%     14:'Found `~>`, expected start of PostScript object. Skipping to next object.',
%     ]).

% PLRM.pdf Section 8.2 - Operator Details - syntaxerror
% Book page: 701 - PDF index page: 715
%
% The scanner has encountered program text that does not conform to the Post-
% Script language syntax rules (see Section 3.2, “Syntax”). This can occur either during
% interpretation of an executable file or executable string object or during
% explicit invocation of the token operator.
%
% Because the syntax of the PostScript language is simple, the set of possible causes
% for a syntaxerror is very small:
%
% • An opening string or procedure bracket—(, <, <~, or {—is not matched by a
% corresponding closing bracket before the end of the file or string being interpreted.
%
% • A closing string or procedure bracket—), >, ~>, or }—is not matched by a corresponding
% previous opening bracket.
%
% • A character other than a hexadecimal digit or white-space character appears
% within a hexadecimal string literal bracketed by < … >.
%
% • An encoding violation occurs in an ASCII base-85 string literal bracketed by
% <~ … ~>.
%
% • A binary token or binary object sequence has incorrect structure (see
% Section 3.14, “Binary Encoding Details”).
%
% Erroneous tokens, such as malformed numbers, do not produce a syntaxerror;
% such tokens are instead treated as name objects (often producing an undefined
% error when executed). Tokens that exceed implementation limits, such as names
% that are too long or numbers whose values are too large, produce a limitcheck
% error (see Appendix B).

% PLRM.pdf Section 8.2 - Operator Details - syntaxerror
% Book page: 168 - PDF index page: 181
%
% When a syntaxerror occurs, the PostScript interpreter pushes the object that
% caused the error onto the operand stack. For an error detected by the scanner,
% however, there is no such object, because the error occurs before the scanner has
% finished creating one. Instead, the scanner fabricates a string object consisting of
% the characters encountered so far in the current token. If a binary token or binary
% object sequence was being scanned, the string object produced is a description of
% the token, such as
%
%    (bin obj seq, type=128, elements=23, size=234, array out of bounds)
%
% rather than the literal characters, which would be gibberish if printed as part of
% an error message.

% -------------------------------------

% PLRM.pdf Section 3.2.2 - ASCII Encoding
% Book page: 27 - PDF index page: 41
%
% The characters (, ), <, >, [, ], {, }, /, and % are special. They delimit syntactic entities
% such as strings, procedure bodies, name literals, and comments. Any of these
% characters terminates the entity preceding it and is not included in the entity.
%
% All characters besides the white-space characters and delimiters are referred to as
% regular characters. These include nonprinting characters that are outside the recommended
% PostScript ASCII character set.

% GREENBK.pdf - Section 2.6 - The interpreter and scanner
% Book page: 23 - PDF index page: 33
%
% The PostScript interpreter deals only with objects. A separate
% entity exists between the interpreter and the standard input
% stream known as the scanner. The scanner actually converts
% incoming bytes into objects and hands them to the interpreter.
% It is invoked directly by the interpreter whenever more information
% is needed from the input stream. (Note that the scanner
% does not pre-scan any of the incoming bytes, since they could be
% used as data and not read by the interpreter.)
%
% The scanner actually tokenizes the input stream into PostScript
% objects. This includes conversion of names into name objects
% and strings into string objects. It is the scanner that makes the
% distinction between a literal and an executable name by recognizing
% the leading slash character (“/”). Thus the distinction
% between /findfont and findfont is made by the scanner, which
% sets the literal or executable flag on the resulting name object.
%
% The scanner recognizes strings (with either the (string) or
% <string> notation) and converts them into string objects. The
% scanner also recognizes the backslash notation in string objects
% (including \\, \(, \), and \octal notation). For example, if it
% encounters a sequence like the following:
%
%     (\101B\103D \\\(ABCD\) (balanced))
%
% the scanner will recognize and replace the backslash notation
% with the appropriate characters and it will produce a string
% object as follows. The parentheses are omitted because they are
% not part of the string, but indications to the scanner of where
% the string starts and end (although this string contains some
% parentheses as data, as you can see):
%
%     ABCD \(ABCD) (balanced)
%
% The scanner also is responsible for issuing the PostScript language
% syntaxerror, which can only result from mismatched
% (unbalanced) string delimiters and unexpected ends-of-file.
% There are no other syntax errors possible in the PostScript language!
%
% The PostScript interpreter invokes the scanner each time it
% needs a token from the object currently being executed. The
% scanner reads from a file or string with exactly the same semantics
% as the token operator (see the PostScript Language Reference
% Manual), returning exactly one object to the interpreter.
%
% RECOGNITION OF OBJECTS
%
% It is the scanner’s responsibility to recognize objects. There are
% only four kinds of objects that it knows how to recognize:
%
% • Literal strings: any string object delimited by either < >
% or ( ). The scanner watches for \ notation and attempts
% to find the closing delimiter. Mismatched delimiters
% result in syntaxerror.
%
% • Numbers: the scanner tries first to make a number out of
% a token. This includes reals, integers, and radix notation.
%
% • Names: anything that cannot be interpreted as one of
% the above is returned as a name object. The literal/
% executable flag is set depending on the presence of a
% leading slash (/).
%
% • Procedure bodies: Procedure bodies delimited by curly
% braces ‘{ }’ are recognized by the scanner and returned
% to the interpreter as executable array objects.
%
% There are a few special cases. For instance, the leading slash
% (indicating a literal name) overrides the scanner’s ability to recognize
% a token as a number:
%
%     /1000 type ==
%     nametype
%
% It is worth noting that any type of object can be used as a key in
% a dictionary. Names are used most often, but they are not
% required. The following is a perfectly legal, although somewhat
% confusing, PostScript language sequence (shown as though
% typed in interactive mode):
%
%     PS> 13 (thirteen) def
%     PS> 13 load ==
%     (thirteen)
%     PS>
%
% It is necessary to use load in this example because the token 13
% is recognized first as an integer, not as a name. Therefore, automatic
% name lookup is not invoked. The load operator explicitly
% invokes key lookup for any object, in the context of the current
% dictionary stack.
%
% Note:
%
%     When a name is encountered in a program, the scanner
%     returns a name object. Name objects require a fixed
%     amount of overhead, regardless of the number of bytes
%     in the name. However, time required to recognize a
%     name is proportional to its length. With this in mind, it
%     is always best to use short procedure names if the procedure
%     will be invoked many times (as in the script, but
%     not in the prologue—see Section 6.2).

% % -------

postscript_scanner_token(Postscript_token) -->
    s000(Postscript_token), !.

postscript_scanner_object(Object) -->
    s000(Token),
    { token_object(Token,Object) }, !.

% token_object(syntax_error(Number,Error)               ,syntax_error(Number,Error)).
% token_object(syntax_error(Number,Error,Items)         ,syntax_error(Number,Error,Items)).

token_object(syntax_error(Number,Token)               ,syntax_error(Number,Object)) :-
    token_object(Token,Object).
token_object(syntax_error(Number,_ITems,Token)        ,syntax_error(Number,Object)) :-
    token_object(Token,Object).

% % http://www.cs.cmu.edu/afs/andrew/scs/cs/15-463/99/pub/www/notes/ps-internals/ps-lecture.pdf - Slide 13 givex C++ data structure for objects
% struct object {
%     unsigned short type:4, exec:1, access:2;
%     unsigned short length;
%     union {
%         int integer;                                    (think integer)
%         float real;                   %                 (think floating point number)
%         unsigned char *string;        % literal_string  (think string)
%         struct name *name;            % literal_name    (think varaible)
%         struct object *array;         %                 (think ? based array)
%         struct dict *dict;            %                 (think association table)
%         unsigned int operator;        %                 (think 1st class function)
%         int boolean;                  %                 (think boolean)
%         } u;
% };

% TIPS (Thinking In PostScript)
%
% Using the // (immediately evaluated name) Notation for Constants
% One excellent use of this notation is to set up constants that you want to work like variables but will never change.

token_object(token(literal_name              ,Value) ,object(name                      ,Value,access_unlimited,false)).    % /a   literal
token_object(token(executable_name           ,Value) ,object(name                      ,Value,access_unlimited,true )).    % a    executable   operator or variable
token_object(token(immediately_evaluated_name,Value) ,object(immediately_evaluated_name,Value,access_unlimited,true )).    % //a  look up in dictionary and replaced   % Should be evaluated in scanner but needs dictionaries to evaluate, so done in interpreter.
token_object(token(integer                   ,Value) ,object(integer                   ,Value,access_unlimited,false)).
token_object(token(real                      ,Value) ,object(real                      ,Value,access_unlimited,false)).
token_object(token(literal_string            ,Value) ,object(string                    ,Value,access_unlimited,false)).
token_object(token(procedure                 ,Value) ,object(procedure                 ,Value,access_unlimited,false)).
token_object(token(comment                   ,Value) ,object(comment                   ,Value,access_unlimited,false)).    % Not a real PostScript object. Added for debugging
token_object(token(whitespace                ,Value) ,object(whitespace                ,Value,access_unlimited,false)).    % Not a real PostScript object. Added for debugging
% object_executable(token(array,Value)                       ,false).     % Not created by PostScript scanner
% object_executable(token(boolean,Value)                     ,false).     % Not created by PostScript scanner
% object_executable(token(dictionary,Value)                  ,false).     % Not created by PostScript scanner
% object_executable(token(file,Value)                        ,false).     % Not created by PostScript scanner
% object_executable(token(font,Value)                        ,false).     % Not created by PostScript scanner
% object_executable(token(gstate,Value)                      ,false).     % Not created by PostScript scanner
% object_executable(token(mark,Value)                        ,false).     % Not created by PostScript scanner
% object_executable(token(null,Value)                        ,false).     % Not created by PostScript scanner
% object_executable(token(operator,Value)                    ,true ).     % Not created by PostScript scanner
% object_executable(token(packedarrray,Value)                ,false).     % Not created by PostScript scanner
% object_executable(token(save,Value)                        ,false).     % Not created by PostScript scanner

% % -------

% s000 - Start

% PLRM.pdf Section 8.2 - Operator Details
% Book page: 701 - PDF index page: 715
%
% syntaxerror (error)
%
% The scanner has encountered program text that does not conform to the Post-
% Script language syntax rules (see Section 3.2, “Syntax”). This can occur either during
% interpretation of an executable file or executable string object or during
% explicit invocation of the token operator.
%
% Because the syntax of the PostScript language is simple, the set of possible causes
% for a syntaxerror is very small:
%
% • An opening string or procedure bracket—(, <, <~, or {—is not matched by a
% corresponding closing bracket before the end of the file or string being interpreted.
%
% • A closing string or procedure bracket—), >, ~>, or }—is not matched by a corresponding
% previous opening bracket.
%

% The longer delimiters are done first, e.g. <~,~>,<<,>>,//
s000(Postscript_token) -->
    "<~",
    s100(type_codes(Type,Codes)),
    s101(type_codes(Type,Codes),Postscript_token).
s000(syntax_error(14,token(literal_string,String))) -->
    "~>",
    s150(Codes),
    { string_codes(String,[0'~,0'>|Codes]) }.
s000(token(executable_name,'<<')) -->
    "<<".
s000(token(executable_name,'>>')) -->
    ">>".
s000(token(immediately_evaluated_name,Atom)) -->
    "//",
    s040(Codes),
    { atom_codes(Atom,Codes) }.
s000(token(comment,String)) -->
    "%",
    s070(type_codes(comment,Codes)),
    { string_codes(String,Codes ) }.
s000(Postscript_token) -->
    "(",
    s080(1,type_codes(Type,Codes)),
    s81(type_codes(Type,Codes ),Postscript_token).
s000(syntax_error(01,token(literal_string,String))) -->
    ")",
    s150(Codes),
    { string_codes(String,[0')|Codes]) }.
s000(Postscript_token) -->
    ".",
    s023(type_codes(Type,Codes0)),
    {
        (
            (Type == integer ; Type == real)
        ->
            % Prolog number_codes/2 needs a 0 before the decimal point
            Codes = [0'0,0'.|Codes0]
        ;
            Codes = [0'.|Codes0]
        )
    },
    { postscript_type_token(type_codes(Type,Codes),Postscript_token) }.
s000(token(literal_name,Atom)) -->
    "/",
    s050(Codes),
    { atom_codes(Atom,Codes) }.
s000(Postscript_token) -->
    "<",
    s090(type_codes(Type,Codes0)),
    {
        length(Codes0,N),
        (
            N == 0
        ->
            Type = syntax_error(09)
        ;
            (
                Type == syntax_error(12)
            ->
                Value_codes = Codes0
            ;
                (
                    1 is N mod 2
                ->
                    append(Codes0,[0'0],Value_codes)
                ;
                    Value_codes = Codes0
                )
            )
        ),
        Input_codes = Codes0
    },
    s091(type_codes(Type,Input_codes,Value_codes),Postscript_token).
s000(syntax_error(04,token(literal_string,String))) -->
    ">",
    s150(Codes),
    { string_codes(String,[0'>|Codes]) }.
s000(token(executable_name,'[')) -->
    "[".
s000(token(executable_name,']')) -->
    "]".
s000(Postscript_token) -->
    "{",
    s130(Items),
    s131(Items,Postscript_token).
s000(syntax_error(03,token(literal_string,String))) -->
    "}",
    s150(Codes),
    { string_codes(String,[0'}|Codes]) }.
s000(token(whitespace,[0x00|Codes]))  --> [0x00],  s060(                           Codes ).                                                                                           % NUL (null)
s000(Postscript_token)               --> [0x01],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x01|Codes]),Postscript_token) }.   % SOH (start of heading)
s000(Postscript_token)               --> [0x02],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x02|Codes]),Postscript_token) }.   % STX (start of text)
s000(Postscript_token)               --> [0x03],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x03|Codes]),Postscript_token) }.   % ETX (end of text)
s000(Postscript_token)               --> [0x04],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x04|Codes]),Postscript_token) }.   % EOT (end of transmission)
s000(Postscript_token)               --> [0x05],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x05|Codes]),Postscript_token) }.   % ENQ (enquiry)
s000(Postscript_token)               --> [0x06],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x06|Codes]),Postscript_token) }.   % ACK (acknowledge)
s000(Postscript_token)               --> [0x07],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x07|Codes]),Postscript_token) }.   % BEL (bell)
s000(Postscript_token)               --> [0x08],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x08|Codes]),Postscript_token) }.   % BS  (backspace)
s000(token(whitespace,[0x09|Codes]))  --> [0x09],  s060(                           Codes ).                                                                                           % TAB (horizontal tab)
s000(token(whitespace,[0x0A|Codes]))  --> [0x0A],  s060(                           Codes ).                                                                                           % LF  (line feed)
s000(Postscript_token)               --> [0x0B],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x0B|Codes]),Postscript_token) }.   % VT  (vertical tab)
s000(token(whitespace,[0x0C|Codes]))  --> [0x0C],  s060(                           Codes ).                                                                                           % FF  (form feed)
s000(token(whitespace,[0x0D|Codes]))  --> [0x0D],  s060(                           Codes ).                                                                                           % CR  (carriage return)
s000(Postscript_token)               --> [0x0E],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x0E|Codes]),Postscript_token) }.   % SO  (shift out)
s000(Postscript_token)               --> [0x0F],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x0F|Codes]),Postscript_token) }.   % SI  (shift in)
s000(Postscript_token)               --> [0x10],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x10|Codes]),Postscript_token) }.   % DLE (data link escape)
s000(Postscript_token)               --> [0x11],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x11|Codes]),Postscript_token) }.   % DC1 (device control 1)
s000(Postscript_token)               --> [0x12],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x12|Codes]),Postscript_token) }.   % DC2 (device control 2)
s000(Postscript_token)               --> [0x13],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x13|Codes]),Postscript_token) }.   % DC3 (device control 3)
s000(Postscript_token)               --> [0x14],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x14|Codes]),Postscript_token) }.   % DC4 (device control 4)
s000(Postscript_token)               --> [0x15],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x15|Codes]),Postscript_token) }.   % NAK (negative acknowledge)
s000(Postscript_token)               --> [0x16],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x16|Codes]),Postscript_token) }.   % SYN (synchronous idle)
s000(Postscript_token)               --> [0x17],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x17|Codes]),Postscript_token) }.   % ETB (end of trans. block)
s000(Postscript_token)               --> [0x18],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x18|Codes]),Postscript_token) }.   % CAN (cancel)
s000(Postscript_token)               --> [0x19],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x19|Codes]),Postscript_token) }.   % EM  (end of medium)
s000(Postscript_token)               --> [0x1A],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x1A|Codes]),Postscript_token) }.   % SUB (substitute)
s000(Postscript_token)               --> [0x1B],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x1B|Codes]),Postscript_token) }.   % ESC (escape)
s000(Postscript_token)               --> [0x1C],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x1C|Codes]),Postscript_token) }.   % FS  (file separator)
s000(Postscript_token)               --> [0x1D],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x1D|Codes]),Postscript_token) }.   % GS  (group separator)
s000(Postscript_token)               --> [0x1E],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x1E|Codes]),Postscript_token) }.   % RS  (record separator)
s000(Postscript_token)               --> [0x1F],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x1F|Codes]),Postscript_token) }.   % US  (unit separator)
s000(token(whitespace,[0'\s|Codes]))  --> " ",     s060(                           Codes ).                                                                                           %     (space)
s000(Postscript_token)               --> "!",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'!|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "\"",    s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'"|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "#",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'#|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "$",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'$|Codes]),Postscript_token) }.
% s000(token(comment,String))          --> "%",     s070(type_codes(comment        ,Codes)), { string_codes(String                              ,     Codes ) }.
s000(Postscript_token)               --> "&",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'&|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "'",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0''|Codes]),Postscript_token) }.
% "(" % See above
% ")" % See above
s000(Postscript_token)               --> "*",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'*|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "+",     s020(type_codes(Type           ,Codes)), { postscript_type_token(type_codes(Type           ,[0'+|Codes]),Postscript_token) }. % Type: executable_name, number
s000(Postscript_token)               --> ",",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0',|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "-",     s020(type_codes(Type           ,Codes)), { postscript_type_token(type_codes(Type           ,[0'-|Codes]),Postscript_token) }. % Type: executable_name, number
% "." % See above
% s000(token(literal_name,Atom))       --> "/" ,    s050(                           Codes ), { atom_codes(Atom                                  ,     Codes ) }.
% "/" % See above
s000(Postscript_token)               --> "0",     s010(0'0,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "1",     s010(0'1,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "2",     s010(0'2,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "3",     s010(0'3,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "4",     s010(0'4,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "5",     s010(0'5,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "6",     s010(0'6,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "7",     s010(0'7,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "8",     s010(0'8,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> "9",     s010(0'9,type_codes(Type       ,Codes)), { postscript_type_token(type_codes(Type           ,     Codes ),Postscript_token) }. % Type: executable_name, number, radix
s000(Postscript_token)               --> ":",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0':|Codes]),Postscript_token) }.
s000(Postscript_token)               --> ";",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0';|Codes]),Postscript_token) }.
% "<" % See above
s000(Postscript_token)               --> "=",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'=|Codes]),Postscript_token) }.
% ">" % See above
s000(Postscript_token)               --> "?",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'?|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "@",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'@|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "A",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'A|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "B",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'B|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "C",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'C|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "D",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'D|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "E",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'E|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "F",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'F|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "G",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'G|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "H",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'H|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "I",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'I|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "J",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'J|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "K",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'K|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "L",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'L|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "M",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'M|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "N",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'N|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "O",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'O|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "P",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'P|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "Q",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'Q|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "R",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'R|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "S",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'S|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "T",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'T|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "U",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'U|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "V",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'V|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "W",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'W|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "X",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'X|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "Y",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'Y|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "Z",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'Z|Codes]),Postscript_token) }.
% "[" % See above
% s000(Postscript_token)             --> "[",     s120(                          Items ),   s121(                                                  Items  ,Postscript_token).
% s000(Postscript_token)             --> "[",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'[|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "\\",    s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'\\|Codes]),Postscript_token) }.
% "]" % See above
% s000(Postscript_token)             --> "]",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0']|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "^",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'^|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "_",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'_|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "`",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'`|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "a",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'a|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "b",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'b|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "c",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'c|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "d",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'd|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "e",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'e|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "f",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'f|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "g",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'g|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "h",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'h|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "i",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'i|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "j",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'j|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "k",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'k|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "l",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'l|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "m",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'm|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "n",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'n|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "o",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'o|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "p",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'p|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "q",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'q|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "r",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'r|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "s",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0's|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "t",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0't|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "u",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'u|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "v",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'v|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "w",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'w|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "x",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'x|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "y",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'y|Codes]),Postscript_token) }.
s000(Postscript_token)               --> "z",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'z|Codes]),Postscript_token) }.
% s000(Postscript_token)             --> "{",     s130(                          Items ),   s131(                                                  Items  ,Postscript_token).
% "{" % See above
s000(Postscript_token)               --> "|",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'||Codes]),Postscript_token) }.
% "}" % See above
s000(Postscript_token)               --> "~",     s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0'~|Codes]),Postscript_token) }.
s000(Postscript_token)               --> [0x7F],  s030(type_codes(executable_name,Codes)), { postscript_type_token(type_codes(executable_name,[0x7F|Codes]),Postscript_token) }.

% -------

% s010 - Radix base 1

% s010(B1,type_codes(Type,Codes)) -->
%     decimal_digit(B2),
%     s011(B1,B2,type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'.|Codes])) -->
%     ".",
%     s022(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,Code|Codes])) -->
%     exponent_signifier(Code),
%     s025(type_codes(Type,Codes)).
s010(B1,Type_codes) -->
    "#",
    { number_codes(Base,[B1]) },
    (
        { (Base >=2, Base =< 36) }
    ->
        s012(Base,type_codes(Type,Codes0)),
        {
            (
                Type == radix
            ->
                Type_codes = type_codes(radix,radix(Base,Codes0))
            ;
                (
                    append([B1,0'#],Codes0,Codes),
                    Type_codes = type_codes(executable_name,Codes)
                )
            )
        }
    ;
        (
            s030(type_codes(Type,Codes)),
            { Type_codes = type_codes(Type,[B1,0'#|Codes]) }
        )
    ).
% s010(B1,type_codes(Type,[B1,Code|Codes])) -->
%     transition_set_06(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a number has successfully been matched.
% s010(B1,type_codes(number,[B1])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a number has successfully been matched.
% s010(B1,type_codes(number,[B1]),[],[]).

% s010(B1,type_codes(Type,[B1,0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                      % Whitespace
s010(B1,type_codes(Type,[B1,0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s010(B1,type_codes(Type,[B1,0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s010(B1,type_codes(Type,[B1,0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s010(B1,type_codes(Type,[B1,0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s010(B1,type_codes(Type,[B1,0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s010(B1,type_codes(Type,[B1,0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s010(B1,type_codes(Type,[B1,0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s010(B1,type_codes(Type,[B1,0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s010(B1,type_codes(Type,[B1,0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)            % Whitespace
% s010(B1,type_codes(Type,[B1,0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)                 % Whitespace
s010(B1,type_codes(Type,[B1,0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s010(B1,type_codes(Type,[B1,0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)                 % Whitespace
% s010(B1,type_codes(Type,[B1,0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)           % Whitespace
s010(B1,type_codes(Type,[B1,0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s010(B1,type_codes(Type,[B1,0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s010(B1,type_codes(Type,[B1,0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s010(B1,type_codes(Type,[B1,0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s010(B1,type_codes(Type,[B1,0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s010(B1,type_codes(Type,[B1,0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s010(B1,type_codes(Type,[B1,0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s010(B1,type_codes(Type,[B1,0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s010(B1,type_codes(Type,[B1,0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s010(B1,type_codes(Type,[B1,0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s010(B1,type_codes(Type,[B1,0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s010(B1,type_codes(Type,[B1,0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s010(B1,type_codes(Type,[B1,0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s010(B1,type_codes(Type,[B1,0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s010(B1,type_codes(Type,[B1,0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s010(B1,type_codes(Type,[B1,0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s010(B1,type_codes(Type,[B1,0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s010(B1,type_codes(Type,[B1,0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s010(B1,type_codes(Type,[B1,0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                     % Whitespace
s010(B1,type_codes(Type,[B1,0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).     % See above
s010(B1,type_codes(Type,[B1,0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).     % Delimiter
s010(B1,type_codes(Type,[B1,0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).     % Delimiter
% s010(B1,type_codes(Type,[B1,0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).     % Delimiter
s010(B1,type_codes(Type,[B1,0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'. |Codes])) --> ".",     s022(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "0",     s011(B1,0'0,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "1",     s011(B1,0'1,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "2",     s011(B1,0'2,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "3",     s011(B1,0'3,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "4",     s011(B1,0'4,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "5",     s011(B1,0'5,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "6",     s011(B1,0'6,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "7",     s011(B1,0'7,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "8",     s011(B1,0'8,type_codes(Type,Codes)).
s010(B1,type_codes(Type,Codes))           --> "9",     s011(B1,0'9,type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).     % Delimiter
s010(B1,type_codes(Type,[B1,0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).     % Delimiter
s010(B1,type_codes(Type,[B1,0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'E |Codes])) --> "E",     s025(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).     % Delimiter
s010(B1,type_codes(Type,[B1,0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).     % Delimiter
s010(B1,type_codes(Type,[B1,0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'e |Codes])) --> "e",     s025(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).     % Delimiter
s010(B1,type_codes(Type,[B1,0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s010(B1,type_codes(Type,[B1,0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).     % Delimiter
s010(B1,type_codes(Type,[B1,0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s010(B1,type_codes(Type,[B1,0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s010
% s010(B1,type_codes(number,[B1])) --> [].
s010(B1,type_codes(integer,[B1])) --> [].

% -------

% s011 - Radix base 2

% s011(B1,B2,type_codes(Type,[B1,B2,Code|Codes])) -->
%     decimal_digit(Code),
%     s021(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'.|Codes])) -->
%     ".",
%     s022(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,Code|Codes])) -->
%     exponent_signifier(Code),
%     s025(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,Code|Codes])) -->
%     transition_set_06(Code),
%     s030(type_codes(Type,Codes)).
s011(B1,B2,Type_codes) -->
    "#",
    { number_codes(Base,[B1,B2]) },
    (
        { (Base >=2, Base =< 36) }
    ->
        s012(Base,type_codes(Type,Codes0)),
        {
            (
                Type == radix
            ->
                Type_codes = type_codes(radix,radix(Base,Codes0))
            ;
                (
                    append([B1,B2,0'#],Codes0,Codes),
                    Type_codes = type_codes(executable_name,Codes)
                )
            )
        }
    ;
        % s030(type_codes(Type,[B1,B2,0'#,Codes])),
        % { Type_codes = type_codes(Type,[B1,B2,0'#,Codes]) }
        s030(type_codes(Type,Codes)),
        { Type_codes = type_codes(Type,[B1,B2,0'#|Codes]) }
    ).
% If the next character is an object delimiter or white-space, then a number has successfully been matched.
% s011(B1,B2,type_codes(number,[B1,B2])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a number has successfully been matched.
% s011(B1,B2,type_codes(number,[B1,B2]),[],[]).

% s011(B1,B2,type_codes(Type,[B1,B2,0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                      % Whitespace
s011(B1,B2,type_codes(Type,[B1,B2,0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s011(B1,B2,type_codes(Type,[B1,B2,0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s011(B1,B2,type_codes(Type,[B1,B2,0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s011(B1,B2,type_codes(Type,[B1,B2,0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s011(B1,B2,type_codes(Type,[B1,B2,0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s011(B1,B2,type_codes(Type,[B1,B2,0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s011(B1,B2,type_codes(Type,[B1,B2,0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s011(B1,B2,type_codes(Type,[B1,B2,0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s011(B1,B2,type_codes(Type,[B1,B2,0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)            % Whitespace
% s011(B1,B2,type_codes(Type,[B1,B2,0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)                 % Whitespace
s011(B1,B2,type_codes(Type,[B1,B2,0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s011(B1,B2,type_codes(Type,[B1,B2,0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)                 % Whitespace
% s011(B1,B2,type_codes(Type,[B1,B2,0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)           % Whitespace
s011(B1,B2,type_codes(Type,[B1,B2,0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s011(B1,B2,type_codes(Type,[B1,B2,0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s011(B1,B2,type_codes(Type,[B1,B2,0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s011(B1,B2,type_codes(Type,[B1,B2,0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s011(B1,B2,type_codes(Type,[B1,B2,0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s011(B1,B2,type_codes(Type,[B1,B2,0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s011(B1,B2,type_codes(Type,[B1,B2,0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s011(B1,B2,type_codes(Type,[B1,B2,0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s011(B1,B2,type_codes(Type,[B1,B2,0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s011(B1,B2,type_codes(Type,[B1,B2,0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s011(B1,B2,type_codes(Type,[B1,B2,0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s011(B1,B2,type_codes(Type,[B1,B2,0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s011(B1,B2,type_codes(Type,[B1,B2,0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s011(B1,B2,type_codes(Type,[B1,B2,0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s011(B1,B2,type_codes(Type,[B1,B2,0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s011(B1,B2,type_codes(Type,[B1,B2,0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s011(B1,B2,type_codes(Type,[B1,B2,0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s011(B1,B2,type_codes(Type,[B1,B2,0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s011(B1,B2,type_codes(Type,[B1,B2,0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                     % Whitespace
s011(B1,B2,type_codes(Type,[B1,B2,0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).     % See above
s011(B1,B2,type_codes(Type,[B1,B2,0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).     % Delimiter
s011(B1,B2,type_codes(Type,[B1,B2,0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).     % Delimiter
% s011(B1,B2,type_codes(Type,[B1,B2,0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).     % Delimiter
s011(B1,B2,type_codes(Type,[B1,B2,0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'. |Codes])) --> ".",     s022(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'0 |Codes])) --> "0",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'1 |Codes])) --> "1",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'2 |Codes])) --> "2",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'3 |Codes])) --> "3",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'4 |Codes])) --> "4",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'5 |Codes])) --> "5",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'6 |Codes])) --> "6",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'7 |Codes])) --> "7",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'8 |Codes])) --> "8",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'9 |Codes])) --> "9",     s021(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).     % Delimiter
s011(B1,B2,type_codes(Type,[B1,B2,0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).     % Delimiter
s011(B1,B2,type_codes(Type,[B1,B2,0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'E |Codes])) --> "E",     s025(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).     % Delimiter
s011(B1,B2,type_codes(Type,[B1,B2,0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).     % Delimiter
s011(B1,B2,type_codes(Type,[B1,B2,0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'e |Codes])) --> "e",     s025(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).     % Delimiter
s011(B1,B2,type_codes(Type,[B1,B2,0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s011(B1,B2,type_codes(Type,[B1,B2,0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).     % Delimiter
s011(B1,B2,type_codes(Type,[B1,B2,0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s011(B1,B2,type_codes(Type,[B1,B2,0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s011
% s011(B1,B2,type_codes(number,[B1,B2])) --> [].
s011(B1,B2,type_codes(integer,[B1,B2])) --> [].

% -------

% s012 - Radix signifier

% TODO: Hard code for common base values such as 2,8,10,16, e.g.
% s012(2,type_codes(Type,[Code|Codes])) -->
% s012(8,type_codes(Type,[Code|Codes])) -->
% s012(10,type_codes(Type,[Code|Codes])) -->
% s012(16,type_codes(Type,[Code|Codes])) -->

s012(Base,type_codes(Type,[Code|Codes])) -->
    radix_digit_code(Base,Code),
    s013(Base,type_codes(Type,Codes)).
% s012(Base,type_codes(Type,[Code|Codes])) -->
%     \+ radix_digit_code(Base,Code),
%     transition_set_07(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a executable_name has successfully been matched.
% s012(_Base,type_codes(executable_name,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a executable_name has successfully been matched.
% s012(_Base,type_codes(executable_name,[]),[],[]).

% s012(_Base,type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s012(_Base,type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s012(_Base,type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s012(_Base,type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s012(_Base,type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s012(_Base,type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s012(_Base,type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s012(_Base,type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s012(_Base,type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s012(_Base,type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s012(_Base,type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s012(_Base,type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s012(_Base,type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s012(_Base,type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s012(_Base,type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s012(_Base,type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s012(_Base,type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s012(_Base,type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s012(_Base,type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s012(_Base,type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s012(_Base,type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s012(_Base,type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s012(_Base,type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s012(_Base,type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s012(_Base,type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s012(_Base,type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s012(_Base,type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s012(_Base,type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s012(_Base,type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s012(_Base,type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s012(_Base,type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s012(_Base,type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s012(_Base,type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s012(_Base,type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s012(_Base,type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s012(_Base,type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s012(_Base,type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
% s012(_Base,type_codes(Type,[0'0 |Codes])) --> "0",     s030(type_codes(Type,Codes)).    % Common to all radix digits
% s012(_Base,type_codes(Type,[0'1 |Codes])) --> "1",     s030(type_codes(Type,Codes)).    % Common to all radix digits
s012(_Base,type_codes(Type,[0'2 |Codes])) --> "2",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'3 |Codes])) --> "3",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'4 |Codes])) --> "4",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'5 |Codes])) --> "5",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'6 |Codes])) --> "6",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'7 |Codes])) --> "7",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'8 |Codes])) --> "8",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'9 |Codes])) --> "9",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s012(_Base,type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s012(_Base,type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s012(_Base,type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s012(_Base,type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s012(_Base,type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s012(_Base,type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s012(_Base,type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s012(_Base,type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s012
s012(_Base,type_codes(executable_name,[])) --> [].

% -------

% s013 - Radix digits

s013(Base,type_codes(Type,[Code|Codes])) -->
    radix_digit_code(Base,Code),
    s013(Base,type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[Code|Codes])) -->
%     \+ radix_digit_code(Base,Code),
%     transition_set_07(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a radix number has successfully been matched.
% s013(_Base,type_codes(radix,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a radix number has successfully been matched.
% s013(_Base,type_codes(radix,[]),[],[]).

% s013(Base,type_codes(Type,[Code|Codes])) -->    \+ radix_digit_code(Base,Code),s030(type_codes(Type,Codes)).

% s013(Base,type_codes(Type,[0x00|Codes])) --> [0x00], \+ radix_digit_code(Base,0x00),s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s013(Base,type_codes(Type,[0x01|Codes])) --> [0x01], \+ radix_digit_code(Base,0x01),s030(type_codes(Type,Codes)).    % SOH (start of heading)
s013(Base,type_codes(Type,[0x02|Codes])) --> [0x02], \+ radix_digit_code(Base,0x02),s030(type_codes(Type,Codes)).    % STX (start of text)
s013(Base,type_codes(Type,[0x03|Codes])) --> [0x03], \+ radix_digit_code(Base,0x03),s030(type_codes(Type,Codes)).    % ETX (end of text)
s013(Base,type_codes(Type,[0x04|Codes])) --> [0x04], \+ radix_digit_code(Base,0x04),s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s013(Base,type_codes(Type,[0x05|Codes])) --> [0x05], \+ radix_digit_code(Base,0x05),s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s013(Base,type_codes(Type,[0x06|Codes])) --> [0x06], \+ radix_digit_code(Base,0x06),s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s013(Base,type_codes(Type,[0x07|Codes])) --> [0x07], \+ radix_digit_code(Base,0x07),s030(type_codes(Type,Codes)).    % BEL (bell)
s013(Base,type_codes(Type,[0x08|Codes])) --> [0x08], \+ radix_digit_code(Base,0x08),s030(type_codes(Type,Codes)).    % BS  (backspace)
% s013(Base,type_codes(Type,[0x09|Codes])) --> [0x09], \+ radix_digit_code(Base,0x09),s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s013(Base,type_codes(Type,[0x0A|Codes])) --> [0x0A], \+ radix_digit_code(Base,0x0A),s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s013(Base,type_codes(Type,[0x0B|Codes])) --> [0x0B], \+ radix_digit_code(Base,0x0B),s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s013(Base,type_codes(Type,[0x0C|Codes])) --> [0x0C], \+ radix_digit_code(Base,0x0C),s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s013(Base,type_codes(Type,[0x0D|Codes])) --> [0x0D], \+ radix_digit_code(Base,0x0D),s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s013(Base,type_codes(Type,[0x0E|Codes])) --> [0x0E], \+ radix_digit_code(Base,0x0E),s030(type_codes(Type,Codes)).    % SO  (shift out)
s013(Base,type_codes(Type,[0x0F|Codes])) --> [0x0F], \+ radix_digit_code(Base,0x0F),s030(type_codes(Type,Codes)).    % SI  (shift in)
s013(Base,type_codes(Type,[0x10|Codes])) --> [0x10], \+ radix_digit_code(Base,0x10),s030(type_codes(Type,Codes)).    % DLE (data link escape)
s013(Base,type_codes(Type,[0x11|Codes])) --> [0x11], \+ radix_digit_code(Base,0x11),s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s013(Base,type_codes(Type,[0x12|Codes])) --> [0x12], \+ radix_digit_code(Base,0x12),s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s013(Base,type_codes(Type,[0x13|Codes])) --> [0x13], \+ radix_digit_code(Base,0x13),s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s013(Base,type_codes(Type,[0x14|Codes])) --> [0x14], \+ radix_digit_code(Base,0x14),s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s013(Base,type_codes(Type,[0x15|Codes])) --> [0x15], \+ radix_digit_code(Base,0x15),s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s013(Base,type_codes(Type,[0x16|Codes])) --> [0x16], \+ radix_digit_code(Base,0x16),s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s013(Base,type_codes(Type,[0x17|Codes])) --> [0x17], \+ radix_digit_code(Base,0x17),s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s013(Base,type_codes(Type,[0x18|Codes])) --> [0x18], \+ radix_digit_code(Base,0x18),s030(type_codes(Type,Codes)).    % CAN (cancel)
s013(Base,type_codes(Type,[0x19|Codes])) --> [0x19], \+ radix_digit_code(Base,0x19),s030(type_codes(Type,Codes)).    % EM  (end of medium)
s013(Base,type_codes(Type,[0x1A|Codes])) --> [0x1A], \+ radix_digit_code(Base,0x1A),s030(type_codes(Type,Codes)).    % SUB (substitute)
s013(Base,type_codes(Type,[0x1B|Codes])) --> [0x1B], \+ radix_digit_code(Base,0x1B),s030(type_codes(Type,Codes)).    % ESC (escape)
s013(Base,type_codes(Type,[0x1C|Codes])) --> [0x1C], \+ radix_digit_code(Base,0x1C),s030(type_codes(Type,Codes)).    % FS  (file separator)
s013(Base,type_codes(Type,[0x1D|Codes])) --> [0x1D], \+ radix_digit_code(Base,0x1D),s030(type_codes(Type,Codes)).    % GS  (group separator)
s013(Base,type_codes(Type,[0x1E|Codes])) --> [0x1E], \+ radix_digit_code(Base,0x1E),s030(type_codes(Type,Codes)).    % RS  (record separator)
s013(Base,type_codes(Type,[0x1F|Codes])) --> [0x1F], \+ radix_digit_code(Base,0x1F),s030(type_codes(Type,Codes)).    % US  (unit separator)
% s013(Base,type_codes(Type,[0'\s|Codes])) --> " ",    \+ radix_digit_code(Base,0'\s),s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s013(Base,type_codes(Type,[0'! |Codes])) --> "!",    \+ radix_digit_code(Base,0'! ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'" |Codes])) --> "\"",   \+ radix_digit_code(Base,0'" ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'# |Codes])) --> "#",    \+ radix_digit_code(Base,0'# ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'$ |Codes])) --> "$",    \+ radix_digit_code(Base,0'$ ),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'% |Codes])) --> "%",    \+ radix_digit_code(Base,0'% ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'& |Codes])) --> "&",    \+ radix_digit_code(Base,0'& ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'\'|Codes])) --> "'",    \+ radix_digit_code(Base,0'\'),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'( |Codes])) --> "(",    \+ radix_digit_code(Base,0'( ),s030(type_codes(Type,Codes)).    % Delimiter
% s013(Base,type_codes(Type,[0') |Codes])) --> ")",    \+ radix_digit_code(Base,0') ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'* |Codes])) --> "*",    \+ radix_digit_code(Base,0'* ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'+ |Codes])) --> "+",    \+ radix_digit_code(Base,0'+ ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0', |Codes])) --> ",",    \+ radix_digit_code(Base,0', ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'- |Codes])) --> "-",    \+ radix_digit_code(Base,0'- ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'. |Codes])) --> ".",    \+ radix_digit_code(Base,0'. ),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'/ |Codes])) --> "/",    \+ radix_digit_code(Base,0'/ ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'0 |Codes])) --> "0",    \+ radix_digit_code(Base,0'0 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'1 |Codes])) --> "1",    \+ radix_digit_code(Base,0'1 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'2 |Codes])) --> "2",    \+ radix_digit_code(Base,0'2 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'3 |Codes])) --> "3",    \+ radix_digit_code(Base,0'3 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'4 |Codes])) --> "4",    \+ radix_digit_code(Base,0'4 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'5 |Codes])) --> "5",    \+ radix_digit_code(Base,0'5 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'6 |Codes])) --> "6",    \+ radix_digit_code(Base,0'6 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'7 |Codes])) --> "7",    \+ radix_digit_code(Base,0'7 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'8 |Codes])) --> "8",    \+ radix_digit_code(Base,0'8 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'9 |Codes])) --> "9",    \+ radix_digit_code(Base,0'9 ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0': |Codes])) --> ":",    \+ radix_digit_code(Base,0': ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'; |Codes])) --> ";",    \+ radix_digit_code(Base,0'; ),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'< |Codes])) --> "<",    \+ radix_digit_code(Base,0'< ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'= |Codes])) --> "=",    \+ radix_digit_code(Base,0'= ),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'> |Codes])) --> ">",    \+ radix_digit_code(Base,0'> ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'? |Codes])) --> "?",    \+ radix_digit_code(Base,0'? ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'@ |Codes])) --> "@",    \+ radix_digit_code(Base,0'@ ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'A |Codes])) --> "A",    \+ radix_digit_code(Base,0'A ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'B |Codes])) --> "B",    \+ radix_digit_code(Base,0'B ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'C |Codes])) --> "C",    \+ radix_digit_code(Base,0'C ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'D |Codes])) --> "D",    \+ radix_digit_code(Base,0'D ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'E |Codes])) --> "E",    \+ radix_digit_code(Base,0'E ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'F |Codes])) --> "F",    \+ radix_digit_code(Base,0'F ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'G |Codes])) --> "G",    \+ radix_digit_code(Base,0'G ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'H |Codes])) --> "H",    \+ radix_digit_code(Base,0'H ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'I |Codes])) --> "I",    \+ radix_digit_code(Base,0'I ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'J |Codes])) --> "J",    \+ radix_digit_code(Base,0'J ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'K |Codes])) --> "K",    \+ radix_digit_code(Base,0'K ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'L |Codes])) --> "L",    \+ radix_digit_code(Base,0'L ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'M |Codes])) --> "M",    \+ radix_digit_code(Base,0'M ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'N |Codes])) --> "N",    \+ radix_digit_code(Base,0'N ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'O |Codes])) --> "O",    \+ radix_digit_code(Base,0'O ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'P |Codes])) --> "P",    \+ radix_digit_code(Base,0'P ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'Q |Codes])) --> "Q",    \+ radix_digit_code(Base,0'Q ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'R |Codes])) --> "R",    \+ radix_digit_code(Base,0'R ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'S |Codes])) --> "S",    \+ radix_digit_code(Base,0'S ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'T |Codes])) --> "T",    \+ radix_digit_code(Base,0'T ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'U |Codes])) --> "U",    \+ radix_digit_code(Base,0'U ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'V |Codes])) --> "V",    \+ radix_digit_code(Base,0'V ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'W |Codes])) --> "W",    \+ radix_digit_code(Base,0'W ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'X |Codes])) --> "X",    \+ radix_digit_code(Base,0'X ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'Y |Codes])) --> "Y",    \+ radix_digit_code(Base,0'Y ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'Z |Codes])) --> "Z",    \+ radix_digit_code(Base,0'Z ),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'[ |Codes])) --> "[",    \+ radix_digit_code(Base,0'[ ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'\\|Codes])) --> "\\",   \+ radix_digit_code(Base,0'\\),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'] |Codes])) --> "]",    \+ radix_digit_code(Base,0'] ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'^ |Codes])) --> "^",    \+ radix_digit_code(Base,0'^ ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'_ |Codes])) --> "_",    \+ radix_digit_code(Base,0'_ ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'` |Codes])) --> "`",    \+ radix_digit_code(Base,0'` ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'a |Codes])) --> "a",    \+ radix_digit_code(Base,0'a ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'b |Codes])) --> "b",    \+ radix_digit_code(Base,0'b ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'c |Codes])) --> "c",    \+ radix_digit_code(Base,0'c ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'd |Codes])) --> "d",    \+ radix_digit_code(Base,0'd ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'e |Codes])) --> "e",    \+ radix_digit_code(Base,0'e ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'f |Codes])) --> "f",    \+ radix_digit_code(Base,0'f ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'g |Codes])) --> "g",    \+ radix_digit_code(Base,0'g ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'h |Codes])) --> "h",    \+ radix_digit_code(Base,0'h ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'i |Codes])) --> "i",    \+ radix_digit_code(Base,0'i ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'j |Codes])) --> "j",    \+ radix_digit_code(Base,0'j ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'k |Codes])) --> "k",    \+ radix_digit_code(Base,0'k ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'l |Codes])) --> "l",    \+ radix_digit_code(Base,0'l ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'm |Codes])) --> "m",    \+ radix_digit_code(Base,0'm ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'n |Codes])) --> "n",    \+ radix_digit_code(Base,0'n ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'o |Codes])) --> "o",    \+ radix_digit_code(Base,0'o ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'p |Codes])) --> "p",    \+ radix_digit_code(Base,0'p ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'q |Codes])) --> "q",    \+ radix_digit_code(Base,0'q ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'r |Codes])) --> "r",    \+ radix_digit_code(Base,0'r ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0's |Codes])) --> "s",    \+ radix_digit_code(Base,0's ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0't |Codes])) --> "t",    \+ radix_digit_code(Base,0't ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'u |Codes])) --> "u",    \+ radix_digit_code(Base,0'u ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'v |Codes])) --> "v",    \+ radix_digit_code(Base,0'v ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'w |Codes])) --> "w",    \+ radix_digit_code(Base,0'w ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'x |Codes])) --> "x",    \+ radix_digit_code(Base,0'x ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'y |Codes])) --> "y",    \+ radix_digit_code(Base,0'y ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0'z |Codes])) --> "z",    \+ radix_digit_code(Base,0'z ),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'{ |Codes])) --> "{",    \+ radix_digit_code(Base,0'{ ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'| |Codes])) --> "|",    \+ radix_digit_code(Base,0'| ),s030(type_codes(Type,Codes)).
% s013(Base,type_codes(Type,[0'} |Codes])) --> "}",    \+ radix_digit_code(Base,0'} ),s030(type_codes(Type,Codes)).    % Delimiter
s013(Base,type_codes(Type,[0'~ |Codes])) --> "~",    \+ radix_digit_code(Base,0'~ ),s030(type_codes(Type,Codes)).
s013(Base,type_codes(Type,[0xFF|Codes])) --> [0xFF], \+ radix_digit_code(Base,0xFF),s030(type_codes(Type,Codes)).

% Recursion base case for s013
s013(_Base,type_codes(radix,[])) --> [].

% S013 support predicates
radix_digit_code(Base,Code) -->
    [Code],
    {
        (
            Base =< 10
        ->
            ( Code >= 0'0, Code < (0'0 + Base) )
        ;
            (
                ( Code >= 0'0, Code < (0'0 + Base) )
            ;
                ( Code >= 0'A, Code < (0'A + (Base - 10)) )
            ;
                ( Code >= 0'a, Code < (0'a + (Base - 10)) )
            )
        )
    }.

% -------

% s028 - -. | +.

% % If '+.' is followed by end of stream then it is an executable_name.
% % NB This is not a DCG but a regular clause
% s028(type_codes(executable_name,"."),".",[]).
% % If '+.' is followed by delimiter or whitespace then it is an executable_name.
% s028(type_codes(executable_name,[0'.])) -->
%     ".",
%     peek_delimiter; peek_whitespace.

% % Otherwise treat '+.' as normal.
% s028(type_codes(Type,Codes)) -->
%     ".",
%     s022(type_codes(Type,Codes0)),
%     {
%         (
%             Type == number
%         ->
%             % Prolog number_codes/2 needs a 0 before the decimal point
%             Codes = [0'0,0'.|Codes0]
%         ;
%             Codes = [0'.|Codes0]
%         )
%     }.

% s028(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                      % Whitespace
s028(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s028(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s028(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s028(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s028(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s028(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s028(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s028(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s028(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)            % Whitespace
% s028(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)                 % Whitespace
s028(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s028(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)                 % Whitespace
% s028(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)           % Whitespace
s028(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s028(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s028(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s028(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s028(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s028(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s028(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s028(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s028(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s028(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s028(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s028(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s028(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s028(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s028(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s028(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s028(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s028(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s028(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                     % Whitespace
s028(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'" |Codes])) --> "\"",    s028(type_codes(Type,Codes)).
s028(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s028(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'0 |Codes])) --> "0",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'1 |Codes])) --> "1",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'2 |Codes])) --> "2",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'3 |Codes])) --> "3",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'4 |Codes])) --> "4",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'5 |Codes])) --> "5",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'6 |Codes])) --> "6",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'7 |Codes])) --> "7",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'8 |Codes])) --> "8",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0'9 |Codes])) --> "9",     s024(type_codes(Type,Codes)).
s028(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'\\|Codes])) --> "\\",    s028(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s028(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s028(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s028(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s028
s028(type_codes(executable_name,[])) --> [].

% -------

% s028 - Whole sign

% Special case, e.g. '+.' or '+.[. Easier to handle as special case then add and adjust clauses.

% If '+.' is followed by end of stream then it is an executable_name.
% NB This is not a DCG but a regular clause
s020(type_codes(executable_name,"."),".",[]).
% If '+.' is followed by delimiter or whitespace then it is an executable_name.
s020(type_codes(executable_name,[0'.])) -->
    ".",
    peek_delimiter; peek_whitespace.

% Otherwise treat '+.' as normal.
s020(type_codes(Type,Codes)) -->
    ".",
    s022(type_codes(Type,Codes0)),
    {
        (
            % Type == number
            (Type == integer ; Type == real)
        ->
            % Prolog number_codes/2 needs a 0 before the decimal point
            Codes = [0'0,0'.|Codes0]
        ;
            Codes = [0'.|Codes0]
        )
    }.

% s020(type_codes(Type,[0x00|Codes])) --> [0x00],  s020(type_codes(Type,Codes)).  % NUL (null)                      % Whitespace
s020(type_codes(Type,[0x01|Codes])) --> [0x01],  s020(type_codes(Type,Codes)).    % SOH (start of heading)
s020(type_codes(Type,[0x02|Codes])) --> [0x02],  s020(type_codes(Type,Codes)).    % STX (start of text)
s020(type_codes(Type,[0x03|Codes])) --> [0x03],  s020(type_codes(Type,Codes)).    % ETX (end of text)
s020(type_codes(Type,[0x04|Codes])) --> [0x04],  s020(type_codes(Type,Codes)).    % EOT (end of transmission)
s020(type_codes(Type,[0x05|Codes])) --> [0x05],  s020(type_codes(Type,Codes)).    % ENQ (enquiry)
s020(type_codes(Type,[0x06|Codes])) --> [0x06],  s020(type_codes(Type,Codes)).    % ACK (acknowledge)
s020(type_codes(Type,[0x07|Codes])) --> [0x07],  s020(type_codes(Type,Codes)).    % BEL (bell)
s020(type_codes(Type,[0x08|Codes])) --> [0x08],  s020(type_codes(Type,Codes)).    % BS  (backspace)
% s020(type_codes(Type,[0x09|Codes])) --> [0x09],  s020(type_codes(Type,Codes)).  % TAB (horizontal tab)            % Whitespace
% s020(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s020(type_codes(Type,Codes)).  % LF  (line feed)                 % Whitespace
s020(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s020(type_codes(Type,Codes)).    % VT  (vertical tab)
% s020(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s020(type_codes(Type,Codes)).  % FF  (form feed)                 % Whitespace
% s020(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s020(type_codes(Type,Codes)).  % CR  (carriage return)           % Whitespace
s020(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s020(type_codes(Type,Codes)).    % SO  (shift out)
s020(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s020(type_codes(Type,Codes)).    % SI  (shift in)
s020(type_codes(Type,[0x10|Codes])) --> [0x10],  s020(type_codes(Type,Codes)).    % DLE (data link escape)
s020(type_codes(Type,[0x11|Codes])) --> [0x11],  s020(type_codes(Type,Codes)).    % DC1 (device control 1)
s020(type_codes(Type,[0x12|Codes])) --> [0x12],  s020(type_codes(Type,Codes)).    % DC2 (device control 2)
s020(type_codes(Type,[0x13|Codes])) --> [0x13],  s020(type_codes(Type,Codes)).    % DC3 (device control 3)
s020(type_codes(Type,[0x14|Codes])) --> [0x14],  s020(type_codes(Type,Codes)).    % DC4 (device control 4)
s020(type_codes(Type,[0x15|Codes])) --> [0x15],  s020(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s020(type_codes(Type,[0x16|Codes])) --> [0x16],  s020(type_codes(Type,Codes)).    % SYN (synchronous idle)
s020(type_codes(Type,[0x17|Codes])) --> [0x17],  s020(type_codes(Type,Codes)).    % ETB (end of trans. block)
s020(type_codes(Type,[0x18|Codes])) --> [0x18],  s020(type_codes(Type,Codes)).    % CAN (cancel)
s020(type_codes(Type,[0x19|Codes])) --> [0x19],  s020(type_codes(Type,Codes)).    % EM  (end of medium)
s020(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s020(type_codes(Type,Codes)).    % SUB (substitute)
s020(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s020(type_codes(Type,Codes)).    % ESC (escape)
s020(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s020(type_codes(Type,Codes)).    % FS  (file separator)
s020(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s020(type_codes(Type,Codes)).    % GS  (group separator)
s020(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s020(type_codes(Type,Codes)).    % RS  (record separator)
s020(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s020(type_codes(Type,Codes)).    % US  (unit separator)
% s020(type_codes(Type,[0'\s|Codes])) --> " ",     s020(type_codes(Type,Codes)).  %     (space)                     % Whitespace
s020(type_codes(Type,[0'! |Codes])) --> "!",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'" |Codes])) --> "\"",    s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'# |Codes])) --> "#",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'$ |Codes])) --> "$",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'% |Codes])) --> "%",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'& |Codes])) --> "&",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'\'|Codes])) --> "'",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'( |Codes])) --> "(",     s020(type_codes(Type,Codes)).    % Delimiter
% s020(type_codes(Type,[0') |Codes])) --> ")",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'* |Codes])) --> "*",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'+ |Codes])) --> "+",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0', |Codes])) --> ",",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'- |Codes])) --> "-",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'. |Codes])) --> ".",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'/ |Codes])) --> "/",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'0 |Codes])) --> "0",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'1 |Codes])) --> "1",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'2 |Codes])) --> "2",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'3 |Codes])) --> "3",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'4 |Codes])) --> "4",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'5 |Codes])) --> "5",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'6 |Codes])) --> "6",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'7 |Codes])) --> "7",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'8 |Codes])) --> "8",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0'9 |Codes])) --> "9",     s021(type_codes(Type,Codes)).
s020(type_codes(Type,[0': |Codes])) --> ":",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'; |Codes])) --> ";",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'< |Codes])) --> "<",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'= |Codes])) --> "=",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'> |Codes])) --> ">",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'? |Codes])) --> "?",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'@ |Codes])) --> "@",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'A |Codes])) --> "A",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'B |Codes])) --> "B",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'C |Codes])) --> "C",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'D |Codes])) --> "D",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'E |Codes])) --> "E",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'F |Codes])) --> "F",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'G |Codes])) --> "G",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'H |Codes])) --> "H",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'I |Codes])) --> "I",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'J |Codes])) --> "J",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'K |Codes])) --> "K",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'L |Codes])) --> "L",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'M |Codes])) --> "M",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'N |Codes])) --> "N",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'O |Codes])) --> "O",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'P |Codes])) --> "P",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'Q |Codes])) --> "Q",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'R |Codes])) --> "R",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'S |Codes])) --> "S",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'T |Codes])) --> "T",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'U |Codes])) --> "U",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'V |Codes])) --> "V",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'W |Codes])) --> "W",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'X |Codes])) --> "X",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'Y |Codes])) --> "Y",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'Z |Codes])) --> "Z",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'[ |Codes])) --> "[",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'\\|Codes])) --> "\\",    s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'] |Codes])) --> "]",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'^ |Codes])) --> "^",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'_ |Codes])) --> "_",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'` |Codes])) --> "`",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'a |Codes])) --> "a",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'b |Codes])) --> "b",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'c |Codes])) --> "c",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'd |Codes])) --> "d",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'e |Codes])) --> "e",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'f |Codes])) --> "f",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'g |Codes])) --> "g",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'h |Codes])) --> "h",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'i |Codes])) --> "i",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'j |Codes])) --> "j",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'k |Codes])) --> "k",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'l |Codes])) --> "l",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'm |Codes])) --> "m",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'n |Codes])) --> "n",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'o |Codes])) --> "o",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'p |Codes])) --> "p",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'q |Codes])) --> "q",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'r |Codes])) --> "r",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0's |Codes])) --> "s",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0't |Codes])) --> "t",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'u |Codes])) --> "u",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'v |Codes])) --> "v",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'w |Codes])) --> "w",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'x |Codes])) --> "x",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'y |Codes])) --> "y",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0'z |Codes])) --> "z",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'{ |Codes])) --> "{",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'| |Codes])) --> "|",     s020(type_codes(Type,Codes)).
% s020(type_codes(Type,[0'} |Codes])) --> "}",     s020(type_codes(Type,Codes)).    % Delimiter
s020(type_codes(Type,[0'~ |Codes])) --> "~",     s020(type_codes(Type,Codes)).
s020(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s020(type_codes(Type,Codes)).

% Recursion base case for s020
s020(type_codes(executable_name,[])) --> [].

% -------

% s021 - Whole digits

% s021(type_codes(Type,[Code|Codes])) -->
%     decimal_digit(Code),
%     s021(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'.|Codes])) -->
%     ".",
%     s022(type_codes(Type,Codes)).
% s021(type_codes(Type,[Code|Codes])) -->
%     transition_set_01(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a number has successfully been matched.
% s021(type_codes(number,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a number has successfully been matched.
% s021(type_codes(number,[]),[],[]).

% s021(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s021(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s021(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s021(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s021(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s021(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s021(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s021(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s021(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s021(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s021(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s021(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s021(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s021(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s021(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s021(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s021(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s021(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s021(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s021(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s021(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s021(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s021(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s021(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s021(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s021(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s021(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s021(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s021(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s021(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s021(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s021(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s021(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s021(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s021(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'. |Codes])) --> ".",     s022(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'0 |Codes])) --> "0",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'1 |Codes])) --> "1",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'2 |Codes])) --> "2",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'3 |Codes])) --> "3",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'4 |Codes])) --> "4",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'5 |Codes])) --> "5",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'6 |Codes])) --> "6",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'7 |Codes])) --> "7",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'8 |Codes])) --> "8",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0'9 |Codes])) --> "9",     s021(type_codes(Type,Codes)).
s021(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s021(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s021(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s021(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s021
s021(type_codes(_Type,[])) --> [].

% transition_set_01(0'!) --> "!".
% transition_set_01(0'") --> "\"".
% transition_set_01(0'#) --> "#".
% transition_set_01(0'$) --> "$".
% % transition_set_01(0'%) --> "%".   % Delimiter
% transition_set_01(0'&) --> "&".
% transition_set_01(0'\') --> "'".
% % transition_set_01(0'() --> "(".   % Delimiter
% % transition_set_01(0')) --> ")".   % Delimiter
% transition_set_01(0'*) --> "*".
% transition_set_01(0'+) --> "+".
% transition_set_01(0',) --> ",".
% transition_set_01(0'-) --> "-".
% % transition_set_01(0'.) --> ".".   % Other transition
% % transition_set_01(0'/) --> "/".   % Delimiter
% % transition_set_01(0'0) --> "0".   % Other transition
% % transition_set_01(0'1) --> "1".   % Other transition
% % transition_set_01(0'2) --> "2".   % Other transition
% % transition_set_01(0'3) --> "3".   % Other transition
% % transition_set_01(0'4) --> "4".   % Other transition
% % transition_set_01(0'5) --> "5".   % Other transition
% % transition_set_01(0'6) --> "6".   % Other transition
% % transition_set_01(0'7) --> "7".   % Other transition
% % transition_set_01(0'8) --> "8".   % Other transition
% % transition_set_01(0'9) --> "9".   % Other transition
% transition_set_01(0':) --> ":".
% transition_set_01(0';) --> ";".
% % transition_set_01(0'<) --> "<".   % Delimiter
% transition_set_01(0'=) --> "=".
% % transition_set_01(0'>) --> ">".   % Delimiter
% transition_set_01(0'?) --> "?".
% transition_set_01(0'@) --> "@".
% transition_set_01(0'A) --> "A".
% transition_set_01(0'B) --> "B".
% transition_set_01(0'C) --> "C".
% transition_set_01(0'D) --> "D".
% transition_set_01(0'E) --> "E".
% transition_set_01(0'F) --> "F".
% transition_set_01(0'G) --> "G".
% transition_set_01(0'H) --> "H".
% transition_set_01(0'I) --> "I".
% transition_set_01(0'J) --> "J".
% transition_set_01(0'K) --> "K".
% transition_set_01(0'L) --> "L".
% transition_set_01(0'M) --> "M".
% transition_set_01(0'N) --> "N".
% transition_set_01(0'O) --> "O".
% transition_set_01(0'P) --> "P".
% transition_set_01(0'Q) --> "Q".
% transition_set_01(0'R) --> "R".
% transition_set_01(0'S) --> "S".
% transition_set_01(0'T) --> "T".
% transition_set_01(0'U) --> "U".
% transition_set_01(0'V) --> "V".
% transition_set_01(0'W) --> "W".
% transition_set_01(0'X) --> "X".
% transition_set_01(0'Y) --> "Y".
% transition_set_01(0'Z) --> "Z".
% % transition_set_01(0'[) --> "[".   % Delimiter
% transition_set_01(0'\\) --> "\\".
% % transition_set_01(0']) --> "]".   % Delimiter
% transition_set_01(0'^) --> "^".
% transition_set_01(0'_) --> "_".
% transition_set_01(0'`) --> "`".
% transition_set_01(0'a) --> "a".
% transition_set_01(0'b) --> "b".
% transition_set_01(0'c) --> "c".
% transition_set_01(0'd) --> "d".
% transition_set_01(0'e) --> "e".
% transition_set_01(0'f) --> "f".
% transition_set_01(0'g) --> "g".
% transition_set_01(0'h) --> "h".
% transition_set_01(0'i) --> "i".
% transition_set_01(0'j) --> "j".
% transition_set_01(0'k) --> "k".
% transition_set_01(0'l) --> "l".
% transition_set_01(0'm) --> "m".
% transition_set_01(0'n) --> "n".
% transition_set_01(0'o) --> "o".
% transition_set_01(0'p) --> "p".
% transition_set_01(0'q) --> "q".
% transition_set_01(0'r) --> "r".
% transition_set_01(0's) --> "s".
% transition_set_01(0't) --> "t".
% transition_set_01(0'u) --> "u".
% transition_set_01(0'v) --> "v".
% transition_set_01(0'w) --> "w".
% transition_set_01(0'x) --> "x".
% transition_set_01(0'y) --> "y".
% transition_set_01(0'z) --> "z".
% % transition_set_01(0'{) --> "{".   % Delimiter
% transition_set_01(0'|) --> "|".
% % transition_set_01(0'}) --> "}".   % Delimiter
% transition_set_01(0'~) --> "~".

% -------

% s023 - Point

% s023(type_codes(Type,[Code|Codes])) -->
%     decimal_digit(Code),
%     s024(type_codes(Type,Codes)).
% s023(type_codes(Type,[Code|Codes])) -->
%     transition_set_02(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a executable_name has successfully been matched.
% Prolog number_codes/2 needs a 0 after the decimal point
% s023(type_codes(executable_name,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a executable_name has successfully been matched.
% Prolog number_codes/2 needs a 0 after the decimal point
% s023(type_codes(executable_name,[]),[],[]).

% s023(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s023(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s023(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s023(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s023(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s023(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s023(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s023(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s023(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s023(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s023(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s023(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s023(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s023(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s023(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s023(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s023(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s023(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s023(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s023(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s023(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s023(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s023(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s023(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s023(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s023(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s023(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s023(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s023(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s023(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s023(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s023(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s023(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s023(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s023(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'0 |Codes])) --> "0",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'1 |Codes])) --> "1",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'2 |Codes])) --> "2",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'3 |Codes])) --> "3",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'4 |Codes])) --> "4",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'5 |Codes])) --> "5",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'6 |Codes])) --> "6",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'7 |Codes])) --> "7",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'8 |Codes])) --> "8",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0'9 |Codes])) --> "9",     s024(type_codes(Type,Codes)).
s023(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s023(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s023(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s023(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s023
s023(type_codes(executable_name,[])) --> [].

% -------

% s022 - Fraction point

% s022(type_codes(Type,[Code|Codes])) -->
%     decimal_digit(Code),
%     s024(type_codes(Type,Codes)).
% s022(type_codes(Type,[Code|Codes])) -->
%     transition_set_02(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a number has successfully been matched.
% Prolog number_codes/2 needs a 0 after the decimal point
% s022(type_codes(number,[0'0])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a number has successfully been matched.
% Prolog number_codes/2 needs a 0 after the decimal point
% s022(type_codes(number,[0'0]),[],[]).

% s022(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s022(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s022(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s022(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s022(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s022(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s022(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s022(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s022(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s022(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s022(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s022(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s022(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s022(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s022(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s022(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s022(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s022(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s022(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s022(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s022(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s022(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s022(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s022(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s022(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s022(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s022(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s022(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s022(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s022(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s022(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s022(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s022(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s022(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s022(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'0 |Codes])) --> "0",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'1 |Codes])) --> "1",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'2 |Codes])) --> "2",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'3 |Codes])) --> "3",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'4 |Codes])) --> "4",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'5 |Codes])) --> "5",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'6 |Codes])) --> "6",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'7 |Codes])) --> "7",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'8 |Codes])) --> "8",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0'9 |Codes])) --> "9",     s024(type_codes(Type,Codes)).
s022(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s022(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s022(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s022(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s022
% s022(type_codes(number,[0'0])) --> [].
s022(type_codes(real,[0'0])) --> [].

% transition_set_02(0'!) --> "!".
% transition_set_02(0'") --> "\"".
% transition_set_02(0'#) --> "#".
% transition_set_02(0'$) --> "$".
% % transition_set_02(0'%) --> "%".   % Delimiter
% transition_set_02(0'&) --> "&".
% transition_set_02(0'\') --> "'".
% % transition_set_02(0'() --> "(".   % Delimiter
% % transition_set_02(0')) --> ")".   % Delimiter
% transition_set_02(0'*) --> "*".
% transition_set_02(0'+) --> "+".
% transition_set_02(0',) --> ",".
% transition_set_02(0'-) --> "-".
% transition_set_02(0'.) --> ".".
% % transition_set_02(0'/) --> "/".   % Delimiter
% % transition_set_02(0'0) --> "0".   % Other transition
% % transition_set_02(0'1) --> "1".   % Other transition
% % transition_set_02(0'2) --> "2".   % Other transition
% % transition_set_02(0'3) --> "3".   % Other transition
% % transition_set_02(0'4) --> "4".   % Other transition
% % transition_set_02(0'5) --> "5".   % Other transition
% % transition_set_02(0'6) --> "6".   % Other transition
% % transition_set_02(0'7) --> "7".   % Other transition
% % transition_set_02(0'8) --> "8".   % Other transition
% % transition_set_02(0'9) --> "9".   % Other transition
% transition_set_02(0':) --> ":".
% transition_set_02(0';) --> ";".
% % transition_set_02(0'<) --> "<".   % Delimiter
% transition_set_02(0'=) --> "=".
% % transition_set_02(0'>) --> ">".   % Delimiter
% transition_set_02(0'?) --> "?".
% transition_set_02(0'@) --> "@".
% transition_set_02(0'A) --> "A".
% transition_set_02(0'B) --> "B".
% transition_set_02(0'C) --> "C".
% transition_set_02(0'D) --> "D".
% transition_set_02(0'E) --> "E".
% transition_set_02(0'F) --> "F".
% transition_set_02(0'G) --> "G".
% transition_set_02(0'H) --> "H".
% transition_set_02(0'I) --> "I".
% transition_set_02(0'J) --> "J".
% transition_set_02(0'K) --> "K".
% transition_set_02(0'L) --> "L".
% transition_set_02(0'M) --> "M".
% transition_set_02(0'N) --> "N".
% transition_set_02(0'O) --> "O".
% transition_set_02(0'P) --> "P".
% transition_set_02(0'Q) --> "Q".
% transition_set_02(0'R) --> "R".
% transition_set_02(0'S) --> "S".
% transition_set_02(0'T) --> "T".
% transition_set_02(0'U) --> "U".
% transition_set_02(0'V) --> "V".
% transition_set_02(0'W) --> "W".
% transition_set_02(0'X) --> "X".
% transition_set_02(0'Y) --> "Y".
% transition_set_02(0'Z) --> "Z".
% % transition_set_02(0'[) --> "[".   % Delimiter
% transition_set_02(0'\\) --> "\\".
% % transition_set_02(0']) --> "]".   % Delimiter
% transition_set_02(0'^) --> "^".
% transition_set_02(0'_) --> "_".
% transition_set_02(0'`) --> "`".
% transition_set_02(0'a) --> "a".
% transition_set_02(0'b) --> "b".
% transition_set_02(0'c) --> "c".
% transition_set_02(0'd) --> "d".
% transition_set_02(0'e) --> "e".
% transition_set_02(0'f) --> "f".
% transition_set_02(0'g) --> "g".
% transition_set_02(0'h) --> "h".
% transition_set_02(0'i) --> "i".
% transition_set_02(0'j) --> "j".
% transition_set_02(0'k) --> "k".
% transition_set_02(0'l) --> "l".
% transition_set_02(0'm) --> "m".
% transition_set_02(0'n) --> "n".
% transition_set_02(0'o) --> "o".
% transition_set_02(0'p) --> "p".
% transition_set_02(0'q) --> "q".
% transition_set_02(0'r) --> "r".
% transition_set_02(0's) --> "s".
% transition_set_02(0't) --> "t".
% transition_set_02(0'u) --> "u".
% transition_set_02(0'v) --> "v".
% transition_set_02(0'w) --> "w".
% transition_set_02(0'x) --> "x".
% transition_set_02(0'y) --> "y".
% transition_set_02(0'z) --> "z".
% % transition_set_02(0'{) --> "{".   % Delimiter
% transition_set_02(0'|) --> "|".
% % transition_set_02(0'}) --> "}".   % Delimiter
% transition_set_02(0'~) --> "~".

% -------

% s024 - Fraction digits

% s024(type_codes(Type,[Code|Codes])) -->
%     decimal_digit(Code),
%     s024(type_codes(Type,Codes)).
% s024(type_codes(Type,[Code|Codes])) -->
%     exponent_signifier(Code),
%     s025(type_codes(Type,Codes)).
% s024(type_codes(Type,[Code|Codes])) -->
%     transition_set_04(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a number has successfully been matched.
% s024(type_codes(number,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a number has successfully been matched.
% s024(type_codes(number,[]),[],[]).

% exponent_signifier(0'e) --> "e".
% exponent_signifier(0'E) --> "E".

% s024(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s024(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s024(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s024(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s024(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s024(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s024(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s024(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s024(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s024(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s024(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s024(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s024(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s024(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s024(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s024(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s024(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s024(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s024(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s024(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s024(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s024(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s024(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s024(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s024(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s024(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s024(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s024(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s024(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s024(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s024(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s024(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s024(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s024(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s024(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'0 |Codes])) --> "0",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'1 |Codes])) --> "1",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'2 |Codes])) --> "2",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'3 |Codes])) --> "3",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'4 |Codes])) --> "4",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'5 |Codes])) --> "5",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'6 |Codes])) --> "6",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'7 |Codes])) --> "7",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'8 |Codes])) --> "8",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0'9 |Codes])) --> "9",     s024(type_codes(Type,Codes)).
s024(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'E |Codes])) --> "E",     s025(type_codes(Type,Codes)).
s024(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'e |Codes])) --> "e",     s025(type_codes(Type,Codes)).
s024(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s024(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s024(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s024(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s024
% s024(type_codes(number,[])) --> [].
s024(type_codes(real,[])) --> [].

% transition_set_04(0'!) --> "!".
% transition_set_04(0'") --> "\"".
% transition_set_04(0'#) --> "#".
% transition_set_04(0'$) --> "$".
% % transition_set_04(0'%) --> "%".   % Delimiter
% transition_set_04(0'&) --> "&".
% transition_set_04(0'\') --> "'".
% % transition_set_04(0'() --> "(".   % Delimiter
% % transition_set_04(0')) --> ")".   % Delimiter
% transition_set_04(0'*) --> "*".
% % transition_set_04(0'+) --> "+".   % Other transition
% transition_set_04(0',) --> ",".
% % transition_set_04(0'-) --> "-".   % Other transition
% transition_set_04(0'.) --> ".".
% % transition_set_04(0'/) --> "/".   % Delimiter
% % transition_set_04(0'0) --> "0".   % Other transition
% % transition_set_04(0'1) --> "1".   % Other transition
% % transition_set_04(0'2) --> "2".   % Other transition
% % transition_set_04(0'3) --> "3".   % Other transition
% % transition_set_04(0'4) --> "4".   % Other transition
% % transition_set_04(0'5) --> "5".   % Other transition
% % transition_set_04(0'6) --> "6".   % Other transition
% % transition_set_04(0'7) --> "7".   % Other transition
% % transition_set_04(0'8) --> "8".   % Other transition
% % transition_set_04(0'9) --> "9".   % Other transition
% transition_set_04(0':) --> ":".
% transition_set_04(0';) --> ";".
% % transition_set_04(0'<) --> "<".   % Delimiter
% transition_set_04(0'=) --> "=".
% % transition_set_04(0'>) --> ">".   % Delimiter
% transition_set_04(0'?) --> "?".
% transition_set_04(0'@) --> "@".
% transition_set_04(0'A) --> "A".
% transition_set_04(0'B) --> "B".
% transition_set_04(0'C) --> "C".
% transition_set_04(0'D) --> "D".
% transition_set_04(0'E) --> "E".
% transition_set_04(0'F) --> "F".
% transition_set_04(0'G) --> "G".
% transition_set_04(0'H) --> "H".
% transition_set_04(0'I) --> "I".
% transition_set_04(0'J) --> "J".
% transition_set_04(0'K) --> "K".
% transition_set_04(0'L) --> "L".
% transition_set_04(0'M) --> "M".
% transition_set_04(0'N) --> "N".
% transition_set_04(0'O) --> "O".
% transition_set_04(0'P) --> "P".
% transition_set_04(0'Q) --> "Q".
% transition_set_04(0'R) --> "R".
% transition_set_04(0'S) --> "S".
% transition_set_04(0'T) --> "T".
% transition_set_04(0'U) --> "U".
% transition_set_04(0'V) --> "V".
% transition_set_04(0'W) --> "W".
% transition_set_04(0'X) --> "X".
% transition_set_04(0'Y) --> "Y".
% transition_set_04(0'Z) --> "Z".
% % transition_set_04(0'[) --> "[".   % Delimiter
% transition_set_04(0'\\) --> "\\".
% % transition_set_04(0']) --> "]".   % Delimiter
% transition_set_04(0'^) --> "^".
% transition_set_04(0'_) --> "_".
% transition_set_04(0'`) --> "`".
% transition_set_04(0'a) --> "a".
% transition_set_04(0'b) --> "b".
% transition_set_04(0'c) --> "c".
% transition_set_04(0'd) --> "d".
% transition_set_04(0'e) --> "e".
% transition_set_04(0'f) --> "f".
% transition_set_04(0'g) --> "g".
% transition_set_04(0'h) --> "h".
% transition_set_04(0'i) --> "i".
% transition_set_04(0'j) --> "j".
% transition_set_04(0'k) --> "k".
% transition_set_04(0'l) --> "l".
% transition_set_04(0'm) --> "m".
% transition_set_04(0'n) --> "n".
% transition_set_04(0'o) --> "o".
% transition_set_04(0'p) --> "p".
% transition_set_04(0'q) --> "q".
% transition_set_04(0'r) --> "r".
% transition_set_04(0's) --> "s".
% transition_set_04(0't) --> "t".
% transition_set_04(0'u) --> "u".
% transition_set_04(0'v) --> "v".
% transition_set_04(0'w) --> "w".
% transition_set_04(0'x) --> "x".
% transition_set_04(0'y) --> "y".
% transition_set_04(0'z) --> "z".
% % transition_set_04(0'{) --> "{".   % Delimiter
% transition_set_04(0'|) --> "|".
% % transition_set_04(0'}) --> "}".   % Delimiter
% transition_set_04(0'~) --> "~".

% -------

% s025 - Exponent signifier

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Numbers
% Book page: 28 - PDF index page: 42
%
% A real number consists of an optional sign and one or more decimal digits, with
% an embedded period (decimal point), a trailing exponent, or both. The exponent,
% if present, consists of the letter E or e followed by an optional sign and one or
% more decimal digits. The number is interpreted as a real number and is converted
% to a real (floating-point) object. If it exceeds the implementation limit for real
% numbers, a limitcheck error occurs.

% TODO: Find limits of SWI-Prolog and map to errors
%
% See: https://www.tutorialspoint.com/cprogramming/c_data_types.htm
% ?- float(1.0e308).
% true.
%
% ?- float(1.0e309).
% ERROR: Syntax error: float_overflow
% ERROR: float
% ERROR: ** here **
% ERROR: (1.0e309) .
% ?-
%
% ?- float(1.72E308).
% true.
%
% ?- float(1.7E308+0.1).
% false.
%
% ?- float(1.7E308+0.00000000000000000000001).
% false.

% set_prolog_flag(bounded,[true,false])

% s025(type_codes(Type,[Code|Codes])) -->
%     number_sign(Code),
%     s026(type_codes(Type,Codes)).
% s025(type_codes(Type,[Code|Codes])) -->
%     decimal_digit(Code),
%     s027(type_codes(Type,Codes)).
% s025(type_codes(Type,[Code|Codes])) -->
%     transition_set_04(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a executable_name has successfully been matched.
% s025(type_codes(executable_name,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a executable_name has successfully been matched.
% s025(type_codes(executable_name,[]),[],[]).

% number_sign(0'-) --> "-".
% number_sign(0'+) --> "+".

% s025(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s025(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s025(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s025(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s025(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s025(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s025(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s025(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s025(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s025(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s025(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s025(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s025(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s025(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s025(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s025(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s025(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s025(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s025(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s025(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s025(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s025(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s025(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s025(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s025(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s025(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s025(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s025(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s025(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s025(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s025(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s025(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s025(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s025(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s025(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'+ |Codes])) --> "+",     s026(type_codes(Type,Codes)).
s025(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'- |Codes])) --> "-",     s026(type_codes(Type,Codes)).
s025(type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'0 |Codes])) --> "0",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'1 |Codes])) --> "1",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'2 |Codes])) --> "2",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'3 |Codes])) --> "3",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'4 |Codes])) --> "4",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'5 |Codes])) --> "5",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'6 |Codes])) --> "6",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'7 |Codes])) --> "7",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'8 |Codes])) --> "8",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0'9 |Codes])) --> "9",     s027(type_codes(Type,Codes)).
s025(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s025(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s025(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s025(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s025
s025(type_codes(executable_name,[])) --> [].

% -------

% s026 - Exponent sign

% s026(type_codes(Type,[Code|Codes])) -->
%     decimal_digit(Code),
%     s027(type_codes(Type,Codes)).
% s026(type_codes(Type,[Code|Codes])) -->
%     transition_set_02(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a executable_name has successfully been matched.
% s026(type_codes(executable_name,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a executable_name has successfully been matched.
% s026(type_codes(executable_name,[]),[],[]).

% s026(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s026(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s026(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s026(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s026(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s026(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s026(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s026(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s026(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s026(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s026(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s026(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s026(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s026(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s026(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s026(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s026(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s026(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s026(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s026(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s026(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s026(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s026(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s026(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s026(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s026(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s026(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s026(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s026(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s026(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s026(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s026(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s026(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s026(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s026(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'0 |Codes])) --> "0",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'1 |Codes])) --> "1",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'2 |Codes])) --> "2",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'3 |Codes])) --> "3",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'4 |Codes])) --> "4",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'5 |Codes])) --> "5",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'6 |Codes])) --> "6",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'7 |Codes])) --> "7",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'8 |Codes])) --> "8",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0'9 |Codes])) --> "9",     s027(type_codes(Type,Codes)).
s026(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s026(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s026(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s026(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s026
s026(type_codes(executable_name,[])) --> [].

% -------

% s027 - Exponent digits

% s027(type_codes(Type,[Code|Codes])) -->
%     decimal_digit(Code),
%     s027(type_codes(Type,Codes)).
% s027(type_codes(Type,[Code|Codes])) -->
%     transition_set_02(Code),
%     s030(type_codes(Type,Codes)).

% If the next character is an object delimiter or white-space, then a number has successfully been matched.
% s027(type_codes(number,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a number has successfully been matched.
% s027(type_codes(number,[]),[],[]).

% s027(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s027(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s027(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s027(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s027(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s027(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s027(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s027(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s027(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s027(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s027(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s027(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s027(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s027(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s027(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s027(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s027(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s027(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s027(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s027(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s027(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s027(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s027(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s027(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s027(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s027(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s027(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s027(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s027(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s027(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s027(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s027(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s027(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s027(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s027(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'0 |Codes])) --> "0",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'1 |Codes])) --> "1",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'2 |Codes])) --> "2",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'3 |Codes])) --> "3",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'4 |Codes])) --> "4",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'5 |Codes])) --> "5",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'6 |Codes])) --> "6",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'7 |Codes])) --> "7",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'8 |Codes])) --> "8",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0'9 |Codes])) --> "9",     s027(type_codes(Type,Codes)).
s027(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s027(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s027(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s027(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s027
% s027(type_codes(number,[])) --> [].
s027(type_codes(real,[])) --> [].

% -------

% s030 - Executable name

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Names
% Book page: 31 - PDF index page: 45
%
% Any token that consists entirely of regular characters and cannot be interpreted as
% a number is treated as a name object (more precisely, an executable name). All
% characters except delimiters and white-space characters can appear in names, including
% characters ordinarily considered to be punctuation.

% s030(type_codes(Type,[Code|Codes])) -->
%     regular_character(Code),
%     s030(type_codes(Type,Codes)).
% If the next character is an object delimiter or white-space, then a executable_name has successfully been matched.
% s030(type_codes(executable_name,[])) -->
%     peek_delimiter; peek_whitespace.
% If there are no more codes in the list, then a executable_name has successfully been matched.
% s030(type_codes(executable_name,[]),R,R).

% s030(type_codes(Type,[0x00|Codes])) --> [0x00],  s030(type_codes(Type,Codes)).  % NUL (null)                    % Whitespace
s030(type_codes(Type,[0x01|Codes])) --> [0x01],  s030(type_codes(Type,Codes)).    % SOH (start of heading)
s030(type_codes(Type,[0x02|Codes])) --> [0x02],  s030(type_codes(Type,Codes)).    % STX (start of text)
s030(type_codes(Type,[0x03|Codes])) --> [0x03],  s030(type_codes(Type,Codes)).    % ETX (end of text)
s030(type_codes(Type,[0x04|Codes])) --> [0x04],  s030(type_codes(Type,Codes)).    % EOT (end of transmission)
s030(type_codes(Type,[0x05|Codes])) --> [0x05],  s030(type_codes(Type,Codes)).    % ENQ (enquiry)
s030(type_codes(Type,[0x06|Codes])) --> [0x06],  s030(type_codes(Type,Codes)).    % ACK (acknowledge)
s030(type_codes(Type,[0x07|Codes])) --> [0x07],  s030(type_codes(Type,Codes)).    % BEL (bell)
s030(type_codes(Type,[0x08|Codes])) --> [0x08],  s030(type_codes(Type,Codes)).    % BS  (backspace)
% s030(type_codes(Type,[0x09|Codes])) --> [0x09],  s030(type_codes(Type,Codes)).  % TAB (horizontal tab)          % Whitespace
% s030(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s030(type_codes(Type,Codes)).  % LF  (line feed)               % Whitespace
s030(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s030(type_codes(Type,Codes)).    % VT  (vertical tab)
% s030(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s030(type_codes(Type,Codes)).  % FF  (form feed)               % Whitespace
% s030(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s030(type_codes(Type,Codes)).  % CR  (carriage return)         % Whitespace
s030(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s030(type_codes(Type,Codes)).    % SO  (shift out)
s030(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s030(type_codes(Type,Codes)).    % SI  (shift in)
s030(type_codes(Type,[0x10|Codes])) --> [0x10],  s030(type_codes(Type,Codes)).    % DLE (data link escape)
s030(type_codes(Type,[0x11|Codes])) --> [0x11],  s030(type_codes(Type,Codes)).    % DC1 (device control 1)
s030(type_codes(Type,[0x12|Codes])) --> [0x12],  s030(type_codes(Type,Codes)).    % DC2 (device control 2)
s030(type_codes(Type,[0x13|Codes])) --> [0x13],  s030(type_codes(Type,Codes)).    % DC3 (device control 3)
s030(type_codes(Type,[0x14|Codes])) --> [0x14],  s030(type_codes(Type,Codes)).    % DC4 (device control 4)
s030(type_codes(Type,[0x15|Codes])) --> [0x15],  s030(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s030(type_codes(Type,[0x16|Codes])) --> [0x16],  s030(type_codes(Type,Codes)).    % SYN (synchronous idle)
s030(type_codes(Type,[0x17|Codes])) --> [0x17],  s030(type_codes(Type,Codes)).    % ETB (end of trans. block)
s030(type_codes(Type,[0x18|Codes])) --> [0x18],  s030(type_codes(Type,Codes)).    % CAN (cancel)
s030(type_codes(Type,[0x19|Codes])) --> [0x19],  s030(type_codes(Type,Codes)).    % EM  (end of medium)
s030(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s030(type_codes(Type,Codes)).    % SUB (substitute)
s030(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s030(type_codes(Type,Codes)).    % ESC (escape)
s030(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s030(type_codes(Type,Codes)).    % FS  (file separator)
s030(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s030(type_codes(Type,Codes)).    % GS  (group separator)
s030(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s030(type_codes(Type,Codes)).    % RS  (record separator)
s030(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s030(type_codes(Type,Codes)).    % US  (unit separator)
% s030(type_codes(Type,[0'\s|Codes])) --> " ",     s030(type_codes(Type,Codes)).  %     (space)                   % Whitespace
s030(type_codes(Type,[0'! |Codes])) --> "!",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'" |Codes])) --> "\"",    s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'# |Codes])) --> "#",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'$ |Codes])) --> "$",     s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'% |Codes])) --> "%",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'& |Codes])) --> "&",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'\'|Codes])) --> "'",     s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'( |Codes])) --> "(",     s030(type_codes(Type,Codes)).    % Delimiter
% s030(type_codes(Type,[0') |Codes])) --> ")",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'* |Codes])) --> "*",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'+ |Codes])) --> "+",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0', |Codes])) --> ",",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'- |Codes])) --> "-",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'. |Codes])) --> ".",     s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'/ |Codes])) --> "/",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'0 |Codes])) --> "0",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'1 |Codes])) --> "1",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'2 |Codes])) --> "2",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'3 |Codes])) --> "3",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'4 |Codes])) --> "4",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'5 |Codes])) --> "5",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'6 |Codes])) --> "6",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'7 |Codes])) --> "7",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'8 |Codes])) --> "8",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'9 |Codes])) --> "9",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0': |Codes])) --> ":",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'; |Codes])) --> ";",     s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'< |Codes])) --> "<",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'= |Codes])) --> "=",     s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'> |Codes])) --> ">",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'? |Codes])) --> "?",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'@ |Codes])) --> "@",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'A |Codes])) --> "A",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'B |Codes])) --> "B",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'C |Codes])) --> "C",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'D |Codes])) --> "D",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'E |Codes])) --> "E",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'F |Codes])) --> "F",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'G |Codes])) --> "G",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'H |Codes])) --> "H",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'I |Codes])) --> "I",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'J |Codes])) --> "J",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'K |Codes])) --> "K",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'L |Codes])) --> "L",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'M |Codes])) --> "M",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'N |Codes])) --> "N",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'O |Codes])) --> "O",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'P |Codes])) --> "P",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'Q |Codes])) --> "Q",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'R |Codes])) --> "R",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'S |Codes])) --> "S",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'T |Codes])) --> "T",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'U |Codes])) --> "U",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'V |Codes])) --> "V",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'W |Codes])) --> "W",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'X |Codes])) --> "X",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'Y |Codes])) --> "Y",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'Z |Codes])) --> "Z",     s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'[ |Codes])) --> "[",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'\\|Codes])) --> "\\",    s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'] |Codes])) --> "]",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'^ |Codes])) --> "^",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'_ |Codes])) --> "_",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'` |Codes])) --> "`",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'a |Codes])) --> "a",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'b |Codes])) --> "b",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'c |Codes])) --> "c",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'd |Codes])) --> "d",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'e |Codes])) --> "e",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'f |Codes])) --> "f",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'g |Codes])) --> "g",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'h |Codes])) --> "h",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'i |Codes])) --> "i",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'j |Codes])) --> "j",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'k |Codes])) --> "k",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'l |Codes])) --> "l",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'm |Codes])) --> "m",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'n |Codes])) --> "n",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'o |Codes])) --> "o",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'p |Codes])) --> "p",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'q |Codes])) --> "q",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'r |Codes])) --> "r",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0's |Codes])) --> "s",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0't |Codes])) --> "t",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'u |Codes])) --> "u",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'v |Codes])) --> "v",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'w |Codes])) --> "w",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'x |Codes])) --> "x",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'y |Codes])) --> "y",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0'z |Codes])) --> "z",     s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'{ |Codes])) --> "{",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'| |Codes])) --> "|",     s030(type_codes(Type,Codes)).
% s030(type_codes(Type,[0'} |Codes])) --> "}",     s030(type_codes(Type,Codes)).    % Delimiter
s030(type_codes(Type,[0'~ |Codes])) --> "~",     s030(type_codes(Type,Codes)).
s030(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s030(type_codes(Type,Codes)).

% Recursion base case for s030
s030(type_codes(executable_name,[])) --> [].

% % regular_character(0x00) --> [0x00].  % NUL (null)                      % Whitespace
% regular_character(0x01) --> [0x01].    % SOH (start of heading)
% regular_character(0x02) --> [0x02].    % STX (start of text)
% regular_character(0x03) --> [0x03].    % ETX (end of text)
% regular_character(0x04) --> [0x04].    % EOT (end of transmission)
% regular_character(0x05) --> [0x05].    % ENQ (enquiry)
% regular_character(0x06) --> [0x06].    % ACK (acknowledge)
% regular_character(0x07) --> [0x07].    % BEL (bell)
% regular_character(0x08) --> [0x08].    % BS  (backspace)
% % regular_character(0x09) --> [0x09].  % TAB (horizontal tab)            % Whitespace
% % regular_character(0x0A) --> [0x0A].  % LF  (line feed)                 % Whitespace
% regular_character(0x0B) --> [0x0B].    % VT  (vertical tab)
% % regular_character(0x0C) --> [0x0C].  % FF  (form feed)                 % Whitespace
% % regular_character(0x0D) --> [0x0D].  % CR  (carriage return)           % Whitespace
% regular_character(0x0E) --> [0x0E].    % SO  (shift out)
% regular_character(0x0F) --> [0x0F].    % SI  (shift in)
% regular_character(0x10) --> [0x10].    % DLE (data link escape)
% regular_character(0x11) --> [0x11].    % DC1 (device control 1)
% regular_character(0x12) --> [0x12].    % DC2 (device control 2)
% regular_character(0x13) --> [0x13].    % DC3 (device control 3)
% regular_character(0x14) --> [0x14].    % DC4 (device control 4)
% regular_character(0x15) --> [0x15].    % NAK (negative acknowledge)
% regular_character(0x16) --> [0x16].    % SYN (synchronous idle)
% regular_character(0x17) --> [0x17].    % ETB (end of trans. block)
% regular_character(0x18) --> [0x18].    % CAN (cancel)
% regular_character(0x19) --> [0x19].    % EM  (end of medium)
% regular_character(0x1A) --> [0x1A].    % SUB (substitute)
% regular_character(0x1B) --> [0x1B].    % ESC (escape)
% regular_character(0x1C) --> [0x1C].    % FS  (file separator)
% regular_character(0x1D) --> [0x1D].    % GS  (group separator)
% regular_character(0x1E) --> [0x1E].    % RS  (record separator)
% regular_character(0x1F) --> [0x1F].    % US  (unit separator)
% % regular_character(0'\s) --> " ".     %     (space)                     % Whitespace
% regular_character(0'!)  --> "!".
% regular_character(0'")  --> "\"".
% regular_character(0'#)  --> "#".
% regular_character(0'$)  --> "$".
% % regular_character(0'%)  --> "%".    % Delimiter
% regular_character(0'&)  --> "&".
% regular_character(0'\') --> "'".
% % regular_character(0'()  --> "(".    % Delimiter
% % regular_character(0'))  --> ")".    % Delimiter
% regular_character(0'*)  --> "*".
% regular_character(0'+)  --> "+".
% regular_character(0',)  --> ",".
% regular_character(0'-)  --> "-".
% regular_character(0'.)  --> ".".
% % regular_character(0'/)  --> "/".    % Delimiter
% regular_character(0'0)  --> "0".
% regular_character(0'1)  --> "1".
% regular_character(0'2)  --> "2".
% regular_character(0'3)  --> "3".
% regular_character(0'4)  --> "4".
% regular_character(0'5)  --> "5".
% regular_character(0'6)  --> "6".
% regular_character(0'7)  --> "7".
% regular_character(0'8)  --> "8".
% regular_character(0'9)  --> "9".
% regular_character(0':)  --> ":".
% regular_character(0';)  --> ";".
% % regular_character(0'<)  --> "<".    % Delimiter
% regular_character(0'=)  --> "=".
% % regular_character(0'>)  --> ">".    % Delimiter
% regular_character(0'?)  --> "?".
% regular_character(0'@)  --> "@".
% regular_character(0'A)  --> "A".
% regular_character(0'B)  --> "B".
% regular_character(0'C)  --> "C".
% regular_character(0'D)  --> "D".
% regular_character(0'E)  --> "E".
% regular_character(0'F)  --> "F".
% regular_character(0'G)  --> "G".
% regular_character(0'H)  --> "H".
% regular_character(0'I)  --> "I".
% regular_character(0'J)  --> "J".
% regular_character(0'K)  --> "K".
% regular_character(0'L)  --> "L".
% regular_character(0'M)  --> "M".
% regular_character(0'N)  --> "N".
% regular_character(0'O)  --> "O".
% regular_character(0'P)  --> "P".
% regular_character(0'Q)  --> "Q".
% regular_character(0'R)  --> "R".
% regular_character(0'S)  --> "S".
% regular_character(0'T)  --> "T".
% regular_character(0'U)  --> "U".
% regular_character(0'V)  --> "V".
% regular_character(0'W)  --> "W".
% regular_character(0'X)  --> "X".
% regular_character(0'Y)  --> "Y".
% regular_character(0'Z)  --> "Z".
% % regular_character(0'[)  --> "[".    % Delimiter
% regular_character(0'\\) --> "\\".
% % regular_character(0'])  --> "]".    % Delimiter
% regular_character(0'^)  --> "^".
% regular_character(0'_)  --> "_".
% regular_character(0'`)  --> "`".
% regular_character(0'a)  --> "a".
% regular_character(0'b)  --> "b".
% regular_character(0'c)  --> "c".
% regular_character(0'd)  --> "d".
% regular_character(0'e)  --> "e".
% regular_character(0'f)  --> "f".
% regular_character(0'g)  --> "g".
% regular_character(0'h)  --> "h".
% regular_character(0'i)  --> "i".
% regular_character(0'j)  --> "j".
% regular_character(0'k)  --> "k".
% regular_character(0'l)  --> "l".
% regular_character(0'm)  --> "m".
% regular_character(0'n)  --> "n".
% regular_character(0'o)  --> "o".
% regular_character(0'p)  --> "p".
% regular_character(0'q)  --> "q".
% regular_character(0'r)  --> "r".
% regular_character(0's)  --> "s".
% regular_character(0't)  --> "t".
% regular_character(0'u)  --> "u".
% regular_character(0'v)  --> "v".
% regular_character(0'w)  --> "w".
% regular_character(0'x)  --> "x".
% regular_character(0'y)  --> "y".
% regular_character(0'z)  --> "z".
% % regular_character(0'{)  --> "{".    % Delimiter
% regular_character(0'|)  --> "|".
% % regular_character(0'})  --> "}".    % Delimiter
% regular_character(0'~)  --> "~".
% regular_character(0xFF)  --> [0xFF]. % DEL

% ---------------------------

% s040 - Immediately evaluated name

% PLRM.pdf Section 3.12.2 - Immediately Evaluated Names
% Book page: 121 - PDF index page: 135
%
% 3.12.2 Immediately Evaluated Names
%
% LanguageLevels 2 and 3, as well as most LanguageLevel 1 implementations (see
% Appendix A), include a syntax feature called immediately evaluated names. When
% the PostScript language scanner encounters a token of the form //name (a name
% preceded by two slashes with no intervening spaces), it immediately looks up the
% name and substitutes the corresponding value. This lookup occurs in the dictionaries
% on the dictionary stack at the time the scanner encounters the token. If it
% cannot find the name, an undefined error occurs.
%
% The substitution occurs immediately—even inside an executable array delimited
% by { and }, where execution is deferred. Note that this process is a substitution and
% not an execution; that is, the name’s value is not executed, but rather is substituted
% for the name itself, just as if the load operator were applied to the name.
%
% The most common use of immediately evaluated names is to perform early binding
% of objects (other than operators) in procedure definitions. The bind operator,
% described in the previous section, performs early binding of operators; binding
% objects of other types requires the explicit use of immediately evaluated names.

% s040([Code|Codes]) -->
%     transition_set_07(Code),
%     s040(Codes).
% Note: There are no checks for delimiters, whitespace or end of list because only the characters in transition_set_07 are allowed.
% Recursion base case for s040
% s040([]) --> [].

% s040([0x00|Codes]) --> [0x00],  s040(Codes).  % NUL (null)                    % Whitespace
s040([0x01|Codes]) --> [0x01],  s040(Codes).    % SOH (start of heading)
s040([0x02|Codes]) --> [0x02],  s040(Codes).    % STX (start of text)
s040([0x03|Codes]) --> [0x03],  s040(Codes).    % ETX (end of text)
s040([0x04|Codes]) --> [0x04],  s040(Codes).    % EOT (end of transmission)
s040([0x05|Codes]) --> [0x05],  s040(Codes).    % ENQ (enquiry)
s040([0x06|Codes]) --> [0x06],  s040(Codes).    % ACK (acknowledge)
s040([0x07|Codes]) --> [0x07],  s040(Codes).    % BEL (bell)
s040([0x08|Codes]) --> [0x08],  s040(Codes).    % BS  (backspace)
% s040([0x09|Codes]) --> [0x09],  s040(Codes).  % TAB (horizontal tab)          % Whitespace
% s040([0x0A|Codes]) --> [0x0A],  s040(Codes).  % LF  (line feed)               % Whitespace
s040([0x0B|Codes]) --> [0x0B],  s040(Codes).    % VT  (vertical tab)
% s040([0x0C|Codes]) --> [0x0C],  s040(Codes).  % FF  (form feed)               % Whitespace
% s040([0x0D|Codes]) --> [0x0D],  s040(Codes).  % CR  (carriage return)         % Whitespace
s040([0x0E|Codes]) --> [0x0E],  s040(Codes).    % SO  (shift out)
s040([0x0F|Codes]) --> [0x0F],  s040(Codes).    % SI  (shift in)
s040([0x10|Codes]) --> [0x10],  s040(Codes).    % DLE (data link escape)
s040([0x11|Codes]) --> [0x11],  s040(Codes).    % DC1 (device control 1)
s040([0x12|Codes]) --> [0x12],  s040(Codes).    % DC2 (device control 2)
s040([0x13|Codes]) --> [0x13],  s040(Codes).    % DC3 (device control 3)
s040([0x14|Codes]) --> [0x14],  s040(Codes).    % DC4 (device control 4)
s040([0x15|Codes]) --> [0x15],  s040(Codes).    % NAK (negative acknowledge)
s040([0x16|Codes]) --> [0x16],  s040(Codes).    % SYN (synchronous idle)
s040([0x17|Codes]) --> [0x17],  s040(Codes).    % ETB (end of trans. block)
s040([0x18|Codes]) --> [0x18],  s040(Codes).    % CAN (cancel)
s040([0x19|Codes]) --> [0x19],  s040(Codes).    % EM  (end of medium)
s040([0x1A|Codes]) --> [0x1A],  s040(Codes).    % SUB (substitute)
s040([0x1B|Codes]) --> [0x1B],  s040(Codes).    % ESC (escape)
s040([0x1C|Codes]) --> [0x1C],  s040(Codes).    % FS  (file separator)
s040([0x1D|Codes]) --> [0x1D],  s040(Codes).    % GS  (group separator)
s040([0x1E|Codes]) --> [0x1E],  s040(Codes).    % RS  (record separator)
s040([0x1F|Codes]) --> [0x1F],  s040(Codes).    % US  (unit separator)
% s040([0'\s|Codes]) --> " ",     s040(Codes).  %     (space)                   % Whitespace
s040([0'! |Codes]) --> "!",     s040(Codes).
s040([0'" |Codes]) --> "\"",    s040(Codes).
s040([0'# |Codes]) --> "#",     s040(Codes).
s040([0'$ |Codes]) --> "$",     s040(Codes).
% s040([0'% |Codes]) --> "%",     s040(Codes).    % Delimiter
s040([0'& |Codes]) --> "&",     s040(Codes).
s040([0'\'|Codes]) --> "'",     s040(Codes).
% s040([0'( |Codes]) --> "(",     s040(Codes).    % Delimiter
% s040([0') |Codes]) --> ")",     s040(Codes).    % Delimiter
s040([0'* |Codes]) --> "*",     s040(Codes).
s040([0'+ |Codes]) --> "+",     s040(Codes).
s040([0', |Codes]) --> ",",     s040(Codes).
s040([0'- |Codes]) --> "-",     s040(Codes).
s040([0'. |Codes]) --> ".",     s040(Codes).
% s040([0'/ |Codes]) --> "/",     s040(Codes).    % Delimiter
s040([0'0 |Codes]) --> "0",     s040(Codes).
s040([0'1 |Codes]) --> "1",     s040(Codes).
s040([0'2 |Codes]) --> "2",     s040(Codes).
s040([0'3 |Codes]) --> "3",     s040(Codes).
s040([0'4 |Codes]) --> "4",     s040(Codes).
s040([0'5 |Codes]) --> "5",     s040(Codes).
s040([0'6 |Codes]) --> "6",     s040(Codes).
s040([0'7 |Codes]) --> "7",     s040(Codes).
s040([0'8 |Codes]) --> "8",     s040(Codes).
s040([0'9 |Codes]) --> "9",     s040(Codes).
s040([0': |Codes]) --> ":",     s040(Codes).
s040([0'; |Codes]) --> ";",     s040(Codes).
% s040([0'< |Codes]) --> "<",     s040(Codes).    % Delimiter
s040([0'= |Codes]) --> "=",     s040(Codes).
% s040([0'> |Codes]) --> ">",     s040(Codes).    % Delimiter
s040([0'? |Codes]) --> "?",     s040(Codes).
s040([0'@ |Codes]) --> "@",     s040(Codes).
s040([0'A |Codes]) --> "A",     s040(Codes).
s040([0'B |Codes]) --> "B",     s040(Codes).
s040([0'C |Codes]) --> "C",     s040(Codes).
s040([0'D |Codes]) --> "D",     s040(Codes).
s040([0'E |Codes]) --> "E",     s040(Codes).
s040([0'F |Codes]) --> "F",     s040(Codes).
s040([0'G |Codes]) --> "G",     s040(Codes).
s040([0'H |Codes]) --> "H",     s040(Codes).
s040([0'I |Codes]) --> "I",     s040(Codes).
s040([0'J |Codes]) --> "J",     s040(Codes).
s040([0'K |Codes]) --> "K",     s040(Codes).
s040([0'L |Codes]) --> "L",     s040(Codes).
s040([0'M |Codes]) --> "M",     s040(Codes).
s040([0'N |Codes]) --> "N",     s040(Codes).
s040([0'O |Codes]) --> "O",     s040(Codes).
s040([0'P |Codes]) --> "P",     s040(Codes).
s040([0'Q |Codes]) --> "Q",     s040(Codes).
s040([0'R |Codes]) --> "R",     s040(Codes).
s040([0'S |Codes]) --> "S",     s040(Codes).
s040([0'T |Codes]) --> "T",     s040(Codes).
s040([0'U |Codes]) --> "U",     s040(Codes).
s040([0'V |Codes]) --> "V",     s040(Codes).
s040([0'W |Codes]) --> "W",     s040(Codes).
s040([0'X |Codes]) --> "X",     s040(Codes).
s040([0'Y |Codes]) --> "Y",     s040(Codes).
s040([0'Z |Codes]) --> "Z",     s040(Codes).
% s040([0'[ |Codes]) --> "[",     s040(Codes).    % Delimiter
s040([0'\\|Codes]) --> "\\",    s040(Codes).
% s040([0'] |Codes]) --> "]",     s040(Codes).    % Delimiter
s040([0'^ |Codes]) --> "^",     s040(Codes).
s040([0'_ |Codes]) --> "_",     s040(Codes).
s040([0'` |Codes]) --> "`",     s040(Codes).
s040([0'a |Codes]) --> "a",     s040(Codes).
s040([0'b |Codes]) --> "b",     s040(Codes).
s040([0'c |Codes]) --> "c",     s040(Codes).
s040([0'd |Codes]) --> "d",     s040(Codes).
s040([0'e |Codes]) --> "e",     s040(Codes).
s040([0'f |Codes]) --> "f",     s040(Codes).
s040([0'g |Codes]) --> "g",     s040(Codes).
s040([0'h |Codes]) --> "h",     s040(Codes).
s040([0'i |Codes]) --> "i",     s040(Codes).
s040([0'j |Codes]) --> "j",     s040(Codes).
s040([0'k |Codes]) --> "k",     s040(Codes).
s040([0'l |Codes]) --> "l",     s040(Codes).
s040([0'm |Codes]) --> "m",     s040(Codes).
s040([0'n |Codes]) --> "n",     s040(Codes).
s040([0'o |Codes]) --> "o",     s040(Codes).
s040([0'p |Codes]) --> "p",     s040(Codes).
s040([0'q |Codes]) --> "q",     s040(Codes).
s040([0'r |Codes]) --> "r",     s040(Codes).
s040([0's |Codes]) --> "s",     s040(Codes).
s040([0't |Codes]) --> "t",     s040(Codes).
s040([0'u |Codes]) --> "u",     s040(Codes).
s040([0'v |Codes]) --> "v",     s040(Codes).
s040([0'w |Codes]) --> "w",     s040(Codes).
s040([0'x |Codes]) --> "x",     s040(Codes).
s040([0'y |Codes]) --> "y",     s040(Codes).
s040([0'z |Codes]) --> "z",     s040(Codes).
% s040([0'{ |Codes]) --> "{",     s040(Codes).    % Delimiter
s040([0'| |Codes]) --> "|",     s040(Codes).
% s040([0'} |Codes]) --> "}",     s040(Codes).    % Delimiter
s040([0'~ |Codes]) --> "~",     s040(Codes).
s040([0xFF|Codes]) --> [0xFF],  s040(Codes).

% Recursion base case for s040
s040([]) --> [].

% transition_set_07(0'!) --> "!".
% transition_set_07(0'") --> "\"".
% transition_set_07(0'#) --> "#".
% transition_set_07(0'$) --> "$".
% % transition_set_07(0'%) --> "%".   % Delimiter
% transition_set_07(0'&) --> "&".
% transition_set_07(0'\') --> "'".
% % transition_set_07(0'() --> "(".   % Delimiter
% % transition_set_07(0')) --> ")".   % Delimiter
% transition_set_07(0'*) --> "*".
% transition_set_07(0'+) --> "+".
% transition_set_07(0',) --> ",".
% transition_set_07(0'-) --> "-".
% transition_set_07(0'.) --> ".".
% % transition_set_07(0'/) --> "/".   % Delimiter
% transition_set_07(0'0) --> "0".
% transition_set_07(0'1) --> "1".
% transition_set_07(0'2) --> "2".
% transition_set_07(0'3) --> "3".
% transition_set_07(0'4) --> "4".
% transition_set_07(0'5) --> "5".
% transition_set_07(0'6) --> "6".
% transition_set_07(0'7) --> "7".
% transition_set_07(0'8) --> "8".
% transition_set_07(0'9) --> "9".
% transition_set_07(0':) --> ":".
% transition_set_07(0';) --> ";".
% % transition_set_07(0'<) --> "<".   % Delimiter
% transition_set_07(0'=) --> "=".
% % transition_set_07(0'>) --> ">".   % Delimiter
% transition_set_07(0'?) --> "?".
% transition_set_07(0'@) --> "@".
% transition_set_07(0'A) --> "A".
% transition_set_07(0'B) --> "B".
% transition_set_07(0'C) --> "C".
% transition_set_07(0'D) --> "D".
% transition_set_07(0'E) --> "E".
% transition_set_07(0'F) --> "F".
% transition_set_07(0'G) --> "G".
% transition_set_07(0'H) --> "H".
% transition_set_07(0'I) --> "I".
% transition_set_07(0'J) --> "J".
% transition_set_07(0'K) --> "K".
% transition_set_07(0'L) --> "L".
% transition_set_07(0'M) --> "M".
% transition_set_07(0'N) --> "N".
% transition_set_07(0'O) --> "O".
% transition_set_07(0'P) --> "P".
% transition_set_07(0'Q) --> "Q".
% transition_set_07(0'R) --> "R".
% transition_set_07(0'S) --> "S".
% transition_set_07(0'T) --> "T".
% transition_set_07(0'U) --> "U".
% transition_set_07(0'V) --> "V".
% transition_set_07(0'W) --> "W".
% transition_set_07(0'X) --> "X".
% transition_set_07(0'Y) --> "Y".
% transition_set_07(0'Z) --> "Z".
% % transition_set_07(0'[) --> "[".   % Delimiter
% transition_set_07(0'\\) --> "\\".
% % transition_set_07(0']) --> "]".   % Delimiter
% transition_set_07(0'^) --> "^".
% transition_set_07(0'_) --> "_".
% transition_set_07(0'`) --> "`".
% transition_set_07(0'a) --> "a".
% transition_set_07(0'b) --> "b".
% transition_set_07(0'c) --> "c".
% transition_set_07(0'd) --> "d".
% transition_set_07(0'e) --> "e".
% transition_set_07(0'f) --> "f".
% transition_set_07(0'g) --> "g".
% transition_set_07(0'h) --> "h".
% transition_set_07(0'i) --> "i".
% transition_set_07(0'j) --> "j".
% transition_set_07(0'k) --> "k".
% transition_set_07(0'l) --> "l".
% transition_set_07(0'm) --> "m".
% transition_set_07(0'n) --> "n".
% transition_set_07(0'o) --> "o".
% transition_set_07(0'p) --> "p".
% transition_set_07(0'q) --> "q".
% transition_set_07(0'r) --> "r".
% transition_set_07(0's) --> "s".
% transition_set_07(0't) --> "t".
% transition_set_07(0'u) --> "u".
% transition_set_07(0'v) --> "v".
% transition_set_07(0'w) --> "w".
% transition_set_07(0'x) --> "x".
% transition_set_07(0'y) --> "y".
% transition_set_07(0'z) --> "z".
% % transition_set_07(0'{) --> "{".   % Delimiter
% transition_set_07(0'|) --> "|".
% % transition_set_07(0'}) --> "}".   % Delimiter
% transition_set_07(0'~) --> "~".

% ---------------------------

% s050 - Literal name

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Names
% Book page: 31 - PDF index page: 45
%
% A / (slash — not backslash) introduces a literal name. The slash is not part of the
% name itself, but is a prefix indicating that the following sequence of zero or more
% regular characters constitutes a literal name object. There can be no white-space
% characters between the / and the name. The characters // (two slashes) introduce
% an immediately evaluated name. The important properties and uses of names and
% the distinction between executable and literal names are described in Section 3.3,
% “Data Types and Objects”; immediately evaluated names are discussed in
% Section 3.12.2, “Immediately Evaluated Names.”
%
% Note: The token / (a slash followed by no regular characters) is a valid literal name.
%
% PLRM.pdf Section 3.3.2 - Attributes of Object - Literal and Executable
% Book page: 36 - PDF index page: 50
%
% Every object is either literal or executable. This distinction comes into play when
% the interpreter attempts to execute the object.
%
% • If the object is literal, the interpreter treats it strictly as data and pushes it on
% the operand stack for use as an operand of some subsequent operator.
% • If the object is executable, the interpreter executes it.
%
% What it means to execute an object depends on the object’s type; this is described
% in Section 3.5, “Execution.” For some object types, such as integers, execution
% consists of pushing the object on the operand stack; the distinction between literal
% and executable integers is meaningless. But for other types, such as names,
% operators, and arrays, execution consists of performing a different action.
%
% • Executing an executable name causes it to be looked up in the current dictionary
% context and the associated value to be executed.
% • Executing an executable operator causes some built-in action to be performed.
% • Executing an executable array (otherwise known as a procedure) causes the elements
% of the array to be executed in turn.
%
% As described in Section 3.2, “Syntax,” some tokens produce literal objects and
% some produce executable ones.
%
% • Integer, real, and string constants are always literal objects.
% • Names are literal if they are preceded by / and executable if they are not.
% • The [ and ] operators, when executed, produce a literal array object with the enclosed
% objects as elements. Likewise, << and >> (LanguageLevel 2) produce a
% literal dictionary object.
% • { and } enclose an executable array or procedure.
%
% Note: As mentioned above, it does not matter whether an object is literal or executable
% when it is accessed as data, only when it is executed. However, referring to an
% executable object by name often causes that object to be executed automatically; see
% Section 3.5.5, “Execution of Specific Types.” To avoid unintended behavior, it is best
% to use the executable attribute only for objects that are meant to be executed, such as
% procedures.

% s050([Code|Codes]) -->
%     regular_character(Code),
%     s050(Codes).
% % Note: There are no checks for delimiters, whitespace or end of list because only the characters in regular_character are allowed.
% % Recursion base case for s050
% s050([]) --> [].

% NB This does not use type_codes(Type,Codes) and instead uses just Codes
% because there can be no errors so no need to have a variable for different types.

% s050([0x00|Codes]) --> [0x00],  s050(Codes).  % NUL (null)                          % Whitespace
s050([0x01|Codes]) --> [0x01],  s050(Codes).    % SOH (start of heading)
s050([0x02|Codes]) --> [0x02],  s050(Codes).    % STX (start of text)
s050([0x03|Codes]) --> [0x03],  s050(Codes).    % ETX (end of text)
s050([0x04|Codes]) --> [0x04],  s050(Codes).    % EOT (end of transmission)
s050([0x05|Codes]) --> [0x05],  s050(Codes).    % ENQ (enquiry)
s050([0x06|Codes]) --> [0x06],  s050(Codes).    % ACK (acknowledge)
s050([0x07|Codes]) --> [0x07],  s050(Codes).    % BEL (bell)
s050([0x08|Codes]) --> [0x08],  s050(Codes).    % BS  (backspace)
% s050([0x09|Codes]) --> [0x09],  s050(Codes).  % TAB (horizontal tab)                  % Whitespace
% s050([0x0A|Codes]) --> [0x0A],  s050(Codes).  % LF  (line feed)                       % Whitespace
s050([0x0B|Codes]) --> [0x0B],  s050(Codes).    % VT  (vertical tab)
% s050([0x0C|Codes]) --> [0x0C],  s050(Codes).  % FF  (form feed)                       % Whitespace
% s050([0x0D|Codes]) --> [0x0D],  s050(Codes).  % CR  (carriage return)                 % Whitespace
s050([0x0E|Codes]) --> [0x0E],  s050(Codes).    % SO  (shift out)
s050([0x0F|Codes]) --> [0x0F],  s050(Codes).    % SI  (shift in)
s050([0x10|Codes]) --> [0x10],  s050(Codes).    % DLE (data link escape)
s050([0x11|Codes]) --> [0x11],  s050(Codes).    % DC1 (device control 1)
s050([0x12|Codes]) --> [0x12],  s050(Codes).    % DC2 (device control 2)
s050([0x13|Codes]) --> [0x13],  s050(Codes).    % DC3 (device control 3)
s050([0x14|Codes]) --> [0x14],  s050(Codes).    % DC4 (device control 4)
s050([0x15|Codes]) --> [0x15],  s050(Codes).    % NAK (negative acknowledge)
s050([0x16|Codes]) --> [0x16],  s050(Codes).    % SYN (synchronous idle)
s050([0x17|Codes]) --> [0x17],  s050(Codes).    % ETB (end of trans. block)
s050([0x18|Codes]) --> [0x18],  s050(Codes).    % CAN (cancel)
s050([0x19|Codes]) --> [0x19],  s050(Codes).    % EM  (end of medium)
s050([0x1A|Codes]) --> [0x1A],  s050(Codes).    % SUB (substitute)
s050([0x1B|Codes]) --> [0x1B],  s050(Codes).    % ESC (escape)
s050([0x1C|Codes]) --> [0x1C],  s050(Codes).    % FS  (file separator)
s050([0x1D|Codes]) --> [0x1D],  s050(Codes).    % GS  (group separator)
s050([0x1E|Codes]) --> [0x1E],  s050(Codes).    % RS  (record separator)
s050([0x1F|Codes]) --> [0x1F],  s050(Codes).    % US  (unit separator)
% s050([0'\s|Codes]) --> " ",     s050(Codes).  %     (space)                           % Whitespace
s050([0'! |Codes]) --> "!",     s050(Codes).
s050([0'" |Codes]) --> "\"",    s050(Codes).
s050([0'# |Codes]) --> "#",     s050(Codes).
s050([0'$ |Codes]) --> "$",     s050(Codes).
% s050([0'% |Codes]) --> "%",     s050(Codes).    % Delimiter
s050([0'& |Codes]) --> "&",     s050(Codes).
s050([0'\'|Codes]) --> "'",     s050(Codes).
% s050([0'( |Codes]) --> "(",     s050(Codes).    % Delimiter
% s050([0') |Codes]) --> ")",     s050(Codes).    % Delimiter
s050([0'* |Codes]) --> "*",     s050(Codes).
s050([0'+ |Codes]) --> "+",     s050(Codes).
s050([0', |Codes]) --> ",",     s050(Codes).
s050([0'- |Codes]) --> "-",     s050(Codes).
s050([0'. |Codes]) --> ".",     s050(Codes).
% s050([0'/ |Codes]) --> "/",     s050(Codes).    % Delimiter
s050([0'0 |Codes]) --> "0",     s050(Codes).
s050([0'1 |Codes]) --> "1",     s050(Codes).
s050([0'2 |Codes]) --> "2",     s050(Codes).
s050([0'3 |Codes]) --> "3",     s050(Codes).
s050([0'4 |Codes]) --> "4",     s050(Codes).
s050([0'5 |Codes]) --> "5",     s050(Codes).
s050([0'6 |Codes]) --> "6",     s050(Codes).
s050([0'7 |Codes]) --> "7",     s050(Codes).
s050([0'8 |Codes]) --> "8",     s050(Codes).
s050([0'9 |Codes]) --> "9",     s050(Codes).
s050([0': |Codes]) --> ":",     s050(Codes).
s050([0'; |Codes]) --> ";",     s050(Codes).
% s050([0'< |Codes]) --> "<",     s050(Codes).    % Delimiter
s050([0'= |Codes]) --> "=",     s050(Codes).
% s050([0'> |Codes]) --> ">",     s050(Codes).    % Delimiter
s050([0'? |Codes]) --> "?",     s050(Codes).
s050([0'@ |Codes]) --> "@",     s050(Codes).
s050([0'A |Codes]) --> "A",     s050(Codes).
s050([0'B |Codes]) --> "B",     s050(Codes).
s050([0'C |Codes]) --> "C",     s050(Codes).
s050([0'D |Codes]) --> "D",     s050(Codes).
s050([0'E |Codes]) --> "E",     s050(Codes).
s050([0'F |Codes]) --> "F",     s050(Codes).
s050([0'G |Codes]) --> "G",     s050(Codes).
s050([0'H |Codes]) --> "H",     s050(Codes).
s050([0'I |Codes]) --> "I",     s050(Codes).
s050([0'J |Codes]) --> "J",     s050(Codes).
s050([0'K |Codes]) --> "K",     s050(Codes).
s050([0'L |Codes]) --> "L",     s050(Codes).
s050([0'M |Codes]) --> "M",     s050(Codes).
s050([0'N |Codes]) --> "N",     s050(Codes).
s050([0'O |Codes]) --> "O",     s050(Codes).
s050([0'P |Codes]) --> "P",     s050(Codes).
s050([0'Q |Codes]) --> "Q",     s050(Codes).
s050([0'R |Codes]) --> "R",     s050(Codes).
s050([0'S |Codes]) --> "S",     s050(Codes).
s050([0'T |Codes]) --> "T",     s050(Codes).
s050([0'U |Codes]) --> "U",     s050(Codes).
s050([0'V |Codes]) --> "V",     s050(Codes).
s050([0'W |Codes]) --> "W",     s050(Codes).
s050([0'X |Codes]) --> "X",     s050(Codes).
s050([0'Y |Codes]) --> "Y",     s050(Codes).
s050([0'Z |Codes]) --> "Z",     s050(Codes).
% s050([0'[ |Codes]) --> "[",     s050(Codes).    % Delimiter
s050([0'\\|Codes]) --> "\\",    s050(Codes).
% s050([0'] |Codes]) --> "]",     s050(Codes).    % Delimiter
s050([0'^ |Codes]) --> "^",     s050(Codes).
s050([0'_ |Codes]) --> "_",     s050(Codes).
s050([0'` |Codes]) --> "`",     s050(Codes).
s050([0'a |Codes]) --> "a",     s050(Codes).
s050([0'b |Codes]) --> "b",     s050(Codes).
s050([0'c |Codes]) --> "c",     s050(Codes).
s050([0'd |Codes]) --> "d",     s050(Codes).
s050([0'e |Codes]) --> "e",     s050(Codes).
s050([0'f |Codes]) --> "f",     s050(Codes).
s050([0'g |Codes]) --> "g",     s050(Codes).
s050([0'h |Codes]) --> "h",     s050(Codes).
s050([0'i |Codes]) --> "i",     s050(Codes).
s050([0'j |Codes]) --> "j",     s050(Codes).
s050([0'k |Codes]) --> "k",     s050(Codes).
s050([0'l |Codes]) --> "l",     s050(Codes).
s050([0'm |Codes]) --> "m",     s050(Codes).
s050([0'n |Codes]) --> "n",     s050(Codes).
s050([0'o |Codes]) --> "o",     s050(Codes).
s050([0'p |Codes]) --> "p",     s050(Codes).
s050([0'q |Codes]) --> "q",     s050(Codes).
s050([0'r |Codes]) --> "r",     s050(Codes).
s050([0's |Codes]) --> "s",     s050(Codes).
s050([0't |Codes]) --> "t",     s050(Codes).
s050([0'u |Codes]) --> "u",     s050(Codes).
s050([0'v |Codes]) --> "v",     s050(Codes).
s050([0'w |Codes]) --> "w",     s050(Codes).
s050([0'x |Codes]) --> "x",     s050(Codes).
s050([0'y |Codes]) --> "y",     s050(Codes).
s050([0'z |Codes]) --> "z",     s050(Codes).
% s050([0'{ |Codes]) --> "{",     s050(Codes).    % Delimiter
s050([0'| |Codes]) --> "|",     s050(Codes).
% s050([0'} |Codes]) --> "}",     s050(Codes).    % Delimiter
s050([0'~ |Codes]) --> "~",     s050(Codes).
s050([0xFF|Codes]) --> [0xFF],  s050(Codes).

% Note: There are no checks for delimiters, whitespace or end of list because only the characters in regular_character are allowed.
% Recursion base case for s050
s050([]) --> [].

% ---------------------------

% s050 - Whitespace

% PLRM.pdf Section 3.2.2 - ASCII Encoding
% Book page: 26 - PDF index page: 40
%
% White-space characters (Table 3.1) separate syntactic constructs such as names
% and numbers from each other. The interpreter treats any number of consecutive
% white-space characters as if there were just one. All white-space characters are
% equivalent, except in comments and strings.

% Old code being left here for use when writing DCG Wiki
% s060([Code|Codes]) -->
%     postscript_whitespace_code(Code),
%     s060(Codes).
% s060([]) --> [].

s060([0x00|Codes]) --> [0x00], s060(Codes). % Null (nul)
s060([0'\t|Codes]) --> [0x09], s060(Codes). % Tab (tab)
s060([0'\n|Codes]) --> [0x0A], s060(Codes). % Line feed (LF)
s060([0'\f|Codes]) --> [0x0C], s060(Codes). % Form feed (FF)
s060([0'\r|Codes]) --> [0x0D], s060(Codes). % Carriage return (CR)
s060([0'\s|Codes]) --> [0x20], s060(Codes). % Space (SP)

% Recursion base case for s060
s060([]) --> [].

% Variation of whitespace as lookup code table.
% Needed for s000 to identify start of whitespace
% postscript_whitespace_code(0x00) --> [0x00].    % Null (nul)
% postscript_whitespace_code(0'\t) --> [0x09].    % Tab (tab)
% postscript_whitespace_code(0'\n) --> [0x0A].    % Line feed (LF)
% postscript_whitespace_code(0'\f) --> [0x0C].    % Form feed (FF)
% postscript_whitespace_code(0'\r) --> [0x0D].    % Carriage return (CR)
% postscript_whitespace_code(0'\s) --> [0x20].    % Space (SP)

% -------

% s070 - Comments

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Comments
% Book page: 27 - PDF index page: 41
%
% Any occurrence of the character % outside a string introduces a comment. The
% comment consists of all characters between the % and the next newline or form
% feed, including regular, delimiter, space, and tab characters.
%
% The scanner ignores comments, treating each one as if it were a single whitespace
% character. That is, a comment separates the token preceding it from the one
% following. Thus the ASCII-encoded program fragment
%
% abc% comment {/%) blah blah blah
% 123
%
% is treated by the scanner as just two tokens: abc and 123.

% Less code lines. Runs slower

% s070(type_codes(comment,[])) -->
%     postscript_newline_code(_Code1,_Code2).
% s070(type_codes(comment,[])) -->
%     postscript_newline_code(_Code1).
% s070(type_codes(comment,[])) -->
%     "\f".
% s070(type_codes(Type,[Code|Codes])) -->
%     [Code],
%     s070(type_codes(Type,Codes)).
% % Base case for s070 recursion.
% s070(type_codes(comment,[])) --> [].
% % If there are no more codes in the list, then a comment has successfully been matched.
% s070(type_codes(comment,[]),[],[]).

% More code lines. Runs faster

s070(type_codes(Type,[0x00|Codes])) --> [0x00],  s070(type_codes(Type,Codes)).    % NUL (null)
s070(type_codes(Type,[0x01|Codes])) --> [0x01],  s070(type_codes(Type,Codes)).    % SOH (start of heading)
s070(type_codes(Type,[0x02|Codes])) --> [0x02],  s070(type_codes(Type,Codes)).    % STX (start of text)
s070(type_codes(Type,[0x03|Codes])) --> [0x03],  s070(type_codes(Type,Codes)).    % ETX (end of text)
s070(type_codes(Type,[0x04|Codes])) --> [0x04],  s070(type_codes(Type,Codes)).    % EOT (end of transmission)
s070(type_codes(Type,[0x05|Codes])) --> [0x05],  s070(type_codes(Type,Codes)).    % ENQ (enquiry)
s070(type_codes(Type,[0x06|Codes])) --> [0x06],  s070(type_codes(Type,Codes)).    % ACK (acknowledge)
s070(type_codes(Type,[0x07|Codes])) --> [0x07],  s070(type_codes(Type,Codes)).    % BEL (bell)
s070(type_codes(Type,[0x08|Codes])) --> [0x08],  s070(type_codes(Type,Codes)).    % BS  (backspace)
s070(type_codes(Type,[0x09|Codes])) --> [0x09],  s070(type_codes(Type,Codes)).    % TAB (horizontal tab)
% s070(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s070(type_codes(Type,Codes)).  % LF  (line feed)            % signals end of comment characters % '\n' are handled in base cases below.
s070(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s070(type_codes(Type,Codes)).    % VT  (vertical tab)
% s070(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s070(type_codes(Type,Codes)).  % FF  (form feed)            % signals end of comment characters % '\r' are handled in base cases below.
% s070(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s070(type_codes(Type,Codes)).  % CR  (carriage return)      % signals end of comment characters % '\f' are handled in base cases below.
s070(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s070(type_codes(Type,Codes)).    % SO  (shift out)
s070(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s070(type_codes(Type,Codes)).    % SI  (shift in)
s070(type_codes(Type,[0x10|Codes])) --> [0x10],  s070(type_codes(Type,Codes)).    % DLE (data link escape)
s070(type_codes(Type,[0x11|Codes])) --> [0x11],  s070(type_codes(Type,Codes)).    % DC1 (device control 1)
s070(type_codes(Type,[0x12|Codes])) --> [0x12],  s070(type_codes(Type,Codes)).    % DC2 (device control 2)
s070(type_codes(Type,[0x13|Codes])) --> [0x13],  s070(type_codes(Type,Codes)).    % DC3 (device control 3)
s070(type_codes(Type,[0x14|Codes])) --> [0x14],  s070(type_codes(Type,Codes)).    % DC4 (device control 4)
s070(type_codes(Type,[0x15|Codes])) --> [0x15],  s070(type_codes(Type,Codes)).    % NAK (negative acknowledge)
s070(type_codes(Type,[0x16|Codes])) --> [0x16],  s070(type_codes(Type,Codes)).    % SYN (synchronous idle)
s070(type_codes(Type,[0x17|Codes])) --> [0x17],  s070(type_codes(Type,Codes)).    % ETB (end of trans. block)
s070(type_codes(Type,[0x18|Codes])) --> [0x18],  s070(type_codes(Type,Codes)).    % CAN (cancel)
s070(type_codes(Type,[0x19|Codes])) --> [0x19],  s070(type_codes(Type,Codes)).    % EM  (end of medium)
s070(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s070(type_codes(Type,Codes)).    % SUB (substitute)
s070(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s070(type_codes(Type,Codes)).    % ESC (escape)
s070(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s070(type_codes(Type,Codes)).    % FS  (file separator)
s070(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s070(type_codes(Type,Codes)).    % GS  (group separator)
s070(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s070(type_codes(Type,Codes)).    % RS  (record separator)
s070(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s070(type_codes(Type,Codes)).    % US  (unit separator)
s070(type_codes(Type,[0'\s|Codes])) --> " ",     s070(type_codes(Type,Codes)).    %     (space)
s070(type_codes(Type,[0'! |Codes])) --> "!",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'" |Codes])) --> "\"",    s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'# |Codes])) --> "#",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'$ |Codes])) --> "$",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'% |Codes])) --> "%",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'& |Codes])) --> "&",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'\'|Codes])) --> "'",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'( |Codes])) --> "(",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0') |Codes])) --> ")",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'* |Codes])) --> "*",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'+ |Codes])) --> "+",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0', |Codes])) --> ",",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'- |Codes])) --> "-",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'. |Codes])) --> ".",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'/ |Codes])) --> "/",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'0 |Codes])) --> "0",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'1 |Codes])) --> "1",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'2 |Codes])) --> "2",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'3 |Codes])) --> "3",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'4 |Codes])) --> "4",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'5 |Codes])) --> "5",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'6 |Codes])) --> "6",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'7 |Codes])) --> "7",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'8 |Codes])) --> "8",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'9 |Codes])) --> "9",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0': |Codes])) --> ":",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'; |Codes])) --> ";",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'< |Codes])) --> "<",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'= |Codes])) --> "=",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'> |Codes])) --> ">",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'? |Codes])) --> "?",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'@ |Codes])) --> "@",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'A |Codes])) --> "A",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'B |Codes])) --> "B",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'C |Codes])) --> "C",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'D |Codes])) --> "D",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'E |Codes])) --> "E",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'F |Codes])) --> "F",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'G |Codes])) --> "G",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'H |Codes])) --> "H",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'I |Codes])) --> "I",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'J |Codes])) --> "J",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'K |Codes])) --> "K",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'L |Codes])) --> "L",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'M |Codes])) --> "M",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'N |Codes])) --> "N",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'O |Codes])) --> "O",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'P |Codes])) --> "P",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'Q |Codes])) --> "Q",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'R |Codes])) --> "R",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'S |Codes])) --> "S",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'T |Codes])) --> "T",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'U |Codes])) --> "U",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'V |Codes])) --> "V",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'W |Codes])) --> "W",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'X |Codes])) --> "X",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'Y |Codes])) --> "Y",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'Z |Codes])) --> "Z",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'[ |Codes])) --> "[",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'\\|Codes])) --> "\\",    s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'] |Codes])) --> "]",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'^ |Codes])) --> "^",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'_ |Codes])) --> "_",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'` |Codes])) --> "`",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'a |Codes])) --> "a",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'b |Codes])) --> "b",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'c |Codes])) --> "c",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'd |Codes])) --> "d",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'e |Codes])) --> "e",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'f |Codes])) --> "f",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'g |Codes])) --> "g",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'h |Codes])) --> "h",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'i |Codes])) --> "i",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'j |Codes])) --> "j",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'k |Codes])) --> "k",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'l |Codes])) --> "l",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'm |Codes])) --> "m",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'n |Codes])) --> "n",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'o |Codes])) --> "o",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'p |Codes])) --> "p",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'q |Codes])) --> "q",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'r |Codes])) --> "r",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0's |Codes])) --> "s",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0't |Codes])) --> "t",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'u |Codes])) --> "u",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'v |Codes])) --> "v",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'w |Codes])) --> "w",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'x |Codes])) --> "x",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'y |Codes])) --> "y",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'z |Codes])) --> "z",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'{ |Codes])) --> "{",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'| |Codes])) --> "|",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'} |Codes])) --> "}",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0'~ |Codes])) --> "~",     s070(type_codes(Type,Codes)).
s070(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s070(type_codes(Type,Codes)).

% Recursion base cases for s070
s070(type_codes(comment,[])) --> [0x0D,0x0A].  % CR,LF                      % signals end of comment characters
s070(type_codes(comment,[])) --> [0x0C].       % FF  (form feed)            % signals end of comment characters
s070(type_codes(comment,[])) --> [0x0D].       % CR  (carriage return)      % signals end of comment characters
s070(type_codes(comment,[])) --> [0x0A].       % LF  (line feed)            % signals end of comment characters
s070(type_codes(comment,[])) --> [].

% ---------------------------

% s080 - Literal string

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Strings
% Book page: 29 - PDF index page: 43
%
% As literal text, enclosed in ( and )
%
% A literal text string consists of an arbitrary number of characters enclosed in
% ( and ). Any characters may appear in the string other than (, ), and \, which must
% be treated specially. Balanced pairs of parentheses in the string require no special
% treatment.
%
% The following lines show several valid strings:
%
% (This is a string)
% (Strings may contain newlines
% and such.)
% (Strings may contain special characters *!&}^% and
% balanced parentheses ( ) (and so on).)
% (The following is an empty string.)
% ()
% (It has 0 (zero) length.)
%
% Within a text string, the \ (backslash) character is treated as an “escape” for various
% purposes, such as including newline characters, unbalanced parentheses, and
% the \ character itself in the string. The character immediately following the \ determines
% its precise interpretation.
%
% \n line feed (LF)
% \r carriage return (CR)
% \t horizontal tab
% \b backspace
% \f form feed
% \\ backslash
% \( left parenthesis
% \) right parenthesis
% \ddd character code ddd (octal)
%
% If the character following the \ is not in the preceding list, the scanner ignores the
% \. If the \ is followed immediately by a newline (CR, LF, or CR-LF pair), the scanner
% ignores both the initial \ and the newline; this breaks a string into multiple
% lines without including the newline character as part of the string, as in the following
% example:
%
% (These \
% two strings \
% are the same.)
% (These two strings are the same.)
%
% But if a newline appears without a preceding \, the result is equivalent to \n. For
% example:
%
% (This string has a newline at the end of it.
% )
% (So does this one.\n)
%
% For more information about end-of-line conventions, see Section 3.8, “File Input
% and Output.”
%
% The \ddd form may be used to include any 8-bit character constant in a string.
% One, two, or three octal digits may be specified, with high-order overflow ignored.
% This notation is preferred for specifying a character outside the recommended
% ASCII character set for the PostScript language, since the notation itself
% stays within the standard set and thereby avoids possible difficulties in transmitting
% or storing the text of the program. It is recommended that three octal digits
% always be used, with leading zeros as needed, to prevent ambiguity. The string
% (\0053), for example, contains two characters—an ASCII 5 (Control-E) followed
% by the digit 3—whereas the strings (\53) and (\053) contain one character, the
% ASCII character whose code is octal 53 (plus sign).

% Note: In a Prolog string \ is escaped as \\, e.g. "\\"
%       In a Prolog character constant ( 0' ) \ is escaped as \\, e.g. 0'\\

% Old code being left here for use when writing DCG Wiki

% % Order of s080//2 clauses is important
% s080(Level,type_codes(Type,Codes)) -->
%     % If the \ is followed immediately by a newline (CR, LF, or CR-LF pair),
%     % the scanner ignores both the initial \ and the newline;
%     % Note: In a Prolog string \ is escaped as \\
%     "\\",
%     postscript_newline_code(_,_),
%     s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,Codes)) -->
%     % If the \ is followed immediately by a newline (CR, LF, or CR-LF pair),
%     % the scanner ignores both the initial \ and the newline;
%     % Note: In a Prolog string \ is escaped as \\
%     "\\",
%     postscript_newline_code(_),
%     s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'\n|Codes])) --> "\\n",s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'\r|Codes])) --> "\\r",s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'\t|Codes])) --> "\\t",s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'\b|Codes])) --> "\\b",s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'\f|Codes])) --> "\\f",s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'\\|Codes])) --> "\\\\",s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'( |Codes])) --> "\\(",s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0') |Codes])) --> "\\)",s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[Code|Codes])) -->
%     "\\",[C1,C2,C3],
%     {
%         char_code(Ch1,C1),
%         char_code(Ch2,C2),
%         char_code(Ch3,C3),
%         atom_number(Ch1,N1),
%         atom_number(Ch2,N2),
%         atom_number(Ch3,N3),
%         must_be(nonneg,N1),
%         must_be(nonneg,N2),
%         must_be(nonneg,N3),
%         trim_escaped_digits([N1,N2,N3],Digits),
%         n_base_digits(Code,8,Digits)
%     },
%     s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[Code|Codes])) -->
%     "\\",[C1,C2],
%     {
%         char_code(Ch1,C1),
%         char_code(Ch2,C2),
%         atom_number(Ch1,N1),
%         atom_number(Ch2,N2),
%         must_be(nonneg,N1),
%         must_be(nonneg,N2),
%         trim_escaped_digits([N1,N2],Digits),
%         n_base_digits(Code,8,Digits)
%     },
%     s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[Code|Codes])) -->
%     "\\",[C1],
%     {
%         char_code(Ch1,C1),
%         atom_number(Ch1,N1),
%         must_be(nonneg,N1),
%         trim_escaped_digits([N1],Digits),
%         n_base_digits(Code,8,Digits)
%     },
%     s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,Codes)) -->
%     "\\",
%     s080(Level,type_codes(Type,Codes)).
% s080(Level0,type_codes(Type,[0'(|Codes])) -->
%     "(",
%     { Level is Level0 + 1 },
%     s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[Code|Codes])) -->
%     { Level >= 1 },
%     \+ ")",
%     [Code],
%     s080(Level,type_codes(Type,Codes)).
% s080(Level0,type_codes(Type,[0')|Codes])) -->
%     { Level0 > 1 },
%     ")",
%     { Level is Level0 - 1 },
%     s080(Level,type_codes(Type,Codes)).

% % If there are no more codes in the list, then a literal string has failed: expected ")".
% % NB This is not a DCG but a regular clause
% s080(1,type_codes(syntax_error(01),[]),[],[]).

% % Base case for s080 recursion.
% s080(1,type_codes(_Type,[])) --> [].

% Order of s080//2 clauses is important
s080(Level,type_codes(Type,[0x00|Codes])) --> [0x00],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % NUL (null)
s080(Level,type_codes(Type,[0x01|Codes])) --> [0x01],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % SOH (start of heading)
s080(Level,type_codes(Type,[0x02|Codes])) --> [0x02],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % STX (start of text)
s080(Level,type_codes(Type,[0x03|Codes])) --> [0x03],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % ETX (end of text)
s080(Level,type_codes(Type,[0x04|Codes])) --> [0x04],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % EOT (end of transmission)
s080(Level,type_codes(Type,[0x05|Codes])) --> [0x05],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % ENQ (enquiry)
s080(Level,type_codes(Type,[0x06|Codes])) --> [0x06],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % ACK (acknowledge)
s080(Level,type_codes(Type,[0x07|Codes])) --> [0x07],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % BEL (bell)
s080(Level,type_codes(Type,[0x08|Codes])) --> [0x08],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % BS  (backspace)
s080(Level,type_codes(Type,[0x09|Codes])) --> [0x09],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % TAB (horizontal tab)
s080(Level,type_codes(Type,[0x0A|Codes])) --> [0x0A],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % LF  (line feed)
s080(Level,type_codes(Type,[0x0B|Codes])) --> [0x0B],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % VT  (vertical tab)
s080(Level,type_codes(Type,[0x0C|Codes])) --> [0x0C],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % FF  (form feed)
s080(Level,type_codes(Type,[0x0D|Codes])) --> [0x0D],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % CR  (carriage return)
s080(Level,type_codes(Type,[0x0E|Codes])) --> [0x0E],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % SO  (shift out)
s080(Level,type_codes(Type,[0x0F|Codes])) --> [0x0F],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % SI  (shift in)
s080(Level,type_codes(Type,[0x10|Codes])) --> [0x10],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % DLE (data link escape)
s080(Level,type_codes(Type,[0x11|Codes])) --> [0x11],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % DC1 (device control 1)
s080(Level,type_codes(Type,[0x12|Codes])) --> [0x12],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % DC2 (device control 2)
s080(Level,type_codes(Type,[0x13|Codes])) --> [0x13],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % DC3 (device control 3)
s080(Level,type_codes(Type,[0x14|Codes])) --> [0x14],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % DC4 (device control 4)
s080(Level,type_codes(Type,[0x15|Codes])) --> [0x15],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % NAK (negative acknowledge)
s080(Level,type_codes(Type,[0x16|Codes])) --> [0x16],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % SYN (synchronous idle)
s080(Level,type_codes(Type,[0x17|Codes])) --> [0x17],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % ETB (end of trans. block)
s080(Level,type_codes(Type,[0x18|Codes])) --> [0x18],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % CAN (cancel)
s080(Level,type_codes(Type,[0x19|Codes])) --> [0x19],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % EM  (end of medium)
s080(Level,type_codes(Type,[0x1A|Codes])) --> [0x1A],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % SUB (substitute)
s080(Level,type_codes(Type,[0x1B|Codes])) --> [0x1B],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % ESC (escape)
s080(Level,type_codes(Type,[0x1C|Codes])) --> [0x1C],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % FS  (file separator)
s080(Level,type_codes(Type,[0x1D|Codes])) --> [0x1D],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % GS  (group separator)
s080(Level,type_codes(Type,[0x1E|Codes])) --> [0x1E],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % RS  (record separator)
s080(Level,type_codes(Type,[0x1F|Codes])) --> [0x1F],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    % US  (unit separator)
s080(Level,type_codes(Type,[0'\s|Codes])) --> " ",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).    %     (space)
s080(Level,type_codes(Type,[0'! |Codes])) --> "!",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'" |Codes])) --> "\"",    { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'# |Codes])) --> "#",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'$ |Codes])) --> "$",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'% |Codes])) --> "%",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'& |Codes])) --> "&",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'\'|Codes])) --> "'",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'( |Codes])) --> "(",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).  % Special case handled below
% s080(Level,type_codes(Type,[0') |Codes])) --> ")",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).  % Special case handled below
s080(Level,type_codes(Type,[0'* |Codes])) --> "*",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'+ |Codes])) --> "+",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0', |Codes])) --> ",",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'- |Codes])) --> "-",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'. |Codes])) --> ".",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'/ |Codes])) --> "/",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'0 |Codes])) --> "0",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'1 |Codes])) --> "1",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'2 |Codes])) --> "2",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'3 |Codes])) --> "3",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'4 |Codes])) --> "4",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'5 |Codes])) --> "5",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'6 |Codes])) --> "6",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'7 |Codes])) --> "7",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'8 |Codes])) --> "8",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'9 |Codes])) --> "9",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0': |Codes])) --> ":",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'; |Codes])) --> ";",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'< |Codes])) --> "<",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'= |Codes])) --> "=",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'> |Codes])) --> ">",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'? |Codes])) --> "?",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'@ |Codes])) --> "@",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'A |Codes])) --> "A",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'B |Codes])) --> "B",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'C |Codes])) --> "C",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'D |Codes])) --> "D",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'E |Codes])) --> "E",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'F |Codes])) --> "F",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'G |Codes])) --> "G",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'H |Codes])) --> "H",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'I |Codes])) --> "I",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'J |Codes])) --> "J",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'K |Codes])) --> "K",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'L |Codes])) --> "L",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'M |Codes])) --> "M",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'N |Codes])) --> "N",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'O |Codes])) --> "O",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'P |Codes])) --> "P",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'Q |Codes])) --> "Q",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'R |Codes])) --> "R",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'S |Codes])) --> "S",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'T |Codes])) --> "T",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'U |Codes])) --> "U",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'V |Codes])) --> "V",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'W |Codes])) --> "W",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'X |Codes])) --> "X",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'Y |Codes])) --> "Y",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'Z |Codes])) --> "Z",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'[ |Codes])) --> "[",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
% s080(Level,type_codes(Type,[0'\\|Codes])) --> "\\",    { Level >= 1 }, s080(Level,type_codes(Type,Codes)).  % Special case handled below
s080(Level,type_codes(Type,[0'] |Codes])) --> "]",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'^ |Codes])) --> "^",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'_ |Codes])) --> "_",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'` |Codes])) --> "`",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'a |Codes])) --> "a",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'b |Codes])) --> "b",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'c |Codes])) --> "c",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'd |Codes])) --> "d",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'e |Codes])) --> "e",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'f |Codes])) --> "f",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'g |Codes])) --> "g",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'h |Codes])) --> "h",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'i |Codes])) --> "i",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'j |Codes])) --> "j",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'k |Codes])) --> "k",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'l |Codes])) --> "l",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'm |Codes])) --> "m",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'n |Codes])) --> "n",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'o |Codes])) --> "o",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'p |Codes])) --> "p",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'q |Codes])) --> "q",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'r |Codes])) --> "r",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0's |Codes])) --> "s",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0't |Codes])) --> "t",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'u |Codes])) --> "u",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'v |Codes])) --> "v",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'w |Codes])) --> "w",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'x |Codes])) --> "x",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'y |Codes])) --> "y",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'z |Codes])) --> "z",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'{ |Codes])) --> "{",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'| |Codes])) --> "|",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'} |Codes])) --> "}",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'~ |Codes])) --> "~",     { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0xFF|Codes])) --> [0xFF],  { Level >= 1 }, s080(Level,type_codes(Type,Codes)).
% If the \ is followed immediately by a newline (CR, LF, or CR-LF pair),
% the scanner ignores both the initial \ and the newline;
% Note: In a Prolog string \ is escaped as \\
s080(Level,type_codes(Type,Codes)) -->
    "\\",
    postscript_newline_code(_,_),       % Two character newline, e.g. CR-LF
    s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,Codes)) -->
    "\\",
    postscript_newline_code(_),         % One character newline, e.g. CR, LF
    s080(Level,type_codes(Type,Codes)).
% Within a text string, the \ (backslash) character is treated as an “escape” for various
% purposes, such as including newline characters, unbalanced parentheses, and
% the \ character itself in the string. The character immediately following the \ determines
% its precise interpretation.
% \n line feed (LF)
% \r carriage return (CR)
% \t horizontal tab
% \b backspace
% \f form feed
% \\ backslash
% \( left parenthesis
% \) right parenthesis
% \ddd character code ddd (octal)
s080(Level,type_codes(Type,[0'\n|Codes])) --> "\\n",s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'\r|Codes])) --> "\\r",s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'\t|Codes])) --> "\\t",s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'\b|Codes])) --> "\\b",s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'\f|Codes])) --> "\\f",s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'\\|Codes])) --> "\\\\",s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0'( |Codes])) --> "\\(",s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[0') |Codes])) --> "\\)",s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[Code|Codes])) -->
    "\\",[C1,C2,C3],
    {
        char_code(Ch1,C1),
        char_code(Ch2,C2),
        char_code(Ch3,C3),
        atom_number(Ch1,N1),
        atom_number(Ch2,N2),
        atom_number(Ch3,N3),
        must_be(nonneg,N1),
        must_be(nonneg,N2),
        must_be(nonneg,N3),
        trim_escaped_digits([N1,N2,N3],Digits),
        n_base_digits(Code,8,Digits)
    },
    s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[Code|Codes])) -->
    "\\",[C1,C2],
    {
        char_code(Ch1,C1),
        char_code(Ch2,C2),
        atom_number(Ch1,N1),
        atom_number(Ch2,N2),
        must_be(nonneg,N1),
        must_be(nonneg,N2),
        trim_escaped_digits([N1,N2],Digits),
        n_base_digits(Code,8,Digits)
    },
    s080(Level,type_codes(Type,Codes)).
s080(Level,type_codes(Type,[Code|Codes])) -->
    "\\",[C1],
    {
        char_code(Ch1,C1),
        atom_number(Ch1,N1),
        must_be(nonneg,N1),
        trim_escaped_digits([N1],Digits),
        n_base_digits(Code,8,Digits)
    },
    s080(Level,type_codes(Type,Codes)).
% If the character following the \ is not in the preceding list, the scanner ignores the \.
s080(Level,type_codes(Type,Codes)) -->
    "\\",
    s080(Level,type_codes(Type,Codes)).
% Nested () are allowed, e.g. (a(b(c))d)
s080(Level0,type_codes(Type,[0'(|Codes])) -->
    "(",
    { Level is Level0 + 1 },
    s080(Level,type_codes(Type,Codes)).
s080(Level0,type_codes(Type,[0')|Codes])) -->
    { Level0 > 1 },
    ")",
    { Level is Level0 - 1 },
    s080(Level,type_codes(Type,Codes)).

% Recursion base case for s080
s080(1,type_codes(_Type,[])) --> [].

% support predicates for s080

trim_escaped_digits([0,0,N3],[N3]).
trim_escaped_digits([0,N2,N3],[N2,N3]).
trim_escaped_digits([N1,N2,N3],[N1,N2,N3]).
trim_escaped_digits([0,N2],[N2]).
trim_escaped_digits([N1,N2],[N1,N2]).
trim_escaped_digits([N1],[N1]).

% ---------------------------

% s81 - Literal string - End

s81(type_codes(literal_string,Codes),token(literal_string,String)) -->
    ")",
    { string_codes(String,Codes) }.
s81(type_codes(syntax_error,[]),syntax_error(07,token(literal_string,String))) -->
    \+ ")",
    { string_codes(String,[0'(]) }.
s81(type_codes(syntax_error,Literal_string_codes),syntax_error(07,token(literal_string,String))) -->
    \+ ")",
    s150(Unknown_codes),
    {
        append(Literal_string_codes,Unknown_codes,Codes),
        string_codes(String,Codes)
    }.

% ---------------------------

% s090 - Hexadecimal string

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Strings
% Book page: 29 - PDF index page: 43
%
% As hexadecimal data, enclosed in < and >
%
% A hexadecimal string consists of a sequence of hexadecimal digits (0–9 and either
% A–F or a–f) enclosed within < and >. Each pair of hexadecimal digits defines one
% character of the string. White-space characters are ignored. If a hexadecimal
% string contains characters outside the allowed character set, a syntax error occurs.
% Hexadecimal strings are useful for including arbitrary binary data as literal text.
%
% If the final digit of a given hexadecimal string is missing—in other words, if there
% is an odd number of digits—the final digit is assumed to be 0. For example,
% <901fa3> is a 3-character string containing the characters whose hexadecimal
% codes are 90, 1f, and a3, but <901fa> is a 3-character string containing the characters
% whose hexadecimal codes are 90, 1f, and a0.

% s090(type_codes(syntax_error(12),[0x00])) --> [0x00].  % NUL (null)                    % Whitespace
s090(type_codes(syntax_error(12),[0x01])) --> [0x01].    % SOH (start of heading)
s090(type_codes(syntax_error(12),[0x02])) --> [0x02].    % STX (start of text)
s090(type_codes(syntax_error(12),[0x03])) --> [0x03].    % ETX (end of text)
s090(type_codes(syntax_error(12),[0x04])) --> [0x04].    % EOT (end of transmission)
s090(type_codes(syntax_error(12),[0x05])) --> [0x05].    % ENQ (enquiry)
s090(type_codes(syntax_error(12),[0x06])) --> [0x06].    % ACK (acknowledge)
s090(type_codes(syntax_error(12),[0x07])) --> [0x07].    % BEL (bell)
s090(type_codes(syntax_error(12),[0x08])) --> [0x08].    % BS  (backspace)
% s090(type_codes(syntax_error(12),[0x09])) --> [0x09].  % TAB (horizontal tab)          % Whitespace
% s090(type_codes(syntax_error(12),[0x0A])) --> [0x0A].  % LF  (line feed)               % Whitespace
s090(type_codes(syntax_error(12),[0x0B])) --> [0x0B].    % VT  (vertical tab)
% s090(type_codes(syntax_error(12),[0x0C])) --> [0x0C].  % FF  (form feed)               % Whitespace
% s090(type_codes(syntax_error(12),[0x0D])) --> [0x0D].  % CR  (carriage return)         % Whitespace
s090(type_codes(syntax_error(12),[0x0E])) --> [0x0E].    % SO  (shift out)
s090(type_codes(syntax_error(12),[0x0F])) --> [0x0F].    % SI  (shift in)
s090(type_codes(syntax_error(12),[0x10])) --> [0x10].    % DLE (data link escape)
s090(type_codes(syntax_error(12),[0x11])) --> [0x11].    % DC1 (device control 1)
s090(type_codes(syntax_error(12),[0x12])) --> [0x12].    % DC2 (device control 2)
s090(type_codes(syntax_error(12),[0x13])) --> [0x13].    % DC3 (device control 3)
s090(type_codes(syntax_error(12),[0x14])) --> [0x14].    % DC4 (device control 4)
s090(type_codes(syntax_error(12),[0x15])) --> [0x15].    % NAK (negative acknowledge)
s090(type_codes(syntax_error(12),[0x16])) --> [0x16].    % SYN (synchronous idle)
s090(type_codes(syntax_error(12),[0x17])) --> [0x17].    % ETB (end of trans. block)
s090(type_codes(syntax_error(12),[0x18])) --> [0x18].    % CAN (cancel)
s090(type_codes(syntax_error(12),[0x19])) --> [0x19].    % EM  (end of medium)
s090(type_codes(syntax_error(12),[0x1A])) --> [0x1A].    % SUB (substitute)
s090(type_codes(syntax_error(12),[0x1B])) --> [0x1B].    % ESC (escape)
s090(type_codes(syntax_error(12),[0x1C])) --> [0x1C].    % FS  (file separator)
s090(type_codes(syntax_error(12),[0x1D])) --> [0x1D].    % GS  (group separator)
s090(type_codes(syntax_error(12),[0x1E])) --> [0x1E].    % RS  (record separator)
s090(type_codes(syntax_error(12),[0x1F])) --> [0x1F].    % US  (unit separator)
% s090(type_codes(syntax_error(12),[0'\s])) --> " ".     %     (space)                   % Whitespace
s090(type_codes(syntax_error(12),[0'!] )) --> "!".
s090(type_codes(syntax_error(12),[0'"] )) --> "\"".
s090(type_codes(syntax_error(12),[0'#] )) --> "#".
s090(type_codes(syntax_error(12),[0'$] )) --> "$".
% s090(type_codes(syntax_error(12),[0'%] )) --> "%".        % Delimiter
s090(type_codes(syntax_error(12),[0'&] )) --> "&".
s090(type_codes(syntax_error(12),[0'\'])) --> "'".
% s090(type_codes(syntax_error(12),[0'(] )) --> "(".        % Delimiter
% s090(type_codes(syntax_error(12),[0')] )) --> ")".        % Delimiter
s090(type_codes(syntax_error(12),[0'*] )) --> "*".
s090(type_codes(syntax_error(12),[0'+] )) --> "+".
s090(type_codes(syntax_error(12),[0',] )) --> ",".
s090(type_codes(syntax_error(12),[0'-] )) --> "-".
s090(type_codes(syntax_error(12),[0'.] )) --> ".".
s090(type_codes(syntax_error(12),[0'/] )) --> "/".        % Delimiter
s090(type_codes(Type,[0'0 |Codes]      )) --> "0", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'1 |Codes]      )) --> "1", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'2 |Codes]      )) --> "2", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'3 |Codes]      )) --> "3", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'4 |Codes]      )) --> "4", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'5 |Codes]      )) --> "5", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'6 |Codes]      )) --> "6", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'7 |Codes]      )) --> "7", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'8 |Codes]      )) --> "8", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'9 |Codes]      )) --> "9", s090(type_codes(Type,Codes)).
s090(type_codes(syntax_error(12),[0':] )) --> ":".
s090(type_codes(syntax_error(12),[0';] )) --> ";".
% s090(type_codes(syntax_error(12),[0'<] )) --> "<".    % Delimiter
s090(type_codes(syntax_error(12),[0'=] )) --> "=".
% s090(type_codes(syntax_error(12),[0'>] )) --> ">".    % Delimiter
s090(type_codes(syntax_error(12),[0'?] )) --> "?".
s090(type_codes(syntax_error(12),[0'@] )) --> "@".
s090(type_codes(Type,[0'A |Codes]      )) --> "A", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'B |Codes]      )) --> "B", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'C |Codes]      )) --> "C", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'D |Codes]      )) --> "D", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'E |Codes]      )) --> "E", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'F |Codes]      )) --> "F", s090(type_codes(Type,Codes)).
s090(type_codes(syntax_error(12),[0'G] )) --> "G".
s090(type_codes(syntax_error(12),[0'H] )) --> "H".
s090(type_codes(syntax_error(12),[0'I] )) --> "I".
s090(type_codes(syntax_error(12),[0'J] )) --> "J".
s090(type_codes(syntax_error(12),[0'K] )) --> "K".
s090(type_codes(syntax_error(12),[0'L] )) --> "L".
s090(type_codes(syntax_error(12),[0'M] )) --> "M".
s090(type_codes(syntax_error(12),[0'N] )) --> "N".
s090(type_codes(syntax_error(12),[0'O] )) --> "O".
s090(type_codes(syntax_error(12),[0'P] )) --> "P".
s090(type_codes(syntax_error(12),[0'Q] )) --> "Q".
s090(type_codes(syntax_error(12),[0'R] )) --> "R".
s090(type_codes(syntax_error(12),[0'S] )) --> "S".
s090(type_codes(syntax_error(12),[0'T] )) --> "T".
s090(type_codes(syntax_error(12),[0'U] )) --> "U".
s090(type_codes(syntax_error(12),[0'V] )) --> "V".
s090(type_codes(syntax_error(12),[0'W] )) --> "W".
s090(type_codes(syntax_error(12),[0'X] )) --> "X".
s090(type_codes(syntax_error(12),[0'Y] )) --> "Y".
s090(type_codes(syntax_error(12),[0'Z] )) --> "Z".
% s090(type_codes(syntax_error(12),[0'[] )) --> "[".    % Delimiter
s090(type_codes(syntax_error(12),[0'\\])) --> "\\".
% s090(type_codes(syntax_error(12),[0']] )) --> "]".    % Delimiter
s090(type_codes(syntax_error(12),[0'^] )) --> "^".
s090(type_codes(syntax_error(12),[0'_] )) --> "_".
s090(type_codes(syntax_error(12),[0'`] )) --> "`".
s090(type_codes(Type,[0'a|Codes]       )) --> "a", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'b|Codes]       )) --> "b", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'c|Codes]       )) --> "c", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'd|Codes]       )) --> "d", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'e|Codes]       )) --> "e", s090(type_codes(Type,Codes)).
s090(type_codes(Type,[0'f|Codes]       )) --> "f", s090(type_codes(Type,Codes)).
s090(type_codes(syntax_error(12),[0'g] )) --> "g".
s090(type_codes(syntax_error(12),[0'h] )) --> "h".
s090(type_codes(syntax_error(12),[0'i] )) --> "i".
s090(type_codes(syntax_error(12),[0'j] )) --> "j".
s090(type_codes(syntax_error(12),[0'k] )) --> "k".
s090(type_codes(syntax_error(12),[0'l] )) --> "l".
s090(type_codes(syntax_error(12),[0'm] )) --> "m".
s090(type_codes(syntax_error(12),[0'n] )) --> "n".
s090(type_codes(syntax_error(12),[0'o] )) --> "o".
s090(type_codes(syntax_error(12),[0'p] )) --> "p".
s090(type_codes(syntax_error(12),[0'q] )) --> "q".
s090(type_codes(syntax_error(12),[0'r] )) --> "r".
s090(type_codes(syntax_error(12),[0's] )) --> "s".
s090(type_codes(syntax_error(12),[0't] )) --> "t".
s090(type_codes(syntax_error(12),[0'u] )) --> "u".
s090(type_codes(syntax_error(12),[0'v] )) --> "v".
s090(type_codes(syntax_error(12),[0'w] )) --> "w".
s090(type_codes(syntax_error(12),[0'x] )) --> "x".
s090(type_codes(syntax_error(12),[0'y] )) --> "y".
s090(type_codes(syntax_error(12),[0'z] )) --> "z".
% s090(type_codes(syntax_error(12),[0'{] )) --> "{".    % Delimiter
s090(type_codes(syntax_error(12),[0'|] )) --> "|".
% s090(type_codes(syntax_error(12),[0'}] )) --> "}".    % Delimiter
s090(type_codes(syntax_error(12),[0'~] )) --> "~".
s090(type_codes(syntax_error(12),[0xFF])) --> [0xFF].   % DEL

% Recursion base case for s090
s090(type_codes(_Type,[])) --> [].

% ---------------------------

% s091 - Hexadecimal string - End

s091(type_codes(hexadecimal_string,_Input_codes,Value_codes),token(literal_string,String)) -->
    ">",
    {
        codes_chars(Value_codes,Hex),
        hex_bytes(Hex,Bytes),
        string_codes(String,Bytes)
    }.
s091(type_codes(hexadecimal_string,Hexadecimal_string_codes,_Value_codes),syntax_error(09,token(literal_string,String))) -->
    \+ ">",
    s150(Unknown_codes),
    {
        append(Hexadecimal_string_codes,Unknown_codes,Codes),
        string_codes(String,Codes)
    }.
s091(type_codes(syntax_error(09),[],_Value_codes),syntax_error(09,token(literal_string,String))) -->
    \+ ">",
    { string_codes(String,[0'<]) }.
s091(type_codes(syntax_error(12),Hexadecimal_string_codes,_),syntax_error(12,token(literal_string,String))) -->
    s150(Unknown_codes),
    {
        append(Hexadecimal_string_codes,Unknown_codes,Codes),
        string_codes(String,Codes)
    }.

% ---------------------------

% s100 - ASCII base-85 string

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Comments
% Book page: 31 - PDF index page: 45
%
% An ASCII base-85 string (LanguageLevel 2) consists of a sequence of printable
% ASCII characters enclosed in <~ and ~>. This notation represents arbitrary binary
% data using an encoding technique that produces a 4:5 expansion as opposed
% to the 1:2 expansion for hexadecimal. The ASCII base-85 encoding algorithm is
% described under “ASCII85Encode Filter” on page 131. If an ASCII base-85 string
% is malformed, a syntax error occurs.

s100(type_codes(syntax_error(13),[0x00])) --> [0x00].  % NUL (null)                    % Whitespace
s100(type_codes(syntax_error(13),[0x01])) --> [0x01].  % SOH (start of heading)
s100(type_codes(syntax_error(13),[0x02])) --> [0x02].  % STX (start of text)
s100(type_codes(syntax_error(13),[0x03])) --> [0x03].  % ETX (end of text)
s100(type_codes(syntax_error(13),[0x04])) --> [0x04].  % EOT (end of transmission)
s100(type_codes(syntax_error(13),[0x05])) --> [0x05].  % ENQ (enquiry)
s100(type_codes(syntax_error(13),[0x06])) --> [0x06].  % ACK (acknowledge)
s100(type_codes(syntax_error(13),[0x07])) --> [0x07].  % BEL (bell)
s100(type_codes(syntax_error(13),[0x08])) --> [0x08].  % BS  (backspace)
s100(type_codes(syntax_error(13),[0x09])) --> [0x09].  % TAB (horizontal tab)          % Whitespace
s100(type_codes(syntax_error(13),[0x0A])) --> [0x0A].  % LF  (line feed)               % Whitespace
s100(type_codes(syntax_error(13),[0x0B])) --> [0x0B].  % VT  (vertical tab)
s100(type_codes(syntax_error(13),[0x0C])) --> [0x0C].  % FF  (form feed)               % Whitespace
s100(type_codes(syntax_error(13),[0x0D])) --> [0x0D].  % CR  (carriage return)         % Whitespace
s100(type_codes(syntax_error(13),[0x0E])) --> [0x0E].  % SO  (shift out)
s100(type_codes(syntax_error(13),[0x0F])) --> [0x0F].  % SI  (shift in)
s100(type_codes(syntax_error(13),[0x10])) --> [0x10].  % DLE (data link escape)
s100(type_codes(syntax_error(13),[0x11])) --> [0x11].  % DC1 (device control 1)
s100(type_codes(syntax_error(13),[0x12])) --> [0x12].  % DC2 (device control 2)
s100(type_codes(syntax_error(13),[0x13])) --> [0x13].  % DC3 (device control 3)
s100(type_codes(syntax_error(13),[0x14])) --> [0x14].  % DC4 (device control 4)
s100(type_codes(syntax_error(13),[0x15])) --> [0x15].  % NAK (negative acknowledge)
s100(type_codes(syntax_error(13),[0x16])) --> [0x16].  % SYN (synchronous idle)
s100(type_codes(syntax_error(13),[0x17])) --> [0x17].  % ETB (end of trans. block)
s100(type_codes(syntax_error(13),[0x18])) --> [0x18].  % CAN (cancel)
s100(type_codes(syntax_error(13),[0x19])) --> [0x19].  % EM  (end of medium)
s100(type_codes(syntax_error(13),[0x1A])) --> [0x1A].  % SUB (substitute)
s100(type_codes(syntax_error(13),[0x1B])) --> [0x1B].  % ESC (escape)
s100(type_codes(syntax_error(13),[0x1C])) --> [0x1C].  % FS  (file separator)
s100(type_codes(syntax_error(13),[0x1D])) --> [0x1D].  % GS  (group separator)
s100(type_codes(syntax_error(13),[0x1E])) --> [0x1E].  % RS  (record separator)
s100(type_codes(syntax_error(13),[0x1F])) --> [0x1F].  % US  (unit separator)
s100(type_codes(syntax_error(13),[0'\s])) --> " ".     %     (space)                   % Whitespace
s100(type_codes(Type,[0'!|Codes]))        --> "!",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'"|Codes]))        --> "\"",   s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'#|Codes]))        --> "#",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'$|Codes]))        --> "$",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'%|Codes]))        --> "%",    s100(type_codes(Type,Codes)).      % Delimiter
s100(type_codes(Type,[0'&|Codes]))        --> "&",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'\'|Codes]))       --> "'",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'(|Codes]))        --> "(",    s100(type_codes(Type,Codes)).      % Delimiter
s100(type_codes(Type,[0')|Codes]))        --> ")",    s100(type_codes(Type,Codes)).      % Delimiter
s100(type_codes(Type,[0'*|Codes]))        --> "*",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'+|Codes]))        --> "+",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0',|Codes]))        --> ",",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'-|Codes]))        --> "-",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'.|Codes]))        --> ".",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'/|Codes]))        --> "/",    s100(type_codes(Type,Codes)).      % Delimiter
s100(type_codes(Type,[0'0|Codes]))        --> "0",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'1|Codes]))        --> "1",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'2|Codes]))        --> "2",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'3|Codes]))        --> "3",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'4|Codes]))        --> "4",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'5|Codes]))        --> "5",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'6|Codes]))        --> "6",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'7|Codes]))        --> "7",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'8|Codes]))        --> "8",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'9|Codes]))        --> "9",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0':|Codes]))        --> ":",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0';|Codes]))        --> ";",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'<|Codes]))        --> "<",    s100(type_codes(Type,Codes)).      % Delimiter
s100(type_codes(Type,[0'=|Codes]))        --> "=",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'>|Codes]))        --> ">",    s100(type_codes(Type,Codes)).      % Delimiter
s100(type_codes(Type,[0'?|Codes]))        --> "?",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'@|Codes]))        --> "@",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'A|Codes]))        --> "A",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'B|Codes]))        --> "B",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'C|Codes]))        --> "C",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'D|Codes]))        --> "D",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'E|Codes]))        --> "E",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'F|Codes]))        --> "F",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'G|Codes]))        --> "G",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'H|Codes]))        --> "H",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'I|Codes]))        --> "I",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'J|Codes]))        --> "J",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'K|Codes]))        --> "K",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'L|Codes]))        --> "L",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'M|Codes]))        --> "M",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'N|Codes]))        --> "N",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'O|Codes]))        --> "O",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'P|Codes]))        --> "P",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'Q|Codes]))        --> "Q",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'R|Codes]))        --> "R",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'S|Codes]))        --> "S",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'T|Codes]))        --> "T",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'U|Codes]))        --> "U",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'V|Codes]))        --> "V",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'W|Codes]))        --> "W",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'X|Codes]))        --> "X",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'Y|Codes]))        --> "Y",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'Z|Codes]))        --> "Z",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'[|Codes]))        --> "[",    s100(type_codes(Type,Codes)).      % Delimiter
s100(type_codes(Type,[0'\\|Codes]))       --> "\\",   s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0']|Codes]))        --> "]",    s100(type_codes(Type,Codes)).      % Delimiter
s100(type_codes(Type,[0'^|Codes]))        --> "^",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'_|Codes]))        --> "_",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'`|Codes]))        --> "`",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'a|Codes]))        --> "a",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'b|Codes]))        --> "b",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'c|Codes]))        --> "c",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'd|Codes]))        --> "d",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'e|Codes]))        --> "e",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'f|Codes]))        --> "f",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'g|Codes]))        --> "g",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'h|Codes]))        --> "h",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'i|Codes]))        --> "i",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'j|Codes]))        --> "j",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'k|Codes]))        --> "k",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'l|Codes]))        --> "l",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'm|Codes]))        --> "m",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'n|Codes]))        --> "n",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'o|Codes]))        --> "o",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'p|Codes]))        --> "p",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'q|Codes]))        --> "q",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'r|Codes]))        --> "r",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0's|Codes]))        --> "s",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0't|Codes]))        --> "t",    s100(type_codes(Type,Codes)).
s100(type_codes(Type,[0'u|Codes]))        --> "u",    s100(type_codes(Type,Codes)).
s100(type_codes(syntax_error(13),[0'v]))  --> "v".
s100(type_codes(syntax_error(13),[0'w]))  --> "w".
s100(type_codes(syntax_error(13),[0'x]))  --> "x".
s100(type_codes(syntax_error(13),[0'y]))  --> "y".
s100(type_codes(Type,[0'z|Codes]))                     --> "z",    s100(type_codes(Type,Codes)).
s100(type_codes(syntax_error(13),[0'{]))  --> "{".           % Delimiter
s100(type_codes(syntax_error(13),[0'|]))  --> "|".
s100(type_codes(syntax_error(13),[0'}]))  --> "}".           % Delimiter
% s100(type_codes(Type,[0'~|Codes]))                     --> "~",    s100(type_codes(Type,Codes)).          % signals end of ASCII 85-base characters % Do not check for '~' in this state so it can be found in other state.
s100(type_codes(syntax_error(13),[0xFF])) --> [0xFF]. % DEL

% Recursion base case for s100
s100(type_codes(_Type,[])) --> [].

% ---------------------------

% s101 - ASCII base-85 string - End

% s101(type_codes(ascii_base_85_string,Codes),bytes(Bytes)) -->
%     "~>",
%     { ascii_base_85_string(Codes,Bytes) }.
s101(type_codes(ascii_base_85_string,Codes),token(literal_string,String)) -->
    "~>",
    {
        ascii_base_85_string(Codes,Bytes),
        string_codes(String,Bytes)
    }.
s101(type_codes(ascii_base_85_string,[]),syntax_error(14,token(literal_string,String))) -->
    \+ "~>",
    { string_codes(String,[0'<,0'~]) }.
s101(type_codes(ascii_base_85_string,Ascii_base_85_string_codes),syntax_error(06,token(literal_string,String))) -->
    \+ "~>",
    s150(Unknown_codes),
    {
        append(Ascii_base_85_string_codes,Unknown_codes,Codes),
        string_codes(String,Codes)
    }.
s101(type_codes(syntax_error(13),Ascii_base_85_string_codes),syntax_error(13,token(literal_string,String))) -->
    s150(Unknown_codes),
    {
        append(Ascii_base_85_string_codes,Unknown_codes,Codes),
        string_codes(String,Codes)
    }.

% ---------------------------

% s110 - Dictionary

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Dictionaries
% Book page: 23 - PDF index page: 47
%
% The special character sequences << and >> (LanguageLevel 2) are self-delimiting
% tokens that denote the construction of a dictionary, much the same as [ and ] denote
% the construction of an array. They are intended to be used as follows:
%
% << key1 value1 key2 value2 … keyn valuen >>
%
% This creates a dictionary containing the bracketed key-value pairs and pushes it
% on the operand stack. Dictionaries are introduced in Section 3.3, “Data Types and
% Objects.”
%
% << and >> are merely special names for operators that, when executed, cause a
% dictionary to be constructed. They are like the [ and ] array construction operators,
% but unlike the { and } delimiters for procedure literals.
%
% The << and >> tokens are self-delimiting, so they need not be surrounded by
% white-space characters or other delimiters. Do not confuse these tokens with
% < and >, which delimit a hexadecimal string literal, or <~ and ~>, which delimit
% an ASCII base-85 string literal. The << and >> tokens are objects in their own
% right (specifically, name objects), whereas in < … > and <~ … ~> the delimiting
% characters are merely punctuation for the enclosed literal string objects.

% PLRM.pdf Section 3.3.9 - Dictionary Object
% Book page: 41 - PDF index page: 55
%
% A dictionary is an associative table whose entries are pairs of PostScript objects.
% The first element of an entry is the key and the second element is the value. The
% PostScript language includes operators that insert an entry into a dictionary, look
% up a key and fetch the associated value, and perform various other operations.
%
% Keys are normally name objects. The PostScript syntax and the interpreter are
% optimized for this most common case. However, a key may be any PostScript object
% except null (defined later). If you attempt to use a string as a key, the Post-
% Script interpreter will first convert the string to a name object; thus, strings and
% names are interchangeable when used as keys in dictionaries. Consequently, a string
% used as a dictionary key is subject to the implementation limit on the length of a
% name.
%
% A dictionary has the capacity to hold a certain maximum number of entries; the
% capacity is specified when the dictionary is created. PostScript interpreters of different
% LanguageLevels differ in their behavior when a program attempts to insert
% an entry into a dictionary that is full: in LanguageLevel 1, a dictfull error occurs;
% in LanguageLevels 2 and 3, the interpreter enlarges the dictionary automatically.
% The length of a dictionary is also subject to an implementation limit; see
% Appendix B.
%
% Dictionaries ordinarily associate the names and values of a program’s components,
% such as variables and procedures. This association corresponds to the conventional
% use of identifiers in other programming languages. But there are many
% other uses for dictionaries. For example, a PostScript font program contains a
% dictionary that associates the names of characters with the procedures for drawing
% those characters’ shapes (see Chapter 5).
%
% There are three primary methods for accessing dictionaries:
%
% • Operators exist to access a specific dictionary supplied as an operand.
%
% • There is a current dictionary and a set of operators to access it implicitly.
%
% • The interpreter automatically looks up executable names it encounters in the
% program being executed.
%
% The interpreter maintains a dictionary stack defining the current dynamic name
% space. Dictionaries may be pushed on and popped off the dictionary stack at will.
% The topmost dictionary on the stack is the current dictionary.
%
% When the interpreter looks up a key implicitly—for example, when it executes a
% name object—it searches for the key in the dictionaries on the dictionary stack. It
% searches first in the topmost dictionary, then in successively lower dictionaries on
% the dictionary stack, until it either finds the key or exhausts the dictionary stack.
% In LanguageLevel 1, there are two built-in dictionaries permanently on the dictionary
% stack; they are called systemdict and userdict. In LanguageLevels 2 and 3,
% there are three dictionaries: systemdict, globaldict, and userdict.
%
% • systemdict is a read-only dictionary that associates the names of all the Post-
% Script operators (those defined in this book) with their values (the built-in actions
% that implement them). It also contains other definitions, including the
% standard local and global dictionaries listed in Section 3.7.5, “Standard and
% User-Defined Dictionaries,” as well as various named constants such as true
% and false.
%
% • globaldict (LanguageLevel 2) is a writeable dictionary in global VM. This is explained
% in Section 3.7.2, “Local and Global VM.”
%
% • userdict is a writeable dictionary in local VM. It is the default modifiable naming
% environment normally used by PostScript programs.
%
% userdict is the topmost of the permanent dictionaries on the dictionary stack.
% The def operator puts definitions there unless the program has pushed some other
% dictionary on the dictionary stack. Applications can and should create their
% own dictionaries rather than put things in userdict.
%
% A dictionary is a composite object. Copying a dictionary

s110([Postscript_token|Postscript_tokens]) -->
    \+ ">>",
    s060(_Whitespace1),
    postscript_scanner_token(Postscript_token),
    s060(_Whitespace2),
    s110(Postscript_tokens).
s110([]) --> [].

% ---------------------------

% s111 - Dictionary - End

% s111(Items,dictionary(Items)) -->
%     ">>",
%     {
%         length(Items,Length),
%         0 is Length mod 2
%     }.
% s111(Items,syntax_error(05,Key)) -->
%     ">>",
%     {
%         length(Items,Length),
%         1 is Length mod 2,
%         last(Items,Key)
%     }.
% s111(Items,syntax_error(08,Items)) -->
%     \+ ">>",
%     s150(_Codes).

% ---------------------------

% s120 - Array
%
% PLRM.pdf Section 3.2.2 - ASCII Encoding - Arrays
% Book page: 32 - PDF index page: 46
%
% The characters [ and ] are self-delimiting tokens that specify the construction of
% an array. For example, the program fragment
%
% [ 123 /abc (xyz) ]
%
% results in the construction of an array object containing the integer object 123,
% the literal name object abc, and the string object xyz. Each token within the
% brackets is executed in turn.
%
% The [ and ] characters are special syntax for names that, when executed, invoke
% PostScript operators that collect objects and construct an array containing them.
% Thus the example
%
% [ 123 /abc (xyz) ]
%
% contains these five tokens:
%
% • The name object [
% • The integer object 123
% • The literal name object abc
% • The string object xyz
% • The name object ]
%
% When the example is executed, a sixth object (the array) results from executing
% the [ and ] name objects.

% s120([Postscript_token|Postscript_tokens]) -->
%     \+ "]",
%     s060(_Whitespace1),
%     postscript_scanner_token(Postscript_token),
%     s060(_Whitespace2),
%     s120(Postscript_tokens).
% s120([]) --> [].

% ---------------------------

% s121 - Array - End

% s121(Items,array(Items)) -->
%     "]".
% s121(Items,syntax_error(10,Items)) -->
%     \+ "]",
%     s150(_Codes).

% ---------------------------

% s130 - Procedure
%
% PLRM.pdf Section 3.2.2 - ASCII Encoding - Procedures
% Book page: 32 - PDF index page: 46
%
% The special characters { and } delimit an executable array, otherwise known as a
% procedure. The syntax is superficially similar to that for the array construction operators
% [ and ]; however, the semantics are entirely different and arise as a result of
% scanning the procedure rather than executing it.
%
% Scanning the program fragment
%
% {add 2 div}
%
% produces a single procedure object that contains the name object add, the integer
% object 2, and the name object div. When the scanner encounters the initial {, it
% continues scanning and creating objects, but the interpreter does not execute
% them. When the scanner encounters the matching }, it puts all the objects created
% since the initial { into a new executable array (procedure) object.
%
% The interpreter does not execute a procedure immediately, but treats it as data; it
% pushes the procedure on the operand stack. Only when the procedure is explicitly
% invoked (by means yet to be described) will it be executed. Execution of the procedure
% and of all objects within the procedure, including any embedded procedures
% has been deferred. The matter of immediate versus deferred execution is
% discussed in Section 3.5, “Execution.”
%
% The procedure object created by { and } is either an array or a packed array,
% according to the current setting of a mode switch. The distinction between these
% array types is discussed in Section 3.3, “Data Types and Objects.”

s130([Postscript_token|Postscript_tokens]) -->
    \+ "}",
    s060(_Whitespace1),
    % postscript_scanner_token(Postscript_token),
    postscript_scanner_object(Postscript_token),
    s060(_Whitespace2),
    s130(Postscript_tokens).
s130([]) --> [].

% ---------------------------

% s131 - Procedure - End

s131(Items,token(procedure,Items)) -->
    "}".
% s131(Items,syntax_error(11,Items)) -->
%     \+ "}",
%     s150(_Codes).
s131([],syntax_error(11,[],token(literal_string,String))) -->
    \+ "}",
    { string_codes(String,[0'{]) }.
s131(Items,syntax_error(11,Items,token(literal_string,String))) -->
    \+ "}",
    s150(Unknown_codes),
    {
        string_codes(String,Unknown_codes)
    }.

% ---------------------------

% s150 - Error scan ahead - Scan until start of next object
% Scan until whitespace or start delimiter
% Should be at whitespace or start delimiter which is the start of next object or end of stream

% s150([0x00|Codes]) --> [0x00],  s060(Codes).  % NUL (null)                      % Whitespace
s150([0x01|Codes]) --> [0x01],  s150(Codes).    % SOH (start of heading)
s150([0x02|Codes]) --> [0x02],  s150(Codes).    % STX (start of text)
s150([0x03|Codes]) --> [0x03],  s150(Codes).    % ETX (end of text)
s150([0x04|Codes]) --> [0x04],  s150(Codes).    % EOT (end of transmission)
s150([0x05|Codes]) --> [0x05],  s150(Codes).    % ENQ (enquiry)
s150([0x06|Codes]) --> [0x06],  s150(Codes).    % ACK (acknowledge)
s150([0x07|Codes]) --> [0x07],  s150(Codes).    % BEL (bell)
s150([0x08|Codes]) --> [0x08],  s150(Codes).    % BS  (backspace)
% s150([0x09|Codes]) --> [0x09],  s060(Codes).  % TAB (horizontal tab)            % Whitespace
% s150([0x0A|Codes]) --> [0x0A],  s060(Codes).  % LF  (line feed)                 % Whitespace
s150([0x0B|Codes]) --> [0x0B],  s150(Codes).    % VT  (vertical tab)
% s150([0x0C|Codes]) --> [0x0C],  s060(Codes).  % FF  (form feed)                 % Whitespace
% s150([0x0D|Codes]) --> [0x0D],  s060(Codes).  % CR  (carriage return)           % Whitespace
s150([0x0E|Codes]) --> [0x0E],  s150(Codes).    % SO  (shift out)
s150([0x0F|Codes]) --> [0x0F],  s150(Codes).    % SI  (shift in)
s150([0x10|Codes]) --> [0x10],  s150(Codes).    % DLE (data link escape)
s150([0x11|Codes]) --> [0x11],  s150(Codes).    % DC1 (device control 1)
s150([0x12|Codes]) --> [0x12],  s150(Codes).    % DC2 (device control 2)
s150([0x13|Codes]) --> [0x13],  s150(Codes).    % DC3 (device control 3)
s150([0x14|Codes]) --> [0x14],  s150(Codes).    % DC4 (device control 4)
s150([0x15|Codes]) --> [0x15],  s150(Codes).    % NAK (negative acknowledge)
s150([0x16|Codes]) --> [0x16],  s150(Codes).    % SYN (synchronous idle)
s150([0x17|Codes]) --> [0x17],  s150(Codes).    % ETB (end of trans. block)
s150([0x18|Codes]) --> [0x18],  s150(Codes).    % CAN (cancel)
s150([0x19|Codes]) --> [0x19],  s150(Codes).    % EM  (end of medium)
s150([0x1A|Codes]) --> [0x1A],  s150(Codes).    % SUB (substitute)
s150([0x1B|Codes]) --> [0x1B],  s150(Codes).    % ESC (escape)
s150([0x1C|Codes]) --> [0x1C],  s150(Codes).    % FS  (file separator)
s150([0x1D|Codes]) --> [0x1D],  s150(Codes).    % GS  (group separator)
s150([0x1E|Codes]) --> [0x1E],  s150(Codes).    % RS  (record separator)
s150([0x1F|Codes]) --> [0x1F],  s150(Codes).    % US  (unit separator)
% s150([0'\s|Codes]) --> " ",     s060(Codes).  %     (space)                     % Whitespace
s150([0'! |Codes]) --> "!",     s150(Codes).
s150([0'" |Codes]) --> "\"",    s150(Codes).
s150([0'# |Codes]) --> "#",     s150(Codes).
s150([0'$ |Codes]) --> "$",     s150(Codes).
% s150([0'% |Codes]) --> "%",     s150(Codes).  % Start delimiter
s150([0'& |Codes]) --> "&",     s150(Codes).
s150([0'\'|Codes]) --> "'",     s150(Codes).
% s150([0'( |Codes]) --> "(",     s150(Codes).  % Start delimiter
s150([0') |Codes]) --> ")",     s150(Codes).    % End delimiter
s150([0'* |Codes]) --> "*",     s150(Codes).
s150([0'+ |Codes]) --> "+",     s150(Codes).
s150([0', |Codes]) --> ",",     s150(Codes).
s150([0'- |Codes]) --> "-",     s150(Codes).
s150([0'. |Codes]) --> ".",     s150(Codes).
% s150([0'/ |Codes]) --> "/",     s150(Codes).  % Start delimiter
s150([0'0 |Codes]) --> "0",     s150(Codes).
s150([0'1 |Codes]) --> "1",     s150(Codes).
s150([0'2 |Codes]) --> "2",     s150(Codes).
s150([0'3 |Codes]) --> "3",     s150(Codes).
s150([0'4 |Codes]) --> "4",     s150(Codes).
s150([0'5 |Codes]) --> "5",     s150(Codes).
s150([0'6 |Codes]) --> "6",     s150(Codes).
s150([0'7 |Codes]) --> "7",     s150(Codes).
s150([0'8 |Codes]) --> "8",     s150(Codes).
s150([0'9 |Codes]) --> "9",     s150(Codes).
s150([0': |Codes]) --> ":",     s150(Codes).
s150([0'; |Codes]) --> ";",     s150(Codes).
% s150([0'< |Codes]) --> "<",     s150(Codes).  % Start delimiter
s150([0'= |Codes]) --> "=",     s150(Codes).
s150([0'> |Codes]) --> ">",     s150(Codes).    % End delimiter
s150([0'? |Codes]) --> "?",     s150(Codes).
s150([0'@ |Codes]) --> "@",     s150(Codes).
s150([0'A |Codes]) --> "A",     s150(Codes).
s150([0'B |Codes]) --> "B",     s150(Codes).
s150([0'C |Codes]) --> "C",     s150(Codes).
s150([0'D |Codes]) --> "D",     s150(Codes).
s150([0'E |Codes]) --> "E",     s150(Codes).
s150([0'F |Codes]) --> "F",     s150(Codes).
s150([0'G |Codes]) --> "G",     s150(Codes).
s150([0'H |Codes]) --> "H",     s150(Codes).
s150([0'I |Codes]) --> "I",     s150(Codes).
s150([0'J |Codes]) --> "J",     s150(Codes).
s150([0'K |Codes]) --> "K",     s150(Codes).
s150([0'L |Codes]) --> "L",     s150(Codes).
s150([0'M |Codes]) --> "M",     s150(Codes).
s150([0'N |Codes]) --> "N",     s150(Codes).
s150([0'O |Codes]) --> "O",     s150(Codes).
s150([0'P |Codes]) --> "P",     s150(Codes).
s150([0'Q |Codes]) --> "Q",     s150(Codes).
s150([0'R |Codes]) --> "R",     s150(Codes).
s150([0'S |Codes]) --> "S",     s150(Codes).
s150([0'T |Codes]) --> "T",     s150(Codes).
s150([0'U |Codes]) --> "U",     s150(Codes).
s150([0'V |Codes]) --> "V",     s150(Codes).
s150([0'W |Codes]) --> "W",     s150(Codes).
s150([0'X |Codes]) --> "X",     s150(Codes).
s150([0'Y |Codes]) --> "Y",     s150(Codes).
s150([0'Z |Codes]) --> "Z",     s150(Codes).
% s150([0'[ |Codes]) --> "[",     s150(Codes).  % Start delimiter
s150([0'\\|Codes]) --> "\\",    s150(Codes).
s150([0'] |Codes]) --> "]",     s150(Codes).    % End delimiter
s150([0'^ |Codes]) --> "^",     s150(Codes).
s150([0'_ |Codes]) --> "_",     s150(Codes).
s150([0'` |Codes]) --> "`",     s150(Codes).
s150([0'a |Codes]) --> "a",     s150(Codes).
s150([0'b |Codes]) --> "b",     s150(Codes).
s150([0'c |Codes]) --> "c",     s150(Codes).
s150([0'd |Codes]) --> "d",     s150(Codes).
s150([0'e |Codes]) --> "e",     s150(Codes).
s150([0'f |Codes]) --> "f",     s150(Codes).
s150([0'g |Codes]) --> "g",     s150(Codes).
s150([0'h |Codes]) --> "h",     s150(Codes).
s150([0'i |Codes]) --> "i",     s150(Codes).
s150([0'j |Codes]) --> "j",     s150(Codes).
s150([0'k |Codes]) --> "k",     s150(Codes).
s150([0'l |Codes]) --> "l",     s150(Codes).
s150([0'm |Codes]) --> "m",     s150(Codes).
s150([0'n |Codes]) --> "n",     s150(Codes).
s150([0'o |Codes]) --> "o",     s150(Codes).
s150([0'p |Codes]) --> "p",     s150(Codes).
s150([0'q |Codes]) --> "q",     s150(Codes).
s150([0'r |Codes]) --> "r",     s150(Codes).
s150([0's |Codes]) --> "s",     s150(Codes).
s150([0't |Codes]) --> "t",     s150(Codes).
s150([0'u |Codes]) --> "u",     s150(Codes).
s150([0'v |Codes]) --> "v",     s150(Codes).
s150([0'w |Codes]) --> "w",     s150(Codes).
s150([0'x |Codes]) --> "x",     s150(Codes).
s150([0'y |Codes]) --> "y",     s150(Codes).
s150([0'z |Codes]) --> "z",     s150(Codes).
% s150([0'{ |Codes]) --> "{",     s150(Codes).  % Start delimiter
s150([0'| |Codes]) --> "|",     s150(Codes).
s150([0'} |Codes]) --> "}",     s150(Codes).    % End delimiter
s150([0'~ |Codes]) --> "~",     s150(Codes).
s150([0xFF|Codes]) --> [0xFF],  s150(Codes).

% Recursion base case for s150
s150([]) --> [].

% ---------------------------

% Section: Convert type and codes to PostScript object based on type

% postscript_type_token(type_codes(number,Number_codes),number(Number)) :-
%     number_codes(Number0,Number_codes),
%     prolog_number(Number0,Number).
postscript_type_token(type_codes(integer,Number_codes),token(integer,Number)) :-
    number_codes(Number0,Number_codes),
    prolog_number(Number0,Number).
postscript_type_token(type_codes(real,Number_codes),token(real,Number)) :-
    number_codes(Number0,Number_codes),
    prolog_number(Number0,Number).
postscript_type_token(type_codes(executable_name,Name_codes),token(executable_name,Name)) :-
    atom_codes(Name,Name_codes).
% postscript_type_token(type_codes(radix,radix(Base,Number_codes)),number(Number)) :-
%     number_codes_digits(Number_codes,Digits0),
%     trim_digits(Digits0,Digits),
%     n_base_digits(Number,Base,Digits).
postscript_type_token(type_codes(radix,radix(Base,Number_codes)),token(integer,Number)) :-
    number_codes_digits(Number_codes,Digits0),
    trim_digits(Digits0,Digits),
    n_base_digits(Number,Base,Digits).

% Convert character codes to Digits (List of numbers where each number is less than base) for n_base_digit.
number_codes_digits([Number_code|Number_codes],[Digit|Digits]) :-
    code_digit(Number_code,Digit),
    number_codes_digits(Number_codes,Digits).
number_codes_digits([],[]).

% Trim leading zero digits
trim_digits([0|Digits0],Digits) :-
    trim_digits(Digits0,Digits).
trim_digits(Digits,Digits).

code_digit(0'0,0).
code_digit(0'1,1).
code_digit(0'2,2).
code_digit(0'3,3).
code_digit(0'4,4).
code_digit(0'5,5).
code_digit(0'6,6).
code_digit(0'7,7).
code_digit(0'8,8).
code_digit(0'9,9).
code_digit(0'A,10).
code_digit(0'B,11).
code_digit(0'C,12).
code_digit(0'D,13).
code_digit(0'E,14).
code_digit(0'F,15).
code_digit(0'G,16).
code_digit(0'H,17).
code_digit(0'I,18).
code_digit(0'J,19).
code_digit(0'K,20).
code_digit(0'L,21).
code_digit(0'M,22).
code_digit(0'N,23).
code_digit(0'O,24).
code_digit(0'P,25).
code_digit(0'Q,26).
code_digit(0'R,27).
code_digit(0'S,28).
code_digit(0'T,29).
code_digit(0'U,30).
code_digit(0'V,31).
code_digit(0'W,32).
code_digit(0'X,33).
code_digit(0'Y,34).
code_digit(0'Z,35).
code_digit(0'a,10).
code_digit(0'b,11).
code_digit(0'c,12).
code_digit(0'd,13).
code_digit(0'e,14).
code_digit(0'f,15).
code_digit(0'g,16).
code_digit(0'h,17).
code_digit(0'i,18).
code_digit(0'j,19).
code_digit(0'k,20).
code_digit(0'l,21).
code_digit(0'm,22).
code_digit(0'n,23).
code_digit(0'o,24).
code_digit(0'p,25).
code_digit(0'q,26).
code_digit(0'r,27).
code_digit(0's,28).
code_digit(0't,29).
code_digit(0'u,30).
code_digit(0'v,31).
code_digit(0'w,32).
code_digit(0'x,33).
code_digit(0'y,34).
code_digit(0'z,35).

prolog_number(-0.0,0.0).
prolog_number(N,N).

% ---------------------------

peek_whitespace([0x00|Rest],[0x00|Rest]).    % Null (nul)
peek_whitespace([0x09|Rest],[0x09|Rest]).    % Tab  (tab)
peek_whitespace([0x0A|Rest],[0x0A|Rest]).    % Line feed (LF)
peek_whitespace([0x0C|Rest],[0x0C|Rest]).    % From feed (FF)
peek_whitespace([0x0D|Rest],[0x0D|Rest]).    % Carriage return (CR)
peek_whitespace([0x20|Rest],[0x20|Rest]).    % Space (SP)

peek_delimiter([0'(|Rest],[0'(|Rest]).      % (
peek_delimiter([0')|Rest],[0')|Rest]).      % )
peek_delimiter([0'<|Rest],[0'<|Rest]).      % <
peek_delimiter([0'>|Rest],[0'>|Rest]).      % >
peek_delimiter([0'[|Rest],[0'[|Rest]).      % [
peek_delimiter([0']|Rest],[0']|Rest]).      % ]
peek_delimiter([0'{|Rest],[0'{|Rest]).      % {
peek_delimiter([0'}|Rest],[0'}|Rest]).      % }
peek_delimiter([0'/|Rest],[0'/|Rest]).      % /
peek_delimiter([0'%|Rest],[0'%|Rest]).      % %

% Dead code. DO NOT DELETE.
% May need for some other use latter.
% postscript_delimiter_code(0'() --> "(".
% postscript_delimiter_code(0')) --> ")".
% postscript_delimiter_code(0'<) --> "<".
% postscript_delimiter_code(0'>) --> ">".
% postscript_delimiter_code(0'[) --> "[".
% postscript_delimiter_code(0']) --> "]".
% postscript_delimiter_code(0'{) --> "{".
% postscript_delimiter_code(0'}) --> "}".
% postscript_delimiter_code(0'/) --> "/".
% postscript_delimiter_code(0'%) --> "%".

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Comments
% Book page: 27 - PDF index page: 41
%
% Any occurrence of the character % outside a string introduces a comment. The
% comment consists of all characters between the % and the next newline or form
% feed, including regular, delimiter, space, and tab characters.
%
% NB Form feed alone can end a comment

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Numbers
% Book page: 28 - PDF index page: 42
%
% Numbers in the PostScript language include:
% • Signed integers, such as
% 123 -98 43445 0 +17
% • Real numbers, such as
% -.002 34.5 -3.62 123.6e10 1.0E-5 1E6 -1. 0.0
% • Radix numbers, such as
% 8#1777 16#FFFE 2#1000

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Numbers - Integer
% Book page: 28 - PDF index page: 42
%
% An integer consists of an optional sign followed by one or more decimal digits.
% The number is interpreted as a signed decimal integer and is converted to an integer
% object. If it exceeds the implementation limit for integers, it is converted to a
% real object. (See Appendix B for implementation limits.)

% PLRM.pdf Appendix B: Implementation Limits - Table B.1 Architectural limits
% Book page: 739 - PDF index page: 753
%
% QUANTITY  LIMIT           DESCRIPTION
% integer   2,147,483,647   Largest integer value. This value is equal to 2^31 - 1, and its internal representation
%                           is 16#7FFFFFFF. In most situations, an integer that would exceed
%                           this limit is automatically converted to a real value.
%           -2,147,483,648  Smallest integer value. This value is equal to -2^31, and its internal representation
%                           is 16#80000000.

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Numbers - Real
% Book page: 28 - PDF index page: 42
%
% A real number consists of an optional sign and one or more decimal digits, with
% an embedded period (decimal point), a trailing exponent, or both. The exponent,
% if present, consists of the letter E or e followed by an optional sign and one or
% more decimal digits. The number is interpreted as a real number and is converted
% to a real (floating-point) object. If it exceeds the implementation limit for real
% numbers, a limitcheck error occurs.

% PLRM.pdf Appendix B: Implementation Limits - Table B.1 Architectural limits
% Book page: 739 - PDF index page: 753
%
% QUANTITY  LIMIT   DESCRIPTION
% real      ±1038   Largest and smallest real values (approximate).
%           ±10-38  Nonzero real values closest to 0 (approximate). Values closer than these
%                   are automatically converted to 0.
%           8       Significant decimal digits of precision (approximate).

scan(Postscript_token) -->                        % PostScript stream (Character codes) is hidden argument with DCG.
    postscript_scanner_token(Postscript_token), !.

codes_chars([Code|Codes],[Char|Chars]) :-
    char_code(Char,Code),
    codes_chars(Codes,Chars).
codes_chars([],[]).

% PLRM.pdf Section 3.2.2 - ASCII Encoding
% Book page: 26 - PDF index page: 40
%
% The standard character set for ASCII-encoded PostScript programs is the visible
% printable subset of the ASCII character set, plus characters that appear as “white
% space,” such as space, tab, and newline characters.
% ascii_printable(0'!) --> "!".
% ascii_printable(0'") --> "\"".
% ascii_printable(0'#) --> "#".
% ascii_printable(0'$) --> "$".
% ascii_printable(0'%) --> "%".
% ascii_printable(0'&) --> "&".
% ascii_printable(0'\') --> "'".
% ascii_printable(0'() --> "(".
% ascii_printable(0')) --> ")".
% ascii_printable(0'*) --> "*".
% ascii_printable(0'+) --> "+".
% ascii_printable(0',) --> ",".
% ascii_printable(0'-) --> "-".
% ascii_printable(0'.) --> ".".
% ascii_printable(0'/) --> "/".
% ascii_printable(0'0) --> "0".
% ascii_printable(0'1) --> "1".
% ascii_printable(0'2) --> "2".
% ascii_printable(0'3) --> "3".
% ascii_printable(0'4) --> "4".
% ascii_printable(0'5) --> "5".
% ascii_printable(0'6) --> "6".
% ascii_printable(0'7) --> "7".
% ascii_printable(0'8) --> "8".
% ascii_printable(0'9) --> "9".
% ascii_printable(0':) --> ":".
% ascii_printable(0';) --> ";".
% ascii_printable(0'<) --> "<".
% ascii_printable(0'=) --> "=".
% ascii_printable(0'>) --> ">".
% ascii_printable(0'?) --> "?".
% ascii_printable(0'@) --> "@".
% ascii_printable(0'A) --> "A".
% ascii_printable(0'B) --> "B".
% ascii_printable(0'C) --> "C".
% ascii_printable(0'D) --> "D".
% ascii_printable(0'E) --> "E".
% ascii_printable(0'F) --> "F".
% ascii_printable(0'G) --> "G".
% ascii_printable(0'H) --> "H".
% ascii_printable(0'I) --> "I".
% ascii_printable(0'J) --> "J".
% ascii_printable(0'K) --> "K".
% ascii_printable(0'L) --> "L".
% ascii_printable(0'M) --> "M".
% ascii_printable(0'N) --> "N".
% ascii_printable(0'O) --> "O".
% ascii_printable(0'P) --> "P".
% ascii_printable(0'Q) --> "Q".
% ascii_printable(0'R) --> "R".
% ascii_printable(0'S) --> "S".
% ascii_printable(0'T) --> "T".
% ascii_printable(0'U) --> "U".
% ascii_printable(0'V) --> "V".
% ascii_printable(0'W) --> "W".
% ascii_printable(0'X) --> "X".
% ascii_printable(0'Y) --> "Y".
% ascii_printable(0'Z) --> "Z".
% ascii_printable(0'[) --> "[".
% ascii_printable(0'\\) --> "\\".
% ascii_printable(0']) --> "]".
% ascii_printable(0'^) --> "^".
% ascii_printable(0'_) --> "_".
% ascii_printable(0'`) --> "`".
% ascii_printable(0'a) --> "a".
% ascii_printable(0'b) --> "b".
% ascii_printable(0'c) --> "c".
% ascii_printable(0'd) --> "d".
% ascii_printable(0'e) --> "e".
% ascii_printable(0'f) --> "f".
% ascii_printable(0'g) --> "g".
% ascii_printable(0'h) --> "h".
% ascii_printable(0'i) --> "i".
% ascii_printable(0'j) --> "j".
% ascii_printable(0'k) --> "k".
% ascii_printable(0'l) --> "l".
% ascii_printable(0'm) --> "m".
% ascii_printable(0'n) --> "n".
% ascii_printable(0'o) --> "o".
% ascii_printable(0'p) --> "p".
% ascii_printable(0'q) --> "q".
% ascii_printable(0'r) --> "r".
% ascii_printable(0's) --> "s".
% ascii_printable(0't) --> "t".
% ascii_printable(0'u) --> "u".
% ascii_printable(0'v) --> "v".
% ascii_printable(0'w) --> "w".
% ascii_printable(0'x) --> "x".
% ascii_printable(0'y) --> "y".
% ascii_printable(0'z) --> "z".
% ascii_printable(0'{) --> "{".
% ascii_printable(0'|) --> "|".
% ascii_printable(0'}) --> "}".
% ascii_printable(0'~) --> "~".

decimal_digit(0'0) --> "0".
decimal_digit(0'1) --> "1".
decimal_digit(0'2) --> "2".
decimal_digit(0'3) --> "3".
decimal_digit(0'4) --> "4".
decimal_digit(0'5) --> "5".
decimal_digit(0'6) --> "6".
decimal_digit(0'7) --> "7".
decimal_digit(0'8) --> "8".
decimal_digit(0'9) --> "9".

% PLRM.pdf Section 3.2.2 - ASCII Encoding - Numbers - Radix numbers
% Book page: 28 - PDF index page: 42
%
% Radix numbers, such as
% 8#1777 16#FFFE 2#1000

% postscript_radix_number(Base_codes,Value_codes,number(Number)) :-
%     flatten([Base_codes,[0''],Value_codes], Codes),
%     atom_codes(Atom,Codes),
%     atom_number(Atom,Number).

ascii_base_85_string([0'z|Codes],[B1,B2,B3,B4|Bytes]) :-
    ascii_base_85_decode([0'!,0'!,0'!,0'!,0'!],[B1,B2,B3,B4]),
    ascii_base_85_string(Codes,Bytes).
ascii_base_85_string([A1,A2,A3,A4,A5|Codes],[B1,B2,B3,B4|Bytes]) :-
    ascii_base_85_decode([A1,A2,A3,A4,A5],[B1,B2,B3,B4]),
    ascii_base_85_string(Codes,Bytes).
ascii_base_85_string([],[]).

ascii_base_85_decode([A10,A20,A30,A40,A50],[B1,B2,B3,B4]) :-
    A1 is A10 - 33,
    A2 is A20 - 33,
    A3 is A30 - 33,
    A4 is A40 - 33,
    A5 is A50 - 33,
    n_base_digits(Value,85,[A1,A2,A3,A4,A5]),
    n_base_digits(Value,256,[B1,B2,B3,B4]).

% PLRM.pdf Section 3.3.9 - Dictionary Objects
% Book page: 42 - PDF index page: 56
%
% The interpreter maintains a dictionary stack defining the current dynamic name
% space. Dictionaries may be pushed on and popped off the dictionary stack at will.
% The topmost dictionary on the stack is the current dictionary.

% ---------------------------

% Newline

% PLRM.pdf Section 3.2.2 - ASCII Encoding
% Book page: 26 - PDF index page: 40
%
% The characters carriage return (CR) and line feed (LF) are also called newline
% characters. The combination of a carriage return followed immediately by a line
% feed is treated as one newline.

postscript_newline_code(0'\r,0'\n) --> "\r\n".
postscript_newline_code(0'\r) --> "\r".
postscript_newline_code(0'\n) --> "\n".

% -------------------------------------

% regular characters

% s070(type_codes(Type,[0x00|Codes])) --> [0x00],  s070(type_codes(Type,Codes)).    % NUL (null)                    % Whitespace
% s070(type_codes(Type,[0x01|Codes])) --> [0x01],  s070(type_codes(Type,Codes)).    % SOH (start of heading)
% s070(type_codes(Type,[0x02|Codes])) --> [0x02],  s070(type_codes(Type,Codes)).    % STX (start of text)
% s070(type_codes(Type,[0x03|Codes])) --> [0x03],  s070(type_codes(Type,Codes)).    % ETX (end of text)
% s070(type_codes(Type,[0x04|Codes])) --> [0x04],  s070(type_codes(Type,Codes)).    % EOT (end of transmission)
% s070(type_codes(Type,[0x05|Codes])) --> [0x05],  s070(type_codes(Type,Codes)).    % ENQ (enquiry)
% s070(type_codes(Type,[0x06|Codes])) --> [0x06],  s070(type_codes(Type,Codes)).    % ACK (acknowledge)
% s070(type_codes(Type,[0x07|Codes])) --> [0x07],  s070(type_codes(Type,Codes)).    % BEL (bell)
% s070(type_codes(Type,[0x08|Codes])) --> [0x08],  s070(type_codes(Type,Codes)).    % BS  (backspace)
% s070(type_codes(Type,[0x09|Codes])) --> [0x09],  s070(type_codes(Type,Codes)).    % TAB (horizontal tab)          % Whitespace
% s070(type_codes(Type,[0x0A|Codes])) --> [0x0A],  s070(type_codes(Type,Codes)).    % LF  (line feed)               % Whitespace
% s070(type_codes(Type,[0x0B|Codes])) --> [0x0B],  s070(type_codes(Type,Codes)).    % VT  (vertical tab)
% s070(type_codes(Type,[0x0C|Codes])) --> [0x0C],  s070(type_codes(Type,Codes)).    % FF  (form feed)               % Whitespace
% s070(type_codes(Type,[0x0D|Codes])) --> [0x0D],  s070(type_codes(Type,Codes)).    % CR  (carriage return)         % Whitespace
% s070(type_codes(Type,[0x0E|Codes])) --> [0x0E],  s070(type_codes(Type,Codes)).    % SO  (shift out)
% s070(type_codes(Type,[0x0F|Codes])) --> [0x0F],  s070(type_codes(Type,Codes)).    % SI  (shift in)
% s070(type_codes(Type,[0x10|Codes])) --> [0x10],  s070(type_codes(Type,Codes)).    % DLE (data link escape)
% s070(type_codes(Type,[0x11|Codes])) --> [0x11],  s070(type_codes(Type,Codes)).    % DC1 (device control 1)
% s070(type_codes(Type,[0x12|Codes])) --> [0x12],  s070(type_codes(Type,Codes)).    % DC2 (device control 2)
% s070(type_codes(Type,[0x13|Codes])) --> [0x13],  s070(type_codes(Type,Codes)).    % DC3 (device control 3)
% s070(type_codes(Type,[0x14|Codes])) --> [0x14],  s070(type_codes(Type,Codes)).    % DC4 (device control 4)
% s070(type_codes(Type,[0x15|Codes])) --> [0x15],  s070(type_codes(Type,Codes)).    % NAK (negative acknowledge)
% s070(type_codes(Type,[0x16|Codes])) --> [0x16],  s070(type_codes(Type,Codes)).    % SYN (synchronous idle)
% s070(type_codes(Type,[0x17|Codes])) --> [0x17],  s070(type_codes(Type,Codes)).    % ETB (end of trans. block)
% s070(type_codes(Type,[0x18|Codes])) --> [0x18],  s070(type_codes(Type,Codes)).    % CAN (cancel)
% s070(type_codes(Type,[0x19|Codes])) --> [0x19],  s070(type_codes(Type,Codes)).    % EM  (end of medium)
% s070(type_codes(Type,[0x1A|Codes])) --> [0x1A],  s070(type_codes(Type,Codes)).    % SUB (substitute)
% s070(type_codes(Type,[0x1B|Codes])) --> [0x1B],  s070(type_codes(Type,Codes)).    % ESC (escape)
% s070(type_codes(Type,[0x1C|Codes])) --> [0x1C],  s070(type_codes(Type,Codes)).    % FS  (file separator)
% s070(type_codes(Type,[0x1D|Codes])) --> [0x1D],  s070(type_codes(Type,Codes)).    % GS  (group separator)
% s070(type_codes(Type,[0x1E|Codes])) --> [0x1E],  s070(type_codes(Type,Codes)).    % RS  (record separator)
% s070(type_codes(Type,[0x1F|Codes])) --> [0x1F],  s070(type_codes(Type,Codes)).    % US  (unit separator)
% s070(type_codes(Type,[0'\s|Codes])) --> " ",     s070(type_codes(Type,Codes)).    %     (space)                   % Whitespace
% s070(type_codes(Type,[0'! |Codes])) --> "!",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'" |Codes])) --> "\"",    s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'# |Codes])) --> "#",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'$ |Codes])) --> "$",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'% |Codes])) --> "%",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'& |Codes])) --> "&",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'\'|Codes])) --> "'",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'( |Codes])) --> "(",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0') |Codes])) --> ")",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'* |Codes])) --> "*",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'+ |Codes])) --> "+",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0', |Codes])) --> ",",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'- |Codes])) --> "-",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'. |Codes])) --> ".",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'/ |Codes])) --> "/",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'0 |Codes])) --> "0",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'1 |Codes])) --> "1",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'2 |Codes])) --> "2",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'3 |Codes])) --> "3",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'4 |Codes])) --> "4",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'5 |Codes])) --> "5",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'6 |Codes])) --> "6",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'7 |Codes])) --> "7",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'8 |Codes])) --> "8",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'9 |Codes])) --> "9",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0': |Codes])) --> ":",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'; |Codes])) --> ";",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'< |Codes])) --> "<",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'= |Codes])) --> "=",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'> |Codes])) --> ">",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'? |Codes])) --> "?",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'@ |Codes])) --> "@",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'A |Codes])) --> "A",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'B |Codes])) --> "B",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'C |Codes])) --> "C",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'D |Codes])) --> "D",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'E |Codes])) --> "E",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'F |Codes])) --> "F",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'G |Codes])) --> "G",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'H |Codes])) --> "H",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'I |Codes])) --> "I",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'J |Codes])) --> "J",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'K |Codes])) --> "K",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'L |Codes])) --> "L",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'M |Codes])) --> "M",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'N |Codes])) --> "N",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'O |Codes])) --> "O",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'P |Codes])) --> "P",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'Q |Codes])) --> "Q",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'R |Codes])) --> "R",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'S |Codes])) --> "S",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'T |Codes])) --> "T",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'U |Codes])) --> "U",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'V |Codes])) --> "V",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'W |Codes])) --> "W",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'X |Codes])) --> "X",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'Y |Codes])) --> "Y",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'Z |Codes])) --> "Z",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'[ |Codes])) --> "[",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'\\|Codes])) --> "\\",    s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'] |Codes])) --> "]",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'^ |Codes])) --> "^",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'_ |Codes])) --> "_",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'` |Codes])) --> "`",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'a |Codes])) --> "a",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'b |Codes])) --> "b",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'c |Codes])) --> "c",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'd |Codes])) --> "d",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'e |Codes])) --> "e",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'f |Codes])) --> "f",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'g |Codes])) --> "g",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'h |Codes])) --> "h",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'i |Codes])) --> "i",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'j |Codes])) --> "j",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'k |Codes])) --> "k",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'l |Codes])) --> "l",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'm |Codes])) --> "m",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'n |Codes])) --> "n",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'o |Codes])) --> "o",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'p |Codes])) --> "p",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'q |Codes])) --> "q",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'r |Codes])) --> "r",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0's |Codes])) --> "s",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0't |Codes])) --> "t",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'u |Codes])) --> "u",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'v |Codes])) --> "v",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'w |Codes])) --> "w",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'x |Codes])) --> "x",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'y |Codes])) --> "y",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'z |Codes])) --> "z",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'{ |Codes])) --> "{",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'| |Codes])) --> "|",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0'} |Codes])) --> "}",     s070(type_codes(Type,Codes)).    % Delimiter
% s070(type_codes(Type,[0'~ |Codes])) --> "~",     s070(type_codes(Type,Codes)).
% s070(type_codes(Type,[0xFF|Codes])) --> [0xFF],  s070(type_codes(Type,Codes)).

% % Recursion base case for s070
% s070(type_codes(_Type,[])) --> [].