a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
45 lines
559 B
C#
45 lines
559 B
C#
using System;
|
|
|
|
class CC {
|
|
|
|
public class IfElseStateMachine {
|
|
|
|
public enum State {
|
|
START,
|
|
IF_SEEN,
|
|
ELSEIF_SEEN,
|
|
ELSE_SEEN,
|
|
ENDIF_SEEN,
|
|
MAX
|
|
}
|
|
|
|
public enum Token {
|
|
START,
|
|
IF,
|
|
ELSEIF,
|
|
ELSE,
|
|
ENDIF,
|
|
EOF,
|
|
MAX
|
|
}
|
|
|
|
State state;
|
|
public IfElseStateMachine()
|
|
{
|
|
}
|
|
|
|
public void HandleToken(Token tok)
|
|
{
|
|
if(tok == Token.IF) {
|
|
state = (State) tok;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static int Main ()
|
|
{
|
|
new IfElseStateMachine ().HandleToken (IfElseStateMachine.Token.IF);
|
|
return 0;
|
|
}
|
|
}
|