本文整理汇总了C#中com.calitha.goldparser.TerminalToken类的典型用法代码示例。如果您正苦于以下问题:C# TerminalToken类的具体用法?C# TerminalToken怎么用?C# TerminalToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TerminalToken类属于com.calitha.goldparser命名空间,在下文中一共展示了TerminalToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoShift
private void DoShift(TerminalToken token, ShiftAction action)
{
stateStack.Push(action.State);
tokenStack.Push(token);
lookahead = null;
if (OnShift != null)
OnShift(this,new ShiftEventArgs(token,action.State));
}
示例2: ShowInputError
public void ShowInputError(TerminalToken token)
{
ClearShowInputError();
int oldpos = this.inputBox.SelectionStart;
this.inputBox.Select(token.Location.Position, token.Text.Length);
this.inputBox.SelectionColor = Color.Red;
this.inputBox.Select(oldpos,0);
this.inputBox.SelectionColor = Color.ForestGreen;
}
示例3: ShiftEventArgs
public ShiftEventArgs(TerminalToken token, State newState)
{
this.token = token;
this.newState = newState;
}
示例4: TokenErrorEventArgs
public TokenErrorEventArgs(TerminalToken token)
{
this.token = token;
contin = false;
}
示例5: ProcessError
private bool ProcessError(TerminalToken token)
{
if (OnTokenError != null)
{
TokenErrorEventArgs e = new TokenErrorEventArgs(token);
OnTokenError(this, e);
return e.Continue;
}
else
return false;
}
示例6: TerminalTryfinally
/// <summary>
/// <para>Symbol: TryFinally</para>
/// <para><c><TryFinally></c></para>
/// </summary>
protected virtual object TerminalTryfinally(TerminalToken token)
{
throw new NotImplementedException("Symbol TryFinally");
}
示例7: ParseTerminal
private void ParseTerminal(TerminalToken token)
{
State currentState = stateStack.Peek();
Action action = currentState.Actions.Get(token.Symbol);
if (action is ShiftAction)
DoShift(token,(ShiftAction)action);
else if (action is ReduceAction)
DoReduce(token,(ReduceAction)action);
else if (action is AcceptAction)
DoAccept(token,(AcceptAction)action);
else
{
continueParsing = false;
FireParseError(token);
}
}
示例8: FireEOFError
private void FireEOFError()
{
TerminalToken eofToken = new TerminalToken(SymbolCollection.EOF,
SymbolCollection.EOF.Name,
tokenizer.GetCurrentLocation());
FireParseError(eofToken);
}
示例9: CreateObject
protected override Object CreateObject(TerminalToken token)
{
switch (token.Symbol.Id)
{
case (int)com.calitha.goldparser.SymbolConstants.SYMBOL_IDENTIFIER:
return token.Text;
case (int)SymbolConstants.SYMBOL_IP:
return token.Text;
case (int)SymbolConstants.SYMBOL_NUMBER:
return token.Text;
case (int)SymbolConstants.SYMBOL_FLOAT:
return token.Text;
case (int)SymbolConstants.SYMBOL_DEVICEID:
return token.Text;
case (int)SymbolConstants.SYMBOL_CMD:
return token.Text;
case (int)SymbolConstants.SYMBOL_SUBCMD:
return token.Text;
case (int)SymbolConstants.SYMBOL_STRINGLITERAL:
return token.Text;
case (int)SymbolConstants.SYMBOL_CMDCLASS:
if (!(token.Text == "A" || token.Text == "B" || token.Text == "C" || token.Text == "D" || token.Text == "N"))
throw new SymbolException(token.Location+", must be 'A' or 'B' or 'C' or 'D' or 'N'==>"+token.Text);
return token.Text;
case (int)SymbolConstants.SYMBOL_CMDTYPE:
if (!(token.Text == "Set" || token.Text == "Query" || token.Text == "Report" ))
throw new SymbolException(token.Location + ", must be 'Set' or 'Query' or 'Report' ==>" + token.Text);
return token.Text;
//case (int)SymbolConstants.SYMBOL_LVALUE:
// return token.Text;
//case (int)SymbolConstants.SYMBOL_HVALUE:
// return Convert.ToInt32(token.Text);
//case (int) SymbolConstants.SYMBOL_BYTES:
//return token.Text;
// break;
}
return null;
}
示例10: CreateObject
protected virtual Object CreateObject(TerminalToken token)
{
switch (token.Symbol.Id)
{
case (int)SymbolConstants.SYMBOL_EOF :
//(EOF)
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_ERROR :
//(Error)
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_WHITESPACE :
//(Whitespace)
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_MINUS :
//'-'
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_LPARAN :
//'('
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_RPARAN :
//')'
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_COMMA :
//','
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_COLON :
//':'
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_ATCMD :
//'@cmd'
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_LBRACKETCOMMANDRBRACKET :
//'[Command]'
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_LBRACKETDEVICEINFORBRACKET :
//'[DeviceInfo]'
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_LBRACE :
//'{'
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_RBRACE :
//'}'
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_CLASSEQ :
//'class='
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_CMD :
//Cmd
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_CMDEQ :
//'cmd='
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_CMDCLASS :
//CmdClass
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_CMDTYPE :
//CmdType
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_DESCRIPTIONEQ :
//'description='
//todo: Create a new object that corresponds to the symbol
return null;
case (int)SymbolConstants.SYMBOL_DEVICEID :
//.........这里部分代码省略.........
示例11: CreateObjectFromTerminal
public virtual object CreateObjectFromTerminal(TerminalToken token)
{
switch (token.Symbol.Id)
{
case (int)Symbols.Eof: //(EOF)
return TerminalEof(token);
case (int)Symbols.Error: //(Error)
return TerminalError(token);
case (int)Symbols.Whitespace: //(Whitespace)
return TerminalWhitespace(token);
case (int)Symbols.Commentend: //(Comment End)
return TerminalCommentend(token);
case (int)Symbols.Commentline: //(Comment Line)
return TerminalCommentline(token);
case (int)Symbols.Commentstart: //(Comment Start)
return TerminalCommentstart(token);
case (int)Symbols.Minus: //'-'
return TerminalMinus(token);
case (int)Symbols.Minusminus: //--
return TerminalMinusminus(token);
case (int)Symbols.Comma: //','
return TerminalComma(token);
case (int)Symbols.Semi: //';'
return TerminalSemi(token);
case (int)Symbols.Colon: //':'
return TerminalColon(token);
case (int)Symbols.Exclam: //'!'
return TerminalExclam(token);
case (int)Symbols.Exclameq: //'!='
return TerminalExclameq(token);
case (int)Symbols.Question: //'?'
return TerminalQuestion(token);
case (int)Symbols.Dot: //'.'
return TerminalDot(token);
case (int)Symbols.Lparan: //'('
return TerminalLparan(token);
case (int)Symbols.Rparan: //')'
return TerminalRparan(token);
case (int)Symbols.Lbracket: //'['
return TerminalLbracket(token);
case (int)Symbols.Rbracket: //']'
return TerminalRbracket(token);
case (int)Symbols.Lbrace: //'{'
return TerminalLbrace(token);
case (int)Symbols.Rbrace: //'}'
return TerminalRbrace(token);
case (int)Symbols.Times: //'*'
return TerminalTimes(token);
case (int)Symbols.Timeseq: //'*='
return TerminalTimeseq(token);
case (int)Symbols.Div: //'/'
return TerminalDiv(token);
case (int)Symbols.Diveq: //'/='
return TerminalDiveq(token);
case (int)Symbols.Percent: //'%'
return TerminalPercent(token);
case (int)Symbols.Plus: //'+'
return TerminalPlus(token);
case (int)Symbols.Plusplus: //'++'
return TerminalPlusplus(token);
case (int)Symbols.Pluseq: //'+='
return TerminalPluseq(token);
case (int)Symbols.Lt: //'<'
return TerminalLt(token);
case (int)Symbols.Lteq: //'<='
return TerminalLteq(token);
case (int)Symbols.Lteqeq: //'<=='
return TerminalLteqeq(token);
//.........这里部分代码省略.........
示例12: CreateObject
private Object CreateObject(TerminalToken token)
{
switch (token.Symbol.Id)
{
case (int)SymbolConstants.SYMBOL_EOF :
//(EOF)
return null;
case (int)SymbolConstants.SYMBOL_ERROR :
//(Error)
return null;
case (int)SymbolConstants.SYMBOL_WHITESPACE :
//(Whitespace)
return null;
case (int)SymbolConstants.SYMBOL_COMMENTLINE :
//(Comment Line)
return null;
case (int)SymbolConstants.SYMBOL_MINUS :
//'-'
return null;
case (int)SymbolConstants.SYMBOL_LPARAN :
//'('
return null;
case (int)SymbolConstants.SYMBOL_RPARAN :
//')'
return null;
case (int)SymbolConstants.SYMBOL_TIMES :
//'*'
return null;
case (int)SymbolConstants.SYMBOL_COLONCOLONEQ :
//'::='
return null;
case (int)SymbolConstants.SYMBOL_QUESTION :
//'?'
return null;
case (int)SymbolConstants.SYMBOL_PIPE :
//'|'
return null;
case (int)SymbolConstants.SYMBOL_PLUS :
//'+'
return null;
case (int)SymbolConstants.SYMBOL_EQ :
//'='
return null;
case (int)SymbolConstants.SYMBOL_LARGECOMMENT :
//LargeComment
return token.Text;
case (int)SymbolConstants.SYMBOL_NEWLINE :
//Newline
return null;
case (int)SymbolConstants.SYMBOL_NONTERMINAL :
//Nonterminal
return token.Text;
case (int)SymbolConstants.SYMBOL_PARAMETERNAME :
//ParameterName
return null;
case (int)SymbolConstants.SYMBOL_SETLITERAL :
//SetLiteral
return null;
case (int)SymbolConstants.SYMBOL_SETNAME :
//SetName
return null;
case (int)SymbolConstants.SYMBOL_TERMINAL :
//Terminal
return token.Text;
case (int)SymbolConstants.SYMBOL_CONTENT :
//<Content>
return null;
case (int)SymbolConstants.SYMBOL_DEFINITION :
//<Definition>
return null;
case (int)SymbolConstants.SYMBOL_GRAMMAR :
//<Grammar>
return null;
case (int)SymbolConstants.SYMBOL_HANDLE :
//<Handle>
return null;
//.........这里部分代码省略.........
示例13: TerminalWndparamlist
/// <summary>
/// <para>Symbol: WndParam List</para>
/// <para><c><WndParam List></c></para>
/// </summary>
protected virtual object TerminalWndparamlist(TerminalToken token)
{
throw new NotImplementedException("Symbol WndParam List");
}
示例14: TerminalWidget2
/// <summary>
/// <para>Symbol: Widget</para>
/// <para><c><Widget></c></para>
/// </summary>
protected virtual object TerminalWidget2(TerminalToken token)
{
throw new NotImplementedException("Symbol Widget");
}
示例15: TerminalValue
/// <summary>
/// <para>Symbol: Value</para>
/// <para><c><Value></c></para>
/// </summary>
protected virtual object TerminalValue(TerminalToken token)
{
throw new NotImplementedException("Symbol Value");
}