annotate Implab/Parsing/CatToken.cs @ 111:0fdaf280c797 v1

minor fix
author cin
date Wed, 19 Nov 2014 03:18:42 +0400
parents c0bf853aa04f
children 97fbbf816844
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
1 using Implab;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
2 using System;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
3 using System.Collections.Generic;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
4 using System.Linq;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
5 using System.Text;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
6 using System.Threading.Tasks;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
7
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
8 namespace Implab.Parsing {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
9 public class CatToken : BinaryToken {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
10 public CatToken(Token left, Token right)
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
11 : base(left, right) {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
12 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
13
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
14 public override void Accept(IVisitor visitor) {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
15 Safe.ArgumentNotNull(visitor, "visitor");
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
16 visitor.Visit(this);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
17 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
18
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
19 public override string ToString() {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
20 return String.Format("{0}{1}", FormatToken(Left), FormatToken(Right));
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
21 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
22
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
23 string FormatToken(Token token) {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
24 return String.Format(token is AltToken ? "({0})" : "{0}", token);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
25 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
26 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
27 }