This project has moved and is read-only. For the latest updates, please go here.

Custom Terminal

Feb 1, 2010 at 11:39 AM

While defining the characters in identifier terminal, Irony grammar compares only with the first char identified and rest of the characters are scanned. Is there any way to compare all the character?

For example, when the user define AllFirstChars as "EFIMNRTYefimnrty" and AllChars as "FIYfyi" and AllPrefixChars as "FIfi" for the keyword "FYI" in IdentifierTerminal.

Ambiguity occurs for flg keywords also.

Is there anyway to solve this ambiguity?

could you please suggest me the proper way of creating custom terminal in our latest version of Irony


Feb 1, 2010 at 5:47 PM

Honestly, I don't quite understand the problem. Please describe in plain english what kind of identifiers you want to recognize and which you want to reject.


Feb 2, 2010 at 5:49 AM

Here is my example,



In the above mentioned string, "fy1" need to parse under the custom terminal. So I created one custom terminal as period terminal.

<font size="2" color="#0000ff"><font size="2" color="#0000ff">


</font></font><font size="2" color="#0000ff">



PeriodTerminal(string name, string extraChars, string extraFirstChars):base(name) 


AllFirstChars = Strings.AllLatinLetters_Period + extraFirstChars;

AllChars =Strings.AllLatinLetters_Period + Strings.DecimalDigits + extraChars;

AllPrefixChars ="fFiI";



in which extraChars, extraFirstChars are  "_" , public const string AllLatinLetters_Period = "EFIMNRTYefimnrty"; 

public const string DecimalDigits = "1234567890";

In S_fy1_mean, "fy1" are getting parsed as period terminal. 

But other identifier terminals which starts from "f" are parsing under this period terminal. For example,

 In S_ci_flg_9, "flg"  is an ordinary identifier terminal but its getting parsed under period terminal.

Is there any way to recognise all the characters "fy1" in period terminal and others start from "f" as usual identifiers?

Could u please suggest me a proper solution to create custom terminal and the identifier terminal to parse both the examples S_fy1_mean and S_ci_flg_mean?





Feb 4, 2010 at 6:18 PM

I still don't quite understand what you try to do, but it looks like if you want to catch the exact "fy1" string you have to use it as is, as KeyTerm, just as you use other string literals in the grammar; do not use custom terminal or identifier for this