Exemplo n.º 1
0
 /// <summary>Constructor 
 /// </summary>
 internal CUP_parser_actions(parser parser)
 {
     InitBlock();
     this.parser = parser;
 }
Exemplo n.º 2
0
        /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
        /// <summary>Parse the grammar specification from standard input.  This produces
        /// sets of terminal, non-terminals, and productions which can be accessed
        /// via static variables of the respective classes, as well as the setting
        /// of various variables (mostly in the emit class) for small user supplied
        /// items such as the code to scan with.
        /// </summary>
        protected internal static void parse_grammar_spec()
        {
            parser parser_obj;

            /* create a parser and parse with it */
            parser_obj = new parser();
            try
            {
                if (opt_do_debug)
                    parser_obj.debug_parse();
                else
                    parser_obj.parse();
            }
            catch (System.Exception e)
            {
                /* something threw an exception.  catch it and emit a message so we
                have a line number to work with, then re-throw it */
                lexer.emit_error("Internal error: Unexpected exception");
                Console.WriteLine("Internal Error: {0}", e.ToString());
                Console.WriteLine(e.StackTrace);
                throw e;
            }
        }