/***************************************************************************** * Copyright (c) 2010 CEA LIST. * * * 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 * * Contributors: * CEA LIST - Initial API and implementation * *****************************************************************************/ grammar org.eclipse.papyrus.uml.textedit.port.xtext.UmlPort with org.eclipse.papyrus.uml.alf.Common import "http://www.eclipse.org/uml2/5.0.0/UML" as uml import "http://www.eclipse.org/emf/2002/Ecore" as ecore generate umlPort "http://www.eclipse.org/papyrus/uml/textedit/port/xtext/UmlPort" PortRule: (visibility = VisibilityRule)? (derived ?= "/")? name=ID (':' (conjugated ?= "~")? (type=TypeRule | typeUndefined?=""))? (multiplicity = MultiplicityRule) ? (modifiers = ModifiersRule) ? (default = DefaultValueRule) ? ; enum VisibilityKind: public = "+" | private = "-" | protected = "#" | package = "~" ; VisibilityRule: visibility = VisibilityKind ; TypeRule : (path=QualifiedName)? type=[uml::Classifier] ; QualifiedName : path=[uml::Namespace]'::' (remaining=QualifiedName)? ; MultiplicityRule: "[" (bounds+=BoundSpecification '..')? bounds+=BoundSpecification "]" ; BoundSpecification: value = (UnlimitedLiteral | StringLiteral) ; UnlimitedLiteral : INT |'*'; StringLiteral : STRING; ModifiersRule: {ModifiersRule}'{' (values += ModifierSpecification (',' values += ModifierSpecification)*)? '}'; ModifierSpecification: value = ModifierKind | redefines = RedefinesRule | subsets = SubsetsRule ; enum ModifierKind: readOnly = "readOnly" | union = "union" | ordered = "ordered" | unique = "unique" ; RedefinesRule : 'redefines' port = [uml::Port] ; SubsetsRule : 'subsets' port = [uml::Port] ; DefaultValueRule : '=' default = Value ; Value : IntValue | StringValue | BooleanValue | RealValue | NullValue | NoValue; IntValue : literalInteger = INT; StringValue : literalString = STRING; enum BooleanLiterals: true = "true" | false = "false" ; BooleanValue : literalBoolean = BooleanLiterals; //TODO: Support all Java-compliant doubles RealValue : integer = INT '.' | '.' fraction = INT | integer = INT "." fraction = INT; NullValue : {NullValue}'null'; NoValue : {NoValue}'none';