Skip to content

Commit 01078e7

Browse files
committed
Add obsolescent block data subprogram
1 parent c0b7693 commit 01078e7

File tree

5 files changed

+557986
-540587
lines changed

5 files changed

+557986
-540587
lines changed

grammar.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ module.exports = grammar({
114114
$.interface,
115115
$.subroutine,
116116
$.function,
117+
$.block_data,
117118
$.preproc_if,
118119
$.preproc_ifdef,
119120
$.preproc_include,
@@ -365,6 +366,39 @@ module.exports = grammar({
365366
$._end_of_statement
366367
)),
367368

369+
// Obsolescent feature
370+
block_data: $ => seq(
371+
$.block_data_statement,
372+
repeat(
373+
choice(
374+
$._specification_part,
375+
alias($.preproc_if_in_module, $.preproc_if),
376+
alias($.preproc_ifdef_in_module, $.preproc_ifdef)
377+
),
378+
),
379+
$.end_block_data_statement
380+
),
381+
382+
block_data_statement: $ => seq(
383+
whiteSpacedKeyword('block', 'data'),
384+
optional($._name),
385+
$._end_of_statement
386+
),
387+
388+
// Can't use `blockStructureEnding` because it's two keywords
389+
end_block_data_statement: $ => {
390+
const structType = whiteSpacedKeyword('block', 'data', false)
391+
return prec.right(seq(
392+
alias(choice(
393+
seq(
394+
caseInsensitive('end', false),
395+
optional(structType)),
396+
caseInsensitive('end' + structType, false)),
397+
'end' + structType),
398+
optional($._name),
399+
$._end_of_statement))
400+
},
401+
368402
assignment: $ => seq(caseInsensitive('assignment'), '(', '=', ')'),
369403
operator: $ => seq(caseInsensitive('operator'), '(', /[^()]+/, ')'),
370404
defined_io_procedure: $ => seq(

src/grammar.json

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
"type": "SYMBOL",
7070
"name": "function"
7171
},
72+
{
73+
"type": "SYMBOL",
74+
"name": "block_data"
75+
},
7276
{
7377
"type": "SYMBOL",
7478
"name": "preproc_if"
@@ -7790,6 +7794,175 @@
77907794
]
77917795
}
77927796
},
7797+
"block_data": {
7798+
"type": "SEQ",
7799+
"members": [
7800+
{
7801+
"type": "SYMBOL",
7802+
"name": "block_data_statement"
7803+
},
7804+
{
7805+
"type": "REPEAT",
7806+
"content": {
7807+
"type": "CHOICE",
7808+
"members": [
7809+
{
7810+
"type": "SYMBOL",
7811+
"name": "_specification_part"
7812+
},
7813+
{
7814+
"type": "ALIAS",
7815+
"content": {
7816+
"type": "SYMBOL",
7817+
"name": "preproc_if_in_module"
7818+
},
7819+
"named": true,
7820+
"value": "preproc_if"
7821+
},
7822+
{
7823+
"type": "ALIAS",
7824+
"content": {
7825+
"type": "SYMBOL",
7826+
"name": "preproc_ifdef_in_module"
7827+
},
7828+
"named": true,
7829+
"value": "preproc_ifdef"
7830+
}
7831+
]
7832+
}
7833+
},
7834+
{
7835+
"type": "SYMBOL",
7836+
"name": "end_block_data_statement"
7837+
}
7838+
]
7839+
},
7840+
"block_data_statement": {
7841+
"type": "SEQ",
7842+
"members": [
7843+
{
7844+
"type": "ALIAS",
7845+
"content": {
7846+
"type": "CHOICE",
7847+
"members": [
7848+
{
7849+
"type": "SEQ",
7850+
"members": [
7851+
{
7852+
"type": "PATTERN",
7853+
"value": "[bB][lL][oO][cC][kK]"
7854+
},
7855+
{
7856+
"type": "PATTERN",
7857+
"value": "[dD][aA][tT][aA]"
7858+
}
7859+
]
7860+
},
7861+
{
7862+
"type": "PATTERN",
7863+
"value": "[bB][lL][oO][cC][kK][dD][aA][tT][aA]"
7864+
}
7865+
]
7866+
},
7867+
"named": false,
7868+
"value": "blockdata"
7869+
},
7870+
{
7871+
"type": "CHOICE",
7872+
"members": [
7873+
{
7874+
"type": "SYMBOL",
7875+
"name": "_name"
7876+
},
7877+
{
7878+
"type": "BLANK"
7879+
}
7880+
]
7881+
},
7882+
{
7883+
"type": "SYMBOL",
7884+
"name": "_end_of_statement"
7885+
}
7886+
]
7887+
},
7888+
"end_block_data_statement": {
7889+
"type": "PREC_RIGHT",
7890+
"value": 0,
7891+
"content": {
7892+
"type": "SEQ",
7893+
"members": [
7894+
{
7895+
"type": "ALIAS",
7896+
"content": {
7897+
"type": "CHOICE",
7898+
"members": [
7899+
{
7900+
"type": "SEQ",
7901+
"members": [
7902+
{
7903+
"type": "PATTERN",
7904+
"value": "[eE][nN][dD]"
7905+
},
7906+
{
7907+
"type": "CHOICE",
7908+
"members": [
7909+
{
7910+
"type": "CHOICE",
7911+
"members": [
7912+
{
7913+
"type": "SEQ",
7914+
"members": [
7915+
{
7916+
"type": "PATTERN",
7917+
"value": "[bB][lL][oO][cC][kK]"
7918+
},
7919+
{
7920+
"type": "PATTERN",
7921+
"value": "[dD][aA][tT][aA]"
7922+
}
7923+
]
7924+
},
7925+
{
7926+
"type": "PATTERN",
7927+
"value": "[bB][lL][oO][cC][kK][dD][aA][tT][aA]"
7928+
}
7929+
]
7930+
},
7931+
{
7932+
"type": "BLANK"
7933+
}
7934+
]
7935+
}
7936+
]
7937+
},
7938+
{
7939+
"type": "PATTERN",
7940+
"value": "[eE][nN][dD][[oO][bB][jJ][eE][cC][tT] O[bB][jJ][eE][cC][tT]]"
7941+
}
7942+
]
7943+
},
7944+
"named": false,
7945+
"value": "end[object Object]"
7946+
},
7947+
{
7948+
"type": "CHOICE",
7949+
"members": [
7950+
{
7951+
"type": "SYMBOL",
7952+
"name": "_name"
7953+
},
7954+
{
7955+
"type": "BLANK"
7956+
}
7957+
]
7958+
},
7959+
{
7960+
"type": "SYMBOL",
7961+
"name": "_end_of_statement"
7962+
}
7963+
]
7964+
}
7965+
},
77937966
"assignment": {
77947967
"type": "SEQ",
77957968
"members": [

0 commit comments

Comments
 (0)