[−][src]Constant mc_parser::_PEST_GRAMMAR_McParser

const _PEST_GRAMMAR_McParser: &'static str = "// Primitives\n\nWHITESPACE = _{ \" \" | \"\\t\" | \"\\r\" | \"\\n\" }\n\nidentifier = @{ (ASCII_ALPHA | \"_\") ~ (ASCII_ALPHANUMERIC | \"_\")* }\n\n\n// Comment\n\nCOMMENT = _{ \"/*\" ~ (!\"*/\" ~ ANY)* ~ \"*/\" }\n\n\n// Types\n\nty = { \"bool\" | \"int\" | \"float\" | \"string\" }\n\n\n// Operators\n\nnot = { \"!\" }\nunary_minus = { \"-\" }\nplus = { \"+\" }\nminus = { \"-\" }\ntimes = { \"*\" }\ndivide = { \"/\" }\nlte = { \"<=\" }\nlt = { \"<\" }\ngte = { \">=\" }\ngt = { \">\" }\nland = { \"&&\" }\nlor = { \"||\" }\neq = { \"==\" }\nneq = { \"!=\" }\nunary_operator = _{ unary_minus | not }\nbinary_operator = _{\n    plus | minus | times | divide\n  | lte | lt | gte | gt\n  | land | lor\n  | eq | neq\n}\n\n\n// Literals\n\nboolean = @{ \"true\" | \"false\" }\nint = @{ ASCII_DIGIT+ }\nfloat = @{ int ~ \".\" ~ ASCII_DIGIT+ }\n\nquote = _{ \"\\\"\" }\nstring = ${ quote ~ inner ~ quote }\ninner = @{ (!quote ~ ANY)* }\n\nliteral = { string | float | int | boolean }\n\n\n// Declarations / Assignments\n\ndeclaration_type = ${ ty ~ (\"[\" ~ int ~ \"]\")? }\ndeclaration = { declaration_type ~ identifier }\n\nassignment = { identifier ~ (\"[\" ~ expression ~ \"]\")? ~ \"=\" ~ expression }\n\n\n// Expressions\n\nunary_expression = ${ unary_operator ~ term }\npar_expression = ${ \"(\" ~ WHITESPACE* ~ expression ~ WHITESPACE* ~ \")\" }\nvariable_expression = ${ identifier ~ (\"[\" ~ WHITESPACE* ~ expression ~ WHITESPACE* ~ \"]\")? }\n\nterm = _{\n    literal\n  | call_expr\n  | variable_expression\n  | unary_expression\n  | par_expression\n}\n\nexpression = ${ term ~ (WHITESPACE* ~ binary_operator ~ WHITESPACE* ~ term)* }\n\n\n// Statements\n\nstatement = {\n    if_stmt\n  | while_stmt\n  | ret_stmt\n  | declaration ~ \";\"\n  | assignment ~ \";\"\n  | expression ~ \";\"\n  | compound_stmt\n}\n\ncondition = _{ \"(\" ~ expression ~ \")\" }\nif_stmt = { WHITESPACE* ~ \"if\" ~ condition ~ statement ~ (\"else\" ~ statement)? }\nwhile_stmt = { WHITESPACE* ~ \"while\" ~ condition ~ statement }\nret_stmt = { WHITESPACE* ~ \"return\" ~ expression? ~ \";\" }\ncompound_stmt = { \"{\" ~ statement* ~ \"}\" }\n\n\n// Functions\n\nfunction_def = { (\"void\" | ty) ~ identifier ~ \"(\" ~ parameters? ~ \")\" ~ compound_stmt }\nparameters = { declaration ~ (\",\" ~ declaration)* }\n\ncall_expr = ${ identifier ~ \"(\" ~ WHITESPACE* ~ arguments? ~ WHITESPACE* ~ \")\" }\narguments = ${ expression ~ (WHITESPACE* ~ \",\" ~ WHITESPACE* ~ expression)* }\n\n\n// Program\n\nprogram = { SOI ~ function_def* ~ EOI }\n";