Posted 16 years ago
by Civa

Hi all,
While writing common DescentSemanticParser today I came up with strange and confusing thing.I can not determine whats real purpose of method IsInMultiMatchSet and how to use it?
I realized it is really important method because I couldn't avoid some syntax error because of its return value.Namely I have added couple of custom TokenID's and i suppose there should be as much elements in each of 2-dimensional arrays (property MultiMatchSets)
as constants where TokenIDs are defined.Am I right?
So how is it working ?How can I know where to put Y/n in this 2-dimensional array?
here is my custom token ID enum :And here is MultiMatchSets property defined in my custom DescentSemanticParser :
If you demystify me this one it would be greatly appreciated. :)
Thank you.
Best regards,
Civa
While writing common DescentSemanticParser today I came up with strange and confusing thing.I can not determine whats real purpose of method IsInMultiMatchSet and how to use it?
I realized it is really important method because I couldn't avoid some syntax error because of its return value.Namely I have added couple of custom TokenID's and i suppose there should be as much elements in each of 2-dimensional arrays (property MultiMatchSets)
as constants where TokenIDs are defined.Am I right?
So how is it working ?How can I know where to put Y/n in this 2-dimensional array?
here is my custom token ID enum :
/// <summary>
/// The Invalid token ID.
/// </summary>
public const int Invalid = 0;
/// <summary>
/// The DocumentEnd token ID.
/// </summary>
public const int DocumentEnd = 1;
/// <summary>
/// The LanguageTransitionStart token ID.
/// </summary>
public const int LanguageTransitionStart = 2;
/// <summary>
/// The LanguageTransitionEnd token ID.
/// </summary>
public const int LanguageTransitionEnd = 3;
/// <summary>
/// The Whitespace token ID.
/// </summary>
public const int Whitespace = 4;
///<summary>
///The Dot Token ID.
///</summary>
public const int Dot = 5;
/// <summary>
/// The LineTerminator token ID.
/// </summary>
public const int LineTerminator = 6;
/// <summary>
/// The SingleLineComment token ID.
/// </summary>
public const int SingleLineComment = 7;
/// <summary>
/// The MultiLineComment token ID.
/// </summary>
public const int MultiLineComment = 8;
/// <summary>
/// The Number token ID.
/// </summary>
public const int Number = 9;
/// <summary>
/// The Identifier token ID.
/// </summary>
public const int Identifier = 10;
/// <summary>
/// The KeywordStart token ID.
/// </summary>
public const int KeywordStart = 11;
/// <summary>
/// The Function token ID.
/// </summary>
public const int Sub = 12;
/// <summary>
/// The Dim token ID.
/// </summary>
public const int Dim = 13;
/// <summary>
/// The Return token ID.
/// </summary>
public const int Return = 14;
/// <summary>
/// The As token ID.
/// </summary>
public const int As = 15;
/// <summary>
/// The KeywordEnd token ID.
/// </summary>
public const int KeywordEnd = 16;
/// <summary>
/// The OperatorOrPunctuatorStart token ID.
/// </summary>
public const int OperatorOrPunctuatorStart = 17;
/// <summary>
/// The OpenCurlyBrace token ID.
/// </summary>
public const int OpenCurlyBrace = 18;
/// <summary>
/// The CloseCurlyBrace token ID.
/// </summary>
public const int CloseCurlyBrace = 19;
/// <summary>
/// The OpenParenthesis token ID.
/// </summary>
public const int OpenParenthesis = 20;
/// <summary>
/// The CloseParenthesis token ID.
/// </summary>
public const int CloseParenthesis = 21;
/// <summary>
/// The DataType token ID.
/// </summary>
public const int DataType = 22;
/// <summary>
/// The Comma token ID.
/// </summary>
public const int Comma = 23;
/// <summary>
/// The SemiColon token ID.
/// </summary>
public const int SemiColon = 24;
/// <summary>
/// The Addition token ID.
/// </summary>
public const int Addition = 25;
/// <summary>
/// The Subtraction token ID.
/// </summary>
public const int Subtraction = 26;
/// <summary>
/// The Multiplication token ID.
/// </summary>
public const int Multiplication = 27;
/// <summary>
/// The Division token ID.
/// </summary>
public const int Division = 28;
/// <summary>
/// The Assignment token ID.
/// </summary>
public const int Assignment = 29;
/// <summary>
/// The Equality token ID.
/// </summary>
public const int Equality = 30;
/// <summary>
/// The Inequality token ID.
/// </summary>
public const int Inequality = 31;
/// <summary>
/// The OperatorOrPunctuatorEnd token ID.
/// </summary>
public const int OperatorOrPunctuatorEnd = 32;
/// <summary>
/// The MaxTokenID token ID.
/// </summary>
public const int MaxTokenID = 33;
private static bool[,] multiMatchSets =
{
// 0: Identifier SemiColon Dim Return OpenCurlyBrace
{
n,//0-The Invalid token ID.
n,//1-The DocumentEnd token ID.
n,//2-The LanguageTransitionStart token ID.
n,//3-The LanguageTransitionEnd token ID.
n,//4-The Whitespace token ID.
n,//5-The Dot Token ID.
n,//6-The LineTerminator token ID.
n,//7-The SingleLineComment token ID.
n,//8-The MultiLineComment token ID.
n,//9-The Number token ID.
Y,//10-The Identifier token ID.
n,//11-The KeywordStart token ID.
n,//12-The Function token ID.
Y,//13-The Dim token ID.
Y,//14-The Return token ID.
n,//15-The As token ID.
n,//16-The KeywordEnd token ID.
n,//17-The OperatorOrPunctuatorStart token ID.
Y,//18-The OpenCurlyBrace token ID.
n,//19-The CloseCurlyBrace token ID.
n,//20-The OpenParenthesis token ID.
n,//21-The CloseParenthesis token ID.
n,//22-The DataType token ID.
n,//23-The Comma token ID.
Y,//24-The SemiColon token ID.
n,//25-The Addition token ID.
n,//26-The Subtraction token ID.
n,//27-The Multiplication token ID.
n,//28-The Division token ID.
n,//29-The Assignment token ID.
n,//30-The Equality token ID.
n,//31-The Inequality token ID.
n,//32-The OperatorOrPunctuatorEnd token ID.
n //33-The MaxTokenID token ID.
},
// 1: Identifier SemiColon Dim Return OpenCurlyBrace
{
n,//0-The Invalid token ID.
n,//1-The DocumentEnd token ID.
n,//2-The LanguageTransitionStart token ID.
n,//3-The LanguageTransitionEnd token ID.
n,//4-The Whitespace token ID.
n,//5-The Dot Token ID.
n,//6-The LineTerminator token ID.
n,//7-The SingleLineComment token ID.
n,//8-The MultiLineComment token ID.
n,//9-The Number token ID.
Y,//10-The Identifier token ID.
n,//11-The KeywordStart token ID.
n,//12-The Function token ID.
Y,//13-The Dim token ID.
Y,//14-The Return token ID.
n,//15-The As token ID.
n,//16-The KeywordEnd token ID.
n,//17-The OperatorOrPunctuatorStart token ID.
Y,//18-The OpenCurlyBrace token ID.
n,//19-The CloseCurlyBrace token ID.
n,//20-The OpenParenthesis token ID.
n,//21-The CloseParenthesis token ID.
n,//22-The DataType token ID.
n,//23-The Comma token ID.
Y,//24-The SemiColon token ID.
n,//25-The Addition token ID.
n,//26-The Subtraction token ID.
n,//27-The Multiplication token ID.
n,//28-The Division token ID.
n,//29-The Assignment token ID.
n,//30-The Equality token ID.
n,//31-The Inequality token ID.
n,//32-The OperatorOrPunctuatorEnd token ID.
n //33-The MaxTokenID token ID.
}
};
Thank you.
Best regards,
Civa