annotate Implab/Automaton/RegularExpressions/CatToken.cs @ 210:5dc21f6a3222 v2

Code review for RunnableComponent Added StaApartment class based on System.Windows.Forms.Application message loop
author cin
date Mon, 20 Mar 2017 17:44:18 +0300
parents a0ff6a0e9c44
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
1 using System;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
2
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
3 namespace Implab.Automaton.RegularExpressions {
177
a0ff6a0e9c44 refactoring
cin
parents: 162
diff changeset
4 public class CatToken : BinaryToken {
a0ff6a0e9c44 refactoring
cin
parents: 162
diff changeset
5 public CatToken(Token left, Token right)
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
6 : base(left, right) {
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
7 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
8
177
a0ff6a0e9c44 refactoring
cin
parents: 162
diff changeset
9 public override void Accept(IVisitor visitor) {
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
10 Safe.ArgumentNotNull(visitor, "visitor");
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
11 visitor.Visit(this);
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
12 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
13
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
14 public override string ToString() {
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
15 return String.Format("{0}{1}", FormatToken(Left), FormatToken(Right));
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
16 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
17
177
a0ff6a0e9c44 refactoring
cin
parents: 162
diff changeset
18 static string FormatToken(Token token) {
a0ff6a0e9c44 refactoring
cin
parents: 162
diff changeset
19 return String.Format(token is AltToken ? "({0})" : "{0}", token);
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
20 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
21 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
22 }