Parse() public method

public Parse ( IrontalkParser parser ) : PerCederberg.Grammatica.Runtime.Node
parser IrontalkParser
return PerCederberg.Grammatica.Runtime.Node
Exemplo n.º 1
0
        public STObject Evaluate(InputSource source, Context context)
        {
            Source = source;
            try {
                Node root = source.Parse(Parser);

                if (root == null)
                    return STUndefinedObject.Instance; // parser found empty string so aborted

                if (STDebug.ShowParseTrees) {
                    var tr = Transcript.Instance;
                    if (tr != null)
                        root.PrintTo(tr.Out);
                    else
                        root.PrintTo(Console.Out);
                }

                return Evaluate (root, context);
            } finally {
                Source = null;
            }
        }