1
0
Fork 0
mirror of https://github.com/pnx/tree-sitter-dotenv synced 2026-06-18 02:30:03 +02:00

Initial Commit

This commit is contained in:
Henrik Hautakoski 2024-12-10 19:51:21 +01:00
commit 948e93ffac
40 changed files with 2760 additions and 0 deletions

172
src/grammar.json generated Normal file
View file

@ -0,0 +1,172 @@
{
"name": "dotenv",
"rules": {
"document": {
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "comment"
},
{
"type": "SYMBOL",
"name": "assignment"
}
]
}
},
"assignment": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "key",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "STRING",
"value": "="
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "_value"
}
}
]
},
"comment": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "#"
},
{
"type": "PATTERN",
"value": ".*"
}
]
},
"identifier": {
"type": "TOKEN",
"content": {
"type": "PATTERN",
"value": "[A-Za-z_][A-Za-z0-9_]*"
}
},
"_value": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "string_interpolation"
},
{
"type": "SYMBOL",
"name": "value"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_empty_value"
},
"named": true,
"value": "value"
}
]
},
"string": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "'"
},
{
"type": "SYMBOL",
"name": "string_content"
},
{
"type": "STRING",
"value": "'"
}
]
},
"string_interpolation": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\""
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "string_interpolation_content"
},
"named": true,
"value": "string_content"
},
{
"type": "STRING",
"value": "\""
}
]
},
"string_content": {
"type": "TOKEN",
"content": {
"type": "PATTERN",
"value": "[^']*"
}
},
"string_interpolation_content": {
"type": "TOKEN",
"content": {
"type": "PATTERN",
"value": "[^\"]*"
}
},
"value": {
"type": "TOKEN",
"content": {
"type": "PREC",
"value": -1,
"content": {
"type": "PATTERN",
"value": "[^\\#\\=\\s]+"
}
}
}
},
"extras": [
{
"type": "PATTERN",
"value": "\\s"
}
],
"conflicts": [],
"precedences": [],
"externals": [
{
"type": "SYMBOL",
"name": "_empty_value"
}
],
"inline": [],
"supertypes": []
}