Skip to content

Commit

Permalink
Improved language syntax grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
fguitton committed May 8, 2020
1 parent 8929422 commit be5b01b
Showing 1 changed file with 176 additions and 29 deletions.
205 changes: 176 additions & 29 deletions syntaxes/gedcom.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,195 @@
"name": "GEDCOM",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"include": "#lastname"
},
{
"include": "#sosa"
"include": "#line"
}
],
"scopeName": "source.gedcom",
"repository": {
"keywords": {
"delim": {
"patterns": [
{
"match": "(\\s)",
"name": "text.gedcom"
}
]
},
"level": {
"patterns": [
{
"match": "(^\\d*)",
"name": "constant.numeric.gedcom"
},
{
"include": "#delim"
}
]
},
"line": {
"patterns": [
{
"include": "#level"
},
{
"include": "#xref"
},
{
"include": "#statement"
}
]
},
"line_name": {
"patterns": [
{
"match": "([^/]*$)",
"name": "text.gedcom"
},
{
"include": "#line_name_composite"
}
]
},
"line_name_composite": {
"patterns": [
{
"begin": "(/)",
"beginCaptures": {
"1": {
"name": "string.regexp.gedcom"
}
},
"contentName": "string.regexp.gedcom",
"end": "(/)",
"endCaptures": {
"1": {
"name": "string.regexp.gedcom"
}
}
},
{
"match": "(.)",
"name": "string.unquoted.gedcom"
}
]
},
"noop": {
"patterns": [
{
"name": "storage.type.gedcom",
"match": "\\b(FAMS|CHAR|FORM|GEDC|CREM|CONT|CONC|TYPE|RELA|DEAT|OCCU|OBJE|FAMS|HEAD|SOUR|VERS|NAME|CORP|ADDR|DATA|DATE|TIME|FILE|BIRT|SEX|PLAC|BAPM|NOTE|FAMC|RESI)\\b"
"match": "(.)",
"name": "text.gedcom"
}
]
},
"lastname": {
"name": "string.regexp.gedcom",
"begin": "NAME/",
"end": "/"
"pointer": {
"patterns": [
{
"begin": "(@)",
"beginCaptures": {
"1": {
"name": "storage.type.gedcom"
}
},
"contentName": "storage.type.gedcom",
"end": "(@)",
"endCaptures": {
"1": {
"name": "storage.type.gedcom"
}
}
}
]
},
"sosa": {
"name": "variable.parameter.gedcom",
"begin": "@",
"end": "@"
"statement": {
"patterns": [
{
"include": "#tag_name"
},
{
"include": "#tag_pointers"
},
{
"include": "#tag_line"
},
{
"include": "#pointer"
}
]
},
"tag_line": {
"patterns": [
{
"begin": "([A-Z]*)",
"beginCaptures": {
"1": {
"name": "keyword.control.gedcom"
}
},
"patterns": [
{
"include": "#noop"
}
],
"end": "(^(?=.{0,1})(?:|))",
"endCaptures": {
"1": {
"name": "text.gedcom"
}
}
}
]
},
"tag_name": {
"patterns": [
{
"begin": "(NAME)",
"beginCaptures": {
"1": {
"name": "keyword.control.gedcom"
}
},
"patterns": [
{
"include": "#line_name"
}
],
"end": "(^(?=.{0,1})(?:|))",
"endCaptures": {
"1": {
"name": "text.gedcom"
}
}
}
]
},
"tag_pointers": {
"patterns": [
{
"begin": "(FAMS|FAMC|HUSB|WIFE|CHIL|SUBM|SUMN|REPO|ALIA|ANCI|DESI|ASSO|OBJE|NOTE|SOUR)",
"beginCaptures": {
"1": {
"name": "keyword.control.gedcom"
}
},
"patterns": [
{
"include": "#pointer"
}
],
"end": "(^(?=.{0,1})(?:|))",
"endCaptures": {
"1": {
"name": "text.gedcom"
}
}
}
]
},
"strings": {
"name": "string.quoted.double.gedcom",
"begin": "\"",
"end": "\"",
"xref": {
"patterns": [
{
"name": "constant.character.escape.gedcom",
"match": "\\\\."
"include": "#pointer"
}
]
}
},
"scopeName": "source.gedcom"
}
}

0 comments on commit be5b01b

Please sign in to comment.