rascal
rascal copied to clipboard
Implement `tag` declarations in type-checker
This is what the grammar now says on Declaration:
\tag : Tags tags Visibility visibility "tag" Kind kind Name name "on" {Type ","}+ types ";"
this does not make sense to me anymore. I'd say we'd like to declare a name and the type of value that is expected for that tag name, and on which other declarations:
function tag str @ignore would declare the tag @ignore to accept string values.
function tag str @synopsis
test tag int @maxDepth
etc.
I noticed accidentally that some tag processing code is very brittle. I.e. an additional space or newline breaks the code in @maxDepth. A type-check would help in detecting issues before they cause harm, and also it could help with processing the data easier.
- parse values with the parser that matches the type (
intmust be anint) - also allow for concrete syntax in tagstrings, i.e.
@statement{int i = 0;}would be parsed with theMyParsernon-terminal because:function tag MyParser @statement;