Beispiel #1
0
        private ParserStatus ParseNOper(char c)
        {
            if (c == '^')
            {
                _tree.AddNode(new PowOperNode());
            }
            else
            {
                _tree.AddNode(NOperNode.MakeNOperNode(c));
            }
            _state = ParserState.NOPER;

            // '-' and '/' as NOPER nodes are parsed as '+' or '*', but need to be followed
            // by the aligning UOPER node.
            if (c == '-' || c == '/')
            {
                _tree.AddNode(UOperNode.MakeUOperNode(c));
                _state = ParserState.UOPER;
            }

            return(GetSuccessState());
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiplicationOperNode"/> class as clone of <paramref name="node"/>.
 /// </summary>
 /// <param name="node">The <see cref="MultiplicationOperNode"/> to clone.</param>
 public MultiplicationOperNode(NOperNode node)
     : base(node)
 {
 }
Beispiel #3
0
 /// <summary>
 /// Executes operation on a <see cref="NOperNode"/>.
 /// </summary>
 /// <param name="node">The <see cref="NOperNode"/> to execute operation on.</param>
 /// <returns>The result of the operation on a <see cref="NOperNode"/>.</returns>
 public virtual ExpNode Execute(NOperNode node) => Execute((OperNode)node);
Beispiel #4
0
 /// <summary>
 /// Prints a <see cref="NOperNode"/>.
 /// </summary>
 /// <param name="node">The <see cref="NOperNode"/> to print.</param>
 /// <returns>The <see cref="NOperNode"/> printed to a string.</returns>
 public virtual string Print(NOperNode node) => Print((OperNode)node);