comparison Implab/Automaton/RegularExpressions/CatToken.cs @ 177:a0ff6a0e9c44 ref20160224

refactoring
author cin
date Wed, 23 Mar 2016 01:42:00 +0300
parents 0526412bbb26
children
comparison
equal deleted inserted replaced
176:0c3c69fe225b 177:a0ff6a0e9c44
1 using System; 1 using System;
2 2
3 namespace Implab.Automaton.RegularExpressions { 3 namespace Implab.Automaton.RegularExpressions {
4 public class CatToken<TTag> : BinaryToken<TTag> { 4 public class CatToken : BinaryToken {
5 public CatToken(Token<TTag> left, Token<TTag> right) 5 public CatToken(Token left, Token right)
6 : base(left, right) { 6 : base(left, right) {
7 } 7 }
8 8
9 public override void Accept(IVisitor<TTag> visitor) { 9 public override void Accept(IVisitor visitor) {
10 Safe.ArgumentNotNull(visitor, "visitor"); 10 Safe.ArgumentNotNull(visitor, "visitor");
11 visitor.Visit(this); 11 visitor.Visit(this);
12 } 12 }
13 13
14 public override string ToString() { 14 public override string ToString() {
15 return String.Format("{0}{1}", FormatToken(Left), FormatToken(Right)); 15 return String.Format("{0}{1}", FormatToken(Left), FormatToken(Right));
16 } 16 }
17 17
18 static string FormatToken(Token<TTag> token) { 18 static string FormatToken(Token token) {
19 return String.Format(token is AltToken<TTag> ? "({0})" : "{0}", token); 19 return String.Format(token is AltToken ? "({0})" : "{0}", token);
20 } 20 }
21 } 21 }
22 } 22 }