Пример #1
0
 private SymbolType State7()
 {
     // Escape
     this.action = AutomatonAction.Move;
     this.state  = 6;
     return(SymbolType.Invalid);
 }
Пример #2
0
 private SymbolType State5(string c)
 {
     if (Regex.IsMatch(c, "[^a-zA-Z_]"))
     {
         this.action = AutomatonAction.Recognize;
         this.state  = 0;
     }
     return(SymbolType.Identifier);
 }
Пример #3
0
 private SymbolType State4(string c)
 {
     if (Regex.IsMatch(c, "[^0-9]"))
     {
         this.action = AutomatonAction.Recognize;
         this.state  = 0;
     }
     return(SymbolType.IntegerValue);
 }
Пример #4
0
 private SymbolType State15(string c)
 {
     if (Regex.IsMatch(c, "\n|\r|\r\n"))
     {
         this.action = AutomatonAction.Recognize;
         this.state  = 0;
     }
     else
     {
         this.action = AutomatonAction.Move;
     }
     return(SymbolType.Comment);
 }
Пример #5
0
 private SymbolType State16(string c)
 {
     if (Regex.IsMatch(c, "\\*"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 17;
     }
     else
     {
         this.action = AutomatonAction.Move;
     }
     return(SymbolType.Invalid);
 }
Пример #6
0
 private SymbolType State20(string c)
 {
     if (Regex.IsMatch(c, "[^=]"))
     {
         this.action = AutomatonAction.Recognize;
         this.state  = 0;
     }
     else
     {
         this.state = 21;
     }
     return(SymbolType.Operator);
 }
Пример #7
0
 private SymbolType State10(string c)
 {
     if (Regex.IsMatch(c, "\\."))
     {
         this.action = AutomatonAction.Move;
         this.state  = 11;
     }
     else
     {
         this.action = AutomatonAction.Recognize;
         this.state  = 0;
     }
     return(SymbolType.Invalid);
 }
Пример #8
0
 private SymbolType State14(string c)
 {
     if (Regex.IsMatch(c, "\\/"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 15;
     }
     else if (Regex.IsMatch(c, "\\*"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 16;
     }
     else
     {
         this.action = AutomatonAction.Recognize;
         this.state  = 0;
     }
     return(SymbolType.Operator);
 }
Пример #9
0
 private SymbolType State11()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.Range);
 }
Пример #10
0
 private SymbolType State19()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.Exclamation);
 }
Пример #11
0
 private SymbolType State18()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.MultilineComment);
 }
Пример #12
0
 private SymbolType State2()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.Assignment);
 }
Пример #13
0
 private SymbolType State3()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.SemiColon);
 }
Пример #14
0
 private SymbolType State13()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.RightParenthesis);
 }
Пример #15
0
 public DFAutomaton()
 {
     this.state  = 0;
     this.action = AutomatonAction.Move;
 }
Пример #16
0
 private SymbolType State21()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.Operator);
 }
Пример #17
0
 private SymbolType State8()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.StringValue);
 }
Пример #18
0
 private SymbolType State22()
 {
     this.action = AutomatonAction.Recognize;
     this.state  = 0;
     return(SymbolType.Minus);
 }
Пример #19
0
 private SymbolType State0(string c)
 {
     if (Regex.IsMatch(c, "\n|\r|\r\n"))
     {
         // NewLine
         this.action = AutomatonAction.Error;
         return(SymbolType.NewLine);
     }
     else if (Regex.IsMatch(c, "\\s"))
     {
         // WhiteSpace needs to be returned separately
         this.action = AutomatonAction.Error;
         return(SymbolType.WhiteSpace);
     }
     else if (Regex.IsMatch(c, ":"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 1;
     }
     else if (Regex.IsMatch(c, ";"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 3;
     }
     else if (Regex.IsMatch(c, "[a-zA-Z]"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 5;
     }
     else if (Regex.IsMatch(c, "[0-9]"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 4;
     }
     else if (Regex.IsMatch(c, "\""))
     {
         this.action = AutomatonAction.Move;
         this.state  = 6;
     }
     else if (Regex.IsMatch(c, "\\+|\\*|\\=|\\&"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 9;
     }
     else if (Regex.IsMatch(c, "\\."))
     {
         this.action = AutomatonAction.Move;
         this.state  = 10;
     }
     else if (Regex.IsMatch(c, "\\("))
     {
         this.action = AutomatonAction.Move;
         this.state  = 12;
     }
     else if (Regex.IsMatch(c, "\\)"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 13;
     }
     else if (Regex.IsMatch(c, "\\/"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 14;
     }
     else if (Regex.IsMatch(c, "!"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 19;
     }
     else if (Regex.IsMatch(c, "\\<|\\>"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 20;
     }
     else if (Regex.IsMatch(c, "\\-|\\−"))
     {
         this.action = AutomatonAction.Move;
         this.state  = 22;
     }
     else
     {
         this.action = AutomatonAction.Error;
     }
     return(SymbolType.Invalid);
 }