~alexreg/mathtexdotnet/0.1

« back to all changes in this revision

Viewing changes to TexDotNet/Semantics/ParserException.cs

  • Committer: Alex Regueiro
  • Date: 2009-10-02 01:30:36 UTC
  • Revision ID: alexreg@gmail.com-20091002013036-0tfciubgveydmtm5
Further improvements to TexComposer regarding emitting of operators/brackets.
Updated test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using System;
2
 
using System.Collections.Generic;
3
 
using System.Linq;
4
 
using System.Text;
5
 
 
6
 
namespace TexDotNet
7
 
{
8
 
    public class ParserException : Exception
9
 
    {
10
 
        private const string errorMessageInvalidSymbol =
11
 
            "Expected one of the following symbol kinds: {0}.";
12
 
 
13
 
        public ParserException(Token tokenRead, ICollection<SymbolKind> expectedSymbolKinds)
14
 
            : this(tokenRead, string.Format(errorMessageInvalidSymbol,
15
 
            string.Join(", ", expectedSymbolKinds.Select(tokenKind => tokenKind.ToString()).ToArray())))
16
 
        {
17
 
        }
18
 
 
19
 
        public ParserException(Token tokenRead, string message)
20
 
            : base(message + Environment.NewLine + string.Format("Token read: {0}", tokenRead))
21
 
        {
22
 
            this.TokenRead = tokenRead;
23
 
        }
24
 
 
25
 
        public Token TokenRead
26
 
        {
27
 
            get;
28
 
            private set;
29
 
        }
30
 
    }
31
 
}