// File: /workspace/github_c_makefile_star2_O1/orangeduck[P]mpc/tests/grammar.c
// Function: test_qscript
void test_qscript(void) {
  
  mpc_ast_t *t0;
  mpc_parser_t *Qscript = mpc_new("qscript");
  mpc_parser_t *Comment = mpc_new("comment");
  mpc_parser_t *Resource = mpc_new("resource");
  mpc_parser_t *Rtype = mpc_new("rtype");
  mpc_parser_t *Rname = mpc_new("rname");
  mpc_parser_t *InnerBlock = mpc_new("inner_block");
  mpc_parser_t *Statement = mpc_new("statement");
  mpc_parser_t *Function = mpc_new("function");
  mpc_parser_t *Parameter = mpc_new("parameter");
  mpc_parser_t *Literal = mpc_new("literal");
  mpc_parser_t *Block = mpc_new("block");
  mpc_parser_t *Seperator = mpc_new("seperator");
  mpc_parser_t *Qstring = mpc_new("qstring");
  mpc_parser_t *SimpleStr = mpc_new("simplestr");
  mpc_parser_t *ComplexStr = mpc_new("complexstr");
  mpc_parser_t *Number = mpc_new("number");
  mpc_parser_t *Float = mpc_new("float");
  mpc_parser_t *Int = mpc_new("int");
  
  mpc_err_t *err = mpca_lang(0,
    "  qscript        : /^/ (<comment> | <resource>)* /$/ ;\n"
    "   comment     : '#' /[^\\n]*/ ;\n"
    "resource       : '[' (<rtype> <rname>) ']' <inner_block> ;\n"
    "   rtype       : /[*]*/ ;\n"
    "   rname       : <qstring> ;\n"
    "\n"
    "inner_block    : (<comment> | <statement>)* ;\n"
    "   statement   : <function> '(' (<comment> | <parameter> | <block>)* ')'  <seperator> ;\n"
    "   function    : <qstring> ;\n"
    "   parameter   : (<statement> | <literal>) ;\n"
    "      literal  : (<number> | <qstring>) <seperator> ;\n"
    "   block       : '{' <inner_block> '}' ;\n"
    "   seperator   : ',' | \"\" ;\n"
    "\n"
    "qstring        : (<complexstr> | <simplestr>) <qstring>* ;\n"
    "   simplestr   : /[a-zA-Z0-9_!@#$%^&\\*_+\\-\\.=\\/<>]+/ ;\n"
    "   complexstr  : (/\"[^\"]*\"/ | /'[^']*'/) ;\n"
    "\n"
    "number         : (<float> | <int>) ;\n"
    "   float       : /[-+]?[0-9]+\\.[0-9]+/ ;\n"
    "   int         : /[-+]?[0-9]+/ ;\n",
  Qscript, Comment, Resource, Rtype, Rname, InnerBlock, Statement, Function,
  Parameter, Literal, Block, Seperator, Qstring, SimpleStr, ComplexStr, Number,
  Float, Int, NULL);
 
  PT_ASSERT(err == NULL);
  
  t0 = mpc_ast_build(3, ">",
          mpc_ast_new("regex", ""),
          mpc_ast_build(5, "resource|>",
            mpc_ast_new("char", "["),
            mpc_ast_new("rtype|regex", ""),
            mpc_ast_new("rname|qstring|simplestr|regex", "my_func"),
            mpc_ast_new("char", "]"),
            mpc_ast_build(5, "inner_block|statement|>",
              mpc_ast_new("function|qstring|simplestr|regex", "echo"),
              mpc_ast_new("char", "("),
              mpc_ast_build(2, "parameter|literal|>",
                mpc_ast_build(2, "qstring|>",
                  mpc_ast_new("simplestr|regex", "a"),
                  mpc_ast_build(2, "qstring|>",
                    mpc_ast_new("simplestr|regex", "b"),
                    mpc_ast_new("qstring|simplestr|regex", "c")
                  )
                ),
                mpc_ast_new("seperator|string", "")
              ),
              mpc_ast_new("char", ")"),
              mpc_ast_new("seperator|string", "")
            )
          ),
          mpc_ast_new("regex", ""));
  
  PT_ASSERT(mpc_test_pass(Qscript, "[my_func]\n  echo (a b c)\n", t0,
    (int(*)(const void*,const void*))mpc_ast_eq,
    (mpc_dtor_t)mpc_ast_delete,
    (void(*)(const void*))mpc_ast_print));
  
  mpc_ast_delete(t0);

  mpc_cleanup(18, Qscript, Comment, Resource, Rtype, Rname, InnerBlock,
  Statement, Function, Parameter, Literal, Block, Seperator, Qstring,
  SimpleStr, ComplexStr, Number, Float, Int);
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
leaq 0xd0b8(%rip), %rdi      # 0x104c2
callq 0x7191
movq %rax, 0x48(%rsp)
leaq 0xe443(%rip), %rdi      # 0x1185e
callq 0x7191
movq %rax, 0x38(%rsp)
leaq 0xd09e(%rip), %rdi      # 0x104ca
callq 0x7191
movq %rax, 0x28(%rsp)
leaq 0xd096(%rip), %rdi      # 0x104d3
callq 0x7191
movq %rax, 0x20(%rsp)
leaq 0xd08b(%rip), %rdi      # 0x104d9
callq 0x7191
movq %rax, 0x50(%rsp)
leaq 0xd080(%rip), %rdi      # 0x104df
callq 0x7191
movq %rax, 0x40(%rsp)
leaq 0xd07b(%rip), %rdi      # 0x104eb
callq 0x7191
movq %rax, 0x30(%rsp)
leaq 0xd074(%rip), %rdi      # 0x104f5
callq 0x7191
movq %rax, 0x18(%rsp)
leaq 0xd06c(%rip), %rdi      # 0x104fe
callq 0x7191
movq %rax, 0x10(%rsp)
leaq 0xd065(%rip), %rdi      # 0x10508
callq 0x7191
movq %rax, 0x8(%rsp)
leaq 0xd031(%rip), %rdi      # 0x104e5
callq 0x7191
movq %rax, (%rsp)
leaq 0xd04c(%rip), %rdi      # 0x10510
callq 0x7191
movq %rax, %r12
movq %rax, 0xb0(%rsp)
leaq 0xd03f(%rip), %rdi      # 0x1051a
callq 0x7191
movq %rax, %r13
movq %rax, 0xa8(%rsp)
leaq 0xd030(%rip), %rdi      # 0x10522
callq 0x7191
movq %rax, %rbp
movq %rax, 0xa0(%rsp)
leaq 0xd023(%rip), %rdi      # 0x1052c
callq 0x7191
movq %rax, %rbx
movq %rax, 0x98(%rsp)
leaq 0xcde7(%rip), %rdi      # 0x10307
callq 0x7191
movq %rax, %r14
movq %rax, 0x90(%rsp)
leaq 0xd000(%rip), %rdi      # 0x10537
callq 0x7191
movq %rax, %r15
movq %rax, 0x88(%rsp)
leaq 0xcfef(%rip), %rdi      # 0x1053d
callq 0x7191
movq %rax, %r10
movq %rax, 0x80(%rsp)
subq $0x8, %rsp
leaq 0xcfd8(%rip), %rsi      # 0x10541
xorl %edi, %edi
movq 0x50(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x28(%rsp), %r9
xorl %eax, %eax
pushq $0x0
pushq %r10
pushq %r15
pushq %r14
pushq %rbx
pushq %rbp
pushq %r13
pushq %r12
pushq 0x48(%rsp)
pushq 0x58(%rsp)
pushq 0x68(%rsp)
pushq 0x78(%rsp)
pushq 0x98(%rsp)
pushq 0xb0(%rsp)
pushq 0xc8(%rsp)
callq 0xcd98
addq $0x80, %rsp
xorl %edi, %edi
testq %rax, %rax
sete %dil
leaq 0xcdfc(%rip), %rsi      # 0x103cc
leaq 0xc763(%rip), %rdx      # 0xfd3a
movl $0xdc, %ecx
callq 0x4050
leaq 0xd290(%rip), %rdi      # 0x10878
leaq 0xee83(%rip), %rbx      # 0x12472
movq %rbx, %rsi
callq 0xab6f
movq %rax, 0x78(%rsp)
leaq 0xc65d(%rip), %r12      # 0xfc60
leaq 0xd266(%rip), %rsi      # 0x10870
movq %r12, %rdi
callq 0xab6f
movq %rax, 0x70(%rsp)
leaq 0xd254(%rip), %rdi      # 0x10872
movq %rbx, %rsi
callq 0xab6f
movq %rax, 0x68(%rsp)
leaq 0xd24c(%rip), %rdi      # 0x1087e
leaq 0xd263(%rip), %rsi      # 0x1089c
callq 0xab6f
movq %rax, 0x60(%rsp)
leaq 0xe0d8(%rip), %rsi      # 0x11722
movq %r12, %rdi
callq 0xab6f
movq %rax, 0x58(%rsp)
leaq 0xd25e(%rip), %rdi      # 0x108bc
leaq 0xd278(%rip), %rsi      # 0x108dd
callq 0xab6f
movq %rax, %rbp
leaq 0xee6d(%rip), %rsi      # 0x124e1
movq %r12, %rdi
callq 0xab6f
movq %rax, %r14
leaq 0xd206(%rip), %r15      # 0x1088c
leaq 0xedef(%rip), %rsi      # 0x1247c
movq %r15, %rdi
callq 0xab6f
movq %rax, %rbx
leaq 0xde13(%rip), %rsi      # 0x114b2
movq %r15, %rdi
callq 0xab6f
movq %rax, %r15
leaq 0xd1d3(%rip), %rdi      # 0x10884
leaq 0xcbba(%rip), %rsi      # 0x10272
callq 0xab6f
leaq 0xd232(%rip), %r13      # 0x108f6
movl $0x2, %edi
movq %r13, %rsi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xabe9
movl $0x2, %edi
movq %r13, %rsi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xabe9
movq %rax, %rbx
leaq 0xd208(%rip), %r15      # 0x10900
movq %r15, %rdi
leaq 0xed70(%rip), %r13      # 0x12472
movq %r13, %rsi
callq 0xab6f
leaq 0xd1d1(%rip), %rsi      # 0x108e2
movl $0x2, %edi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xabe9
movq %rax, %rbx
leaq 0xdfe9(%rip), %rsi      # 0x11716
movq %r12, %rdi
callq 0xab6f
movq %rax, %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0xab6f
movq %rax, %r10
subq $0x8, %rsp
leaq 0xd153(%rip), %rsi      # 0x108a4
movl $0x5, %edi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r10
callq 0xabe9
addq $0x10, %rsp
movq %rax, %r10
subq $0x8, %rsp
leaq 0xd0e8(%rip), %rsi      # 0x10865
movl $0x5, %edi
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %r8
movq 0x60(%rsp), %r9
xorl %eax, %eax
pushq %r10
callq 0xabe9
addq $0x10, %rsp
movq %rax, %rbx
leaq 0xd0cb(%rip), %rdi      # 0x10878
movq %r13, %rsi
callq 0xab6f
leaq 0xecf6(%rip), %rsi      # 0x124b2
movl $0x3, %edi
movq 0x78(%rsp), %rdx
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xabe9
movq %rax, %rbx
leaq 0xd134(%rip), %rsi      # 0x10911
leaq 0x75b5(%rip), %rcx      # 0xad99
leaq 0x732c(%rip), %r8       # 0xab17
leaq 0x778c(%rip), %r9       # 0xaf7e
movq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rax, %rdx
callq 0xaa3c
leaq 0xd122(%rip), %rsi      # 0x1092b
movl %eax, %edi
leaq 0xc528(%rip), %rdx      # 0xfd3a
movl $0xfb, %ecx
callq 0x4050
movq %rbx, %rdi
callq 0xab17
subq $0x8, %rsp
movl $0x12, %edi
movq %r14, %rsi
movq 0x40(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x58(%rsp), %r9
xorl %eax, %eax
pushq 0x88(%rsp)
pushq 0x98(%rsp)
pushq 0xa8(%rsp)
pushq 0xb8(%rsp)
pushq 0xc8(%rsp)
pushq 0xd8(%rsp)
pushq 0xe8(%rsp)
pushq 0x40(%rsp)
pushq 0x50(%rsp)
pushq 0x60(%rsp)
pushq 0x70(%rsp)
pushq 0x90(%rsp)
pushq 0xa8(%rsp)
callq 0x75e0
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq