Skip to content
Discussion options

You must be logged in to vote

Hey @Serhioromano,

so in theory you could use the unordered groups feature:

VarGlobal:
    'VAR_GLOBAL' (decconstant+='CONSTANT' & decconstant+='RETAIN' & decconstant+='PERSISTENT')
    'END_VAR_GLOBAL'
;

However, I would recommend a more flexible approach with better error messages:

VarGlobal:
    'VAR_GLOBAL' (decconstant+=DeclarationConstant)* // Allow an unlimited amount of modifiers
    'END_VAR_GLOBAL'
;

DeclarationConstant returns string:
    'CONSTANT' | 'RETAIN' | 'PERSISTENT'

And then simply write a custom validator to determine whether modifiers are duplicated. That allows you to write a specific message that helps users identify issues (i.e. something like Duplicate declara…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Serhioromano
Comment options

Answer selected by Serhioromano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants