Exemplo n.º 1
0
     /** Constructor */
 	public CUP_parser_actions(parser parser) 
     {
     	this.parser = parser;
     }
Exemplo n.º 2
0
		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** 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.
		 */
		protected 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 (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");
				throw e;
			}
		}