Skip to content

Commit

Permalink
Support constraint lists in packets and structs.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Jan 31, 2023
1 parent 69c602d commit 3c92b75
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 2 deletions.
36 changes: 34 additions & 2 deletions syntaxes/pdl.tmLanguage.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,19 @@ repository:
'1': {name: punctuation.section.braces.end.pdl}
patterns:
- include: '#field_list'
# TODO: Packets with constraint lists.
- name: meta.packet.pdl
begin: '(packet)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([a-zA-Z][a-zA-Z0-9_]*)\s*(\()'
beginCaptures:
'1': {name: storage.type.packet.pdl}
'2': {name: entity.name.type.packet.pdl}
'3': {name: punctuation.separator.pdl}
'4': {name: entity.name.pdl}
'5': {name: punctuation.begin.pdl}
end: '(\))'
endCaptures:
'1': {name: punctuation.section.braces.end.pdl}
patterns:
- include: '#constraint_list'
- name: meta.struct.pdl
begin: '(struct)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(\{)'
beginCaptures:
Expand All @@ -117,7 +129,27 @@ repository:
'1': {name: punctuation.section.braces.end.pdl}
patterns:
- include: '#field_list'
# TODO: Structs with constraint lists.
- name: meta.struct.pdl
begin: '(struct)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([a-zA-Z][a-zA-Z0-9_]*)\s*(\()'
beginCaptures:
'1': {name: storage.type.struct.pdl}
'2': {name: entity.name.type.struct.pdl}
'3': {name: punctuation.separator.pdl}
'4': {name: entity.name.pdl}
'5': {name: punctuation.begin.pdl}
end: '(\))'
endCaptures:
'1': {name: punctuation.section.braces.end.pdl}
patterns:
- include: '#constraint_list'
- begin: '(\{)'
beginCaptures:
'1': {name: punctuation.begin.pdl}
end: '(\})'
endCaptures:
'1': {name: punctuation.section.braces.end.pdl}
patterns:
- include: '#field_list'
- name: meta.group.pdl
begin: '(group)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(\{)'
beginCaptures:
Expand Down
83 changes: 83 additions & 0 deletions syntaxes/pdl.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,38 @@
}
]
},
{
"name": "meta.packet.pdl",
"begin": "(packet)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\()",
"beginCaptures": {
"1": {
"name": "storage.type.packet.pdl"
},
"2": {
"name": "entity.name.type.packet.pdl"
},
"3": {
"name": "punctuation.separator.pdl"
},
"4": {
"name": "entity.name.pdl"
},
"5": {
"name": "punctuation.begin.pdl"
}
},
"end": "(\\))",
"endCaptures": {
"1": {
"name": "punctuation.section.braces.end.pdl"
}
},
"patterns": [
{
"include": "#constraint_list"
}
]
},
{
"name": "meta.struct.pdl",
"begin": "(struct)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\{)",
Expand Down Expand Up @@ -236,6 +268,57 @@
}
]
},
{
"name": "meta.struct.pdl",
"begin": "(struct)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\()",
"beginCaptures": {
"1": {
"name": "storage.type.struct.pdl"
},
"2": {
"name": "entity.name.type.struct.pdl"
},
"3": {
"name": "punctuation.separator.pdl"
},
"4": {
"name": "entity.name.pdl"
},
"5": {
"name": "punctuation.begin.pdl"
}
},
"end": "(\\))",
"endCaptures": {
"1": {
"name": "punctuation.section.braces.end.pdl"
}
},
"patterns": [
{
"include": "#constraint_list"
}
]
},
{
"begin": "(\\{)",
"beginCaptures": {
"1": {
"name": "punctuation.begin.pdl"
}
},
"end": "(\\})",
"endCaptures": {
"1": {
"name": "punctuation.section.braces.end.pdl"
}
},
"patterns": [
{
"include": "#field_list"
}
]
},
{
"name": "meta.group.pdl",
"begin": "(group)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\{)",
Expand Down

0 comments on commit 3c92b75

Please sign in to comment.