blob: 9728e63ee02015ffd007bae761a3e0a5cd371961 [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2011 E.D.Willink 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
*
* Contributors:
* E.D.Willink - Initial API and implementation
*
* </copyright>
*
* $Id: OCLStates.xtext,v 1.1 2011/03/15 07:51:54 ewillink Exp $
*/
grammar org.eclipse.ocl.tutorial.eclipsecon2011.OCLStates with org.eclipse.xtext.common.Terminals
import "platform:/resource/org.eclipse.ocl.tutorial.eclipsecon2011.oclstates/model/OCLStates.ecore"
Module:
'module' name=STRING
(machines+=Statemachine)*
;
Statemachine:
(initial?='initial')? 'statemachine' name=ID ('value' value=INT)? '{'
'events' (events+=Event)* ';'
(states+=State)* '}'
;
Event:
name=ID;
State: SimpleState | CompoundState;
SimpleState:
(initial?='initial')? 'state' name=ID ('value' value=INT)?
'{' (transitions+=Transition)* '}'
;
CompoundState:
'compound' (initial?='initial')? 'state' name=ID
'machine' machine=[Statemachine]
'{' (transitions+=Transition)* '}'
;
Transition:
event=[Event] '=>' state=[State]
;