14 using System.Collections.Generic;
20 public KeyTermTable(StringComparer comparer) : base(100, comparer) {}
27 public KeyTerm(
string text,
string name) : base(name) {
29 base.ErrorAlias = name;
33 public string Text {
get;
private set;}
36 public bool AllowAlphaAfterKeyword =
false;
38 #region overrides: TryMatch, Init, GetPrefixes(), ToString()
40 base.Init(grammarData);
42 #region comments about keyterms priority
53 base.Priority = ReservedWordsPriority +
Text.Length;
55 base.Priority = LowestPriority +
Text.Length;
57 if (this.EditorInfo != null)
return;
66 if (this.FlagIsSet(
TermFlags.IsMemberSelect))
77 source.PreviewPosition += Text.Length;
79 if (this.FlagIsSet(
TermFlags.IsKeyword) && !AllowAlphaAfterKeyword) {
80 var previewChar = source.PreviewChar;
81 if (
char.IsLetterOrDigit(previewChar) || previewChar ==
'_')
return null;
83 var token = source.CreateToken(this.OutputTerminal,
Text);
88 return new string[] {
Text };
91 if (Name !=
Text)
return Name;
96 var result = (token.ValueString ?? token.Text) +
" " + keyw;
101 [System.Diagnostics.DebuggerStepThrough]
102 public override bool Equals(
object obj) {
103 return base.Equals(obj);
106 [System.Diagnostics.DebuggerStepThrough]
108 return Text.GetHashCode();
KeyTermTable(StringComparer comparer)
override string TokenToString(Token token)
static string LabelKeySymbol
Looks up a localized string similar to (Key symbol).
override int GetHashCode()
Interface for Terminals to access the source stream and produce tokens.
readonly bool CaseSensitive
Gets case sensitivity of the grammar. Read-only, true by default. Can be set to false only through a ...
override IList< string > GetFirsts()
override bool Equals(object obj)
override Token TryMatch(ParsingContext context, ISourceStream source)
Tokens are produced by scanner and fed to parser, optionally passing through Token filters in between...
bool MatchSymbol(string symbol, bool ignoreCase)
Tries to match the symbol with the text at current preview position.
override string ToString()
override void Init(GrammarData grammarData)
KeyTerm(string text, string name)