/** @file syntaxstatetype.hpp
*
 *  @author Roland Conybeare, Jan 2026
 **/

#pragma once

#include <ostream>

namespace xo {
    namespace scm {
        /** @enum syntaxstatemachine
         *  @brief Label a specialized parsing state machine
         *
         *  Label for a schematika syntax state machine
         *  dedicated to some particular piece of syntax
         **/
        enum class syntaxstatetype {
            invalid = -1,

            /** handle define-expression. See @ref DDefineSsm **/
            defexpr,

            /** handle deftype-expression. See @ref DDeftypeSsm **/
            deftypeexpr,

            /** handle lambda-expression. See @ref DLambdaSsm **/
            lambdaexpr,

            /** handle ifelse-expression. See @ref DIfElseSsm **/
            ifelseexpr,

            /** handle sequence-expression syntax. See @ref DSequenceSsm **/
            sequence,

            /** handle apply-expression syntax. See @ref DApplySsm **/
            apply,

            /** rhs expression.  state exists to achieve 1-token lookahead **/
            progress,

            /** expression enclosed in parentheses. See @ref DParenSsm **/
            paren,

            /** quoted literal using #q{..} syntax.  See @ref DQuoteSsm **/
            quote,

            /** toplevel of some translation unit. See @ref DToplevelSeqSsm **/
            expect_toplevel_expression_sequence,

            /** expecting a formal argument list (sub-syntax within lambda-expression) **/
            expect_formal_arglist,

            /** expecting a formal argument (sub-syntax within formal-arglist) **/
            expect_formal_arg,

            /** expecting a s symbol. See @ref DExpectSymbolSsm **/
            expect_symbol,

            /** expecting a type. See @ref DExpectTypeSsm **/
            expect_type,

            /** expecting a list type. See @ref DExpectListTypeSsm **/
            expect_listtype,

            /** expecting a rhs expression. See @ref DExpectExprSsm **/
            expect_rhs_expression,

            /** expecting a quoted literal. See @ref DExpectQLiteralSsm **/
            expect_qliteral,

            /** expecting a quoted list.  See @ref DExpectQListSsm **/
            expect_qlist,

            /** expecting a quoted array.  See @ref DExpectQArraySsm **/
            expect_qarray,

            /** expecting a quoted dictionary.  See @ref DExpectQDictSsm **/
            expect_qdict,

            /** comes last, counts number of valid enums **/
            N
        };

        const char * syntaxstatetype_descr(syntaxstatetype x);

        inline std::ostream &
        operator<< (std::ostream & os, syntaxstatetype x) {
            os << syntaxstatetype_descr(x);
            return os;
        }
    }
} /*namespace xo*/

/* end syntaxstatetype.hpp */
