public virtual void ImportVocab(Grammar importG)
{
foreach (string tokenName in importG.tokenNameToTypeMap.Keys)
{
DefineTokenName(tokenName, importG.tokenNameToTypeMap[tokenName]);
}
foreach (string tokenName in importG.stringLiteralToTypeMap.Keys)
{
DefineStringLiteral(tokenName, importG.stringLiteralToTypeMap[tokenName]);
}
foreach (KeyValuePair<string, int> channel in importG.channelNameToValueMap)
{
DefineChannelName(channel.Key, channel.Value);
}
// this.tokenNameToTypeMap.putAll( importG.tokenNameToTypeMap );
// this.stringLiteralToTypeMap.putAll( importG.stringLiteralToTypeMap );
int max = Math.Max(this.typeToTokenList.Count, importG.typeToTokenList.Count);
Utils.SetSize(typeToTokenList, max);
for (int ttype = 0; ttype < importG.typeToTokenList.Count; ttype++)
{
maxTokenType = Math.Max(maxTokenType, ttype);
this.typeToTokenList[ttype] = importG.typeToTokenList[ttype];
}
max = Math.Max(this.channelValueToNameList.Count, importG.channelValueToNameList.Count);
Utils.SetSize(channelValueToNameList, max);
for (int channelValue = 0; channelValue < importG.channelValueToNameList.Count; channelValue++)
{
maxChannelType = Math.Max(maxChannelType, channelValue);
this.channelValueToNameList[channelValue] = importG.channelValueToNameList[channelValue];
}
}