~alexreg/mathtexdotnet/0.1

« back to all changes in this revision

Viewing changes to TexDotNet/TexHelper.cs

  • Committer: Alex Regueiro
  • Date: 2009-09-25 19:25:01 UTC
  • Revision ID: alexreg@gmail.com-20090925192501-lyu4daug4m0f6he7
Rewrote testing framework. Tests work on principle that if you parse an expression, write it back, and parse it again, the two expression trees should always be equivalent.
Fixed bug in TexComposer involving  brackets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        {
41
41
            return CreateParseTree(CreateTokenStream(expression));
42
42
        }
 
43
 
43
44
        public static ParseNode CreateParseTree(TokenStream tokenStream)
44
45
        {
45
46
            var parser = new TexParser();
67
68
                throw new ParserException(TexToken.Null, "Unexpected end of token stream.");
68
69
        }
69
70
 
 
71
        public static bool IsLongOperator(this TexSymbolKind symbol)
 
72
        {
 
73
            switch (symbol)
 
74
            {
 
75
                case TexSymbolKind.Dot:
 
76
                    return true;
 
77
                default:
 
78
                    return false;
 
79
            }
 
80
        }
 
81
 
70
82
        public static bool IsBracket(this TexSymbolKind symbol)
71
83
        {
72
84
            return IsOpenBracket(symbol) || IsCloseBracket(symbol);