/// <summary> /// Finds symbol of token iTok everywhere. /// Error if not found or not a keyword or the token is not an identifier. /// </summary> /// <param name="kwType">If not _KeywordT.Any, error if the keyword is not of this type.</param> _Keyword _FindKeyword(int iTok, _KeywordT kwType = _KeywordT.Any) { _Symbol x = _FindSymbol(iTok, true); var k = x as _Keyword; if (k == null) { _Err(iTok, "unexpected"); } if (kwType != _KeywordT.Any && k.kwType != kwType) { _Err(iTok, "unexpected"); } return(k); }
public _Keyword(_KeywordT kwType = _KeywordT.Normal, bool cannotStartStatement = false) { this.kwType = kwType; this.cannotStartStatement = cannotStartStatement; }