// File: /workspace/github_c_makefile_star2_O3/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 0xd074(%rip), %rdi      # 0x104c2
callq 0x71ca
movq %rax, 0x48(%rsp)
leaq 0xe3ff(%rip), %rdi      # 0x1185e
callq 0x71ca
movq %rax, 0x38(%rsp)
leaq 0xd05a(%rip), %rdi      # 0x104ca
callq 0x71ca
movq %rax, 0x28(%rsp)
leaq 0xd052(%rip), %rdi      # 0x104d3
callq 0x71ca
movq %rax, 0x20(%rsp)
leaq 0xd047(%rip), %rdi      # 0x104d9
callq 0x71ca
movq %rax, 0x50(%rsp)
leaq 0xd03c(%rip), %rdi      # 0x104df
callq 0x71ca
movq %rax, 0x40(%rsp)
leaq 0xd037(%rip), %rdi      # 0x104eb
callq 0x71ca
movq %rax, 0x30(%rsp)
leaq 0xd030(%rip), %rdi      # 0x104f5
callq 0x71ca
movq %rax, 0x18(%rsp)
leaq 0xd028(%rip), %rdi      # 0x104fe
callq 0x71ca
movq %rax, 0x10(%rsp)
leaq 0xd021(%rip), %rdi      # 0x10508
callq 0x71ca
movq %rax, 0x8(%rsp)
leaq 0xcfed(%rip), %rdi      # 0x104e5
callq 0x71ca
movq %rax, (%rsp)
leaq 0xd008(%rip), %rdi      # 0x10510
callq 0x71ca
movq %rax, %r12
movq %rax, 0xb0(%rsp)
leaq 0xcffb(%rip), %rdi      # 0x1051a
callq 0x71ca
movq %rax, %r13
movq %rax, 0xa8(%rsp)
leaq 0xcfec(%rip), %rdi      # 0x10522
callq 0x71ca
movq %rax, %rbp
movq %rax, 0xa0(%rsp)
leaq 0xcfdf(%rip), %rdi      # 0x1052c
callq 0x71ca
movq %rax, %rbx
movq %rax, 0x98(%rsp)
leaq 0xcda3(%rip), %rdi      # 0x10307
callq 0x71ca
movq %rax, %r14
movq %rax, 0x90(%rsp)
leaq 0xcfbc(%rip), %rdi      # 0x10537
callq 0x71ca
movq %rax, %r15
movq %rax, 0x88(%rsp)
leaq 0xcfab(%rip), %rdi      # 0x1053d
callq 0x71ca
movq %rax, %r10
movq %rax, 0x80(%rsp)
subq $0x8, %rsp
leaq 0xcf94(%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 0xccc2
addq $0x80, %rsp
xorl %edi, %edi
testq %rax, %rax
sete %dil
leaq 0xcdb8(%rip), %rsi      # 0x103cc
leaq 0xc71f(%rip), %rdx      # 0xfd3a
movl $0xdc, %ecx
callq 0x4094
leaq 0xd24c(%rip), %rdi      # 0x10878
leaq 0xee6f(%rip), %rbx      # 0x124a2
movq %rbx, %rsi
callq 0xaa70
movq %rax, 0x78(%rsp)
leaq 0xc619(%rip), %r12      # 0xfc60
leaq 0xd222(%rip), %rsi      # 0x10870
movq %r12, %rdi
callq 0xaa70
movq %rax, 0x70(%rsp)
leaq 0xd210(%rip), %rdi      # 0x10872
movq %rbx, %rsi
callq 0xaa70
movq %rax, 0x68(%rsp)
leaq 0xd208(%rip), %rdi      # 0x1087e
leaq 0xd21f(%rip), %rsi      # 0x1089c
callq 0xaa70
movq %rax, 0x60(%rsp)
leaq 0xe094(%rip), %rsi      # 0x11722
movq %r12, %rdi
callq 0xaa70
movq %rax, 0x58(%rsp)
leaq 0xd21a(%rip), %rdi      # 0x108bc
leaq 0xd234(%rip), %rsi      # 0x108dd
callq 0xaa70
movq %rax, %rbp
leaq 0xee59(%rip), %rsi      # 0x12511
movq %r12, %rdi
callq 0xaa70
movq %rax, %r14
leaq 0xd1c2(%rip), %r15      # 0x1088c
leaq 0xeddb(%rip), %rsi      # 0x124ac
movq %r15, %rdi
callq 0xaa70
movq %rax, %rbx
leaq 0xddcf(%rip), %rsi      # 0x114b2
movq %r15, %rdi
callq 0xaa70
movq %rax, %r15
leaq 0xd18f(%rip), %rdi      # 0x10884
leaq 0xcb76(%rip), %rsi      # 0x10272
callq 0xaa70
leaq 0xd1ee(%rip), %r13      # 0x108f6
movl $0x2, %edi
movq %r13, %rsi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xaaea
movl $0x2, %edi
movq %r13, %rsi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xaaea
movq %rax, %rbx
leaq 0xd1c4(%rip), %r15      # 0x10900
movq %r15, %rdi
leaq 0xed5c(%rip), %r13      # 0x124a2
movq %r13, %rsi
callq 0xaa70
leaq 0xd18d(%rip), %rsi      # 0x108e2
movl $0x2, %edi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xaaea
movq %rax, %rbx
leaq 0xdfa5(%rip), %rsi      # 0x11716
movq %r12, %rdi
callq 0xaa70
movq %rax, %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0xaa70
movq %rax, %r10
subq $0x8, %rsp
leaq 0xd10f(%rip), %rsi      # 0x108a4
movl $0x5, %edi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r10
callq 0xaaea
addq $0x10, %rsp
movq %rax, %r10
subq $0x8, %rsp
leaq 0xd0a4(%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 0xaaea
addq $0x10, %rsp
movq %rax, %rbx
leaq 0xd087(%rip), %rdi      # 0x10878
movq %r13, %rsi
callq 0xaa70
leaq 0xece2(%rip), %rsi      # 0x124e2
movl $0x3, %edi
movq 0x78(%rsp), %rdx
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xaaea
movq %rax, %rbx
leaq 0xd0f0(%rip), %rsi      # 0x10911
leaq 0x7472(%rip), %rcx      # 0xac9a
leaq 0x71e9(%rip), %r8       # 0xaa18
leaq 0x7641(%rip), %r9       # 0xae77
movq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rax, %rdx
callq 0xa93d
leaq 0xd0de(%rip), %rsi      # 0x1092b
movl %eax, %edi
leaq 0xc4e4(%rip), %rdx      # 0xfd3a
movl $0xfb, %ecx
callq 0x4094
movq %rbx, %rdi
callq 0xaa18
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 0x75de
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq