1

ANTLR を使用して mqsi コマンドをモデル化しようとしていますが、次の問題に遭遇しました。mqsicreateconfigurableservice のドキュメントには、queuePrefix について次のように記載されています。 , SET.1 は有効ですが、.SET1 と SET1. は無効です。複数の構成可能サービスが同じキュー プレフィックスを使用できます。

私は一時しのぎとして以下を使用しましたが、この手法は最低 2 文字の名前が必要であることを意味し、非常に無駄が多く、拡張性のないソリューションのようです。より良い方法はありますか?

以下の「queuePrefixValue」を参照してください...

ありがとう: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'))
;
4

1 に答える 1