tree-sitter-plain 0.1.0

plaintext or unknown files
Documentation
{
  "$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
  "name": "plain",
  "rules": {
    "document": {
      "type": "REPEAT",
      "content": {
        "type": "SYMBOL",
        "name": "_item"
      }
    },
    "_item": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "fenced_code_block"
        },
        {
          "type": "PREC",
          "value": 1,
          "content": {
            "type": "SYMBOL",
            "name": "list"
          }
        },
        {
          "type": "SYMBOL",
          "name": "paragraph"
        },
        {
          "type": "PREC",
          "value": -1,
          "content": {
            "type": "SYMBOL",
            "name": "paragraph_break"
          }
        },
        {
          "type": "SYMBOL",
          "name": "any_char"
        }
      ]
    },
    "paragraph": {
      "type": "PREC_RIGHT",
      "value": 0,
      "content": {
        "type": "SEQ",
        "members": [
          {
            "type": "REPEAT1",
            "content": {
              "type": "CHOICE",
              "members": [
                {
                  "type": "SYMBOL",
                  "name": "text_line"
                },
                {
                  "type": "SYMBOL",
                  "name": "newline"
                }
              ]
            }
          },
          {
            "type": "CHOICE",
            "members": [
              {
                "type": "SYMBOL",
                "name": "paragraph_break"
              },
              {
                "type": "BLANK"
              }
            ]
          }
        ]
      }
    },
    "list": {
      "type": "PREC_RIGHT",
      "value": 3,
      "content": {
        "type": "SEQ",
        "members": [
          {
            "type": "SYMBOL",
            "name": "list_item"
          },
          {
            "type": "REPEAT",
            "content": {
              "type": "CHOICE",
              "members": [
                {
                  "type": "SEQ",
                  "members": [
                    {
                      "type": "SYMBOL",
                      "name": "newline"
                    },
                    {
                      "type": "SYMBOL",
                      "name": "list_item"
                    }
                  ]
                },
                {
                  "type": "SEQ",
                  "members": [
                    {
                      "type": "SYMBOL",
                      "name": "paragraph_break"
                    },
                    {
                      "type": "SYMBOL",
                      "name": "list_item"
                    }
                  ]
                }
              ]
            }
          },
          {
            "type": "CHOICE",
            "members": [
              {
                "type": "CHOICE",
                "members": [
                  {
                    "type": "SYMBOL",
                    "name": "newline"
                  },
                  {
                    "type": "SYMBOL",
                    "name": "paragraph_break"
                  }
                ]
              },
              {
                "type": "BLANK"
              }
            ]
          }
        ]
      }
    },
    "fenced_code_block": {
      "type": "PREC_RIGHT",
      "value": 0,
      "content": {
        "type": "SEQ",
        "members": [
          {
            "type": "TOKEN",
            "content": {
              "type": "SEQ",
              "members": [
                {
                  "type": "STRING",
                  "value": "```"
                },
                {
                  "type": "REPEAT",
                  "content": {
                    "type": "CHOICE",
                    "members": [
                      {
                        "type": "PATTERN",
                        "value": "[^`]"
                      },
                      {
                        "type": "PATTERN",
                        "value": "`[^`]"
                      },
                      {
                        "type": "PATTERN",
                        "value": "``[^`]"
                      }
                    ]
                  }
                },
                {
                  "type": "STRING",
                  "value": "```"
                }
              ]
            }
          },
          {
            "type": "CHOICE",
            "members": [
              {
                "type": "CHOICE",
                "members": [
                  {
                    "type": "SYMBOL",
                    "name": "newline"
                  },
                  {
                    "type": "SYMBOL",
                    "name": "paragraph_break"
                  }
                ]
              },
              {
                "type": "BLANK"
              }
            ]
          }
        ]
      }
    },
    "paragraph_break": {
      "type": "PATTERN",
      "value": "\\r?\\n\\r?\\n+"
    },
    "newline": {
      "type": "PATTERN",
      "value": "\\r?\\n"
    },
    "text_line": {
      "type": "CHOICE",
      "members": [
        {
          "type": "SYMBOL",
          "name": "text_content"
        }
      ]
    },
    "text_content": {
      "type": "PATTERN",
      "value": "[^-*0-9\\r\\n][^\\r\\n]*"
    },
    "list_item": {
      "type": "TOKEN",
      "content": {
        "type": "SEQ",
        "members": [
          {
            "type": "CHOICE",
            "members": [
              {
                "type": "STRING",
                "value": "-"
              },
              {
                "type": "STRING",
                "value": "*"
              },
              {
                "type": "PATTERN",
                "value": "\\d+\\."
              }
            ]
          },
          {
            "type": "PATTERN",
            "value": "[ \\t]+"
          },
          {
            "type": "PATTERN",
            "value": "[^\\r\\n]+"
          }
        ]
      }
    },
    "any_char": {
      "type": "PATTERN",
      "value": "."
    }
  },
  "extras": [
    {
      "type": "PATTERN",
      "value": "[ \\t]"
    }
  ],
  "conflicts": [],
  "precedences": [],
  "externals": [],
  "inline": [],
  "supertypes": [],
  "reserved": {}
}