{
  "$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
  "name": "mf2",
  "word": "name",
  "rules": {
    "source_file": {
      "type": "SEQ",
      "members": [
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "message"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        }
      ]
    },
    "message": {
      "type": "CHOICE",
      "members": [
        {
          "type": "PREC",
          "value": 2,
          "content": {
            "type": "SYMBOL",
            "name": "complex_message"
          }
        },
        {
          "type": "PREC",
          "value": 1,
          "content": {
            "type": "SYMBOL",
            "name": "simple_message"
          }
        }
      ]
    },
    "simple_message": {
      "type": "SEQ",
      "members": [
        {
          "type": "SYMBOL",
          "name": "_simple_start"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_pattern_tail"
            },
            {
              "type": "BLANK"
            }
          ]
        }
      ]
    },
    "_simple_start": {
      "type": "CHOICE",
      "members": [
        {
          "type": "ALIAS",
          "content": {
            "type": "SYMBOL",
            "name": "text_start"
          },
          "named": true,
          "value": "text"
        },
        {
          "type": "SYMBOL",
          "name": "escape"
        },
        {
          "type": "SYMBOL",
          "name": "placeholder"
        }
      ]
    },
    "text_start": {
      "type": "TOKEN",
      "content": {
        "type": "PATTERN",
        "value": "[^\\u0000-\\u0020\\u002E\\u005C\\u007B\\u007D\\u3000][^\\u005C\\u007B\\u007D]*",
        "flags": "u"
      }
    },
    "_pattern_tail": {
      "type": "REPEAT1",
      "content": {
        "type": "CHOICE",
        "members": [
          {
            "type": "SYMBOL",
            "name": "text"
          },
          {
            "type": "SYMBOL",
            "name": "escape"
          },
          {
            "type": "SYMBOL",
            "name": "placeholder"
          }
        ]
      }
    },
    "complex_message": {
      "type": "SEQ",
      "members": [
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "declaration"
              },
              {
                "type": "CHOICE",
                "members": [
                  {
                    "type": "SYMBOL",
                    "name": "_ws"
                  },
                  {
                    "type": "BLANK"
                  }
                ]
              }
            ]
          }
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "quoted_pattern"
            },
            {
              "type": "SYMBOL",
              "name": "matcher"
            }
          ]
        }
      ]
    },
    "quoted_pattern": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "{{"
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "CHOICE",
            "members": [
              {
                "type": "SYMBOL",
                "name": "text"
              },
              {
                "type": "SYMBOL",
                "name": "escape"
              },
              {
                "type": "SYMBOL",
                "name": "placeholder"
              }
            ]
          }
        },
        {
          "type": "STRING",
          "value": "}}"
        }
      ]
    },
    "declaration": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "input_declaration"
        },
        {
          "type": "SYMBOL",
          "name": "local_declaration"
        }
      ]
    },
    "input_declaration": {
      "type": "SEQ",
      "members": [
        {
          "type": "ALIAS",
          "content": {
            "type": "TOKEN",
            "content": {
              "type": "STRING",
              "value": ".input"
            }
          },
          "named": true,
          "value": "keyword_input"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "SYMBOL",
          "name": "variable_expression"
        }
      ]
    },
    "local_declaration": {
      "type": "SEQ",
      "members": [
        {
          "type": "ALIAS",
          "content": {
            "type": "TOKEN",
            "content": {
              "type": "STRING",
              "value": ".local"
            }
          },
          "named": true,
          "value": "keyword_local"
        },
        {
          "type": "SYMBOL",
          "name": "_ws"
        },
        {
          "type": "SYMBOL",
          "name": "variable"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "="
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "SYMBOL",
          "name": "expression"
        }
      ]
    },
    "matcher": {
      "type": "SEQ",
      "members": [
        {
          "type": "SYMBOL",
          "name": "match_statement"
        },
        {
          "type": "SYMBOL",
          "name": "_ws"
        },
        {
          "type": "SYMBOL",
          "name": "variant"
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "CHOICE",
                "members": [
                  {
                    "type": "SYMBOL",
                    "name": "_ws"
                  },
                  {
                    "type": "BLANK"
                  }
                ]
              },
              {
                "type": "SYMBOL",
                "name": "variant"
              }
            ]
          }
        }
      ]
    },
    "match_statement": {
      "type": "SEQ",
      "members": [
        {
          "type": "ALIAS",
          "content": {
            "type": "TOKEN",
            "content": {
              "type": "STRING",
              "value": ".match"
            }
          },
          "named": true,
          "value": "keyword_match"
        },
        {
          "type": "REPEAT1",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "selector"
              }
            ]
          }
        }
      ]
    },
    "selector": {
      "type": "SYMBOL",
      "name": "variable"
    },
    "variant": {
      "type": "SEQ",
      "members": [
        {
          "type": "SYMBOL",
          "name": "key"
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "key"
              }
            ]
          }
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "SYMBOL",
          "name": "quoted_pattern"
        }
      ]
    },
    "key": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "literal"
        },
        {
          "type": "ALIAS",
          "content": {
            "type": "STRING",
            "value": "*"
          },
          "named": true,
          "value": "catchall"
        }
      ]
    },
    "placeholder": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "expression"
        },
        {
          "type": "SYMBOL",
          "name": "markup"
        }
      ]
    },
    "expression": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "literal_expression"
        },
        {
          "type": "SYMBOL",
          "name": "variable_expression"
        },
        {
          "type": "SYMBOL",
          "name": "function_expression"
        }
      ]
    },
    "literal_expression": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "{"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "SYMBOL",
          "name": "literal"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SEQ",
              "members": [
                {
                  "type": "SYMBOL",
                  "name": "_ws"
                },
                {
                  "type": "SYMBOL",
                  "name": "function"
                }
              ]
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "attribute"
              }
            ]
          }
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "}"
        }
      ]
    },
    "variable_expression": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "{"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "SYMBOL",
          "name": "variable"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SEQ",
              "members": [
                {
                  "type": "SYMBOL",
                  "name": "_ws"
                },
                {
                  "type": "SYMBOL",
                  "name": "function"
                }
              ]
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "attribute"
              }
            ]
          }
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "}"
        }
      ]
    },
    "function_expression": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "{"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "SYMBOL",
          "name": "function"
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "attribute"
              }
            ]
          }
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "}"
        }
      ]
    },
    "markup": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "markup_open_or_standalone"
        },
        {
          "type": "SYMBOL",
          "name": "markup_close"
        }
      ]
    },
    "markup_open_or_standalone": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "{"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "#"
        },
        {
          "type": "SYMBOL",
          "name": "identifier"
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "option"
              }
            ]
          }
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "attribute"
              }
            ]
          }
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "ALIAS",
              "content": {
                "type": "STRING",
                "value": "/"
              },
              "named": true,
              "value": "self_closing"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "}"
        }
      ]
    },
    "markup_close": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "{"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "/"
        },
        {
          "type": "SYMBOL",
          "name": "identifier"
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "option"
              }
            ]
          }
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "attribute"
              }
            ]
          }
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "}"
        }
      ]
    },
    "function": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": ":"
        },
        {
          "type": "SYMBOL",
          "name": "identifier"
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "SEQ",
            "members": [
              {
                "type": "SYMBOL",
                "name": "_ws"
              },
              {
                "type": "SYMBOL",
                "name": "option"
              }
            ]
          }
        }
      ]
    },
    "option": {
      "type": "SEQ",
      "members": [
        {
          "type": "SYMBOL",
          "name": "identifier"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "STRING",
          "value": "="
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "_ws"
            },
            {
              "type": "BLANK"
            }
          ]
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SYMBOL",
              "name": "literal"
            },
            {
              "type": "SYMBOL",
              "name": "variable"
            }
          ]
        }
      ]
    },
    "attribute": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "@"
        },
        {
          "type": "SYMBOL",
          "name": "identifier"
        },
        {
          "type": "CHOICE",
          "members": [
            {
              "type": "SEQ",
              "members": [
                {
                  "type": "CHOICE",
                  "members": [
                    {
                      "type": "SYMBOL",
                      "name": "_ws"
                    },
                    {
                      "type": "BLANK"
                    }
                  ]
                },
                {
                  "type": "STRING",
                  "value": "="
                },
                {
                  "type": "CHOICE",
                  "members": [
                    {
                      "type": "SYMBOL",
                      "name": "_ws"
                    },
                    {
                      "type": "BLANK"
                    }
                  ]
                },
                {
                  "type": "SYMBOL",
                  "name": "literal"
                }
              ]
            },
            {
              "type": "BLANK"
            }
          ]
        }
      ]
    },
    "literal": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "quoted_literal"
        },
        {
          "type": "SYMBOL",
          "name": "unquoted_literal"
        }
      ]
    },
    "quoted_literal": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "|"
        },
        {
          "type": "REPEAT",
          "content": {
            "type": "CHOICE",
            "members": [
              {
                "type": "SYMBOL",
                "name": "quoted_char"
              },
              {
                "type": "SYMBOL",
                "name": "escape"
              }
            ]
          }
        },
        {
          "type": "STRING",
          "value": "|"
        }
      ]
    },
    "unquoted_literal": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "name"
        },
        {
          "type": "SYMBOL",
          "name": "_nonname_unquoted"
        }
      ]
    },
    "_nonname_unquoted": {
      "type": "TOKEN",
      "content": {
        "type": "PATTERN",
        "value": "[0-9\\-.][A-Za-z\\u002B\\u005F\\u00A1-\\u061B\\u061D-\\u167F\\u1681-\\u1FFF\\u200B-\\u200D\\u2010-\\u2027\\u2030-\\u205E\\u2060-\\u2065\\u206A-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E0000}-\\u{EFFFD}\\u{F0000}-\\u{FFFFD}\\u{100000}-\\u{10FFFD}0-9\\-.]*",
        "flags": "u"
      }
    },
    "variable": {
      "type": "SEQ",
      "members": [
        {
          "type": "STRING",
          "value": "$"
        },
        {
          "type": "SYMBOL",
          "name": "name"
        }
      ]
    },
    "identifier": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SEQ",
          "members": [
            {
              "type": "ALIAS",
              "content": {
                "type": "SYMBOL",
                "name": "name"
              },
              "named": true,
              "value": "namespace"
            },
            {
              "type": "STRING",
              "value": ":"
            },
            {
              "type": "SYMBOL",
              "name": "name"
            }
          ]
        },
        {
          "type": "SYMBOL",
          "name": "name"
        }
      ]
    },
    "name": {
      "type": "TOKEN",
      "content": {
        "type": "PATTERN",
        "value": "[\\u061C\\u200E\\u200F\\u2066-\\u2069]?[A-Za-z\\u002B\\u005F\\u00A1-\\u061B\\u061D-\\u167F\\u1681-\\u1FFF\\u200B-\\u200D\\u2010-\\u2027\\u2030-\\u205E\\u2060-\\u2065\\u206A-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E0000}-\\u{EFFFD}\\u{F0000}-\\u{FFFFD}\\u{100000}-\\u{10FFFD}][A-Za-z\\u002B\\u005F\\u00A1-\\u061B\\u061D-\\u167F\\u1681-\\u1FFF\\u200B-\\u200D\\u2010-\\u2027\\u2030-\\u205E\\u2060-\\u2065\\u206A-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E0000}-\\u{EFFFD}\\u{F0000}-\\u{FFFFD}\\u{100000}-\\u{10FFFD}0-9\\-.]*[\\u061C\\u200E\\u200F\\u2066-\\u2069]?",
        "flags": "u"
      }
    },
    "text": {
      "type": "TOKEN",
      "content": {
        "type": "PATTERN",
        "value": "[^\\u005C\\u007B\\u007D]+",
        "flags": "u"
      }
    },
    "escape": {
      "type": "TOKEN",
      "content": {
        "type": "CHOICE",
        "members": [
          {
            "type": "STRING",
            "value": "\\\\"
          },
          {
            "type": "STRING",
            "value": "\\{"
          },
          {
            "type": "STRING",
            "value": "\\}"
          },
          {
            "type": "STRING",
            "value": "\\|"
          }
        ]
      }
    },
    "quoted_char": {
      "type": "TOKEN",
      "content": {
        "type": "PATTERN",
        "value": "[^\\u005C\\u007C]+",
        "flags": "u"
      }
    },
    "_ws": {
      "type": "TOKEN",
      "content": {
        "type": "PATTERN",
        "value": "[ \\t\\r\\n\\u3000\\u061C\\u200E\\u200F\\u2066-\\u2069]+",
        "flags": "u"
      }
    }
  },
  "extras": [],
  "conflicts": [
    [
      "matcher"
    ],
    [
      "match_statement"
    ],
    [
      "function"
    ],
    [
      "attribute"
    ]
  ],
  "precedences": [],
  "externals": [],
  "inline": [],
  "supertypes": [],
  "reserved": {}
}