aboutsummaryrefslogtreecommitdiffstats
path: root/model/utilities/src/main/antlr4
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-05-24 14:39:38 +0100
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-05-24 14:49:48 +0100
commit8e424a8db287f180c65b5e5fc32a6f23b4b2011f (patch)
tree80bab5706b2d3277e455558adfc5a75500ebc20c /model/utilities/src/main/antlr4
parenta94302f0e4af0d6136d1c694cfae12abc175dc55 (diff)
Fixing typo in utilities module name
Change-Id: I7bae55aa9c9064fc4aea32bacba3baee196c10a0 Issue-ID: POLICY-855 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'model/utilities/src/main/antlr4')
-rw-r--r--model/utilities/src/main/antlr4/org/onap/policy/apex/model/utilities/typeutils/ParametrizedType.g458
1 files changed, 58 insertions, 0 deletions
diff --git a/model/utilities/src/main/antlr4/org/onap/policy/apex/model/utilities/typeutils/ParametrizedType.g4 b/model/utilities/src/main/antlr4/org/onap/policy/apex/model/utilities/typeutils/ParametrizedType.g4
new file mode 100644
index 000000000..3a37d4043
--- /dev/null
+++ b/model/utilities/src/main/antlr4/org/onap/policy/apex/model/utilities/typeutils/ParametrizedType.g4
@@ -0,0 +1,58 @@
+//-------------------------------------------------------------------------------
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: Apache-2.0
+// ============LICENSE_END=========================================================
+//-------------------------------------------------------------------------------
+
+grammar ParametrizedType;
+
+//For more information see:
+// http://stackoverflow.com/questions/39401083/class-forname-equivalent-for-creating-parameterizedtypes-from-string
+// https://github.com/KetothXupack/stackoverflow-answers/tree/master/q39401083
+
+@parser::header {
+ //For more information see:
+ // http://stackoverflow.com/questions/39401083/class-forname-equivalent-for-creating-parameterizedtypes-from-string
+ // https://github.com/KetothXupack/stackoverflow-answers/tree/master/q39401083
+
+
+ //Note: Unused Imports
+ //Since this is generated code compile warnings are to be expected and cannot always be suppressed
+ //See https://github.com/antlr/antlr4/issues/1192
+ import org.onap.policy.apex.model.utilities.typeutils.ClassBuilder;
+}
+
+type returns[ClassBuilder value]
+ : cls=CLASS { $value = ClassBuilder.parse($cls.text); }
+ | cls=CLASS { $value = ClassBuilder.parse($cls.text); }
+ LT head=type { $value.add($head.value); }
+ (COMMA tail=type { $value.add($tail.value); })* GT
+ ;
+
+GT : '>'
+ ;
+
+LT : '<'
+ ;
+
+COMMA
+ : ','
+ ;
+
+CLASS
+ : ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'.'|'_')*
+ ;