All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations.xtext Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
grammar org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations with org.eclipse.xtext.xbase.Xbase

import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase
import "http://www.eclipse.org/xtext/xbase/Xtype" as xtype
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types
import "http://www.eclipse.org/Xtext/Xbase/XAnnotations"

XAnnotation :
	{XAnnotation}
	'@' annotationType=[types::JvmAnnotationType | QualifiedName] (=>'('
		(
			elementValuePairs+=XAnnotationElementValuePair (',' elementValuePairs+=XAnnotationElementValuePair)* 
		|	value=XAnnotationElementValue
		)?
	')')?
;

XAnnotationElementValuePair :
	element=[types::JvmOperation|ValidID] '=' value=XAnnotationElementValue	
;

XAnnotationElementValueStringConcatenation returns xbase::XExpression :
	XAnnotationElementValue ({XAnnotationElementValueBinaryOperation.leftOperand = current} operator='+' rightOperand=XAnnotationElementValue)*
;

XAnnotationElementValue returns xbase::XExpression :
	XAnnotation |
	XListLiteral |
	XStringLiteral |
	XBooleanLiteral |
	XNumberLiteral |
	XTypeLiteral |
	XAnnotationValueMemberFieldReference |
	'(' XAnnotationElementValueStringConcatenation ')'
;

XAnnotationValueMemberFieldReference returns xbase::XExpression :
	XAnnotationValueFieldReference (
		{xbase::XMemberFeatureCall.memberCallTarget=current} ("."|explicitStatic?="::")
		feature=[types::JvmIdentifiableElement|IdOrSuper] 
	)*
;

XAnnotationValueFieldReference returns xbase::XExpression :
	{xbase::XFeatureCall} 
	feature=[types::JvmIdentifiableElement|IdOrSuper] 
;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy