internal string RegisterDynamicTokenString(LexPattern lexPattern) { string tokenString = lexPattern.StringContent(); string token_name; if (!tokenStringsMapping.TryGetValue(Tuple.Create(tokenString, lexPattern.StringComparison), out token_name)) { // todo: polish it someday // it can create conflict with terminals given explictly in lexer rules // but we cannot check them in advance, and besides we don't parse code action // thus we don't know terminals // the only way would be postpone resolution of the name until grammar constructor // and using in parser rules wrapper for tokens -- a lot of burden when // processing parser productions if (Regex.IsMatch(tokenString, identifierPattern)) { token_name = tokenString; } else { token_name = "__term" + tokenStringsMapping.Count; } tokenStringsMapping.Add(Tuple.Create(tokenString, lexPattern.StringComparison), token_name); } return(token_name); }
internal PatternsInfo(string fqClassname, LexPattern directory) : base(dotSplit(fqClassname).Item2, null, false) { this.Namespace = dotSplit(fqClassname).Item1; if (directory != null) { this.DirectoryName = directory.StringContent().Replace('/', System.IO.Path.DirectorySeparatorChar); } }