/* A Bison parser, made by GNU Bison 3.8.2.  */

/* Bison interface for Yacc-like parsers in C

   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
   Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
   especially those whose name start with YY_ or yy_.  They are
   private implementation details that can be changed or removed.  */

#ifndef YY_BLOCK_CSH_BLOCK_PARSER_CSH_H_INCLUDED
# define YY_BLOCK_CSH_BLOCK_PARSER_CSH_H_INCLUDED
/* Debug traces.  */
#ifndef BLOCK_CSH_DEBUG
# if defined YYDEBUG
#if YYDEBUG
#   define BLOCK_CSH_DEBUG 1
#  else
#   define BLOCK_CSH_DEBUG 0
#  endif
# else /* ! defined YYDEBUG */
#  define BLOCK_CSH_DEBUG 0
# endif /* ! defined YYDEBUG */
#endif  /* ! defined BLOCK_CSH_DEBUG */
#if BLOCK_CSH_DEBUG
extern int block_csh_debug;
#endif
/* "%code requires" blocks.  */
#line 4 "./block_lang.yy"
 #define C_S_H_IS_COMPILED 
#line 34 "./block_lang.yy"

    #include "cgen_shapes.h"
    #include "blockcsh.h"
    #include "blockchart.h"
    #include "block_lexer.h"

    //To allow including both block_parse_{compile,csh}.h
    #undef C_S_H
    #undef CHAR_IF_CSH
    #undef FIRST_IF_CSH

    #ifdef C_S_H_IS_COMPILED
        #define C_S_H true
        #define CHAR_IF_CSH(A) char
        #define FIRST_IF_CSH(A, B) A
    #else
        #define C_S_H false
        #define CHAR_IF_CSH(A) A
        #define FIRST_IF_CSH(A, B) B
    #endif

    using namespace block;

#line 83 "block_parser_csh.h"

