Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Application freezes when typing an undefined terminal
Application freezes when typing an undefined terminal [message #1729776] Mon, 18 April 2016 20:43 Go to next message
Chris Bryan is currently offline Chris BryanFriend
Messages: 3
Registered: April 2016
Junior Member
I am having trouble with a grammar which does not include the standard terminals. If I type any character in the editor which is not defined in a terminal, the Eclipse application hangs completely!

What is the easiest solution to avoid this?

The grammar is as follows (note I had to remove the URLs before Eclipse would allow me to post it!):

grammar org.lilychant.LilyChant hidden(WS, ML_COMMENT, SL_COMMENT)

<...>

generate lilyChantScript <...>

Script:
	(
		(tones+=Tone)+
//		ensemble=Ensemble
		(chants+=Chant)*
	)?
;

/*
 * Tone definitions
 */

// TODO VOICE NAMES SHOULD BE GLOBAL

Tone:
	'Tone' name=ID 'in' key=ID
		BEGIN
		'Voices'
			BEGIN
			voiceNames+=VoiceName+
			END
		(phrases+=TonePhrase)+
		END
;

VoiceName:
	name=ID
;

TonePhrase:
	'Phrase' name=ID
		BEGIN
		voices+=VoicePhrase+
		END
;

VoicePhrase:
	'Voice' name=[VoiceName]
		BEGIN
		notes+=Note+
		END
;


///*
// * Ensemble
// */
//
//Ensemble:
//	'ensemble' ':'
//	'top' 'staff' ':' BEGIN voices+=[VoiceName]+ END
//	'bottom' 'staff' ':' BEGIN voices+=[VoiceName]+ END
//;

/*
 * Chants
 */

Chant:
	'Chant' 'in' 'Tone' tone=[Tone] 'in' key=ID
		BEGIN
		phrases+=LyricPhrase+
		END
;

LyricPhrase:
	'Phrase' notes=[TonePhrase]
		BEGIN
		noteGroups+=NoteGroup+
		END
;

NoteGroup:
	// single syllable
	// '--' is allowed at the start to support exiting a '<...>' group in the middle of a word
	(syllables+=ID =>(syllables+=HYPHEN)?
	| syllables+=HYPHEN syllables+=ID)
	syllables+=EXTENDER?
//	syllables+=HYPHEN? syllables+=ID =>syllables+=HYPHEN? syllables+=EXTENDER*
//	| syllables+=ID syllables+=HYPHEN? syllables+=EXTENDER*
	
	// group of syllables to be repeated on the same pitch
	// Note that '__' is not allowed within a group, as this implies a slur
	| START_NOTE_GROUP syllables+=(ID|HYPHEN)+ END_NOTE_GROUP
;

/*
 * Notes and keys
 */

//enum Mode:
//	major='major' | minor='minor'
//;

Note:
	ID DURATION?
;

/*
 * Terminals
 */

terminal ID: '^'?('a'..'z'|'A'..'Z'|','|';'|'.'|':')*;
terminal DURATION: ('1'|'2'|'4'|'8'|'16'|'\breve')+;
terminal HYPHEN: '--';
terminal EXTENDER: '__';
terminal START_NOTE_GROUP: '<';
terminal END_NOTE_GROUP: '>';

terminal BEGIN: 'synthetic:BEGIN';
terminal END: 'synthetic:END';

terminal ML_COMMENT : '/*' -> '*/';
terminal SL_COMMENT : '//' !('\n'|'\r')* ('\r'? '\n')?;

terminal WS : (' '|'\t'|'\r'|'\n')+;
Re: Application freezes when typing an undefined terminal [message #1729833 is a reply to message #1729776] Tue, 19 April 2016 12:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13186
Registered: July 2009
Senior Member
maybe you should add (copy) the ANY_OTHER terminal from common.Terminals

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Application freezes when typing an undefined terminal [message #1729880 is a reply to message #1729833] Tue, 19 April 2016 22:49 Go to previous message
Chris Bryan is currently offline Chris BryanFriend
Messages: 3
Registered: April 2016
Junior Member
I thought I had tried that, and was surprised that it didn't work. But I just tried again and it did the trick!

Apologies for the simple question, but perhaps others will find it useful.
Previous Topic:Content Assist for multi Word
Next Topic:Invoke a Rule Explicitly
Goto Forum:
  


Current Time: Wed Nov 13 09:24:02 GMT 2019

Powered by FUDForum. Page generated in 0.01940 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top