I am trying to model mqsi commands, using ANTLR and have come across the following problem. The documents for mqsicreateconfigurableservice say for the queuePrefix : "The prefix can contain any characters that are valid in a WebSphere® MQ queue name, but must be no longer than eight characters and must not begin or end with a period (.). For example, SET.1 is valid, but .SET1 and SET1. are invalid. Multiple configurable services can use the same queue prefix."
I've used the following, as a stopgap but this technique implies I must have a minimum of a two character name and seems a very wasteful and non-scalable solution. Is there a better method?
See 'queuePrefixValue', below...
Thanks :o)
parser grammar mqsicreateconfigurableservice;
mqsicreateconfigurableservice
: 'mqsicreateconfigurableservice' ' '+ params
;
params : (broker ' '+ switches+)
;
broker : validChar+
;
switches
: AggregationConfigurableService
;
AggregationConfigurableService
: (objectName ' '+ AggregationNameValuePropertyPair)
;
objectName
: (' '+ '-o' ' '+ validChar+)
;
AggregationNameValuePropertyPair
: (' '+ '-n' ' '+ 'queuePrefix' ' '+ '-v' ' '+ queuePrefixValue)?
(' '+ '-n' ' '+ 'timeoutSeconds' ' '+ '-v' ' '+ timeoutSecondsValue)?
;
// I'm not satisfied with this rule as it means at least two digits are mandatory
//Couldn't see how to use regex or semantic predicates which appear to offer a solution
queuePrefixValue
: validChar (validChar | '.')? (validChar | '.')? (validChar | '.')? (validChar | '.')? (validChar | '.')? (validChar | '.')? validChar
;
timeoutSecondsValue //a positive integer
: ('0'..'9')+
;
//This char list is just a temporary subset which eventually needs to reflect all the WebSphere acceptable characters, apart from the dot '.'
validChar
: (('a'..'z')|('A'..'Z')|('0'..'9'))
;