/* Token kinds.  */
#ifndef BLOCK_CSH_TOKENTYPE
# define BLOCK_CSH_TOKENTYPE
  enum block_csh_tokentype
  {
    BLOCK_CSH_EMPTY = -2,
    TOK_EOF = 0,                   /* TOK_EOF  */
    BLOCK_CSH_error = 256,         /* error  */
    BLOCK_CSH_UNDEF = 257,         /* "invalid token"  */
    TOK_STRING = 258,              /* TOK_STRING  */
    TOK_QSTRING = 259,             /* TOK_QSTRING  */
    TOK_NUMBER = 260,              /* TOK_NUMBER  */
    TOK_DASH = 261,                /* TOK_DASH  */
    TOK_EQUAL = 262,               /* TOK_EQUAL  */
    TOK_COMMA = 263,               /* TOK_COMMA  */
    TOK_SEMICOLON = 264,           /* TOK_SEMICOLON  */
    TOK_PLUS_PLUS = 265,           /* TOK_PLUS_PLUS  */
    TOK_PLUS = 266,                /* TOK_PLUS  */
    TOK_MINUS = 267,               /* TOK_MINUS  */
    TOK_ATSYMBOL = 268,            /* TOK_ATSYMBOL  */
    TOK_ASTERISK = 269,            /* TOK_ASTERISK  */
    TOK_PERCENT = 270,             /* TOK_PERCENT  */
    TOK_OCBRACKET = 271,           /* TOK_OCBRACKET  */
    TOK_CCBRACKET = 272,           /* TOK_CCBRACKET  */
    TOK_OSBRACKET = 273,           /* TOK_OSBRACKET  */
    TOK_CSBRACKET = 274,           /* TOK_CSBRACKET  */
    TOK_BOX = 275,                 /* TOK_BOX  */
    TOK_BOXCOL = 276,              /* TOK_BOXCOL  */
    TOK_ROW = 277,                 /* TOK_ROW  */
    TOK_COLUMN = 278,              /* TOK_COLUMN  */
    TOK_TEXT = 279,                /* TOK_TEXT  */
    TOK_SHAPE = 280,               /* TOK_SHAPE  */
    TOK_CELL = 281,                /* TOK_CELL  */
    TOK_SHAPE_COMMAND = 282,       /* TOK_SHAPE_COMMAND  */
    TOK_ALIGN_MODIFIER = 283,      /* TOK_ALIGN_MODIFIER  */
    TOK_BREAK_COMMAND = 284,       /* TOK_BREAK_COMMAND  */
    TOK_SPACE_COMMAND = 285,       /* TOK_SPACE_COMMAND  */
    TOK_MULTI_COMMAND = 286,       /* TOK_MULTI_COMMAND  */
    TOK_AROUND_COMMAND = 287,      /* TOK_AROUND_COMMAND  */
    TOK_JOIN_COMMAND = 288,        /* TOK_JOIN_COMMAND  */
    TOK_COPY_COMMAND = 289,        /* TOK_COPY_COMMAND  */
    TOK_AS = 290,                  /* TOK_AS  */
    TOK_MARK_COMMAND = 291,        /* TOK_MARK_COMMAND  */
    TOK_EXTEND_COMMAND = 292,      /* TOK_EXTEND_COMMAND  */
    TOK_TEMPLATE_COMMAND = 293,    /* TOK_TEMPLATE_COMMAND  */
    TOK_COMP_OP = 294,             /* TOK_COMP_OP  */
    TOK_COLON_STRING = 295,        /* TOK_COLON_STRING  */
    TOK_COLON_QUOTED_STRING = 296, /* TOK_COLON_QUOTED_STRING  */
    TOK_COMMAND_DEFSHAPE = 297,    /* TOK_COMMAND_DEFSHAPE  */
    TOK_COMMAND_DEFCOLOR = 298,    /* TOK_COMMAND_DEFCOLOR  */
    TOK_COMMAND_DEFSTYLE = 299,    /* TOK_COMMAND_DEFSTYLE  */
    TOK_COMMAND_DEFDESIGN = 300,   /* TOK_COMMAND_DEFDESIGN  */
    TOK_COMMAND_USEDESIGN = 301,   /* TOK_COMMAND_USEDESIGN  */
    TOK_COMMAND_USESTYLE = 302,    /* TOK_COMMAND_USESTYLE  */
    TOK_COMMAND_ARROWS = 303,      /* TOK_COMMAND_ARROWS  */
    TOK_COMMAND_BLOCKS = 304,      /* TOK_COMMAND_BLOCKS  */
    TOK_CLONE_MODIFIER_RECURSIVE = 305, /* TOK_CLONE_MODIFIER_RECURSIVE  */
    TOK_CLONE_MODIFIER_ADD = 306,  /* TOK_CLONE_MODIFIER_ADD  */
    TOK_CLONE_MODIFIER_MOVE = 307, /* TOK_CLONE_MODIFIER_MOVE  */
    TOK_CLONE_MODIFIER_DROP = 308, /* TOK_CLONE_MODIFIER_DROP  */
    TOK_CLONE_MODIFIER_UPDATE = 309, /* TOK_CLONE_MODIFIER_UPDATE  */
    TOK_CLONE_MODIFIER_REPLACE = 310, /* TOK_CLONE_MODIFIER_REPLACE  */
    TOK_CLONE_MODIFIER_BEFORE = 311, /* TOK_CLONE_MODIFIER_BEFORE  */
    TOK_TILDE = 312,               /* TOK_TILDE  */
    TOK_PARAM_NAME = 313,          /* TOK_PARAM_NAME  */
    TOK_OPARENTHESIS = 314,        /* TOK_OPARENTHESIS  */
    TOK_CPARENTHESIS = 315,        /* TOK_CPARENTHESIS  */
    TOK_COMMAND_DEFPROC = 316,     /* TOK_COMMAND_DEFPROC  */
    TOK_COMMAND_REPLAY = 317,      /* TOK_COMMAND_REPLAY  */
    TOK_COMMAND_SET = 318,         /* TOK_COMMAND_SET  */
    TOK_BYE = 319,                 /* TOK_BYE  */
    TOK_IF = 320,                  /* TOK_IF  */
    TOK_THEN = 321,                /* TOK_THEN  */
    TOK_ELSE = 322,                /* TOK_ELSE  */
    TOK_COMMAND_INCLUDE = 323,     /* TOK_COMMAND_INCLUDE  */
    TOK_UNRECOGNIZED_CHAR = 324,   /* TOK_UNRECOGNIZED_CHAR  */
    TOK__NEVER__HAPPENS = 325,     /* TOK__NEVER__HAPPENS  */
    TOK_ARROW_FW = 326,            /* TOK_ARROW_FW  */
    TOK_ARROW_BW = 327,            /* TOK_ARROW_BW  */
    TOK_ARROW_BIDIR = 328,         /* TOK_ARROW_BIDIR  */
    TOK_ARROW_NO = 329,            /* TOK_ARROW_NO  */
    TOK_WHITESPACE = 330,          /* TOK_WHITESPACE  */
    TOK_NEWLINE = 331,             /* TOK_NEWLINE  */
    TOK_COMMENT = 332,             /* TOK_COMMENT  */
    TOK_OINLINE = 333,             /* TOK_OINLINE  */
    TOK_CINLINE = 334,             /* TOK_CINLINE  */
    TOK_INLINE = 335,              /* TOK_INLINE  */
    TOK_UNMATCHED_INLINE = 336,    /* TOK_UNMATCHED_INLINE  */
    TOK_CHART = 337                /* TOK_CHART  */
  };
  typedef enum block_csh_tokentype block_csh_token_kind_t;
#endif

/* Value type.  */
#if ! defined BLOCK_CSH_STYPE && ! defined BLOCK_CSH_STYPE_IS_DECLARED
union BLOCK_CSH_STYPE
{
#line 102 "./block_lang.yy"

    str_view                                                   str;
    ShapeElement::Type                                         shapecommand;
    gsl::owner<FIRST_IF_CSH(std::vector<string>,Shape)*>       shape;
    FIRST_IF_CSH(multi_segment_string, gsl::owner<ShapeElement*>) shapeelement; //csh: the port name
    FIRST_IF_CSH(int, gsl::owner<Attribute*>)                  attribute;       //-2 if none, -1<= if a shape= attr
    FIRST_IF_CSH(int, gsl::owner<AttributeList*>)              attributelist;   //-2 if none, -1<= if a shape= attr is present
    EBlockType                                                 eblocktype;
    AlignModifier                                              alignmodifier;
    gsl::owner<FIRST_IF_CSH(CshStringWithPosList,BlockBlockList)*> blockblocklist;
    gsl::owner<CHAR_IF_CSH(BlockInstruction)*>                 instruction;
    gsl::owner<CHAR_IF_CSH(BlockInstrList)*>                   instruction_list;
    const char*                                                input_text_ptr;
    int                                                        condition; //0:false, 1:true, 2:had_error
    ECompareOperator                                           compare_op;
    EUseKeywords                                               use_keywords;
    multi_segment_string                                       multi_str;
    gsl::owner<CHAR_IF_CSH(Procedure)*>                        procedure;
    CHAR_IF_CSH(const Procedure)*                              cprocedure;
    gsl::owner<CHAR_IF_CSH(ProcParamDef)*>                     procparamdef;
    gsl::owner<CHAR_IF_CSH(ProcParamDefList)*>                 procparamdeflist;
    gsl::owner<CHAR_IF_CSH(ProcParamInvocation)*>              procparaminvoc;
    gsl::owner<CHAR_IF_CSH(ProcParamInvocationList)*>          procparaminvoclist;
    gsl::owner<CHAR_IF_CSH(ProcDefParseHelper<AttributeList>)*>procdefhelper;
    EArrowStyle                                                arrowstyle;
    ArrowType                                                  arrowtype;
    gsl::owner<FIRST_IF_CSH(CshStringWithPosList, StringWithPosList)*> stringposlist;
    gsl::owner<FIRST_IF_CSH(CshStringViewWithPosList, StringWithPosList)*> stringviewposlist; //A string view only in CSH mode.
    gsl::owner<CHAR_IF_CSH(StringWithPosList)*>                stringposlist_nocsh;
    FIRST_IF_CSH(multi_segment_string, gsl::owner<CopyParseHelper*>) copystruct;
    gsl::owner<CHAR_IF_CSH(AlignmentAttr)*>                    alignment_attr;
    gsl::owner<CHAR_IF_CSH(ArrowLabel)*>                       arrowlabel;
    CHAR_IF_CSH(ArrowAttrHelper)                               arrowattrs;
    gsl::owner<CHAR_IF_CSH(CloneAction)*>                      cloneaction;
    gsl::owner<CHAR_IF_CSH(CloneActionList)*>                  cloneactionlist;
    FIRST_IF_CSH(char*, UseCommandParseHelper)                 usecommandhelper;

#line 220 "block_parser_csh.h"

};
typedef union BLOCK_CSH_STYPE BLOCK_CSH_STYPE;
# define BLOCK_CSH_STYPE_IS_TRIVIAL 1
# define BLOCK_CSH_STYPE_IS_DECLARED 1
#endif

/* Location type.  */
typedef SourceLocationRange<C_S_H> BLOCK_CSH_LTYPE;




int block_csh_parse (block::BlockCsh &csh, sv_reader<C_S_H> &input);


#endif /* !YY_BLOCK_CSH_BLOCK_PARSER_CSH_H_INCLUDED  */
