Skip to content

Commit

Permalink
Update grammar files to jlelong/vscode-latex-basics@8d6b454
Browse files Browse the repository at this point in the history
  • Loading branch information
jlelong committed Aug 27, 2023
1 parent 341cc16 commit 383d346
Showing 1 changed file with 92 additions and 122 deletions.
214 changes: 92 additions & 122 deletions syntax/Bibtex.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,70 @@
{
"comment": "Grammar based on description from http://artis.imag.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html#comment\n\t\n\tTODO: Does not support @preamble\n\t",
"comment": "Grammar based on description from https://github.com/aclements/biblib\n",
"name": "BibTeX",
"patterns": [
{
"begin": "@Comment",
"beginCaptures": {
"match": "@(?i:comment)(?=[\\s{(])",
"captures": {
"0": {
"name": "punctuation.definition.comment.bibtex"
}
},
"end": "$\\n?",
"name": "comment.line.at-sign.bibtex"
"name": "comment.block.at-sign.bibtex"
},
{
"begin": "((@)(?i:preamble))\\s*(\\{)\\s*",
"beginCaptures": {
"1": {
"name": "keyword.other.preamble.bibtex"
},
"2": {
"name": "punctuation.definition.keyword.bibtex"
},
"3": {
"name": "punctuation.section.preamble.begin.bibtex"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.section.preamble.end.bibtex"
}
},
"name": "meta.preamble.braces.bibtex",
"patterns": [
{
"include": "#field_value"
}
]
},
{
"begin": "((@)(?i:string))\\s*(\\{)\\s*([a-zA-Z0-9\\!\\$\\&\\*\\+\\-\\.\\/\\:\\;\\<\\>\\?\\[\\]\\^\\_\\`\\|]+)",
"begin": "((@)(?i:preamble))\\s*(\\()\\s*",
"beginCaptures": {
"1": {
"name": "keyword.other.preamble.bibtex"
},
"2": {
"name": "punctuation.definition.keyword.bibtex"
},
"3": {
"name": "punctuation.section.preamble.begin.bibtex"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.preamble.end.bibtex"
}
},
"name": "meta.preamble.parenthesis.bibtex",
"patterns": [
{
"include": "#field_value"
}
]
},
{
"begin": "((@)(?i:string))\\s*(\\{)\\s*([a-zA-Z!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~][a-zA-Z0-9!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~]*)",
"beginCaptures": {
"1": {
"name": "keyword.other.string-constant.bibtex"
Expand All @@ -37,12 +88,12 @@
"name": "meta.string-constant.braces.bibtex",
"patterns": [
{
"include": "#string_content"
"include": "#field_value"
}
]
},
{
"begin": "((@)(?i:string))\\s*(\\()\\s*([a-zA-Z0-9\\!\\$\\&\\*\\+\\-\\.\\/\\:\\;\\<\\>\\?\\[\\]\\^\\_\\`\\|]+)",
"begin": "((@)(?i:string))\\s*(\\()\\s*([a-zA-Z!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~][a-zA-Z0-9!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~]*)",
"beginCaptures": {
"1": {
"name": "keyword.other.string-constant.bibtex"
Expand All @@ -66,12 +117,12 @@
"name": "meta.string-constant.parenthesis.bibtex",
"patterns": [
{
"include": "#string_content"
"include": "#field_value"
}
]
},
{
"begin": "((@)[a-zA-Z]+)\\s*(\\{)\\s*([^\\s,]*)",
"begin": "((@)[a-zA-Z!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~][a-zA-Z0-9!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~]*)\\s*(\\{)\\s*([^\\s,}]*)",
"beginCaptures": {
"1": {
"name": "keyword.other.entry-type.bibtex"
Expand All @@ -95,10 +146,7 @@
"name": "meta.entry.braces.bibtex",
"patterns": [
{
"include": "#url_field"
},
{
"begin": "([a-zA-Z0-9\\!\\$\\&\\*\\+\\-\\.\\/\\:\\;\\<\\>\\?\\[\\]\\^\\_\\`\\|]+)\\s*(\\=)",
"begin": "([a-zA-Z!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~][a-zA-Z0-9!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~]*)\\s*(\\=)",
"beginCaptures": {
"1": {
"name": "support.function.key.bibtex"
Expand All @@ -111,20 +159,14 @@
"name": "meta.key-assignment.bibtex",
"patterns": [
{
"include": "#integer"
},
{
"include": "#string_content"
},
{
"include": "#string_var"
"include": "#field_value"
}
]
}
]
},
{
"begin": "((@)[a-zA-Z]+)\\s*(\\()\\s*([^\\s,]*)",
"begin": "((@)[a-zA-Z!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~][a-zA-Z0-9!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~]*)\\s*(\\()\\s*([^\\s,]*)",
"beginCaptures": {
"1": {
"name": "keyword.other.entry-type.bibtex"
Expand All @@ -148,10 +190,7 @@
"name": "meta.entry.parenthesis.bibtex",
"patterns": [
{
"include": "#url_field"
},
{
"begin": "([a-zA-Z0-9\\!\\$\\&\\*\\+\\-\\.\\/\\:\\;\\<\\>\\?\\[\\]\\^\\_\\`\\|]+)\\s*(\\=)",
"begin": "([a-zA-Z!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~][a-zA-Z0-9!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~]*)\\s*(\\=)",
"beginCaptures": {
"1": {
"name": "support.function.key.bibtex"
Expand All @@ -164,13 +203,7 @@
"name": "meta.key-assignment.bibtex",
"patterns": [
{
"include": "#integer"
},
{
"include": "#string_content"
},
{
"include": "#string_var"
"include": "#field_value"
}
]
}
Expand All @@ -183,6 +216,23 @@
}
],
"repository": {
"field_value": {
"patterns": [
{
"include": "#string_content"
},
{
"include": "#integer"
},
{
"include": "#string_var"
},
{
"name": "keyword.operator.bibtex",
"match": "#"
}
]
},
"integer": {
"match": "\\s*(\\d+)\\s*",
"captures": {
Expand All @@ -192,13 +242,13 @@
}
},
"nested_braces": {
"begin": "(?<!\\\\)\\{",
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.group.begin.bibtex"
}
},
"end": "(?<!\\\\)\\}",
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.group.end.bibtex"
Expand All @@ -211,16 +261,10 @@
]
},
"string_var": {
"match": "(#)?\\s*([a-zA-Z0-9\\!\\$\\&\\*\\+\\-\\.\\/\\:\\;\\<\\>\\?\\[\\]\\^\\_\\`\\|]+)\\s*(#)?",
"match": "[a-zA-Z!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~][a-zA-Z0-9!$&*+\\-./:;<>?@\\[\\\\\\]^_`|~]*",
"captures": {
"1": {
"name": "keyword.operator.bibtex"
},
"2": {
"0": {
"name": "support.variable.bibtex"
},
"3": {
"name": "keyword.operator.bibtex"
}
}
},
Expand All @@ -233,20 +277,13 @@
"name": "punctuation.definition.string.begin.bibtex"
}
},
"end": "(\\})(?=(?:,?\\s*\\}?\\s*\\n)|(?:\\s*#))",
"end": "\\}",
"endCaptures": {
"1": {
"0": {
"name": "punctuation.definition.string.end.bibtex"
}
},
"patterns": [
{
"include": "#url_cmd"
},
{
"match": "@",
"name": "invalid.illegal.at-sign.bibtex"
},
{
"include": "#nested_braces"
}
Expand All @@ -259,87 +296,20 @@
"name": "punctuation.definition.string.begin.bibtex"
}
},
"end": "\"(?=(?:,?\\s*\\}?\\s*\\n)|(?:\\s*#))",
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.bibtex"
}
},
"patterns": [
{
"include": "#url_cmd"
},
{
"match": "@",
"name": "invalid.illegal.at-sign.bibtex"
}
]
}
]
},
"string_url": {
"patterns": [
{
"begin": "\\{|\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.bibtex"
}
},
"end": "(\\}|\")(?=(?:,?\\s*\\}?\\s*\\n)|(?:\\s*#))",
"endCaptures": {
"1": {
"name": "punctuation.definition.string.end.bibtex"
}
},
"contentName": "meta.url.bibtex",
"patterns": [
{
"include": "#url_cmd"
"include": "#nested_braces"
}
]
}
]
},
"url_cmd": {
"captures": {
"1": {
"name": "support.function.url.bibtex"
},
"2": {
"name": "punctuation.definition.function.bibtex"
},
"3": {
"name": "punctuation.definition.arguments.begin.bibtex"
},
"4": {
"name": "markup.underline.link.bibtex"
},
"5": {
"name": "punctuation.definition.arguments.end.bibtex"
}
},
"match": "(?:\\s*)((\\\\)(?:url|href))(\\{)([^}]*)(\\})",
"name": "meta.function.link.url.bibtex"
},
"url_field": {
"begin": "(url)\\s*(\\=)",
"beginCaptures": {
"1": {
"name": "support.function.key.bibtex"
},
"2": {
"name": "punctuation.separator.key-value.bibtex"
}
},
"end": "(?=[,}])",
"name": "meta.key-assignment.url.bibtex",
"patterns": [
{
"include": "#string_url"
}
]
}
},
"scopeName": "text.bibtex"
}
}

0 comments on commit 383d346

Please sign in to comment.