/* Generated By:JJTree&JavaCC: Do not edit this line. Compiler2.java */
package jsdai.expressCompiler;

import java.io.*;
import java.util.regex.*;
import java.util.*;
import jsdai.tools.RepositoryChanges;

//import org.eclipse.core.runtime.IProgressMonitor;

public class Compiler2 extends Support/*@bgen(jjtree)*/implements Compiler2TreeConstants, Compiler2Constants {/*@bgen(jjtree)*/
  protected static JJTCompiler2State jjtree = new JJTCompiler2State();
// rule inheritance yes, derived-as-derived redeclaration - temporarily removed

  static Vector compiled_schemas;


        static String progress;
        static boolean in_progress = true;

        static final String xc_build     = "476";
        static final String xc_date      = "2009-07-02";
        static final String xc_version   = "4.2.1";
        static final String xc_title     = "JSDAI(TM) Express Compiler";
        static final String xc_copyright = "Copyright (C) 1998-2009 LKSoftWare GmbH";

        // old, perhaps updated during builds? If not, remove
        static String build = "476";

    final static int WA_UNKNOWN             =  0;
                final static int WA_ATTRIBUTE_REF       =  1;
                final static int WA_BUILTIN_CONSTANT      =  2;
                final static int WA_CONSTANT_REF              =  3;
                final static int WA_FUNCTION_CALL             =  4;
                final static int WA_POPULATION          =  5;
                final static int WA_VIEW_ATTRIBUTE_REF  =  6;
                final static int WA_VIEW_CALL             =  7;
                final static int WA_PARAMETER_REF             =  8;
                final static int WA_VARIABLE_REF              =  9;
                final static int WA_MAP_CALL              = 10;

        static final int PI_CONSTANT = 1;
        static final int PI_MAP = 2;
        static final int PI_PARTITION = 3;
        static final int PI_SOURCE_ENTITY_OR_VIEW = 4;
        static final int PI_SCHEMA_MAP = 5;
        static final int PI_SCHEMA_MAP_OR_SCHEMA_VIEW = 6;
        static final int PI_SCHEMA_OR_SCHEMA_MAP_OR_SCHEMA_VIEW = 7;
        static final int PI_SOURCE_SCHEMA = 8;
        static final int PI_SOURCE_SCHEMA_OR_TARGET_SCHEMA_OR_SCHEMA = 9;
        static final int PI_VIEW = 10;



  static boolean artificial_exception_thrown = false;
        static HashSet domain_rule_labels;
  static long start_time, finish_time, elapsed_time;
  static long total_start_time, total_finish_time, total_elapsed_time;
  static long pass_start_time, pass_finish_time, pass_elapsed_time;

        static boolean numeric_expression_calculated = false;
//	static boolean expression_instances = false;
        // static int parser_pass;
        static boolean flag_in_redeclaring = false;
        static boolean flag_derived_expression = false;

        static boolean flag_print_attribute_not_found_error = false;
        static int no_label_nr = 0;
        static int from_order_count;
        static int target_parameter_order_count;
        static int view_attribute_order_count;
        static int attribute_order_count;
        static int explicit_attribute_order_count;
        static int derived_attribute_order_count;
        static int inverse_attribute_order_count;
        static int where_rule_order_count;
        static int error_count;
        static int function_depth = 0;
        static int unique_pdb_name = 0;
        static int unique_pdb_name2 = 0;
        static String unique_pdb1_str = null;
        static String unique_pdb2_str = null;
        static boolean self_type = false;
        static boolean self_entity = false;
        static boolean self_constructor = false;

        static Token doc_token;

        static int choice = 0;
        static int ahead = 0;
        static String global_name = null;
  static boolean is_complex_schema;
        static String short_name_dir = null;
        static String express_file_name;
        static String complex_file_name;
        static String complex_list_file = "generic.ce";
        static String physical_file = "generic.pf";
//	static Vector express_files = null;
//	static  String express_file = null;
        static  String complex_file = "";
//      static String complex_file;
//-- see if works moved to support      static Stack argument_stack = new Stack();


        static jsdai.SExtended_dictionary_schema.EAttribute     global_redeclaring = null;
        static jsdai.SExtended_dictionary_schema.EAttribute     global_redeclared = null;
        static jsdai.lang.SdaiModel model_doc = null;
        static jsdai.lang.SdaiModel model_express = null;
        static jsdai.lang.SdaiModel model_java = null;
        static jsdai.lang.SdaiModel model_const = null;
        static jsdai.lang.SdaiTransaction trans;
        static String p21_file = "generic.pf";
        static String repository_name = "ExpressCompilerRepo";
        static String model_name = "generic_model";
        static String expression_model_name = "generic_expression_model";
        //	static jsdai.SExtended_dictionary_schema.ESchema_definition sd;
        static jsdai.SExtended_dictionary_schema.EGeneric_schema_definition sd;
        static jsdai.SExtended_dictionary_schema.ESchema_definition esd;
        // Added by V.N.
        static String specialClassSuffix = "";
    static long compilation_sn = -1;  // Added by VV
    static String indexFileName = "none";  // Added by VV
        static String baseInterface = "EEntity";
        static String baseClass = "CEntity";

        static String _data_type_name;

        static String global_attribute_name;
        static jsdai.SExtended_dictionary_schema.EEntity_definition global_entity1;
        static jsdai.SExtended_dictionary_schema.EEntity_definition global_entity2;
        static Object global_reference;


//	public static X_Expression runParserDerivedExpression(String str, jsdai.lang.SdaiModel _model, jsdai.SExtended_dictionary_schema.ESchema_definition _sd, jsdai.SExtended_dictionary_schema.EEntity_definition _ed, jsdai.SExtended_dictionary_schema.EDerived_attribute _da) throws jsdai.lang.SdaiException {
        public static X_Expression runParserDerivedExpression(String str, jsdai.lang.SdaiModel _model, jsdai.SExtended_dictionary_schema.ESchema_definition _sd, jsdai.SExtended_dictionary_schema.EEntity_definition _ed, jsdai.SExtended_dictionary_schema.EDerived_attribute _da, Compiler2 parser) throws jsdai.lang.SdaiException {
                // Compiler2 parser = null;
          X_Expression x_result = null;
                first_parsed_file = true;

                // here we may want to initialize some static stuff, sd, model, current_scope, argument_stack, etc.
                express_x = false;
                scope_stack = new Stack();
                argument_stack = new Stack();
                if (flag_type_tracking)
                        type_stack = new Stack();
                scope_stack.push(current_scope);
                current_scope = new Vector();
                function_depth = 0;
    model = _model;
    sd = _sd;
                active_scope = _ed;

//		parser = new Compiler2(new java.io.ByteArrayInputStream(str.getBytes()));
                parser.ReInit(new java.io.DataInputStream(new java.io.ByteArrayInputStream(str.getBytes())));


                try {
                        error_count = 0;
      is_complex_schema = false;
                        unique_pdb_name2 = 0;
                        unique_pdb_name = 0;
                        parser_pass = 5;
//      initializeExpressTypes(repository);
                        x_result = parser.Expression5();
                } catch (ParseException e) {
                        System.out.println("Express Compiler - Derived Expression> Parser found errors in pass 5.");
                        System.out.println(e.getMessage());
                }
                return x_result;
        }

        public static X_Expression runParserEntityRuleExpression(String str, jsdai.lang.SdaiModel _model, jsdai.SExtended_dictionary_schema.ESchema_definition _sd, jsdai.SExtended_dictionary_schema.EEntity_definition _ed, jsdai.SExtended_dictionary_schema.EWhere_rule _wr, Compiler2 parser) throws jsdai.lang.SdaiException {

System.out.println("RUNNING parser on STRING:");
System.out.println("\tstring: " + str);
System.out.println("\tmodel: " + _model);
System.out.println("\tschema: " + _sd);
System.out.println("\tentity: " + _ed);
System.out.println("\twhere_rule: " + _wr);
System.out.println("\tparser: " + parser);
System.out.println("------------------------------");

                // lets force non-optimal search, because optimal can't find anything
                hm_current_entity_declarations = null;

                // Compiler2 parser = null;
          X_Expression x_result = null;
                first_parsed_file = true;

                // here we may want to initialize some static stuff, sd, model, current_scope, argument_stack, etc.
                express_x = false;
                scope_stack = new Stack();
                argument_stack = new Stack();
                if (flag_type_tracking)
                        type_stack = new Stack();
                scope_stack.push(current_scope);
                current_scope = new Vector();
                function_depth = 0;
    model = _model;
    sd = _sd;
                active_scope = _ed;

//		parser = new Compiler2(new java.io.ByteArrayInputStream(str.getBytes()));
                parser.ReInit(new java.io.DataInputStream(new java.io.ByteArrayInputStream(str.getBytes())));


                try {
                        error_count = 0;
      is_complex_schema = false;
                        unique_pdb_name2 = 0;
                        unique_pdb_name = 0;
                        parser_pass = 5;
//      initializeExpressTypes(repository);
                        x_result = parser.Expression5();
                } catch (ParseException e) {
                        System.out.println("Express Compiler - entity domain rule expression> Parser found errors in pass 5.");
                        System.out.println(e.getMessage());
                }
                return x_result;
        }


        public static X_AllSchemas runParser(String str) throws jsdai.lang.SdaiException {
                Compiler2 parser;
          X_AllSchemas x_result = null;

                parser = new Compiler2(new java.io.ByteArrayInputStream(str.getBytes()));
                try {
                        error_count = 0;
      is_complex_schema = false;
                        unique_pdb_name2 = 0;
                        unique_pdb_name = 0;
                        parser_pass = 1;
//      initializeExpressTypes(repository);
                        parser.AllSchemas();
                } catch (ParseException e) {
                        System.out.println("Express Compiler - STRING TEST> Parser found errors in pass 1.");
                        System.out.println(e.getMessage());
                }

                // void TheParser.ReInit(java.io.InputStream stream) - if parser is static 
                parser.ReInit(new java.io.ByteArrayInputStream(str.getBytes()));
//		parser = new Compiler2(new java.io.ByteArrayInputStream(str.getBytes()));
                try {
                        error_count = 0;
      is_complex_schema = false;
                        unique_pdb_name2 = 0;
                        unique_pdb_name = 0;
                        parser_pass = 2;
//      initializeExpressTypes(repository);
                        parser.AllSchemas();
                } catch (ParseException e) {
                        System.out.println("Express Compiler - STRING TEST> Parser found errors in pass 1.");
                        System.out.println(e.getMessage());
                }

                parser.ReInit(new java.io.ByteArrayInputStream(str.getBytes()));
//		parser = new Compiler2(new java.io.ByteArrayInputStream(str.getBytes()));
                try {
                        error_count = 0;
      is_complex_schema = false;
                        unique_pdb_name2 = 0;
                        unique_pdb_name = 0;
                        parser_pass = 3;
//      initializeExpressTypes(repository);
                        parser.AllSchemas();
                } catch (ParseException e) {
                        System.out.println("Express Compiler - STRING TEST> Parser found errors in pass 1.");
                        System.out.println(e.getMessage());
                }

                parser.ReInit(new java.io.ByteArrayInputStream(str.getBytes()));
//		parser = new Compiler2(new java.io.ByteArrayInputStream(str.getBytes()));
                try {
                        error_count = 0;
      is_complex_schema = false;
                        unique_pdb_name2 = 0;
                        unique_pdb_name = 0;
                        parser_pass = 4;
                        flag_in_redeclaring = false;
//      initializeExpressTypes(repository);
                        parser.AllSchemas();
                } catch (ParseException e) {
                        System.out.println("Express Compiler - STRING TEST> Parser found errors in pass 1.");
                        System.out.println(e.getMessage());
                }

                parser.ReInit(new java.io.ByteArrayInputStream(str.getBytes()));
//		parser = new Compiler2(new java.io.ByteArrayInputStream(str.getBytes()));
                try {
                        error_count = 0;
      is_complex_schema = false;
                        unique_pdb_name2 = 0;
                        unique_pdb_name = 0;
                        parser_pass = 5;
                        flag_in_redeclaring = false;
//      initializeExpressTypes(repository);
                        x_result = parser.AllSchemas();
                } catch (ParseException e) {
                        System.out.println("Express Compiler - STRING TEST> Parser found errors in pass 1.");
                        System.out.println(e.getMessage());
                }

                parser.ReInit(new java.io.ByteArrayInputStream(str.getBytes()));
//		parser = new Compiler2(new java.io.ByteArrayInputStream(str.getBytes()));
                try {
                        error_count = 0;
      is_complex_schema = false;
                        unique_pdb_name2 = 0;
                        unique_pdb_name = 0;
                        parser_pass = 5;
//      initializeExpressTypes(repository);
                        x_result = parser.AllSchemas();
                } catch (ParseException e) {
                        System.out.println("Express Compiler - STRING TEST> Parser found errors in pass 1.");
                        System.out.println(e.getMessage());
                }
                return x_result;
        }


//    public static int main(String args[], Vector par_express_files, boolean first_time_invoking, IProgressMonitor monitor, Vector compiled_schemas2) throws jsdai.lang.SdaiException, java.lang.ClassNotFoundException, java.io.IOException
    // replacing IProgressMonitor by ECMonitor for now.
    public static int main(String args[], Vector par_express_files, boolean first_time_invoking, ECMonitor monitor, Vector compiled_schemas2) throws jsdai.lang.SdaiException, java.lang.ClassNotFoundException, java.io.IOException
//	public static void main(String args[], Vector par_express_files, boolean first_time_invoking) throws jsdai.lang.SdaiException, java.lang.ClassNotFoundException, java.io.IOException
        {


                global_entity_ref = null;
                global_entity_name = null;
                global_schema_name = null;
                hm_attribute_key = null;

                int return_value = -1;

                if (compiled_schemas2 == null) {
                        compiled_schemas2 = new Vector();
                }
                compiled_schemas = compiled_schemas2;

          in_progress = true;
                Vector x_all_data = null;
                X_AllSchemas x_data = null;
//		X_AllSchemas x_tree = null;
                self_entity = false;
                self_type = false;
                self_constructor = false;
                domain_rule_labels = new HashSet();

                String jsdai_properties = null;
                boolean flag_allow_no_repository = false;
                boolean flag_print_nodes = false;
                boolean keep_flag = false;
                boolean keep_all_flag = false;
                Vector keep_names = null;
                boolean flag_complex_directory = false;
                boolean annex_a_flag = false;
                boolean flag_value = true;
                boolean update_flag = false;
                boolean compile_flag = false;
                boolean jar_flag = false;
                boolean zip_flag = false;
                boolean flag_relax = false;
                boolean flag_insert = false;
                boolean instance_flag = false;
                boolean flag_inherit = true;
                boolean generate_java = false;
                boolean no_parsing = true;
                boolean generate_bin = true;
          boolean generate_p21  = false;
          boolean create_repository  = false;
                boolean delete_declarations = true;
                boolean add_short_names = false;
                boolean delete_old = false;
                //  remove those switches, both always true, after changes to return all violations in A_string for Gintaras
                boolean flag_print_failed_domain_rule = true;
                boolean flag_process_all_domain_rules = true;
//		boolean flag_print_failed_domain_rule = false;
//		boolean flag_process_all_domain_rules = false;

                String instance_name = "DEFAULT_INSTANCE";
                String compile_string = null;
                String jar_string = null;
                String jar_string0 = null;
                String zip_string = null;
                String batch_file = null;
                String log_file = null;
                String jar_file = null;
                String zip_file = null;
                String jar_batch_file = null;
                String zip_batch_file = null;
                Compiler2 parser = null;

                // taking care of static, because from GUI the compiler may be invoked several times

    compiled_models = new Vector();
                model_file_name = null;
                express_file = null;
                express_files = null;
                Vector global_excluded = null;

                sd = null;

                hm_parameters = null;
                hm_variables = null;
                hm_current_parameters = null;
                hm_current_variables = null;
                hm_entity_declarations = null;
                hm_current_entity_declarations = null;
                hm_type_declarations = null;
                hm_current_type_declarations = null;
                hm_function_declarations = null;
                hm_current_function_declarations = null;
                hm_procedure_declarations = null;
                hm_current_procedure_declarations = null;
                hm_rule_declarations = null;
                hm_current_rule_declarations = null;
                hm_constant_declarations = null;
                hm_current_constant_declarations = null;
                hm_subtype_constraint_declarations = null;
                hm_current_subtype_constraint_declarations = null;
                hm_attributes = null;
                hs_redeclared_attribute_originals = null;

        no_express_amendment = false;
        flag_implicit_expressions = false;
        flag_serialize = false;
                flag_relative_exclude = false;
                flag_stepmod = false;
                global_express_dir_name = null;
                flag_arm = false;
                flag_mim = false;
        express_x = false;
        parser_pass = 0;
        // first_parsed_file;
        global_name1_global = null;
        // global_kind1_global;
        global_name2_global = null;
        // global_kind2_global;
        global_name3_global = null;
        // global_kind3_global;
        flag_replace_schema = false;
        flag_print_attribute_not_found_error = false;
  flag_xt_declarations = false; // if true, declarations are generated for standard express types, local and implicit data_type_declarations
  flag_xt_sdai = true; // if true, standard express types are generated in sdai_dictionary_schema instead of in extended_dictionary_schema
  flag_xt_init_sdai = true; // if true, standard express types are generated in sdai_dictionary_schema instead of in extended_dictionary_schema
  flag_stack = false;
  flag_scope = false;
  flag_scope_stack = false;
  flag_verbose0 = false;
  flag_verbose = false;
  flag_debug = false;
  flag_error_debug = false;
  flag_deep_debug = false;
        flag_debug_split_return = false;
        flag_no_print_active_nodes = false;
  flag_complex = false;
        flag_oc = true;
        flag_more_errors = false;
        flag_complex_off = false;
  flag_implicit_select = false;
        flag_original_expressions = true;
        flag_really_original_expressions = false;
  scope_stack = new Stack();
  current_scope = new Vector();
  variable_uid = 0;
  variable_id_stack = new Stack();
  argument_stack = new Stack();
        if (flag_type_tracking)
          type_stack = new Stack();
  expression_stack = new Stack();
  active_scope = null;
  active_scope_extension = null;
  active_scope_string = "";

  used_vectors = new Vector();
  referenced_vectors = new Vector();
  model_vector = new Vector();

  // perhaps could be final instead
  FLAG_USED = new Integer(1);
  FLAG_REFERENCED = new Integer(2);
  FLAG_IMPLICIT = new Integer(0);
  FLAG_KEEP_OUT = new Integer(-1);

  session = null;
  repository = null;
  sysrepository = null;
  dic_sd = null;
  model = null;
  expression_model = null;
  _st_integer = null;
  _st_real = null;
  _st_number = null;
  _st_logical = null;
  _st_boolean = null;
  _st_string = null;
  _st_binary = null;
  _st_generic = null;

  // static EEntity_definition _st_entity;
  _st_entity = null;
  _std_entity = null;
  _st_list_string = null;
  _st_list_generic = null;
  _st_set_generic = null;
   _st_set_string = null;
   _st_bag_generic = null;
  _st_aggregate_generic = null;
  _st_schema = null;
  _st_model = null;
  _std_integer = null;
  _std_real = null;
  _std_number = null;
  _std_logical = null;
  _std_boolean = null;
  _std_string = null;
  _std_binary = null;
  _std_generic = null;
  _std_list_string = null;
  _std_list_generic = null;
  _std_set_generic = null;
  _std_set_string = null;
  _std_bag_generic = null;
  _std_aggregate_generic = null;
  the_depth = 0;
        schema_depth = 0;

        progress = null;
        in_progress = true;

        // static final String xc_build     = "273";
        // static final String xc_date      = "2004-06-03";
        // static final String xc_version   = "3.6";
        // static final String xc_title     = "JSDAI(TM) Express Compiler";
        // static final String xc_copyright = "Copyright (C) 1998-2003 LKSoftWare GmbH";

        // static String build = "273";

   /*
    final static int WA_UNKNOWN             =  0;
		final static int WA_ATTRIBUTE_REF       =  1;
		final static int WA_BUILTIN_CONSTANT	  =  2;
		final static int WA_CONSTANT_REF	      =  3;
		final static int WA_FUNCTION_CALL	      =  4;
		final static int WA_POPULATION	        =  5;
		final static int WA_VIEW_ATTRIBUTE_REF	=  6;
		final static int WA_VIEW_CALL	          =  7;
		final static int WA_PARAMETER_REF	      =  8;
		final static int WA_VARIABLE_REF	      =  9;
		final static int WA_MAP_CALL	          = 10;

	static final int PI_CONSTANT = 1;
	static final int PI_MAP = 2;
	static final int PI_PARTITION = 3;
	static final int PI_SOURCE_ENTITY_OR_VIEW = 4;
	static final int PI_SCHEMA_MAP = 5;
	static final int PI_SCHEMA_MAP_OR_SCHEMA_VIEW = 6;
	static final int PI_SCHEMA_OR_SCHEMA_MAP_OR_SCHEMA_VIEW = 7;
	static final int PI_SOURCE_SCHEMA = 8;
	static final int PI_SOURCE_SCHEMA_OR_TARGET_SCHEMA_OR_SCHEMA = 9;
	static final int PI_VIEW = 10;

*/

  // start_time, finish_time, elapsed_time;
  // total_start_time, total_finish_time, total_elapsed_time;
  // pass_start_time, pass_finish_time, pass_elapsed_time;

        x_tree = null;
        numeric_expression_calculated = false;
        expression_instances = false;
        // static int parser_pass;
        no_label_nr = 0;
        from_order_count = 0;
        target_parameter_order_count = 0;
        view_attribute_order_count = 0;
        attribute_order_count = 0;
        explicit_attribute_order_count = 0;
        derived_attribute_order_count = 0;
        inverse_attribute_order_count = 0;
        where_rule_order_count = 0;
        error_count = 0;
        function_depth = 0;
        unique_pdb_name2 = 0;
        unique_pdb_name = 0;

        doc_token = null;

        choice = 0;
        ahead = 0;
        global_name = null;
  is_complex_schema = false;
  output_dir = null;
        short_name_dir = null;
        express_file_name = null;
        complex_file_name = null;
        complex_list_file = "generic.ce";
        physical_file = "generic.pf";
//	static Vector express_files = null;
//	static  String express_file = null;
        complex_file = "";
//      static String complex_file;
//-- see if works moved to support      static Stack argument_stack = new Stack();


        global_redeclaring = null;
        global_redeclared = null;
        model_doc = null;
        model_express = null;
        model_java = null;
        model_const = null;
        trans = null;
        p21_file = "generic.pf";
        repository_name = "ExpressCompilerRepo";
  model_name = "generic_model";
        expression_model_name = "generic_expression_model";
        //	static jsdai.SExtended_dictionary_schema.ESchema_definition sd;
        sd = null;
        esd = null;
        // Added by V.N.
  specialClassSuffix = "";
   compilation_sn = -1;  // Added by VV
   indexFileName = "none";  // Added by VV
        baseInterface = "EEntity";
        baseClass = "CEntity";

        _data_type_name = null;

        global_attribute_name = null;
        global_entity1 = null;
        global_entity2 = null;
        global_reference = null;

                for (int ihi = 0; ihi < args.length; ihi++) {
                        if (args[ihi].equalsIgnoreCase("-gui_express")) {
                                express_files = par_express_files;
                                no_parsing = false;
                        }



                        if (args[ihi].equalsIgnoreCase("-spec_reference_from")) flag_no_special_reference_from = false;
                        if (args[ihi].equalsIgnoreCase("-rf")) flag_no_special_reference_from = false;
                        if (args[ihi].equalsIgnoreCase("-express_x")) express_x = true;
                        if (args[ihi].equalsIgnoreCase("-attribute_not_found")) flag_print_attribute_not_found_error = true;
                        if (args[ihi].equalsIgnoreCase("-implicit_expressions")) flag_implicit_expressions = true;
                        if (args[ihi].equalsIgnoreCase("-relative_exclude")) flag_relative_exclude = true;
                        if (args[ihi].equalsIgnoreCase("-re")) flag_relative_exclude = true;
                        if (args[ihi].equalsIgnoreCase("-stepmod")) flag_stepmod = true;
                        if (args[ihi].equalsIgnoreCase("-arm")) flag_arm = true;
                        if (args[ihi].equalsIgnoreCase("-mim")) flag_mim = true;
                        if (args[ihi].equalsIgnoreCase("-create_repository")) flag_allow_no_repository = true;
                        if (args[ihi].equalsIgnoreCase("-cr")) flag_allow_no_repository = true;
                        if (args[ihi].equalsIgnoreCase("-more_errors")) flag_more_errors = true;
                        if (args[ihi].equalsIgnoreCase("-normalized_case")) flag_oc = false;
                        if (args[ihi].equalsIgnoreCase("-nc")) flag_oc = false;
                        if (args[ihi].equalsIgnoreCase("-original_case")) flag_oc = true;
                        if (args[ihi].equalsIgnoreCase("-oc")) flag_oc = true;
                        if (args[ihi].equalsIgnoreCase("-complex_off")) flag_complex_off = true;
                        if (args[ihi].equalsIgnoreCase("-co")) flag_complex_off = true;
                        if (args[ihi].equalsIgnoreCase("-nodes")) flag_print_nodes = true;
                        if (args[ihi].equalsIgnoreCase("-all_rules")) flag_process_all_domain_rules = true;
                        if (args[ihi].equalsIgnoreCase("-print_violations")) flag_print_failed_domain_rule = true;
                        if (args[ihi].equalsIgnoreCase("-replace_schemas")) flag_replace_schema = true;
                        if (args[ihi].equalsIgnoreCase("-replace")) flag_replace_schema = true;
                        if (args[ihi].equalsIgnoreCase("-rs")) flag_replace_schema = true;
                        if (args[ihi].equalsIgnoreCase("-incremental")) flag_serialize = true;
                        if (args[ihi].equalsIgnoreCase("-inc")) flag_serialize = true;
                        if (args[ihi].equalsIgnoreCase("-no_amendment"))   no_express_amendment = true;
                        if (args[ihi].equalsIgnoreCase("-na"))   no_express_amendment = true;
                        if (args[ihi].equalsIgnoreCase("-stack"))   flag_stack = true;
                        if (args[ihi].equalsIgnoreCase("-split"))  flag_debug_split_return = true;
                        if (args[ihi].equalsIgnoreCase("-ddebug"))  flag_deep_debug = true;
                        if (args[ihi].equalsIgnoreCase("-debug"))   flag_debug = true;
                        if (args[ihi].equalsIgnoreCase("-no_active_nodes"))   flag_no_print_active_nodes = true;
                        if (args[ihi].equalsIgnoreCase("-make_complex_directory")) flag_complex_directory = true;
                        if (args[ihi].equalsIgnoreCase("-mcd")) flag_complex_directory = true;
                        if (args[ihi].equalsIgnoreCase("-xt_declarations")) flag_xt_declarations = true;
                        if (args[ihi].equalsIgnoreCase("-xt_sdai")) flag_xt_sdai = false;
                        if (args[ihi].equalsIgnoreCase("-xt_init_sdai")) flag_xt_init_sdai = false;
                        if (args[ihi].equalsIgnoreCase("-keep_all_instances")) keep_all_flag = true;
                        if (args[ihi].equalsIgnoreCase("-keep_all")) keep_all_flag = true;
                        if (args[ihi].equalsIgnoreCase("-old_xp")) flag_value = false;
                        if (args[ihi].equalsIgnoreCase("-annex_a")) annex_a_flag = true;
                        if (args[ihi].equalsIgnoreCase("-annex_a_instance")) annex_a_flag = true;
                        if (args[ihi].equalsIgnoreCase("-implicit_select")) flag_implicit_select = true;
                        if (args[ihi].equalsIgnoreCase("-is")) flag_implicit_select = true;
                        if (args[ihi].equalsIgnoreCase("-original_expressions")) flag_original_expressions = true; // changed to default, no longer needed
                        if (args[ihi].equalsIgnoreCase("-oe")) flag_original_expressions = true;                   // changed to default, no longer needed
                        if (args[ihi].equalsIgnoreCase("-parsed_expressions")) flag_original_expressions = false;
                        if (args[ihi].equalsIgnoreCase("-pe")) flag_original_expressions = false;
                        if (args[ihi].equalsIgnoreCase("-really_original_expressions")) flag_really_original_expressions = true;
                        if (args[ihi].equalsIgnoreCase("-roe")) flag_really_original_expressions = true;
                        if (args[ihi].equalsIgnoreCase("-instantiate_expressions")) expression_instances = true;
                        if (args[ihi].equalsIgnoreCase("-t")) expression_instances = true;
                        if (args[ihi].equalsIgnoreCase("-inst")) expression_instances = true;
                        if (args[ihi].equalsIgnoreCase("-enable_expressions")) expression_instances = true;
                        if (args[ihi].equalsIgnoreCase("-ee")) expression_instances = true;
                        if (args[ihi].equalsIgnoreCase("-g"))   flag_debug = true;
                        if (args[ihi].equalsIgnoreCase("-dd"))   flag_deep_debug = true;
                        if (args[ihi].equalsIgnoreCase("-inherit_disable")) flag_inherit = false;       // it is possible that in the future this key will be inverted
                        if (args[ihi].equalsIgnoreCase("-i")) flag_inherit = false;     // it is possible that in the future this key will be inversed
                        // -relax disabled 
                        if (args[ihi].equalsIgnoreCase("-relax"))   flag_relax = false;
                        if (args[ihi].equalsIgnoreCase("-x"))   flag_relax = true;
                        if (args[ihi].equalsIgnoreCase("-binaries")) flag_insert = true;          // it is possible that in the future this key will be inversed.
                        if (args[ihi].equalsIgnoreCase("-b")) flag_insert = true;         // it is possible that in the future this key will be inversed.
                        if (args[ihi].equalsIgnoreCase("-verbose")) flag_verbose = true;
                        if (args[ihi].equalsIgnoreCase("-v")) flag_verbose = true;
                        if (args[ihi].equalsIgnoreCase("-schema_verbose")) flag_verbose0 = true;
                        if ((args[ihi].equalsIgnoreCase("-compile")) || (args[ihi].equalsIgnoreCase("-o"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A string must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A string must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                compile_string = args[ihi];
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow as the second parameter " + args[ihi-2] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow as the second parameter " + args[ihi-2] + " switch");
                                        return -1;
                                }
                                batch_file = args[ihi];
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                log_file = null;
                                                ihi--;
                                        } else {
                                                log_file = args[ihi];
                                        }
                                } else {
                                        log_file = null;
                                        ihi--;
                                }
                                compile_flag = true;
                        }
                        if ((args[ihi].equalsIgnoreCase("-jar")) || (args[ihi].equalsIgnoreCase("-a"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow as the first parameter " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow as the first parameter " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                jar_batch_file = args[ihi];
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow as the second parameter " + args[ihi-2] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow as the second parameter " + args[ihi-2] + " switch");
                                        return -1;
                                }
                                jar_file = args[ihi];
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A string must follow as the third parameter " + args[ihi-3] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A string must follow as the third parameter " + args[ihi-3] + " switch");
                                        return -1;
                                }
                                jar_string = args[ihi];
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                jar_string0 = null;
                                                ihi--;
                                        } else {
                                                jar_string0 = args[ihi];
                                        }
                                } else {
                                        jar_string0 = null;
                                        ihi--;
                                }
                                jar_flag = true;
                        }

                        if ((args[ihi].equalsIgnoreCase("-zip")) || (args[ihi].equalsIgnoreCase("-z"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow as the first parameter " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow as the first parameter " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                zip_batch_file = args[ihi];
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow as the second parameter " + args[ihi-2] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow as the second parameter " + args[ihi-2] + " switch");
                                        return -1;
                                }
                                zip_file = args[ihi];
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A string must follow as the third parameter " + args[ihi-3] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A string must follow as the third parameter " + args[ihi-3] + " switch");
                                        return -1;
                                }
                                zip_string = args[ihi];
                                zip_flag = true;
                        }
                        if ((args[ihi].equalsIgnoreCase("-express")) || (args[ihi].equalsIgnoreCase("-e"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                if (express_files == null) {
                                        express_files = new Vector();
                                }
                                express_files.addElement(args[ihi]);
                                // express_file = args[ihi];
                                no_parsing = false;
                        }

                        if (args[ihi].equalsIgnoreCase("-properties")) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A path must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A path must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                jsdai_properties = args[ihi];
                        }

                        if ((args[ihi].equalsIgnoreCase("-files")) || (args[ihi].equalsIgnoreCase("-f"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                if (express_files == null) {
                                        express_files = new Vector();
                                }
                                addExpressFiles(express_files, args[ihi]);
                                // express_file = args[ihi];
                                no_parsing = false;
                        }

                        if ((args[ihi].equalsIgnoreCase("-directory")) || (args[ihi].equalsIgnoreCase("-dir"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A directory path must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A directory path must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                String express_dir_name = args[ihi];
                                global_express_dir_name = express_dir_name; // neeeded for new exclusion with relative paths
                                String exclude_dir_name = "_exclude";
                                if (ihi+1 < args.length) {
                                        if (!(args[ihi+1].substring(0,1).equals("-"))) {
                ihi++;
                                                exclude_dir_name = args[ihi];
                                        }
                                }
                                if (express_files == null) {
                                        express_files = new Vector();
                                }
                                addExpressDirectory(express_files, express_dir_name, exclude_dir_name);
                                // express_file = args[ihi];
                                no_parsing = false;
                        }

                        if ((args[ihi].equalsIgnoreCase("-recurse")) || (args[ihi].equalsIgnoreCase("-dr"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A directory path must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A directory path must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                String express_dir_name = args[ihi];
                                global_express_dir_name = express_dir_name; // neeeded for new exclusion with relative paths
                                String exclude_dir_name = "_exclude";
                                if (ihi+1 < args.length) {
                                        if (!(args[ihi+1].substring(0,1).equals("-"))) {
                ihi++;
                                                exclude_dir_name = args[ihi];
                                        }
                                }
                                if (express_files == null) {
                                        express_files = new Vector();
                                }
                                addExpressDirectoryRecursively(express_files, express_dir_name, null, exclude_dir_name, false);
                                // express_file = args[ihi];
                                no_parsing = false;
                        }

                        if ((args[ihi].equalsIgnoreCase("-exclude")) || (args[ihi].equalsIgnoreCase("-ex"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                global_excluded = excludeExpressFiles(args[ihi]);
                        }

                        if ((args[ihi].equalsIgnoreCase("-short_name_dir")) || (args[ihi].equalsIgnoreCase("-sd"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A directory path must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A directory path must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                short_name_dir = args[ihi];
                        }

      if ((args[ihi].equalsIgnoreCase("-output_dir")) || (args[ihi].equalsIgnoreCase("-out"))) {
              ihi++;
        if (ihi < args.length) {
              if (args[ihi].substring(0,1).equals("-")) {
                    System.out.println("A directory path must follow " + args[ihi-1] + " switch");
                        return -1;
          }
        } else {
          System.out.println("A directory path must follow " + args[ihi-1] + " switch");
          return -1;
        }
        output_dir = args[ihi];
      }

                        // Added by V.N.
                        if ((args[ihi].equalsIgnoreCase("-special_class_suffix")) || (args[ihi].equalsIgnoreCase("-scs"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("Name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("Name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                specialClassSuffix = args[ihi];
                        }


                        if ((args[ihi].equalsIgnoreCase("-special_class_suffix_match")) || (args[ihi].equalsIgnoreCase("-scsm"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("Regular expression  must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("Regular expression must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                specialClassSuffixMatcher = Pattern.compile(args[ihi], Pattern.CASE_INSENSITIVE).matcher("");
                        }

                        // typical usage of the two above switches:   
                        // -special_class_suffix Base -special_class_suffix_match "\w+_xim|mixed_complex_types"


            // Added by --VV--
                        if ((args[ihi].equalsIgnoreCase("-compilation_sn")) || (args[ihi].equalsIgnoreCase("-csn"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("Compilation sequence number must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("Compilation sequence number must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                compilation_sn = (long)Long.parseLong(args[ihi]);
                if (compilation_sn < 0 || compilation_sn > (2L << 15)-1) {
                    System.out.println("Compilation sequence number must be in range from 0 to "+Long.toString((long)Math.pow(2,15)-1));
                                        return -1;
                }
                        }

            // Added by --VV--
                        if ((args[ihi].equalsIgnoreCase("-index_file")) || (args[ihi].equalsIgnoreCase("-idx"))) {
                                indexFileName = "repository";
                                if (ihi+1 < args.length) {
                                        if (!(args[ihi+1].substring(0,1).equals("-"))) {
                ihi++;
                                                indexFileName = args[ihi];
                                        }
                                }
                        }

                        if ((args[ihi].equalsIgnoreCase("-list_models")) || (args[ihi].equalsIgnoreCase("-lm"))) {
                                model_file_name = "models";
                                if (ihi+1 < args.length) {
                                        if (!(args[ihi+1].substring(0,1).equals("-"))) {
                ihi++;
                                                model_file_name = args[ihi];
                                        }
                                }
                        }

                        if ((args[ihi].equalsIgnoreCase("-base_interface")) || (args[ihi].equalsIgnoreCase("-bi"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("Name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("Name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                baseInterface = args[ihi];
                        }

                        if ((args[ihi].equalsIgnoreCase("-base_class")) || (args[ihi].equalsIgnoreCase("-bc"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("Name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("Name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                baseClass = args[ihi];
                        }


                        if ((args[ihi].equalsIgnoreCase("-instance")) || (args[ihi].equalsIgnoreCase("-schema_instance"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                instance_name = args[ihi];
                                instance_name = instance_name.toUpperCase() + "_INSTANCE";
                                instance_flag = true;
                        }
                        if ((args[ihi].equalsIgnoreCase("-keep_instance")) || (args[ihi].equalsIgnoreCase("-keep")) || (args[ihi].equalsIgnoreCase("-k"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                if (!keep_flag) {
                                        keep_names = new Vector();
                                        keep_flag = true;
                                }
                                String keep_name = args[ihi];
                                keep_name = keep_name.toUpperCase() + "_INSTANCE";
                                keep_names.addElement(keep_name);
                        }


                        if ((args[ihi].equalsIgnoreCase("-complex")) || (args[ihi].equalsIgnoreCase("-c"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                complex_list_file = args[ihi];
                                flag_complex = true;
                        }
                        if ((args[ihi].equalsIgnoreCase("-p21")) || (args[ihi].equalsIgnoreCase("-p"))) {
                                ihi++;
                                if (ihi < args.length) {
                                        if (args[ihi].substring(0,1).equals("-")) {
                                                System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                                return -1;
                                        }
                                } else {
                                        System.out.println("A file name must follow " + args[ihi-1] + " switch");
                                        return -1;
                                }
                                physical_file = args[ihi];
                                generate_p21 = true;
                        }
                        if ((args[ihi].equalsIgnoreCase("-java")) || (args[ihi].equalsIgnoreCase("-j"))) {
                                generate_java = true;
      }



      if (args[ihi].equalsIgnoreCase("-update")) update_flag = true;
      if (args[ihi].equalsIgnoreCase("-u")) update_flag = true;
      if (args[ihi].equalsIgnoreCase("-delete")) delete_old = true;
      if (args[ihi].equalsIgnoreCase("-d")) delete_old = true;
      if (args[ihi].equalsIgnoreCase("-short_names")) add_short_names = true;
      if (args[ihi].equalsIgnoreCase("-s")) add_short_names = true;
      if (args[ihi].equalsIgnoreCase("-repository")) create_repository = true;
      if (args[ihi].equalsIgnoreCase("-r")) create_repository = true;
      if (args[ihi].equalsIgnoreCase("-mixed_declarations")) delete_declarations = false;
      if (args[ihi].equalsIgnoreCase("-m")) delete_declarations = false;
      if (args[ihi].equalsIgnoreCase("-nobin")) generate_bin = false;
      if (args[ihi].equalsIgnoreCase("-n")) generate_bin = false;
                }

                if ((!specialClassSuffix.equals("")) && (specialClassSuffixMatcher == null)) {
                        specialClassSuffixMatcher = Pattern.compile(".+", Pattern.CASE_INSENSITIVE).matcher("");
                }


                System.out.println("");
                System.out.println(xc_title + ",   " + xc_copyright);
                System.out.println("                  version " + xc_version + ", build " + xc_build + ", " + xc_date );
                System.out.println("----------------------------------------------------------------------");
        total_start_time = System.currentTimeMillis();

/*
		if ((!generate_java) && (!generate_bin) && (!generate_p21)) {
      System.out.println("Express Compiler> No backend was selected. The compiler will not run");
			System.out.println("Express Compiler>  Usage is:");
			System.out.println("    java jsdai.expressCompiler.Main [-verbose] [-delete_old] [-express express_file] [-complex complex_file] [-short_names] [-p21 physical_file] [-java]");
			return;
    }
*/
//              if ((args.length > 0) && (args.length < 20) && (express_file != null)){

//		if (!no_parsing) {

//			printVerbose("Reading from file " + express_file);
//			express_file_name = express_file.substring(0, express_file.lastIndexOf("."));
//			complex_file_name = "C$$" + express_file_name;
//			complex_file = "C$$" + express_file;
//			p21_file = express_file_name.toLowerCase() + "_dictionary.pf";



                        hm_variables = new HashMap();
                        hm_parameters = new HashMap();
                        hm_entity_declarations = new HashMap();
                        hm_type_declarations = new HashMap();
                        hm_function_declarations = new HashMap();
                        hm_procedure_declarations = new HashMap();
                        hm_rule_declarations = new HashMap();
                        hm_constant_declarations = new HashMap();
                        hm_subtype_constraint_declarations = new HashMap();
                        hm_attributes = new HashMap();
//		}


                if (jsdai_properties != null) {
//System.out.println("jsdai_properties: " + jsdai_properties);
                        Properties prop = new Properties();
                        File repoDir = new File(jsdai_properties);
                        if (!repoDir.exists()) repoDir.mkdirs();
                        prop.setProperty("repositories", jsdai_properties);
                        jsdai.lang.SdaiSession.setSessionProperties(prop);
                }
                session = jsdai.lang.SdaiSession.openSession();
                trans = session.startTransactionReadWriteAccess();

//      jsdai.lang.SdaiRepository repository;


//          trans.endTransactionAccessAbort();

        repository = null;

        if (create_repository) {
                        jsdai.lang.ASdaiRepository repos = session.getKnownServers();
                        if (repos.getMemberCount() > 0) {
                                jsdai.lang.SdaiIterator iter = repos.createIterator();
                                while (iter.next()) {
                                        repository = repos.getCurrentMember(iter);
                                        if (repository.getName().equalsIgnoreCase(repository_name)) {
                                                if (repository.isActive()) {
                                                repository.closeRepository();
                                                }
                                repository.deleteRepository();
                                                break;
                                        }
                                }
                        }
                        repository = session.createRepository(repository_name, null);
                        repository.openRepository();
        }       else {

/*
	if (create_repository) {
		repository = session.createRepository(repository_name, null);
		repository.openRepository();
	} else {
*/
                jsdai.lang.ASdaiRepository repos = session.getKnownServers();
                jsdai.lang.SdaiIterator iter = repos.createIterator();

                while (iter.next()) {

                        jsdai.lang.SdaiRepository rp = repos.getCurrentMember(iter);
// System.out.println("current repository : " + repository.getName());
                        if (rp.getName().equalsIgnoreCase(repository_name)) {
                                repository = rp;
                        } else
                        if (rp.getName().equalsIgnoreCase("SystemRepository")) {
                                sysrepository = rp;
                        }
                }

                if (repository == null) {
                        if (flag_allow_no_repository) {
                                repository = session.createRepository(repository_name, null);
                                repository.openRepository();
                        } else {
                                System.out.println("ERROR: " + repository_name + " repository not found");
                                trans.endTransactionAccessAbort();
        session.closeSession();
                                return -2;
                        }
                }

                if (!(repository.isActive())) {  // open repo if not open
                                repository.openRepository();
                }



                if (delete_old) {
                        // delete sdai models in this repository model-by-model
                        deleteAllModels(repository);
                }

                if ((!no_parsing) && (update_flag)) {
//                      deleteRelatedModels(repository, express_file);
                        deleteRelatedModels(repository, express_file, instance_flag, instance_name, keep_flag, keep_names);
                }

                initializeExpressTypes(repository);
  }
  if (!no_parsing) {
                initializeHashMaps(repository);
        }
    if (!(indexFileName.equalsIgnoreCase("none"))) {
        RepositoryChanges.rememberRepositoryState(repository);
    }

    if (compilation_sn >= 0) {
        repository.setNextPersistentLabel( compilation_sn << 48 ); //--VV--
    }

///////////////  - let's try setting context

                jsdai.lang.ASdaiModel a_domain = repository.getSchemas().getAssociatedModels();
                // jsdai.lang.ASchemaInstance asi= repository.getSchemas();
                // jsdai.lang.SchemaInstance si = asi.getByIndex(0);


// System.out.println("native schema: " + a_schema.getName(null));		
                jsdai.lang.SdaiModel work = repository.createSdaiModel("working", jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                jsdai.dictionary.ESchema_definition a_schema = work.getUnderlyingSchema();
                jsdai.lang.SdaiContext _context = new jsdai.lang.SdaiContext(a_schema, a_domain, work);
                session.setSdaiContext(_context);


//////////////
        if (monitor != null) {
                monitor.worked(1);
                monitor.subTask("Compiling express, parsing in pass 1");
        }


        // pass 1
                if (!no_parsing) {

    if (first_time_invoking) {
                        parser = null;
                }
                first_parsed_file = true;
                error_count = 0;
                unique_pdb_name2 = 0;
                unique_pdb_name = 0;
                for (int file_index = 0; file_index < express_files.size(); file_index++) {

                        express_file = (String)express_files.elementAt(file_index);
// System.out.println("express file name: " + express_file);
                  if (global_excluded != null) {
                        Iterator exclude_iter = global_excluded.iterator();
                        boolean skip_file = false;
                        while (exclude_iter.hasNext()) {
                                String exclude_name = (String)exclude_iter.next();
// System.out.println("global excluded: " + exclude_name);
                                if (exclude_name.equalsIgnoreCase(express_file)) {
                                        skip_file = true;
                                        break;
                                }
                        }
                        if (skip_file) {
                                continue;
                        }
                  }

                progress = "parsing " + express_file + " in pass 1";
//		Gui.status_label.setText(progress);		
                printVerbose("Parsing express schema(s) in file: " + express_file);

                        try {
/*
				if (first_parsed_file && first_time_invoking) {
					parser = new Compiler2(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
				} else {
					parser.ReInit(new java.io.DataInputStream(new java.io.FileInputStream(express_file))); 
				}
*/
//				if (first_parsed_file && first_time_invoking) {
//					parser = new Compiler2(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
//				} else {

                                        parser.ReInit(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));

                        } catch (java.io.FileNotFoundException e) {
                                System.out.println("Express Compiler> File " + express_file + " not found.");
                                trans.endTransactionAccessAbort();
        session.closeSession();
        return -3;
                        } catch (java.lang.NullPointerException e) {
                                try {
                                        parser = new Compiler2(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
                                } catch (java.io.FileNotFoundException e2) {
                                        System.out.println("Express Compiler> File " + express_file + " not found.");
                                        trans.endTransactionAccessAbort();
          session.closeSession();
          return -3;
                                }
                        }



                        try {
        is_complex_schema = false;
                                parser_pass = 1;
  variable_uid = 0;
//      initializeExpressTypes(repository);
                pass_start_time = System.currentTimeMillis();
                                parser.AllSchemas();
                                first_parsed_file = false;
                pass_finish_time = System.currentTimeMillis();
                pass_elapsed_time = pass_finish_time - pass_start_time;
                                printVerbose("duration of pass 1: " + pass_elapsed_time);
                        } catch (ParseException e) {
                                System.out.println("Express Compiler> Parser found errors in pass 1.");
                                System.out.println(e.getMessage());
                                trans.endTransactionAccessAbort();
        session.closeSession();
        return -4;
                        } catch (TokenMgrError e) {

// just see if Encountered: is <EOF>, and if after is empty
// curLexState = 1 means in single line comment, the same situation in multi-line comment occurs only if end of comment is missing,
// therefore it is a legitimate error, and better to throw it and stop parsing
   if (Compiler2TokenManager.curLexState == 1) { // single-line comment
                        String error_msg = e.getMessage();
                        if (error_msg.indexOf("Encountered: <EOF> after : \"\"") > 0) {
                                // do nothing at all for now
                                // perhaps an additional check of <EOF> can be performed - to see if <EOF> did not occur in the middle of the file (is it possible?)
                                /*
						 the EOF test seems to be this:

				     try { input_stream.readChar(); input_stream.backup(1); }
     				 catch (java.io.IOException e1) {
        			 EOFSeen = true;
						 }
						 
						 so, can it occur from a garbage in the middle of the file or not?

				*/

                        } else {
                                printErrorMsg(e.getMessage(), null, true);
                                trans.endTransactionAccessAbort();
            session.closeSession();
                                return -4;
                        }

         } else { // better report this error and exit
                                printErrorMsg(e.getMessage(), null, true);
                                trans.endTransactionAccessAbort();
            session.closeSession();
                                return -4;
         }

// ERROR:  line: 27, column: 11. Lexical error at line 27, column 25.  Encountered: <EOF> after : ""



//System.out.println("<>: " + Compiler2TokenManager.curLexState);

                                // System.out.println("Express Compiler> Parser found errors in pass 1.");
//				printError(e.getMessage());
//				printErrorMsg(e.getMessage(), null, true);
                                // return;
                        }
                } // going through all the express files in pass 1 - loop end	

// System.out.println("XXXXXXXXXXXXXXXXXX after 1st pass, error_count: " + error_count + ", flag: " + flag_relax);			

                if ((error_count > 0) && (!flag_relax)) {
                        if (error_count == 1) {
                                System.out.println(error_count + " error found in pass 1.");
                        } else {
                                System.out.println(error_count + " errors found in pass 1.");
                        }
                        trans.endTransactionAccessAbort();
      session.closeSession();
                        return -4;
                }


                // pass 2
    if (monitor != null) {
                        monitor.worked(1);
                        monitor.subTask("Compiling express, parsing in pass 2");
                }

                first_parsed_file = true;
                unique_pdb_name2 = 0;
                unique_pdb_name = 0;
                for (int file_index = 0; file_index < express_files.size(); file_index++) {

                        express_file = (String)express_files.elementAt(file_index);
                  if (global_excluded != null) {
                        Iterator exclude_iter = global_excluded.iterator();
                        boolean skip_file = false;
                        while (exclude_iter.hasNext()) {
                                String exclude_name = (String)exclude_iter.next();
                                if (exclude_name.equalsIgnoreCase(express_file)) {
                                        skip_file = true;
                                        break;
                                }
                        }
                        if (skip_file) {
                                continue;
                        }
                  }

                progress = "parsing " + express_file + " in pass 2";
//		Gui.status_label.setText(progress);		

                        try {
                                parser.ReInit(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
//			parser = new Compiler2(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
                        } catch (java.io.FileNotFoundException e) {
                                System.out.println("Express Compiler> File " + express_file + " not found.");
                                trans.endTransactionAccessAbort();
        session.closeSession();
        return -3;
                        }

                        try {
//				error_count = 0;
        is_complex_schema = false;
  variable_uid = 0;
                                parser_pass = 2;
//      initializeExpressTypes(repository);
                pass_start_time = System.currentTimeMillis();
                                parser.AllSchemas();
                                first_parsed_file = false;
                pass_finish_time = System.currentTimeMillis();
                pass_elapsed_time = pass_finish_time - pass_start_time;
                                printVerbose("duration of pass 2: " + pass_elapsed_time);
                        } catch (ParseException e) {
                                System.out.println("Express Compiler> Parser found errors in pass 2.");
                                System.out.println(e.getMessage());
                        trans.endTransactionAccessAbort();
        session.closeSession();
        return -5;
                        } catch (TokenMgrError e) {
//				System.out.println("Express Compiler> Parser found errors in pass 2.");
//				System.out.println(e.getMessage());
//				return;
                        }
                } // going through all the express files in pass 2 - loop end	


                if ((error_count > 0) && (!flag_relax)) {
                        if (error_count == 1) {
                                System.out.println(error_count + " error found in pass 2.");
                        } else {
                                System.out.println(error_count + " errors found in pass 2.");
                        }
                        trans.endTransactionAccessAbort();
      session.closeSession();
      return -5;
                }
    start_time = System.currentTimeMillis();
//repository.exportClearTextEncoding("before_chain.pf");

                chainUseFroms();
//repository.exportClearTextEncoding("after_chain.pf");
    finish_time = System.currentTimeMillis();
    elapsed_time = finish_time - start_time;
    printVerbose("duration of generation of chained USE FROM declarations: " + elapsed_time);

    // new pass 3
    if (monitor != null) {
                                monitor.worked(1);
                                monitor.subTask("Compiling express, parsing in pass 3");
                }

                first_parsed_file = true;
                unique_pdb_name2 = 0;
                unique_pdb_name = 0;
                for (int file_index = 0; file_index < express_files.size(); file_index++) {

                        express_file = (String)express_files.elementAt(file_index);
                  if (global_excluded != null) {
                        Iterator exclude_iter = global_excluded.iterator();
                        boolean skip_file = false;
                        while (exclude_iter.hasNext()) {
                                String exclude_name = (String)exclude_iter.next();
                                if (exclude_name.equalsIgnoreCase(express_file)) {
                                        skip_file = true;
                                        break;
                                }
                        }
                        if (skip_file) {
                                continue;
                        }
                  }

                progress = "parsing " + express_file + " in pass 3";
//		Gui.status_label.setText(progress);		

                        try {
                                parser.ReInit(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
//			parser = new Compiler2(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
                        } catch (java.io.FileNotFoundException e) {
                                System.out.println("Express Compiler> File " + express_file + " not found.");
                                trans.endTransactionAccessAbort();
        session.closeSession();
        return -3;
                        }
                        try {
//				error_count = 0;
        is_complex_schema = false;
  variable_uid = 0;
                                parser_pass = 3;
//      initializeExpressTypes(repository);
                pass_start_time = System.currentTimeMillis();
                                parser.AllSchemas();
                first_parsed_file = false;
                pass_finish_time = System.currentTimeMillis();
                pass_elapsed_time = pass_finish_time - pass_start_time;
                                printVerbose("duration of pass 3: " + pass_elapsed_time);
                        } catch (ParseException e) {
                                System.out.println("Express Compiler> Parser found errors in pass 3.");
                                System.out.println(e.getMessage());
                                trans.endTransactionAccessAbort();
        session.closeSession();
        return -6;
                        } catch (TokenMgrError e) {
//				System.out.println("Express Compiler> Parser found errors in pass 3.");
//				System.out.println(e.getMessage());
//				return;
                        }
                } // going through all the express files in pass 3 - loop end	

                if ((error_count > 0) && (!flag_relax)) {
                        if (error_count == 1) {
                                System.out.println(error_count + " error found in pass 3.");
                        } else {
                                System.out.println(error_count + " errors found in pass 3.");
                        }
                        trans.endTransactionAccessAbort();
      session.closeSession();
      return -6;
                }
// repository.exportClearTextEncoding("___testing_after_3.p21");

//repository.exportClearTextEncoding("after_pass3.pf");

    // ok, let's try to put resolving RENAMED here
    ECtRenamed.resolve(repository);


    // new pass 4
    if (monitor != null) {
                        monitor.worked(1);
                        monitor.subTask("Compiling express, parsing in pass 4");
                }

                first_parsed_file = true;
                unique_pdb_name2 = 0;
                unique_pdb_name = 0;
                for (int file_index = 0; file_index < express_files.size(); file_index++) {

                        express_file = (String)express_files.elementAt(file_index);
                  if (global_excluded != null) {
                        Iterator exclude_iter = global_excluded.iterator();
                        boolean skip_file = false;
                        while (exclude_iter.hasNext()) {
                                String exclude_name = (String)exclude_iter.next();
                                if (exclude_name.equalsIgnoreCase(express_file)) {
                                        skip_file = true;
                                        break;
                                }
                        }
                        if (skip_file) {
                                continue;
                        }
                  }

                progress = "parsing " + express_file + " in pass 4";
//		Gui.status_label.setText(progress);		

                        try {
                                parser.ReInit(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
//			parser = new Compiler2(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
                        } catch (java.io.FileNotFoundException e) {
                                System.out.println("Express Compiler> File " + express_file + " not found.");
                        trans.endTransactionAccessAbort();
        session.closeSession();
        return -3;
                        }
                        try {
//				error_count = 0;
        is_complex_schema = false;
  variable_uid = 0;
                                parser_pass = 4;
                                flag_in_redeclaring = false;
//      initializeExpressTypes(repository);
                pass_start_time = System.currentTimeMillis();
                                parser.AllSchemas();
                                first_parsed_file = false;
                pass_finish_time = System.currentTimeMillis();
                pass_elapsed_time = pass_finish_time - pass_start_time;
                                printVerbose("duration of pass 4: " + pass_elapsed_time);
                        } catch (ParseException e) {
                                System.out.println("Express Compiler> Parser found errors in pass 4.");
                                System.out.println(e.getMessage());
                        trans.endTransactionAccessAbort();
        session.closeSession();
        return -7;
                        } catch (TokenMgrError e) {
//				System.out.println("Express Compiler> Parser found errors in pass 4.");
//				System.out.println(e.getMessage());
//				return;
                        }
                } // going through all the express files in pass 4 - loop end	

                if ((error_count > 0) && (!flag_relax)) {
                        if (error_count == 1) {
                                System.out.println(error_count + " error found in pass 4.");
                        } else {
                                System.out.println(error_count + " errors found in pass 4.");
                        }
        trans.endTransactionAccessAbort();
      session.closeSession();
      return -7;
                }

// repository.exportClearTextEncoding("___testing_after_4.p21");

//repository.exportClearTextEncoding("after_pass4.pf");

    // pass 5
//              argument_stack.clear();
      if (monitor != null) {
                                monitor.worked(1);
                                monitor.subTask("Compiling express, parsing in pass 5");
                        }

                first_parsed_file = true;
                unique_pdb_name2 = 0;
                unique_pdb_name = 0;
                for (int file_index = 0; file_index < express_files.size(); file_index++) {

                        express_file = (String)express_files.elementAt(file_index);
                  if (global_excluded != null) {
                        Iterator exclude_iter = global_excluded.iterator();
                        boolean skip_file = false;
                        while (exclude_iter.hasNext()) {
                                String exclude_name = (String)exclude_iter.next();
                                if (exclude_name.equalsIgnoreCase(express_file)) {
                                        skip_file = true;
                                        break;
                                }
                        }
                        if (skip_file) {
                                continue;
                        }
                  }

                        if (x_all_data == null) {
                                x_all_data = new Vector();
                        }

                progress = "parsing " + express_file + " in pass 5";
//		Gui.status_label.setText(progress);		

                        try {
                                parser.ReInit(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
//			parser = new Compiler2(new java.io.DataInputStream(new java.io.FileInputStream(express_file)));
                        } catch (java.io.FileNotFoundException e) {
                                System.out.println("Express Compiler> File " + express_file + " not found.");
                        trans.endTransactionAccessAbort();
        session.closeSession();
        return -3;
                        }
                // creating sdai model for the expressions of the current file - set of short form schemas
                        if (expression_instances) {
                    // expression_model_name = "_EXPRESSIONS_" + express_file_name;
// printDebug("before creating expression_model Sdai Model");
//                              expression_model = repository.createSdaiModel(expression_model_name, jsdai.SSdai_expressions_schema.SSdai_expressions_schema.class);
// printDebug("after creating expression_model Sdai Model, before creating schema definition");
//                      expression_model.startReadWriteAccess();
//                              esd = (jsdai.SExtended_dictionary_schema.ESchema_definition)expression_model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSchema_definition.class);
// printDebug("after creating schema definition");
//                              esd.setName(null, express_file_name.toUpperCase());
                        }
                        try {
        is_complex_schema = false;
//				error_count = 0;
  variable_uid = 0;
                                parser_pass = 5;
                        flag_in_redeclaring = false;
//                      X_AllSchemas x_data = parser.AllSchemas();
//      initializeExpressTypes(repository);
                pass_start_time = System.currentTimeMillis();
                                x_data = parser.AllSchemas5();
                x_all_data.addElement(x_data);
                first_parsed_file = false;
                pass_finish_time = System.currentTimeMillis();
                pass_elapsed_time = pass_finish_time - pass_start_time;
                                printVerbose("duration of pass 5: " + pass_elapsed_time);
      // Compiler2Visitor v = new ECxDebugPrint();
                        // System.out.println("    Printing Node names: ");
                        // System.out.println("");
                                if (expression_instances) {
           //  x_data.jjtAccept(v, null);
                                }
                        // System.out.println("");
                        // System.out.println(" A simpler way to dump: ");
                        // System.out.println("");
// System.out.println("XAXA1 - before dumping");
                                if (expression_instances) {
// System.out.println("XAXA2 - dumping");

//				if (flag_print_nodes) {
// 					x_data.dump("MULTI: ");
//				}	

 // key would be good				x_data.dump("NODE: ");
                                }
//				System.out.println("");
                        } catch (ParseException e) {
                                System.out.println("Express Compiler> Parser found errors in pass 5.");
                                System.out.println(e.getMessage());
                trans.endTransactionAccessAbort();
        session.closeSession();
        return -8;
//			} catch (TokenMgrError e) {

// x_data = jjtThis;
// System.out.println("<> x_data: " + x_data);
// x_all_data.addElement(x_data);
// first_parsed_file = false;
// pass_finish_time = System.currentTimeMillis();
// pass_elapsed_time = pass_finish_time - pass_start_time;

//				System.out.println("Express Compiler> Parser found errors in pass 5.");
//				System.out.println(e.getMessage());
//				return;
                        } catch (java.util.EmptyStackException ex) {
                                System.out.println("Express Compiler> Empty argument stack in pass 5.");
                                throw ex;
                        }
                } // going through all the express files in pass 5 - loop end	

//repository.exportClearTextEncoding("after_pass5.pf");


                x_data = makeOneRoot(x_all_data);
                                if ((flag_print_nodes) && (expression_instances)) {
                                        x_data.dump("NODE: ");
                                }
                if ((error_count > 0) && (!flag_relax)) {
                        if (error_count == 1) {
                                System.out.println(error_count + " error found in pass 5.");
                        } else {
                                System.out.println(error_count + " errors found in pass 5.");
                        }
        trans.endTransactionAccessAbort();
      session.closeSession();
      return -8;
                }

    if (monitor != null) {
                        monitor.worked(1);
                        monitor.subTask("Compiling express, implicit declarations, complex entities, etc.");
        }

    start_time = System.currentTimeMillis();
                if (expression_instances) {
//                      expression_model.reduceSdaiModelToRO();
                }
//repository.exportClearTextEncoding("before_implicit.pf");
                generateImplicitDeclarations(x_data, parser);

//repository.exportClearTextEncoding("after_implicit.pf");


// repository.exportClearTextEncoding("___testing_after_implicit.p21");
    finish_time = System.currentTimeMillis();
    elapsed_time = finish_time - start_time;
    printVerbose("duration of generation of implicit declarations: " + elapsed_time);
    total_finish_time = System.currentTimeMillis();
        total_elapsed_time = total_finish_time - total_start_time;
                printVerbose("duration of parsing: " + total_elapsed_time);
                } // if !no_parsing
                else { // noparsing
                        setAllReadWrite(repository);
                }
                if (!flag_complex_off) {
                progress = "generator of complex entities is running";
//		Gui.status_label.setText(progress);		

                        AddComplex add_complex = new AddComplex();
            boolean complex_added = false;
            pass_start_time = System.currentTimeMillis();

                        if (flag_complex) {
                                complex_added = add_complex.runMe(repository, trans, complex_list_file, flag_verbose, flag_debug, flag_complex_directory);
            } else {
                                complex_added = add_complex.runMe(repository, trans, null, flag_verbose, flag_debug, flag_complex_directory);
            }
                if (complex_added) {
                                compiled_schemas.addElement("mixed_complex_types");
                }
            pass_finish_time = System.currentTimeMillis();
        pass_elapsed_time = pass_finish_time - pass_start_time;
                        printVerbose("duration of generation of complex entities: " + pass_elapsed_time);
                }
//repository.exportClearTextEncoding("after_complex.pf");
                if (add_short_names) {
                        AddShortNames short_names = new AddShortNames();
//                      short_names.runMe(repository, flag_verbose, flag_debug);
                        short_names.runMe(repository, flag_verbose, flag_debug, short_name_dir);
                }
//RR temp
//		if (generate_p21) {
//			repository.exportClearTextEncoding(physical_file);
//		}

                // hey, garbage collector, take them
//repository.exportClearTextEncoding("after_short_names.pf");

                Set keys = hm_entity_declarations.keySet();
                Iterator iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_entity_declarations.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_entity_declarations.clear();
                hm_entity_declarations = null;
          if (hm_current_entity_declarations != null) {
                hm_current_entity_declarations.clear();
                hm_current_entity_declarations = null;
                }

                keys = hm_type_declarations.keySet();
                iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_type_declarations.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_type_declarations.clear();
                hm_type_declarations = null;
          if (hm_current_type_declarations != null) {
                hm_current_type_declarations.clear();
                hm_current_type_declarations = null;
                }

                keys = hm_function_declarations.keySet();
                iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_function_declarations.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_function_declarations.clear();
                hm_function_declarations = null;
          if (hm_current_function_declarations != null) {
                hm_current_function_declarations.clear();
                hm_current_function_declarations = null;
                }

                keys = hm_procedure_declarations.keySet();
                iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_procedure_declarations.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_procedure_declarations.clear();
                hm_procedure_declarations = null;
          if (hm_current_procedure_declarations != null) {
                hm_current_procedure_declarations.clear();
                hm_current_procedure_declarations = null;
                }

                keys = hm_rule_declarations.keySet();
                iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_rule_declarations.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_rule_declarations.clear();
                hm_rule_declarations = null;
          if (hm_current_rule_declarations != null) {
                hm_current_rule_declarations.clear();
                hm_current_rule_declarations = null;
                }

                keys = hm_constant_declarations.keySet();
                iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_constant_declarations.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_constant_declarations.clear();
                hm_constant_declarations = null;
          if (hm_current_constant_declarations != null) {
                hm_current_constant_declarations.clear();
                hm_current_constant_declarations = null;
                }

                keys = hm_subtype_constraint_declarations.keySet();
                iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_subtype_constraint_declarations.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_subtype_constraint_declarations.clear();
                hm_subtype_constraint_declarations = null;
          if (hm_current_subtype_constraint_declarations != null) {
                hm_current_subtype_constraint_declarations.clear();
                hm_current_subtype_constraint_declarations = null;
                }


                keys = hm_parameters.keySet();
                iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_parameters.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_parameters.clear();
                hm_parameters = null;
          if (hm_current_parameters != null) {
                hm_current_parameters.clear();
                hm_current_parameters = null;
                }

                keys = hm_variables.keySet();
                iter = keys.iterator();
                while (iter.hasNext()) {
                        Object key = iter.next();
                        HashMap current = (HashMap)hm_variables.get(key);
                        current.clear();
                        current = null;
                        key = null;
                }
                hm_variables.clear();
                hm_variables = null;
          if (hm_current_variables != null) {
                hm_current_variables.clear();
                hm_current_variables = null;
                }


                hm_attributes.clear();
                hm_attributes = null;

                keys.clear();
                keys = null;

    if (monitor != null) {
                        monitor.worked(1);
                        monitor.subTask("Compiling express, java backend");
                }

//repository.exportClearTextEncoding("before_java.pf");

                if (generate_java) {
                progress = "java backend is running";
//		Gui.status_label.setText(progress);		

                        JavaBackend java_backend = new JavaBackend();
                        if (flag_print_failed_domain_rule) {
                                java_backend.flag_print_failed_domain_rule = true;
                        } else {
//				java_backend.flag_print_failed_domain_rule = false;
                                java_backend.flag_print_failed_domain_rule = true;
                        }
                        if (flag_process_all_domain_rules) {
                                java_backend.flag_process_all_domain_rules = true;
                        } else {
//				java_backend.flag_process_all_domain_rules = false;
                                java_backend.flag_process_all_domain_rules = true;
                        }
                        if (flag_debug) {
                                java_backend.debug_mode = true;
                        } else {
                                java_backend.debug_mode = false;
                        }
                        if (flag_debug) {
                                java_backend.flag_debug = true;
                        } else {
                                java_backend.flag_debug = false;
                        }
                        if (flag_debug_split_return) {
                                java_backend.flag_split_debug = true;
                        } else {
                                java_backend.flag_split_debug = false;
                        }
                        if (flag_deep_debug) {
                                java_backend.flag_deep_debug = true;
                        } else {
                                java_backend.flag_deep_debug = false;
                        }
                        if (flag_no_print_active_nodes) {
                                java_backend.flag_no_print_active_nodes = true;
                        } else {
                                java_backend.flag_no_print_active_nodes = false;
                        }
                        if (flag_verbose) {
                                java_backend.verbose_mode = true;
                        }       else {
                                java_backend.verbose_mode = false;
                        }
        pass_start_time = System.currentTimeMillis();
//			java_backend.runMe(repository, flag_inherit, flag_verbose, flag_debug, flag_value, expression_instances, x_data, flag_serialize, xc_version, xc_build, xc_date);	
//			java_backend.runMe(repository, flag_inherit, flag_verbose, flag_debug, flag_value, expression_instances, x_data, flag_serialize, xc_version, xc_build, xc_date, parser);
                        java_backend.runMe(repository, flag_inherit, flag_verbose, flag_debug, flag_value, expression_instances, x_data, flag_serialize, xc_version, xc_build, xc_date, parser, output_dir);
        pass_finish_time = System.currentTimeMillis();
                pass_elapsed_time = pass_finish_time - pass_start_time;
                        printVerbose("duration of backend: " + pass_elapsed_time);
                }

//repository.exportClearTextEncoding("after_java.pf");

                // after all passes
                if (delete_declarations) {
                        deleteInterfacedDeclarations();
                }
//		if (generate_p21) {
//			repository.exportClearTextEncoding(physical_file);
//		}
                if (compile_flag) {
                        generateCompileBatch(repository, compile_string, batch_file, log_file);
                }
                if (jar_flag) {
                        generateJarBatch(repository, jar_string, jar_file, jar_string0, jar_batch_file);
                }
                if (zip_flag) {
                        generateZipBatch(repository, zip_string, zip_file, zip_batch_file);
                }

          if (model_file_name != null) {
                        generateModelFile();
                }

                if (!create_repository) {
                        if (!(sysrepository.isActive())) {  // open repo if not open
                                        sysrepository.openRepository();
                        }
                  jsdai.lang.ASdaiModel models3 = sysrepository.getModels();
                        jsdai.lang.SdaiIterator iter_model3 = models3.createIterator();
                        while (iter_model3.next()) {
                                jsdai.lang.SdaiModel model3 = models3.getCurrentMember(iter_model3);
                                String m_name = model3.getName();
                                if (m_name.equalsIgnoreCase("SDAI_DICTIONARY_SCHEMA_DICTIONARY_DATA")) {
                                        jsdai.lang.Aggregate ia = model3.getEntityExtentInstances(jsdai.dictionary.ESchema_definition.class);
                                        jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                                        while (iter_inst.next()) {
                                                dic_sd = (jsdai.dictionary.ESchema_definition)ia.getCurrentMemberObject(iter_inst);
                                                break;
                                        }
                                        break;
                                }
                                // break;
                        }
//                      updateSchemaInstances(dic_sd, repository, repository_name, express_file);
                        updateSchemaInstances(dic_sd, repository, repository_name, express_file, instance_flag, instance_name);
                        deleteSchemaInstances(dic_sd, repository, repository_name, express_file, instance_flag, instance_name, annex_a_flag, keep_flag, keep_names, keep_all_flag);
                }
          work.deleteSdaiModel();
//repository.exportClearTextEncoding("before_remove_duplicates.pf");
        removeDuplicateDataTypes(repository);
//repository.exportClearTextEncoding("after_remove_duplicates.pf");
                if (generate_p21) {
                        repository.exportClearTextEncoding(physical_file);
          }
        File file_old = null;
    File file_new = null;
    String repo_path_old = repository.getLocation();
          String repo_path_new = repo_path_old.substring(0,repo_path_old.lastIndexOf(".")) + ".x";
                if (generate_bin) {
                        trans.commit();

                if (flag_oc) {

                        // move this file to subdirectory for original case, or just leave it there, but rename to something else
      // movied does not work as I need, copying is better, because after moving, new model when running compiler again is created in the wrong repository file, etc,
      // instead of investigating the issues, just copying instead.
                  // String repo_path_new = repo_path_old.substring(0,repo_path_old.lastIndexOf(".")) + ".exd";
                  //System.out.println("<<>><<>>repo location :" + source_path);
        file_old = new File(repo_path_old);
      file_new = new File(repo_path_new);
      copyFile_old(file_old, file_new);
      //boolean is_renamed = file_old.renameTo(file_new);
      //if (!is_renamed) {
        // File was not successfully renamed
                          //System.out.println("<<>><<>>renaming problem");
      //}
                  // normalize all IDs
                        normalizeIDs(repository);
                        trans.commit();
                }
            if (!(indexFileName.equalsIgnoreCase("none"))) {
                                                        String indexFilePath = null;
                                                        if (output_dir != null) {
                                                                if (indexFileName.endsWith(".properties")) {
                                                                        indexFilePath = output_dir + File.separator + indexFileName;
                                                                } else {
                                                                        indexFilePath = output_dir + File.separator + "jsdai" + File.separator + indexFileName + ".properties";
                                                                }
                                                        } else {
                                                                indexFilePath = indexFileName;
                                                        }
                RepositoryChanges.trackRepositoryChanges(repository, indexFilePath);
//                RepositoryChanges.trackRepositoryChanges(repository, indexFileName);
//                RepositoryChanges.trackRepositoryChanges(repository, indexFileName, output_dir);
            }
                }
                if (flag_insert) {
                        insertBinaries(repository, x_data, true);
                  // now we could move the repository file back and delete the subdirectory
                }
                // at this point, if both files .x and .sdai are present, delete .sdai and rename .x to .sdai
                // old - sdai, new - x,  x contains OC, sdai - normalized
                // first, commit - sdai - with original case
                // then rename to x
                // then normalize IDs
                // then commit again - sdai
                // then insert binaries - from sdai
                // then delete sdai
                // then rename x back to sdai
    //String repo_path_old = repository.getLocation();
          // String repo_path_new = repo_path_old.substring(0,repo_path_old.lastIndexOf(".")) + ".exd";
          //String repo_path_new = repo_path_old.substring(0,repo_path_old.lastIndexOf(".")) + ".x";
          //System.out.println("<<>><<>>repo location :" + source_path);
        //file_old = new File(repo_path_old);
    //file_new = new File(repo_path_new);

                if (!generate_bin) {
            trans.endTransactionAccessAbort();
                repository.closeRepository();
        repository.deleteRepository();
                }
                session.closeSession();
        total_finish_time = System.currentTimeMillis();
        total_elapsed_time = total_finish_time - total_start_time;
                printVerbose("total duration: " + total_elapsed_time);
                System.out.println("Express Compiler ended");
                in_progress = false;


                if (flag_oc) {
                  file_old = new File(repo_path_old);
          file_new = new File(repo_path_new);
        boolean is_deleted = file_old.delete();
            if (!is_deleted) {
                           System.out.println("<<>><<>>deleting problem");
        }
                boolean is_renamed_back = file_new.renameTo(file_old);
           if (!is_renamed_back) {
          // File was not successfully renamed
                           System.out.println("<<>><<>>renaming back problem");
          }
                }
                return 0;

        }

/**************************************************************************************************************************
 *                                    ISO 10303-11:A.1.5 Interpreted identifiers                                          *
 **************************************************************************************************************************/

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.145 ------------*/
  static final public jsdai.SExtended_dictionary_schema.EAttribute AttributeRef(jsdai.SExtended_dictionary_schema.EEntity_definition ed, jsdai.SExtended_dictionary_schema.EEntity_definition ed2, int attr_type, Object reference) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        String attribute_name;
        Token attribute_token;
        String attr_key = null;
        Object temp_object = null;
        ECtRenamed renamed = null;
        printDebug("In AttributeRef, starting, ed: " + ed + ", ed2: " + ed2 + ", attr. type: " + attr_type + ", reference: " + reference + ", pass: " + parser_pass);
    attribute_token = AttributeId();
                if (flag_oc) {
                        attribute_name = attribute_token.image;
                } else {
                        attribute_name = attribute_token.image.toLowerCase();
                }

                if (ed != null) {
                        temp_object = ed.getTemp();
                        if (temp_object != null) {
                                if (temp_object instanceof ECtRenamed) {
                                        renamed = (ECtRenamed)temp_object;
                                        if (renamed.isActive()) {
                                                renamed.addOld(ed2, attribute_name);
                                                ed.setTemp(renamed);
                                        }
                                }
                        }
                }

//System.out.println("In AttributeRef, starting, ed: " + ed + ", ed2: " + ed2 + ", attr. type: " + attr_type + ", reference: " + reference + ", pass: " + parser_pass);
//System.out.println("attribute name: " + attribute_name);
                global_attribute_name = attribute_name;
                global_entity1 = ed;
                global_entity2 = ed2;
                global_reference = reference;
                printDebug("In AttributeRef, attribute name: " + attribute_name);

                if (parser_pass == 10) {
                        // creation of redeclared attributes moved back to pass 1, special tricks to resolve them later
                } else
                if (parser_pass == 2) {
                } else
//		if (parser_pass == 3) { // previously - pass 1
                if (parser_pass == 1) { // previously - pass 1

                        // do we need here a check, and perhaps in AttributeDecl, or do we get only redeclared here
                        // attr = findAttribute(attribute_name, ed2, attr_type, ed);
      // if (attr != null) {
        // return attr;
      // }

                        if (attr_type == 0) { // explicit
                                if (flag_in_redeclaring) {
                                        hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + attribute_name.toLowerCase();
                                        if (hm_attributes.containsKey(hm_attribute_key)) {
                                                // error - multiple redeclaration of the same attribute in the same entity
                                                printErrorMsg("" + attribute_name + " - the same attribute from the same supertype entity " + global_entity_ref + " is redeclared in entity " + global_entity_name + " more than once", null, true);
                                                error_count++;
                                        }
                                } else {
                                        hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                                }
// System.out.println("CREATING EXPLICIT ATTRIBUTE <=EA-1 AttributeRef => key: " + hm_attribute_key + ", ed: " + ed + ", ed2: " + ed2 + ", reference: " + reference);
                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExplicit_attribute.class);
                                attr.setName(null, attribute_name);
                                attr.unsetOrder(null);
                                // attr.setOrder(null, Integer.MIN_VALUE);
                                attr.setParent(null, ed);
                                // currently, ed is declared as entity_definition, but who knows what will happen in the future
                                // parent_entity is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // attr.setParent_entity(null, ed);
                                // }
//System.out.println("PUTTING INTO hm_attributes - parser pass: " + parser_pass + "\n\tkey: " + hm_attribute_key + "\n\tattribute: " + attr);
                                hm_attributes.put(hm_attribute_key, attr);

                        } else
                        if (attr_type == 1) { // derived
// System.out.println("<=DA-1=>");
                                if (flag_in_redeclaring) {
                                        hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + attribute_name.toLowerCase();
                                        if (hm_attributes.containsKey(hm_attribute_key)) {
                                                // error - multiple redeclaration of the same attribute in the same entity
                                                printErrorMsg("" + attribute_name + " - the same attribute from the same supertype entity " + global_entity_ref + " is redeclared in entity " + global_entity_name + " more than once", null, true);
                                                error_count++;
                                        }
                                } else {
                                        hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                                }
                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDerived_attribute.class);
                                attr.setName(null, attribute_name);
                                attr.unsetOrder(null);
                                // attr.setOrder(null, Integer.MIN_VALUE);
                                attr.setParent(null, ed);
                                // parent_entity is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // attr.setParent_entity(null, ed);
                                // }
                                hm_attributes.put(hm_attribute_key, attr);
                        } else
                        if (attr_type == 2) { // inverse
// System.out.println("<=IA-1=>");
                                if (flag_in_redeclaring) {
                                        hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + attribute_name.toLowerCase();
                                        if (hm_attributes.containsKey(hm_attribute_key)) {
                                                // error - multiple redeclaration of the same attribute in the same entity
                                                printErrorMsg("" + attribute_name + " - the same attribute from the same supertype entity " + global_entity_ref + " is redeclared in entity " + global_entity_name + " more than once", null, true);
                                                error_count++;
                                        }
                                } else {
                                        hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                                }
                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInverse_attribute.class);
                                attr.setName(null, attribute_name);
                                attr.unsetOrder(null);
                                // attr.setOrder(null, Integer.MIN_VALUE);
                                attr.setParent(null, ed);
                                // parent_entity is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // attr.setParent_entity(null, ed);
                                // }
                                hm_attributes.put(hm_attribute_key, attr);
                        }
                } else
                if (parser_pass == 20) { // removing pass 2 handling
                                if (flag_in_redeclaring) {
//				 	attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + attribute_name.toLowerCase();
                                        attr_key = "#" + global_schema_name + "_#" + global_entity_ref + "_#_#" + attribute_name.toLowerCase();
                                } else {
//				 	hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                                        attr_key = null;
                                }

                if (hm_attributes != null) {
                        if (attr_key != null) {
                                Object attr_from_hm_object = hm_attributes.get(attr_key);
                                if (attr_from_hm_object != null) {
                                        if (attr_from_hm_object instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
// System.out.println("<= hm_attribute @ work, key: " + attr_key + ", attribute: " + attr_from_hm_object);
                                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)attr_from_hm_object;
                                        }
                                }
                        }
                }


                } else
//		if (parser_pass == 30) { // removing pass 3 handling
                if (parser_pass == 3) { // removing pass 3 handling
                                if (flag_in_redeclaring) {
//				 	attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + attribute_name.toLowerCase();
                                        attr_key = "#" + global_schema_name + "_#" + global_entity_ref + "_#_#" + attribute_name.toLowerCase();
                                } else {
//				 	hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                                        attr_key = null;
                                }
                        if (attr_type == 0) {
                                attr = findAttribute(attribute_name, ed2, attr_type, ed, attr_key);
                        } else {

                if (hm_attributes != null) {
                        if (attr_key != null) {
                                Object attr_from_hm_object = hm_attributes.get(attr_key);
                                if (attr_from_hm_object != null) {
                                        if (attr_from_hm_object instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
// System.out.println("<= hm_attribute @ work, key: " + attr_key + ", attribute: " + attr_from_hm_object);
                                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)attr_from_hm_object;
                                        }
                                }
                        }
                }

                        }
                } else
                if (parser_pass == 4) {
//if (attribute_name.equalsIgnoreCase("associated_definition")) {
//System.out.println("DBG-AttributeRef-01");
//}
                                if (flag_in_redeclaring) {
//				 	attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + attribute_name.toLowerCase();
                                        attr_key = "#" + global_schema_name + "_#" + global_entity_ref + "_#_#" + attribute_name.toLowerCase();
                                } else {
//				 	hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                                        attr_key = null;
                                }
                        if (attr_type >= 0) {
                                if (attr_type == 3) {
// System.out.println("<D2008> BEFORE @X 1 (attr type = 3) name: " + attribute_name + ", ed: " + ed2 + ", attr_key: " + attr_key);
                                        attr = findAttribute(attribute_name, ed2, 0, ed, attr_key);
// System.out.println("<D2008> AFTER @X 1 (attr type = 3) attribute: " + attr);
                                }
                                else {
// System.out.println("@X 2 name: " + attribute_name + ", ed: " + ed + ", key: " + attr_key);

//					attr = findAttribute(attribute_name, ed, attr_type);
                                        // why it was changed to ed??? with ed, redeclared attributes are redeclaring themselves.
//if (attribute_name.equalsIgnoreCase("associated_definition")) {
//System.out.println("<D2008> DBG-AttributeRef-02, attribute_name: " + attribute_name + ", ed2: " + ed2 + ", ed: " + ed + ", key: " + attr_key);
//}
                                        attr = findAttribute(attribute_name, ed2, attr_type, ed, attr_key);
//System.out.println("<D2008> @X2 attribute: " + attr);
//if (attribute_name.equalsIgnoreCase("associated_definition")) {
//System.out.println("DBG-AttributeRef-03, attr: " + attr);
//}
                                }
                          if (attr == null) {
                                if (flag_in_redeclaring) {
//			 			error_count++;
//						printErrorMsg("" + attribute_name +  " - attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it", null, true);
                                        } else {
//			 			error_count++;
//						printErrorMsg("" + attribute_name +  " - attribute not found in entity " + ed2.getName(null), null, true);
//						printErrorMsg("" + attribute_name +  " - attribute not found in entity ed2: " + ed2 + ", ed: " + ed, null, true);
                                        }
                                }
                        } else {

                if (hm_attributes != null) {
// System.out.println("@X33");
                        if (attr_key != null) {
// System.out.println("@X34");
                                Object attr_from_hm_object = hm_attributes.get(attr_key);
                                if (attr_from_hm_object != null) {
// System.out.println("@X35");
                                        if (attr_from_hm_object instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
// System.out.println("<= hm_attribute @ work, key: " + attr_key + ", attribute: " + attr_from_hm_object);
                                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)attr_from_hm_object;
                                        }
                                }
                        }
                }

                        }
                } else
                if (parser_pass == 5) {
                }
//              if (attr == null) {
//              printDDebug("##_________## Inside Attribute Ref = NULL");
//              } else {
//                      printDDebug("##_________## Inside Attribute Ref: " + attr.getName(null));
//              }
//System.out.println("<D2008> AttrRef returning: " + attr);		


/*
System.out.println("+++++++++++ Resolving attribute reference  in pass " + parser_pass +" +++++++++++++++++++++++");

System.out.println("attribute_name: " + attribute_name);
System.out.println("ed: " + ed);
System.out.println("ed2: " + ed2);
System.out.println("reference: " + reference);
System.out.println("active_scope: " + active_scope);
System.out.println("attr_key: " + attr_key);

System.out.println("attr_type: " + attr_type);
//System.out.println("attr_type_original: " + attr_type_original);

System.out.println("hm_attributes: " + hm_attributes);
System.out.println("---------------------------------------------------------------");
System.out.println("resolved attr: "  + attr);


System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
*/

                {if (true) return attr;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------ ISO 10303-11:A.1.5-interpreted identifiers----------- */

/*
	 This is all my idea - the InterpretedId() is outside the part 11 grammar.

	 the following identifier can not be distinguished by the parser, but could be distinguished by the 1st pass information:

	 attribute_ref
	 constant_ref
	 entity_ref
	 enumeration_ref
	 function_ref
	 parameter_ref
	 procedure_ref
	 schema_ref
	 type_label_ref
	 type_ref
	 variable_ref

	 So it is better to use them only where they are used alone, and InterpretedId() non-terminal symbol to use when there is
	 a choice between them. That would allow to make them more specialized.

*/

/*
void InterpretedId() :
{}
{
	ConstantId()
}
*/
  static final public String InterpretedId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        global_name = t.image;
                        {if (true) return (t.image);}
                } else {
                        global_name = t.image.toLowerCase();
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

  static final public Object InterpretedRef(int possible_interpretations) throws ParseException, jsdai.lang.SdaiException {
        String name = null;
        Object result = null;
    name = InterpretedId();
                printDDebug("InterpretedRef - name: " + name + ", possible: " + possible_interpretations + ", pass: " + parser_pass);
                result = findInterpretedId2(name, possible_interpretations);
// System.out.println("interpreted ref, name: " + name + ", result: " + result);
                if (result == null) {
                        if ((possible_interpretations == PI_SOURCE_SCHEMA) || (possible_interpretations == PI_SCHEMA_OR_SCHEMA_MAP_OR_SCHEMA_VIEW)) {
                                if (parser_pass == 2) {
//					printError("(interfaced) schema not found: " + name);
                                        printErrorMsg("" + name + " - (interfaced) schema not found", null, true);
                                }
                        }
                }

// System.out.println("returning from InterpretedRef: " + result);

                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

// temporory Express X interpreted identifiers
  static final public jsdai.SExtended_dictionary_schema.ESchema_definition SourceSchemaRef() throws ParseException, jsdai.lang.SdaiException {
        Object result = null;
    // SchemaId()
            result = InterpretedRef(PI_SOURCE_SCHEMA);
                {if (true) return (jsdai.SExtended_dictionary_schema.ESchema_definition)result;}
    throw new Error("Missing return statement in function");
  }

  static final public Object TargetSchemaRef() throws ParseException, jsdai.lang.SdaiException {
    SchemaId();
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public Object DummyQualifiableFactor() throws ParseException, jsdai.lang.SdaiException {
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public jsdai.SExtended_dictionary_schema.EView_attribute ViewAttributeRef() throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
    name = ViewAttributeId();
                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EView_definition) {
                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)active_scope;
                }
                {if (true) return findView_attribute(name, vd);}
    throw new Error("Missing return statement in function");
  }

  static final public Object SchemaMapRef() throws ParseException, jsdai.lang.SdaiException {
    SchemaMapId();
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public Object SchemaViewRef() throws ParseException, jsdai.lang.SdaiException {
    SchemaViewId();
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public jsdai.SExtended_dictionary_schema.EMap_or_view_partition PartitionRef(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.EMap_or_view_partition result = null;
    name = PartitionId();
                result = findMap_or_view_partition(name, parent);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

// Removed in DIS
/*
Object InstanceRef() throws jsdai.lang.SdaiException :
{}
{
	InstanceId()
	{
		return null;
	}
}
*/
  static final public Object ViewRef() throws ParseException, jsdai.lang.SdaiException {
    ViewId();
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.146 ------------ */
  static final public Object ConstantRef() throws ParseException, jsdai.lang.SdaiException {
  Object result = null;
  jsdai.SExtended_dictionary_schema.EConstant_definition cd = null;
  String name;
    name = ConstantId();
//		cd = findConstant_definition(name);
                cd = findConstant_definitionX(name);
                result = cd;
                if (cd == null) {
                        if (parser_pass == 3) {
                                Token t = getToken(0);
//				printError("referenced (line " + t.beginLine + ", column " + t.beginColumn + ") constant not found: " + name);
                                printErrorMsg("" + name + " - referenced constant not found", null, true);
                        }
                        printDebug("constant not found: " + name + " in pass: " + parser_pass);
                }
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.147 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition EntityRef(jsdai.SExtended_dictionary_schema.ESchema_definition optional_schema) throws ParseException, jsdai.lang.SdaiException {
        String entity_name = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                printDebug("In EntityRef, starting");
    entity_name = EntityId();
                global_entity_ref = entity_name.toLowerCase();
                printDebug("In EntityRef, entity: " + entity_name);
                // if parser pass = 2;
                if (parser_pass == 1) {
                } else
                if (parser_pass == 2) {
                } else
                if (parser_pass > 2) {
                        // check if an entity with this name exists in the extent.
                        ed = findEntity_definition(entity_name, optional_schema);
                        if (ed == null) {
                                error_count++;
                                if (parser_pass == 3) {
                                        Token t = getToken(0);
//					System.out.println("token: " + t.image + ", line: " + t.beginLine + ", column: " + t.beginColumn);
//					printError("referenced (line " + t.beginLine + ", column " + t.beginColumn + ") entity \"" + entity_name + "\" not found");                 
                                        printErrorMsg("" + entity_name + " - referenced entity not found", null, true);
                                }
                                printDebug("entity \"" + entity_name + "\" not found in pass " + parser_pass);
// printDDebug("##1 current schema: " + sd.getName(null) + ", pass: " + parser_pass);
                                _data_type_name = "_ENTITY_NOT_FOUND_" + entity_name;
                        } else {
                                _data_type_name = ed.getName(null);
                        }
                }
                if (ed == null) {
                        printDebug("In EntityRef, ending with null, pass: " + parser_pass);
                } else {
                        printDebug("In EntityRef, ending with non-null, pass: " + parser_pass);
                }
                {if (true) return ed;}
    throw new Error("Missing return statement in function");
  }

/*----------------------------------------------------------------------------------- introduced by eRRe ----------------*/
  static final public jsdai.SExtended_dictionary_schema.ENamed_type NamedTypeRef() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ENamed_type nt = null;
        String named_type_name;
    named_type_name = NamedTypeId();
                named_type_name = named_type_name.replace('$', '+');
                if (parser_pass == 1) {
                } else
                if (parser_pass == 2) {
                } else
                if (parser_pass > 2) {
                        nt = findNamed_type(named_type_name);
                        if (nt == null) {
                                error_count++;
                                if (parser_pass == 3) {
                                        Token t = getToken(0);
//					printError("referenced (line " + t.beginLine + ", column " + t.beginColumn + ") named type \"" + named_type_name + "\" not found");
                                        printErrorMsg("" + named_type_name + " - referenced named type not found", null, true);
                                }
                                printDebug("named type \"" + named_type_name + "\" not found in pass " + parser_pass);
                        }
                }
                {if (true) return nt;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.148 ------------ */
  static final public void EnumerationRef(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
        String name = null;
        Integer enumeration_value_object = null;
        int enumeration_value = 0;
                printDebug("In EnumerationRef, starting in pass " + parser_pass);
    name = EnumerationId();
                if (parser_pass == 5) {
                }
                printDebug("In EnumerationRef: " + name + ", ending in pass " + parser_pass);
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.149 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EFunction_definition FunctionRef() throws ParseException, jsdai.lang.SdaiException {
        String function_id = null;
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
    function_id = FunctionId();
                if (parser_pass == 5) {
//			fd = findFunction_definition(function_id);	
                        fd = findFunction_definitionX(function_id);
                }
                {if (true) return fd;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.150 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter ParameterRef() throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
    name = ParameterId();
                if(parser_pass == 5) {
                }
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.151 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EProcedure_definition ProcedureRef() throws ParseException, jsdai.lang.SdaiException {
        String procedure_id = null;
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
    procedure_id = ProcedureId();
                if (parser_pass == 5) {
//			pd = findProcedure_definition(procedure_id);
                        pd = findProcedure_definitionX(procedure_id);
//			pd = findProcedure(procedure_id);
//			if (pd == null) {
//				printError("Procedure not found: " + procedure_id);
//			}
                }
                {if (true) return pd;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.152 ------------ */
  static final public String SchemaRef() throws ParseException, jsdai.lang.SdaiException {
  String schema_name;
    schema_name = SchemaId();
                if (flag_oc) {
            {if (true) return schema_name;}
                } else {
            {if (true) return schema_name.toLowerCase();}
                }
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.153 ------------ */
  static final public void TypeLabelRef() throws ParseException, jsdai.lang.SdaiException {
    TypeLabelId();
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.154 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EDefined_type TypeRef(int scope) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
        String type_name;
    type_name = TypeId();
                printDebug("In TypeRef starting in pass: " + parser_pass + ": " + type_name);
                if (parser_pass != 1) { // it is  a risky implementation leftover from 2 pass compiler. OK, if TypeRef(0) is invoked from pass 4.
                        if (scope == 0) {
                                dt = findDefined_type(type_name);
                                if (dt == null) {
                                        if (parser_pass > 2) {
                                                error_count++;
                                                if (parser_pass == 3) {
                                                        Token t = getToken(0);
//							printError("referenced (line " + t.beginLine + ", column " + t.beginColumn + ") defined type \"" + type_name + "\" not found");
                                                        printErrorMsg("" + type_name + " - referenced defined type not found", null, true);
                                                }
                                                printDebug("Type reference - defined type \"" + type_name + "\" not found in pass " + parser_pass);
                                        } else {
                                                // error_count++;
                                                // may not be an error - chained USE FROMs are processed between passes 2 and 3.
                                                // printWarning("Type reference - defined type \"" + type_name + "\" not found in pass " + parser_pass);
                                        }
                                }
                        }
                        else if (scope == 1) {
//        printDDebug("Enumeration scope: " + type_name);
                        }
                        else {
//        printDDebug("Unknown scope: " + type_name);
                        }
                }
                printDebug("In TypeRef ending in pass: " + parser_pass);
                {if (true) return dt;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.155 ------------ */
  static final public ECtVariable VariableRef() throws ParseException, jsdai.lang.SdaiException {
        String name;
        ECtVariable var = null;
    name = VariableId();
                if (parser_pass > 1) {
//System.out.println("<about to find var, 01, name: " + name); 
                        var = findVariableX(name);
                }
                {if (true) return var;}
    throw new Error("Missing return statement in function");
  }

/**************************************************************************************************************************
 *                                         ISO 10303-11:A.2 Grammar rules                                                 *
 **************************************************************************************************************************/

/* -----------------------------------------------------------------Amendment---------- ISO 10303-11:A.2.156 ------------ */
  static final public void AbstractSupertypeDeclaration(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
        boolean has_supertype = false;
    jj_consume_token(ABSTRACT);
    switch (jj_nt.kind) {
    case SUPERTYPE:
      jj_consume_token(SUPERTYPE);
                                   has_supertype = true;
      switch (jj_nt.kind) {
      case OF:
        SubtypeConstraint(ed);
        break;
      default:
        jj_la1[0] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[1] = jj_gen;
      ;
    }
                if (parser_pass == 5) {
                        if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).setInstantiable(null, false);
//                     		ed.setInstantiable(null, 0);
                                if (!has_supertype) {
                                        ((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).setAbstract_entity(null, true);
                                }
                        }
                }
  }

/* -------------------------------------------------------------------Amendment-------- ISO 10303-11:A.2.401 ------------ */
  static final public jsdai.lang.EEntity ConcreteTypes(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity ae = null;
                printDebug("Starting ConcreteTypes in pass: " + parser_pass);
    switch (jj_nt.kind) {
    case ARRAY:
    case BAG:
    case LIST:
    case SET:
      ae = AggregationTypes(whose);
      break;
    case BINARY:
    case BOOLEAN:
    case INTEGER:
    case LOGICAL:
    case NUMBER:
    case REAL:
    case STRING:
      ae = SimpleTypes(whose);
      break;
    case SIMPLE_ID:
      ae = NamedTypes(whose);
      break;
    default:
      jj_la1[2] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("Ending ConcreteTypes: " + ae + " in pass: " + parser_pass);
                {if (true) return ae;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.157 ------------ */
  static final public int ActualParameterList(Vector arguments, Vector expressions) throws ParseException, jsdai.lang.SdaiException {
        int argument_count = 0;
        Object argument [] = null;
                printDebug("Starting ActualParameterList");
    jj_consume_token(LPAREN);
    if (jj_2_1(1)) {
      argument = Parameter();
                                      argument_count++; arguments.addElement(argument[0]); expressions.addElement(argument[1]);
      label_1:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[3] = jj_gen;
          break label_1;
        }
        jj_consume_token(COMMA);
        argument = Parameter();
                                                                                                                                                            argument_count++; arguments.addElement(argument[0]);expressions.addElement(argument[1]);
      }
    } else {
      ;
    }
    jj_consume_token(RPAREN);
                printDebug("Ending ActualParameterList, nr of arguments: " + argument_count);
                {if (true) return argument_count;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.158 ------------ */
  static final public int AddLikeOp() throws ParseException, jsdai.lang.SdaiException {
        int value = 0;
    switch (jj_nt.kind) {
    case PLUS:
      jj_consume_token(PLUS);
               value = 1;
      break;
    case MINUS:
      jj_consume_token(MINUS);
                                       value = 2;
      break;
    case OR:
      jj_consume_token(OR);
                                        value = 3;
      break;
    case XOR:
      jj_consume_token(XOR);
                                         value = 4;
      break;
    default:
      jj_la1[4] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.159 ------------ */
  static final public void AggregateInitializer() throws ParseException, jsdai.lang.SdaiException {
        Vector members = new Vector();
        Object member = null;
        Object pop_inst = null;
                printDebug("In AggregateInitializer, starting");
    jj_consume_token(LBRACKET);
    if (jj_2_2(1)) {
      Element();
                if (parser_pass == 5) {
                }
      label_2:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[5] = jj_gen;
          break label_2;
        }
        jj_consume_token(COMMA);
        Element();
                if (parser_pass == 5) {
                }
      }
    } else {
      ;
    }
    jj_consume_token(RBRACKET);
                if (parser_pass == 5) {
                }
                printDebug("In AggregateInitializer, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.160 ------------ */
  static final public void AggregateSource() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In AggregateSource, starting");
    SimpleExpression();
                printDebug("In AggregateSource, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.161 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter AggregateType() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        String label = "";
        jsdai.SExtended_dictionary_schema.EAggregation_type at = null;
        jsdai.lang.A_string labels = null;
        String bound_name;
        boolean optional = false;
        boolean unique = false;
                printDebug("In AggregateType, starting");
    jj_consume_token(AGGREGATE);
    switch (jj_nt.kind) {
    case COLON:
      jj_consume_token(COLON);
      label = TypeLabel();
      break;
    default:
      jj_la1[6] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    par = ParameterType();
                if (parser_pass == 5) {

                        boolean must_create = false;

                        if (par != null) {
                                if (par.testParameter_type(null)) {
                                        if (par.getParameter_type(null) != _st_generic) {
                                                must_create = true;
                                        }
                        } else {
                                // why unset?
                                must_create = true;
                        }
                  } else {
                    // not standart type, but, on the other hand, something wrong here
                        must_create = true;
                  }

                        if (must_create) {


                        at = (jsdai.SExtended_dictionary_schema.EAggregation_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregation_type.class);
//		  at.setName(null, "_AGGREGATE");
//		  _data_type_name = "_AGGREGATE";
                        at.setName(null, "_AGGREGATE" + _data_type_name);
                        _data_type_name = "_AGGREGATE"  + _data_type_name;

                  if (par != null) {

                        if (par.testParameter_type(null)) {
                                        at.setElement_type(null, par.getParameter_type(null));
                        } else {
                                printDDebug("Oo> parameter_type unset in aggregate_type: AGGREGATE OF " + par);
                        }
                        if (par.testType_labels(null)) {
                                        labels = par.getType_labels(null);
                                }
                        if (label.length() > 0) {
                                        if (labels == null) {
                                                labels = par.createType_labels(null);
                                        }
                                        labels.addByIndex(1, label);
                                } else {
                                        if (labels != null) {
                                                labels.addByIndex(1, label);
                                        }
                        }
                        } // par not 0
                        // for some reason I replaced the parameter type, probably a bug, if not, don't remember why.
                        // par.setParameter_type(null, at);

                  } else {
                        at = _st_aggregate_generic;
                                _data_type_name = "_AGGREGATE_GENERIC";
                  }

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_PARAMETER_AGGREGATE");
                        _data_type_name = "_PARAMETER_AGGREGATE";

                }
                printDebug("In AggregateType, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.162 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EAggregation_type AggregationTypes(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAggregation_type at;
                printDebug("In AggregationTypes, starting in pass " + parser_pass);
    switch (jj_nt.kind) {
    case ARRAY:
      at = ArrayType(whose);
      break;
    case BAG:
      at = BagType(whose);
      break;
    case LIST:
      at = ListType(whose);
      break;
    case SET:
      at = SetType(whose);
      break;
    default:
      jj_la1[7] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In AggregationTypes, ending: " + at + " in pass " + parser_pass);
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.163 ------------ */
  static final public void AlgorithmHead() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In AlgorithmHead, starting");
    label_3:
    while (true) {
      switch (jj_nt.kind) {
      case ENTITY:
      case FUNCTION:
      case PROCEDURE:
      case SUBTYPE_CONSTRAINT:
      case TYPE:
        ;
        break;
      default:
        jj_la1[8] = jj_gen;
        break label_3;
      }
      Declaration();
    }
    switch (jj_nt.kind) {
    case CONSTANT:
      ConstantDecl();
      break;
    default:
      jj_la1[9] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case LOCAL:
      LocalDecl();
      break;
    default:
      jj_la1[10] = jj_gen;
      ;
    }
                printDebug("In AlgorithHead, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.164 ------------ */
  static final public void AliasStmt() throws ParseException, jsdai.lang.SdaiException {
        Object operand = null;
        ECtVariable var = null;
        String variable_id = null;
        jsdai.lang.EEntity variable_parameter_type = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type = null;
                printDebug("In AliasStmt, starting");
                scope_stack.push(current_scope);
                current_scope = new Vector();
    jj_consume_token(ALIAS);
    variable_id = VariableId();
    jj_consume_token(FOR);
    GeneralRef();
    label_4:
    while (true) {
      switch (jj_nt.kind) {
      case LBRACKET:
      case DOT:
      case BPATH:
      case FPATH:
      case BACKSLASH:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[11] = jj_gen;
        break label_4;
      }
      Qualifier(null);
    }
    jj_consume_token(SEMICOLON);
    label_5:
    while (true) {
      Stmt();
      switch (jj_nt.kind) {
      case SEMICOLON:
      case ALIAS:
      case BEGIN:
      case CASE:
      case ESCAPE:
      case IF:
      case INSERT:
      case REMOVE:
      case REPEAT:
      case RETURN:
      case KW_SKIP:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[12] = jj_gen;
        break label_5;
      }
    }
    jj_consume_token(END_ALIAS);
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {

                        variable_type = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        // variable_type.setName(null, "_query_variable_");
                        variable_type.setName(null, "_PARAMETER");
                        _data_type_name = "_PARAMETER";

                        // variable_type.setParameter_type(null, variable_parameter_type);
                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);


//                      operand = argument_stack.pop();
//                      printStack("POP: AliasStmt, return value: " + operand);

                } else { // other passes - added to handle interpreted IDs
                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);
                }
                current_scope = (Vector)scope_stack.pop();
                printDebug("In AliasStmt, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.165 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EArray_type ArrayType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EArray_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = null;
        jsdai.SExtended_dictionary_schema.EBound bounds [] = null;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        String bound_name;
        // int optional = 0;
        // int unique = 0;
        boolean optional = false;
        boolean unique = false;

        jsdai.lang.EEntity bt;
    jj_consume_token(ARRAY);
    bounds = BoundSpec();
    jj_consume_token(OF);
    switch (jj_nt.kind) {
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
                                                      optional = true;
      break;
    default:
      jj_la1[13] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case UNIQUE:
      jj_consume_token(UNIQUE);
                                                                                   unique = true;
      break;
    default:
      jj_la1[14] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (whose != null) {
                          if (!(whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute)) {
//					at = (jsdai.SExtended_dictionary_schema.EArray_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CArray_type.class);
//					at.setUnique_flag(null, unique); 
//					at.setOptional_flag(null, optional); 
                                }
//				bound_name = getBoundString(1, bounds, optional, unique);
//				at.setName(null, "_ARRAY" + bound_name + _data_type_name);
//				_data_type_name = "_ARRAY"  + bound_name + _data_type_name;
                        }
                } else
                if (parser_pass == 4) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EArray_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CArray_type.class);
//				bound_name = getBoundString(1, bounds, optional, unique);
//				at.setName(null, "_ARRAY" + bound_name + _data_type_name);
//				_data_type_name = "_ARRAY"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                                at.setOptional_flag(null, optional);
//System.out.println("SET OPTIONAL 01, attribute: " + at);
                        }
                } else
                if (parser_pass == 5) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EArray_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CArray_type.class);
//				bound_name = getBoundString(1, bounds, optional, unique);
//				at.setName(null, "_ARRAY" + bound_name + _data_type_name);
//				_data_type_name = "_ARRAY"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                                at.setOptional_flag(null, optional);
// System.out.println("SET OPTIONAL 02, attribute: " + at);
                        }
                        at.setLower_index(null, bounds[0]);

                        if (bounds[1] != null) {
                                at.setUpper_index(null, bounds[1]);
                        }
                        else { // should never happen for an array.
//				printWarning("Undefined upper index of an array");                 
                                printWarningMsg("" + "" + " - undefined upper index of an array", null, true);
                                printDebug("Undefined upper index of an array");
                        }
                        // set element_type
                }
    bt = BaseType(at);
                if (parser_pass > 3) {
//			if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        if (!(at.testElement_type(null))) {
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EData_type) {
                                        at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EData_type)bt);
                                } else {
                                        // possible express amendment issue
                                }
                        }
                }
                bound_name = getBoundString(1, bounds, optional, unique);
                _data_type_name = "_ARRAY"  + bound_name + _data_type_name;
                if (at != null) {
                        at.setName(null, _data_type_name);
                }
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.166 ------------ */
  static final public void AssignmentStmt() throws ParseException, jsdai.lang.SdaiException {
        Object operand = null;
        Object pop_inst = null;
        Object general_reference = null;
        Object qualified_reference = null;
                printDebug("In AssignmentStmt, starting");
    general_reference = GeneralRef();
                if (parser_pass == 5) {
                }
    label_6:
    while (true) {
      switch (jj_nt.kind) {
      case LBRACKET:
      case DOT:
      case BPATH:
      case FPATH:
      case BACKSLASH:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[15] = jj_gen;
        break label_6;
      }
      qualified_reference = Qualifier(general_reference);
                general_reference = qualified_reference;
                if (parser_pass == 5) {
                }
    }
    jj_consume_token(ASSIGN);
    Expression();
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
                }
                printDebug("In AssignmentStmt, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.167 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute AttributeDecl(jsdai.SExtended_dictionary_schema.EEntity_definition ed, int attr_type) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition already_ed = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.AExplicit_attribute aea;
        String attribute_name;
        Token attribute_token;
        String attr_key = null;
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      attribute_token = AttributeId();
                        if (flag_oc) {
                                attribute_name = attribute_token.image;
                        } else {
                                attribute_name = attribute_token.image.toLowerCase();
                        }
                 already_ed = moreThanOneAttributeWithTheSameName(attribute_name, ed);
                 if (already_ed != null) {
                                error_count++;
                                if (already_ed == ed) {
                                        printErrorMsg("" + attribute_name +  " - more than one attribute with the same name in entity " + ed.getName(null), null, true);
                                } else {
                                        printErrorMsg("" + attribute_name +  " - more than one attribute with the same name in entity " + ed.getName(null) + " and in its supertype " + already_ed.getName(null), null, true);
                                }
                 }
                 if (parser_pass == 1) {
                         if (attr_type == 0) { // explicit
                                 hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
//System.out.println("CREATING EXPLICIT ATTRIBUTE <=EA-2 AttributeDecl => key: " + hm_attribute_key + ", ed: " + ed);
                                 attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExplicit_attribute.class);
//			   attr.setOrder(null, explicit_attribute_order_count++);
                                 // aea = ed.getExplicit_attributes(null);
                                 // aea.addByIndex(aea.getMemberCount() + 1, attr); // + 1 because it is a list?
//System.out.println("PUTTING INTO hm_attributes - parser pass: " + parser_pass + "\n\tkey: " + hm_attribute_key + "\n\tattribute: " + attr);
                                        hm_attributes.put(hm_attribute_key, attr);
                         } else
                         if (attr_type == 1) { // derived
                                 hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
//System.out.println("<=DA-2 AttributeDecl => key: " + hm_attribute_key + ", ed: " + ed);
                                 attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDerived_attribute.class);
//				 attr.setOrder(null, derived_attribute_order_count++);
                                        hm_attributes.put(hm_attribute_key, attr);
                         } else
                         if (attr_type == 2) { // inverse
// System.out.println("<=IA-2=>");
                                 hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                                 attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInverse_attribute.class);
//				 attr.setOrder(null, inverse_attribute_order_count++);
                                        hm_attributes.put(hm_attribute_key, attr);
                         }
                         attr.setName(null, attribute_name);
                         attr.setParent(null, ed);
                         // parent_entity is now derived instead of explicit 
                         // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                 // attr.setParent_entity(null, ed);
                         // }
                         createDocumentationEntity2(attr, attribute_token);
                 } else
                 if (parser_pass == 2) { // pass 2
                        attr_key =  "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                        if (hm_attributes != null) {
                                        Object attr_from_hm_object = hm_attributes.get(attr_key);
                                        if (attr_from_hm_object != null) {
                                                if (attr_from_hm_object instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
// System.out.println("<= hm_attribute @ work, pass 2 - key: " + attr_key + ", attribute: " + attr_from_hm_object);
                                                        attr =  (jsdai.SExtended_dictionary_schema.EAttribute)attr_from_hm_object;
                                                }
                                        }
                        }

                 } else
                 if (parser_pass == 3) { // pass 2
                        attr_key =  "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                        if (hm_attributes != null) {
                                        Object attr_from_hm_object = hm_attributes.get(attr_key);
                                        if (attr_from_hm_object != null) {
                                                if (attr_from_hm_object instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
 //System.out.println("<= hm_attribute @ work, pass 3 - key: " + attr_key + ", attribute: " + attr_from_hm_object);
                                                        attr =  (jsdai.SExtended_dictionary_schema.EAttribute)attr_from_hm_object;
                                                }
                                        }
                        }
                 } else
                 if (parser_pass == 4) { // pass 2
// System.out.println("@X 3 name: " + attribute_name + ", ed: " + ed);
                         attr_key =  "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                         attr = findAttribute(attribute_name, ed, attr_type, null, attr_key); // also can check for duplicate attribute names.
 //System.out.println("<= hm_attribute @ work (or not), pass 4 - key: " + attr_key + ", attribute: " + attr);
                         if (attr != null) {
                                 if (attr_type == 0) { // explicit
                                  attr.setOrder(null, explicit_attribute_order_count++);
                                 } else
                                 if (attr_type == 1) { // derived
//System.out.println(">PARSER setting order - AttributeDecl - order: " + derived_attribute_order_count  + ", pass: " + parser_pass + ", attr: " + attr); 
                                        attr.setOrder(null, derived_attribute_order_count++);
                                 } else
                                 if (attr_type == 2) { // inverse
                                        attr.setOrder(null, inverse_attribute_order_count++);
                                 }
                         } else {
                                printVerbose("possible error: attribute null in AttributeDecl in 4th pass: " + attribute_name + ", entity: " + ed);
                         }
                 } else
                 if (parser_pass > 4) { // pass 2
// System.out.println("@X 4 name: " + attribute_name + ", ed: " + ed);
                         attr_key =  "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                         attr = findAttribute(attribute_name, ed, attr_type, null, attr_key); // also can check for duplicate attribute names.
                 }
      break;
    case SELF:
      attr = RedeclaredAttribute(ed, attr_type);
      break;
    default:
      jj_la1[16] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
if (attr == null) {

        if (parser_pass == 1) {
//              printDDebug("######43 in AttributeDecl NULL ");
        }
}
//               createDocumentationEntity(attr);
                 _data_type_name = "";
                 {if (true) return attr;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.168 ------------ */
  static final public Token AttributeId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
//      if (doc_token == null) doc_token = t;
        {if (true) return (t);}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.169 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute AttributeQualifier(jsdai.SExtended_dictionary_schema.EEntity_definition ed, jsdai.SExtended_dictionary_schema.EEntity_definition ed2, int attr_type, Object reference) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr2 = null;
        String name;
        String name2 = null;
        Object mark_obj = null;
        String x_operand = "";
        String attr_key = null;
        Object temp_object = null;
        ECtRenamed renamed = null;
        printDebug("In AttributeQualifier, starting");
// System.out.println("@X 10-500 In attribute qualifier, starting");
// System.out.println("@X 10-501 ed: " + ed);
// System.out.println("@X 10-502 ed2: " + ed2);
// System.out.println("@X 10-503 reference: " + reference);
// System.out.println("@X 10-504 type: " + attr_type);
                if (reference == null) {
                        reference = active_scope;
// System.out.println("@X 10-505 new reference: " + reference);
                }
                if (ed2 == null) {
                        if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ed2 = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
// System.out.println("@X 10-506 new e2: " + reference);
                        } else {
                        }
                }
    jj_consume_token(DOT);
    attr2 = AttributeRef(ed, ed2, attr_type, reference);
                if (ed != null) {
                        temp_object = ed.getTemp();
                        if (temp_object != null) {
                                if (temp_object instanceof ECtRenamed) {
                                        renamed = (ECtRenamed)temp_object;
                                        if (renamed.isActive()) {
                                                renamed.addOldAttribute(attr2);
                                                ed.setTemp(renamed);
                                        }
                                }
                        } // ! null
    }


//if (parser_pass == 4) {
//	System.out.println("in AttributeQualifier after AttirbuteRef, ed: " + ed + ", GroupQualifier ed2: " + ed2 + ", reference: " + reference + ", active_scope: " + active_scope + ", AttributeRef result: " + attr2);
//}

 //System.out.println("@@1 current entity: " + ed);
 //System.out.println("@@1 redeclared entity: " + ed2);
 //System.out.println("@@1 attribute type: " + attr_type);
 //System.out.println("@@1 reference: " + reference);
 //System.out.println("@@1 redeclared attr: " + attr2);

                if(flag_in_redeclaring) {
                        flag_in_redeclaring = false;
                }

                if (attr2 == null) {
//			if (parser_pass == 4) {
//				error_count++;
//				printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
//			}

//	System.out.println("in AttributeQualifier after AttirbuteRef, attr2 is NULL - returning!");

                        {if (true) return null;}

                }

                if (parser_pass == 1) {
                } else
                if (parser_pass == 2) {
                } else
                if (parser_pass == 3) {
                        if (attr_type == 0) { // explicit
                                if (attr2 != null) {
// System.out.println("@@# attr2: " + attr2);
                                        name = attr2.getName(null);
                                        attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + name.toLowerCase();
// System.out.println("<=OOOOO-pass3 attr_key: " + attr_key);
                                        attr = findAttribute(name, ed, attr_type, ed2, attr_key);
                                } else {
// System.out.println("@@# attr2 NULL");
                                }
                        }
                } else
                if (parser_pass == 4) {
                        // if (attr2 == null) return null;
                        if (attr_type < 0) {if (true) return null;}
                        name = attr2.getName(null);
        mark_obj = attr2.getTemp();
        if (mark_obj instanceof String) {
                name2 = (String) mark_obj;
        }
// System.out.println("in AttributeQualifier - @X 5 name2: " + name2 + ", name: " + name + ", ed: " + ed);

                        if (attr_type == 0) { // explicit
// System.out.println("@X 5 name: " + name + ", ed: " + ed);

//				if (flag_in_redeclaring) {
                                        attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + name.toLowerCase();
// System.out.println("<=OOOOO-E attr_key: " + attr_key);
//					attr_key = null;
//				}	
                                attr = findAttribute(name, name2, ed, attr_type, ed2, attr_key);
// System.out.println("in AttributeQualifier - after findAttribute, name2: " + name2 + ", name: " + name + ", ed: " + ed + ", ed2: " + ed2 + ", key: " + attr_key + ", result attr: " + attr);

// System.out.println("@@ current entity: " + ed);
// System.out.println("@@ redeclared entity: " + ed2);
// System.out.println("@@ redeclaring attribute: " + attr);
// System.out.println("@@ redeclared attr: " + attr2);

//				((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);

// System.out.println("<><> attr: " + attr + ", attr2: " + attr2);
//System.out.println("redeclaring: " + attr);
//System.out.println("redeclared: " + attr2);
                                if (attr2 instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (isRedeclared_attrCompatible(attr, attr2)) {
                                                if (attr == attr2) {
                                                        printErrorMsg("" + attr.getName(null) + " - attribute is redeclaring itself (1), entity: " + attr.getParent(null).getName(null), null, true);
                                                        error_count++;
                                                } else {
//System.out.println("OXO- redeclaring attr: " + attr + ", redeclared attr2: " + attr2);
//System.out.println("OXO- ed: " + ed + ", ed2: " + ed2 + ", reference: " + reference);
                                                        ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);
//System.out.println("OXO-OK");
                                                }
                                        } else {
                                                error_count++;
//						printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
                                        }
                                }       else {
                                        error_count++;
                                        Token t = getToken(0);
                                int line = t.beginLine;
                                int column = t.beginColumn;
                                        if (attr2 instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                                String attr_name_err = "";
                                                String entity_name_err = "";
                                                if (attr != null) {
                                                        if (attr instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                                                attr_name_err = attr.getName(null);
                                                        }
                                                        // parent_entity no longer explicit
                                                        // if (attr.testParent_entity(null)) {
                                                                // entity_name_err = attr.getParent_entity(null).getName(null);
                                                        // }
                                                        if (attr.testParent(null)) {
                                                                entity_name_err = attr.getParent(null).getName(null);
                                                        }
                                                }
//						printError("on line " + line + ", column " + column  + ": probably an attempt to redeclare a derived attribute as explicit. Entity: " + entity_name_err + ", attribute: " + attr_name_err);
                                                printErrorMsg("" + attr_name_err +  " - in entity " + entity_name_err + ", probably an attempt to redeclare a derived attribute as explicit", null, true);
                                        } else {
//						printError("on line " + line + ", column " + column  + ": this attribute must be explicit: " + attr2);
                                                printErrorMsg("" + attr2 + " - this attribute must be explicit", null, true);
                                        }
                                        printDebug("error in AttributeQualifier, not explicit: " + attr2 + ", in pass " + parser_pass);
                                }
                                 attr.unsetOrder(null);
                        } else
                        if (attr_type == 1) { // derived
// System.out.println("@X 6 name: " + name + ", ed: " + ed);
//				attr = findAttribute(name, ed, attr_type, ed2);


                                        attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + name.toLowerCase();
// System.out.println("<=OOOOO-D HERE attr_key: " + attr_key);
                                attr = findAttribute(name, name2, ed, attr_type, ed2, attr_key);
// System.out.println("redeclaring: " + attr);
// System.out.println("redeclared: " + attr2);

                                if (attr2 instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (isRedeclared_attrCompatible(attr, attr2)) {
                                                if (attr == attr2) {
                                                        printErrorMsg("" + attr.getName(null) + " - attribute is redeclaring itself (2), entity: " + attr.getParent(null).getName(null), null, true);
                                                        error_count++;
                                                } else {
                                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);
                                                }
                                        } else {
                                                error_count++;
                                                //printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
                                        }
//System.out.println(">PARSER setting order - AttributeQualifier - order: " + derived_attribute_order_count  + ", pass: " + parser_pass + ", attr: " + attr); 

                                         attr.setOrder(null, derived_attribute_order_count++);
// System.out.println("DONE - order set: attr: " + attr);				

                                } else
                                if (attr2 instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (isRedeclared_attrCompatible(attr, attr2)) {
                                                if (attr == attr2) {
                                                        printErrorMsg("" + attr.getName(null) + " - attribute is redeclaring itself (3), entity: " + attr.getParent(null).getName(null), null, true);
                                                        error_count++;
                                                } else {
                                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)attr2);
                                                }
                                        } else {
                                                error_count++;
//						printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
                                        }
                                 attr.unsetOrder(null);
                                } else {
// System.out.println("KLAIDA: attr2: " + attr2);				
                                }
//                              if (parser_pass == 4) {
//                                      if (expression_instances) {
//                                              x_operand = (String)expression_stack.pop();
//                                              x_operand += attr.getName(null);
//                                              expression_stack.push(x_operand);
//                                      }
//                              }
                        } else
                        if (attr_type == 2) { // inverse
// printDDebug("######2 in AttributeQ name: " + name + ", entity name: " + ed.getName(null) + ", attribute type: " + attr_type);
// System.out.println("@X 7 name: " + name + ", ed: " + ed);



                                        attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + name.toLowerCase();
// System.out.println("<=OOOOO-I attr_key: " + attr_key);
                                attr = findAttribute(name, ed, attr_type, ed2, attr_key);
// System.out.println("redeclaring: " + attr);
// System.out.println("redeclared: " + attr2);
                                if (isRedeclared_attrCompatible(attr, attr2)) {
                                                if (attr == attr2) {
                                                        printErrorMsg("" + attr.getName(null) + " - attribute is redeclaring itself (4), entity: " + attr.getParent(null).getName(null), null, true);
                                                        error_count++;
                                                } else {
                                                        ((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EInverse_attribute)attr2);
                                                }
              } else {
                                        error_count++;
//					printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
              }
                                 attr.unsetOrder(null);
                        }
                        if (attr_type == 4) { // uniqueness rule
// printDDebug("######4 in AttributeQ name: " + name + ", entity name: " + ed.getName(null) + ", attribute type: " + attr_type);
// System.out.println("@X 8 name: " + name + ", ed: " + ed);


                                        attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + name.toLowerCase();
// System.out.println("<=OOOOO-U attr_key: " + attr_key);
                                attr = findAttribute(name, ed, attr_type, ed2, attr_key);
// no need to set redeclaring for uniqueness rule
//                              if (attr instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
//                                      ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);
//                              } else
//                              if (attr instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
//                                      ((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)attr2);
//                              } else
//                              if (attr instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
//                                      ((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EInverse_attribute)attr2);
//                              }
                        } else
                        if (attr_type == 5) { // expressions, from Qualifier()
                        }
                } else
                if (parser_pass == 5) {
                        if (attr_type < 0) {if (true) return null;}
                        name = attr2.getName(null);
// System.out.println("@X 10 name: " + name + ", ed: " + ed);
                        attr = findAttribute(name, ed, attr_type, ed2, attr_key);
// System.out.println("@X 10-100 original: " + attr2 + ", found: " + attr);
                }
                printDebug("In AttributeQualifier, ending, attr: " + attr);

          if (renamed != null) {
                if (renamed.isActive()) {
                                if (attr2 != attr) {
                                        renamed.addNewAttribute(attr);
                        } else {
                                // this case is probably an internall error, should be fixed!!!
                        }
                        ed.setTemp(renamed);
                        }
                }
                {if (true) return attr;}
    throw new Error("Missing return statement in function");
  }

/*-+------- ISO 10303-14: B2.40 -------------------------------------------------------------------------------------------*/
  static final public void BackwardPathQualifier() throws ParseException, jsdai.lang.SdaiException {
        Object reference = null;
        int attr_type = -1;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed2 = null;
                printDebug("In BackwardPathQualifier, starting");
    jj_consume_token(BPATH);
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      AttributeRef(ed, ed2, attr_type, reference);
      break;
    default:
      jj_la1[17] = jj_gen;
      ;
    }
    PathCondition();
                printDebug("In BackwardPathQualifier, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.170 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EBag_type BagType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EBag_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        jsdai.lang.EEntity bt;
        String bound_name;
    jj_consume_token(BAG);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec();
      break;
    default:
      jj_la1[18] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (whose != null) {
                          if (!(whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute)) {
//					at = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
                                }
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_BAG" + bound_name + _data_type_name);
//				_data_type_name = "_BAG"  + bound_name + _data_type_name;
                        }
                }
                else
                if (parser_pass == 4) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_BAG" + bound_name + _data_type_name);
//				_data_type_name = "_BAG" + bound_name + _data_type_name;
                        }
                } else
                if (parser_pass == 5) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_BAG" + bound_name + _data_type_name);
//				_data_type_name = "_BAG" + bound_name + _data_type_name;
                        }
                        if (bounds[0] == null) {
                                // should I do this or not? 
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        } else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                }
    jj_consume_token(OF);
    bt = BaseType(at);
//System.out.println("<RR>bag element type: " + bt + ", pass: " + parser_pass);
                if (parser_pass > 3) {
//			if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        if (!(at.testElement_type(null))) {
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EData_type) {
                                        at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EData_type)bt);
                                } else {
                                        // possible express amendment issue
                                }
                        }
                }
                bound_name = getBoundString(0, bounds, false, false);
                _data_type_name = "_BAG"  + bound_name + _data_type_name;
                if (at != null) {
                        at.setName(null, _data_type_name);
                }
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.171 ------------ */
// changed according to Amendment - 171

// CHOICE CONFLICT between aggregates and generalized aggregates
/*
    ARRAY OF ParameterType
    ARRAY OF BaseType
	
*/
  static final public jsdai.lang.EEntity BaseType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity ae;
                printDebug("In BaseType, starting, pass " + parser_pass);
    if (jj_2_3(2147483647)) {

      ae = ConcreteTypes(whose);
    } else {
      switch (jj_nt.kind) {
      case AGGREGATE:
      case ARRAY:
      case BAG:
      case GENERIC_ENTITY:
      case GENERIC:
      case LIST:
      case SET:
        ae = GeneralizedTypes(whose);
        break;
      default:
        jj_la1[19] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                printDebug("In BaseType, ending: " + ae + ", pass " + parser_pass);
                {if (true) return ae;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.172 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EBinary_type BinaryType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EBinary_type bt = null;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        int width_spec = 0;
        boolean is_fixed = false;
        String str_fixed;
    jj_consume_token(BINARY);

    switch (jj_nt.kind) {
    case LPAREN:
      width_spec = WidthSpec();
      break;
    default:
      jj_la1[20] = jj_gen;
      ;
    }
                if (width_spec == Integer.MIN_VALUE) {
                        width_spec = 0;
                }
                if (width_spec < 0) {
                        width_spec = -width_spec;
                        is_fixed = true;
                        str_fixed = "_FIXED";
                } else {
                        is_fixed = false;
                        str_fixed = "";
                }
                if (parser_pass == 3) {
                        if (width_spec == 0) {
                                bt = _st_binary;
                        } else {
                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                _data_type_name = "_Binary_" + width_spec + str_fixed;
                                // _data_type_name = "_Binary_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                bt.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, width_spec);
                                bt.setWidth(null, b1);
                                if (is_fixed) {
                                        bt.setFixed_width(null, true);
                                } else {
                                        bt.setFixed_width(null, false);
                                }
                        }
                }
                if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (bt == null) {
                                if (width_spec == 0) {
                                        bt = _st_binary;
                                } else {
                                        bt = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                        _data_type_name = "_Binary_" + width_spec + str_fixed;
                                        // _data_type_name = "_Binary_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                        bt.setName(null, _data_type_name);
                                        b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, width_spec);
                                        bt.setWidth(null, b1);
                                        if (is_fixed) {
                                                bt.setFixed_width(null, true);
                                        } else {
                                                bt.setFixed_width(null, false);
                                        }
                                }
                        }
                }
                if ((parser_pass == 5) && (width_spec != 0)) {
                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                _data_type_name = "_Binary_" + width_spec + str_fixed;
                                // _data_type_name = "_Binary_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                bt.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, width_spec);
                                bt.setWidth(null, b1);
                                if (is_fixed) {
                                        bt.setFixed_width(null, true);
                                } else {
                                        bt.setFixed_width(null, false);
                                }

                }
                {if (true) return bt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.172 ------------ */

/*-------- ISO 10303-14: B2.44 -------------------------------------------------------------------------------------------*/
  static final public jsdai.lang.EEntity BindingHeader(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String partition_name = "_implicit_partition_"; // partition may be implicit, let's have name "_implicit_partition_" for it (so far)
        // I would like to have partition entity, supertype of map_partition and view_partition.
        jsdai.SExtended_dictionary_schema.EMap_partition mp = null;
        jsdai.SExtended_dictionary_schema.EView_partition vp = null;
        jsdai.lang.EEntity partition = null;
printDebug("In BindingHeader, starting, parent: " + parent);
    switch (jj_nt.kind) {
    case PARTITION:
      jj_consume_token(PARTITION);
      partition_name = PartitionId();
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[21] = jj_gen;
      ;
    }
                if (parser_pass == 1) {
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_definition) {
                                vp = (jsdai.SExtended_dictionary_schema.EView_partition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CView_partition.class);
                                vp.setParent(null, (jsdai.SExtended_dictionary_schema.EView_definition)parent);
                                vp.setName(null, partition_name);
                                partition = (jsdai.lang.EEntity)vp;

                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EMap_definition) {
                                mp = (jsdai.SExtended_dictionary_schema.EMap_partition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CMap_partition.class);
                                mp.setParent(null, (jsdai.SExtended_dictionary_schema.EMap_definition)parent);
                                mp.setName(null, partition_name);
                                partition = (jsdai.lang.EEntity)mp;
                        } else {
                                // error
                        }
                } else {
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_definition) {
                                vp = findView_partition(partition_name, (jsdai.SExtended_dictionary_schema.EView_definition)parent);
                                partition = (jsdai.lang.EEntity)vp;
                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EMap_definition) {
                                mp = findMap_partition(partition_name, (jsdai.SExtended_dictionary_schema.EMap_definition)parent);
                                partition = (jsdai.lang.EEntity)mp;
                        } else {
                                // error
                        }
                }
    switch (jj_nt.kind) {
    case FROM:
      FromClause(partition);
      break;
    default:
      jj_la1[22] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case LOCAL:
      LocalDecl();
      break;
    default:
      jj_la1[23] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case WHERE:
      WhereClause(parent);
      break;
    default:
      jj_la1[24] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case IDENTIFIED_BY:
      IdentifiedByClause();
      break;
    default:
      jj_la1[25] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case ORDERED_BY:
      OrderedByClause();
      break;
    default:
      jj_la1[26] = jj_gen;
      ;
    }
                printDebug("In BindingHeader, ending");
                {if (true) return partition;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.173 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EBoolean_type BooleanType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EBoolean_type bt = null;
    jj_consume_token(BOOLEAN);
                if (parser_pass == 3) {
                        // bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBoolean_type.class);
                        bt = _st_boolean;
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
//System.out.println("bt: " + bt + ", boolean: " + _st_boolean + ", whose: " + whose);
                        if (bt == null) {
                                // bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBoolean_type.class);
                                bt = _st_boolean;
                        }
                }
                {if (true) return bt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.174 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EBound Bound1(boolean make_pdb) throws ParseException, jsdai.lang.SdaiException {
        int value;
        jsdai.SExtended_dictionary_schema.EBound b1 = null;
    value = NumericExpression();
                if (parser_pass == 5) {
                        if (numeric_expression_calculated) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                // this line is probably not needed for aggregate bound and dangerous in other cases, better remove
                                if (value == Integer.MIN_VALUE) value = 0;
                                b1.setBound_value(null, value);
                        } else {
                                b1 = (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CPopulation_dependent_bound.class);
                                // schema_name, entity_name, method_name
                                ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setSchema_name(null, sd.getName(null));
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope).getName(null));
                                }
                                ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setMethod_name(null, getPDBname());

                        }
                }
                {if (true) return b1;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.175------------ */
  static final public jsdai.SExtended_dictionary_schema.EBound Bound2(boolean make_pdb) throws ParseException, jsdai.lang.SdaiException {
        int value;
        jsdai.SExtended_dictionary_schema.EBound b2 = null;
    value = NumericExpression();
                if (parser_pass == 5) {
                        if (value != Integer.MIN_VALUE) {
                                b2 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b2.setBound_value(null, value);
                        } else if (!(numeric_expression_calculated)) {
                                b2 = (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CPopulation_dependent_bound.class);
                                ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setSchema_name(null, sd.getName(null));
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope).getName(null));
                                }
                                ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setMethod_name(null, getPDBname());
                        }
                }
                {if (true) return b2;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.176------------ */

// jsdai.SExtended_dictionary_schema.EInteger_bound [] BoundSpec() throws jsdai.lang.SdaiException :
  static final public jsdai.SExtended_dictionary_schema.EBound [] BoundSpec() throws ParseException, jsdai.lang.SdaiException {
        // jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EBound[2];
        // jsdai.SExtended_dictionary_schema.EInteger_bound b1 = null;
        // jsdai.SExtended_dictionary_schema.EInteger_bound b2 = null;
        jsdai.SExtended_dictionary_schema.EBound b1 = null;
        jsdai.SExtended_dictionary_schema.EBound b2 = null;
    jj_consume_token(LBRACKET);
    b1 = Bound1(true);
    jj_consume_token(COLON);
                if (parser_pass == 5) {
                        bounds[0] = b1;
                }
    b2 = Bound2(true);
    jj_consume_token(RBRACKET);
                if (parser_pass == 5) {
                        bounds[1] = b2;
                }
                {if (true) return bounds;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.177------------ */
  static final public Object BuiltInConstant() throws ParseException, jsdai.lang.SdaiException {
        Object result = null;
        Integer l;
        Double d;
        Token t;
    switch (jj_nt.kind) {
    case CONST_E:
      jj_consume_token(CONST_E);
                if (parser_pass == 5) {
                }
                {if (true) return result;}
      break;
    case PI:
      jj_consume_token(PI);
                if (parser_pass == 5) {
                }
                {if (true) return result;}
      break;
    case SELF:
      t = jj_consume_token(SELF);
          // using Token for SELF for now, later will see.
                if (!(self_entity || self_type || self_constructor)) {
                        error_count++;
                        printErrorMsg("illegal usage of SELF", null, true);

                }
                if (parser_pass == 5) {
                }
                {if (true) return result;}
      break;
    case HOOK:
      jj_consume_token(HOOK);
                if (parser_pass == 5) {
                }
                {if (true) return result;}
      break;
    default:
      jj_la1[27] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.178------------ */
  static final public int BuiltInFunction() throws ParseException {
        int id = 0;
    switch (jj_nt.kind) {
    case ABS:
      jj_consume_token(ABS);
                id = 1;
      break;
    case ACOS:
      jj_consume_token(ACOS);
                id = 2;
      break;
    case ASIN:
      jj_consume_token(ASIN);
                id = 3;
      break;
    case ATAN:
      jj_consume_token(ATAN);
                id = 4;
      break;
    case BLENGTH:
      jj_consume_token(BLENGTH);
                   id = 5;
      break;
    case COS:
      jj_consume_token(COS);
               id = 6;
      break;
    case EXISTS:
      jj_consume_token(EXISTS);
                  id = 7;
      break;
    case EXTENT:
      jj_consume_token(EXTENT);
                  id = 30;
      break;
    case EXP:
      jj_consume_token(EXP);
               id = 8;
      break;
    case FORMAT:
      jj_consume_token(FORMAT);
                  id = 9;
      break;
    case HIBOUND:
      jj_consume_token(HIBOUND);
                   id = 10;
      break;
    case HIINDEX:
      jj_consume_token(HIINDEX);
                   id = 11;
      break;
    case LENGTH:
      jj_consume_token(LENGTH);
                  id = 12;
      break;
    case LOBOUND:
      jj_consume_token(LOBOUND);
                   id = 13;
      break;
    case LOINDEX:
      jj_consume_token(LOINDEX);
                   id = 14;
      break;
    case LOG:
      jj_consume_token(LOG);
               id = 15;
      break;
    case LOG2:
      jj_consume_token(LOG2);
                id = 16;
      break;
    case LOG10:
      jj_consume_token(LOG10);
                 id = 17;
      break;
    case NVL:
      jj_consume_token(NVL);
               id = 18;
      break;
    case ODD:
      jj_consume_token(ODD);
               id = 19;
      break;
    case ROLESOF:
      jj_consume_token(ROLESOF);
                   id = 20;
      break;
    case SIN:
      jj_consume_token(SIN);
               id = 21;
      break;
    case SIZEOF:
      jj_consume_token(SIZEOF);
                  id = 22;
      break;
    case SQRT:
      jj_consume_token(SQRT);
                id = 23;
      break;
    case TAN:
      jj_consume_token(TAN);
               id = 24;
      break;
    case TYPEOF:
      jj_consume_token(TYPEOF);
                  id = 25;
      break;
    case USEDIN:
      jj_consume_token(USEDIN);
                  id = 26;
      break;
    case VALUE:
      jj_consume_token(VALUE);
                 id = 27;
      break;
    case VALUE_IN:
      jj_consume_token(VALUE_IN);
                    id = 28;
      break;
    case VALUE_UNIQUE:
      jj_consume_token(VALUE_UNIQUE);
                        id = 29;
      break;
    default:
      jj_la1[28] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In BuiltInFunction, function: " + id);
                {if (true) return id;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.179------------ */
  static final public int BuiltInProcedure() throws ParseException, jsdai.lang.SdaiException {
        int id = 0;
    switch (jj_nt.kind) {
    case INSERT:
      jj_consume_token(INSERT);
                  id = 1;
      break;
    case REMOVE:
      jj_consume_token(REMOVE);
                                       id = 2;
      break;
    default:
      jj_la1[29] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return id;}
    throw new Error("Missing return statement in function");
  }

/* -+----------------------------------------------------------------------------------- ISO 10303-11:A.2.180------------ */
  static final public void CaseAction() throws ParseException, jsdai.lang.SdaiException {
    CaseLabel();
    label_7:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[30] = jj_gen;
        break label_7;
      }
      jj_consume_token(COMMA);
      CaseLabel();
    }
    jj_consume_token(COLON);
    Stmt();
  }

/*-+-------- ISO 10303-14:B2.53 ---------*/
  static final public void CaseExpr() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(CASE);
    Selector();
    jj_consume_token(OF);
    label_8:
    while (true) {
      if (jj_2_4(1)) {
        ;
      } else {
        break label_8;
      }
      CaseExprAction();
    }
    switch (jj_nt.kind) {
    case OTHERWISE:
      jj_consume_token(OTHERWISE);
      jj_consume_token(COLON);
      Expression();
      break;
    default:
      jj_la1[31] = jj_gen;
      ;
    }
    jj_consume_token(END_CASE);
  }

/*-+-------- ISO 10303-14:B2.54 ---------*/
  static final public void CaseExprAction() throws ParseException, jsdai.lang.SdaiException {
    CaseLabel();
    label_9:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[32] = jj_gen;
        break label_9;
      }
      jj_consume_token(COMMA);
      CaseLabel();
    }
    jj_consume_token(COLON);
    Expression();
    jj_consume_token(SEMICOLON);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.181------------ */
  static final public void CaseLabel() throws ParseException, jsdai.lang.SdaiException {
        Object op_case_label = null;
        Object pop_inst = null;
                printDebug("In CaseLabel, starting, pass " + parser_pass);
    Expression();
                if (parser_pass == 5) {
                }
                printDebug("In CaseLabel, ending, pass " + parser_pass);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.182------------ */
  static final public void CaseStmt() throws ParseException, jsdai.lang.SdaiException {
        Object op_selector = null;
        Object pop_inst = null;
        boolean otherwise_present = false;
                printDebug("In CaseStmt, starting");
    jj_consume_token(CASE);
                 X_CaseSelector jjtn001 = new X_CaseSelector(JJTCASESELECTOR);
                 boolean jjtc001 = true;
                 jjtree.openNodeScope(jjtn001);
                 jjtreeOpenNodeScope(jjtn001);
    try {
      Selector();
    } catch (Throwable jjte001) {
                 if (jjtc001) {
                   jjtree.clearNodeScope(jjtn001);
                   jjtc001 = false;
                 } else {
                   jjtree.popNode();
                 }
                 if (jjte001 instanceof RuntimeException) {
                   {if (true) throw (RuntimeException)jjte001;}
                 }
                 if (jjte001 instanceof ParseException) {
                   {if (true) throw (ParseException)jjte001;}
                 }
                 if (jjte001 instanceof jsdai.lang.SdaiException) {
                   {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                 }
                 {if (true) throw (Error)jjte001;}
    } finally {
                 if (jjtc001) {
                   jjtree.closeNodeScope(jjtn001, true);
                   jjtreeCloseNodeScope(jjtn001);
                 }
    }
                if (parser_pass == 5) {
                }
    jj_consume_token(OF);
    label_10:
    while (true) {
      if (jj_2_5(1)) {
        ;
      } else {
        break label_10;
      }
      CaseAction();
    }
    switch (jj_nt.kind) {
    case OTHERWISE:
      jj_consume_token(OTHERWISE);
                                            otherwise_present = true;
      jj_consume_token(COLON);
      Stmt();
      break;
    default:
      jj_la1[33] = jj_gen;
      ;
    }
    jj_consume_token(END_CASE);
    jj_consume_token(SEMICOLON);
                printDebug("In CaseStmt, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.183------------ */
  static final public void CompoundStmt() throws ParseException, jsdai.lang.SdaiException {
        Object operand = null;
                printDebug("In CompoundStmt, starting");
    jj_consume_token(BEGIN);
    label_11:
    while (true) {
      Stmt();
      switch (jj_nt.kind) {
      case SEMICOLON:
      case ALIAS:
      case BEGIN:
      case CASE:
      case ESCAPE:
      case IF:
      case INSERT:
      case REMOVE:
      case REPEAT:
      case RETURN:
      case KW_SKIP:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[34] = jj_gen;
        break label_11;
      }
    }
    jj_consume_token(END);
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
//                      operand = argument_stack.pop();
///             printStack("POP: CompoundStmt, return value: " + operand);
                }
                printDebug("In CompoundStmt, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.184------------ */
  static final public void ConstantBody() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EConstant_definition cd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration cond;
        int index = 1;
        String name;
  Object operand = null;
        Object pop_inst = null;
  jsdai.lang.EEntity bt = null;
        String key = null;
        jsdai.lang.EEntity active_scope_backup = null;
                active_scope_backup = active_scope;
    name = ConstantId();
                if (parser_pass == 1) {
                        printVerbose("Constant: " + name);
//			cd = findConstant_definition(name);
                        cd = findConstant_definitionX(name);
                        Token t = getToken(0);
                        if (cd != null) {
                                                error_count++;
//						printError("duplicate constant name \"" + name + "\" at line " + t.beginLine + ", column " + t.beginColumn);
                                                printErrorMsg("" + name + " - duplicate constant name", null, true);
                        } else {
                                String wrong_name = findAnyName(name);
                                if (wrong_name != null) {
                                                error_count++;
//						printError("duplicate name \"" + name + "\". The same name used for a constant and for " + wrong_name + " at line " + t.beginLine + ", column " + t.beginColumn);
                                                printErrorMsg("" + name + " - duplicate constant name,  the name is already in use in the same scope", null, true);
                                }
                        }
                        printDebug("In ConstantBody, before 1st create");
                        cd = (jsdai.SExtended_dictionary_schema.EConstant_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CConstant_definition.class);
                        printDebug("In ConstantBody, after 1st create");
                        if ((active_scope instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) || (active_scope instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule)) {
                        cond = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CConstant_declaration$inner_declaration.class);
                                ((jsdai.SExtended_dictionary_schema.EInner_declaration)cond).setScope(null, active_scope);
                        } else {
                        cond = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CConstant_declaration$local_declaration.class);
                        }
                        cond.setDefinition(null, cd);
                        cond.setParent(null, sd);
                        key = constructConstantKey(name);
                        printDebug("In ConstantBody, after 2nd create");
                  active_scope_extension = new ECtScope(active_scope, cd, active_scope_extension, active_scope_string, name, key);
                        active_scope = cd;
                active_scope_string = "";

                        // parent_schema is now derived instead of explicit 
                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                // cond.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);	
                        // }
//System.out.println("ConstantDecl, HashMap key: " + key);
//System.out.println("ConstantDecl, constant declaration: " + cond);
//System.out.println("ConstantDecl, constant definition: " + cd);

//			if (!(hm_current_constant_declarations.containsKey(name.toLowerCase()))) {
                        if (!(hm_current_constant_declarations.containsKey(key))) {
                                hm_current_constant_declarations.put(key, cond);
//System.out.println("ConstantDecl, put into HashMap: " + hm_current_constant_declarations);
                        } else {
//System.out.println("ConstantDecl, already in the HashMap HashMap");
                        }
                        if (flag_oc) {
                                cd.setName(null, name);
                        } else {
                                cd.setName(null, name.toLowerCase());
                        }
                } else {
//			cd = findConstant_definition(name);
                        cd = findConstant_definitionX(name);
                  active_scope_extension = new ECtScope(active_scope, cd, active_scope_extension, active_scope_string, name, constructConstantKey(name));
                        active_scope = cd;
                active_scope_string = "";
                        if (cd == null) {
                                error_count++;
                                if (parser_pass == 2) {
                                        // it is more like an internal error, actually
//					printError("constant not found: " + name);
                                        printErrorMsg("" + name + " - constant not found", null, true);
                                }
                                printDebug("ConstantBody- constant not found: " + name);
                        }
                }
    jj_consume_token(COLON);
    bt = BaseType(cd);
                        if (bt != null) {
                                // possible additional check because of the changes for amendment and because of the way paramater_type is implemented.
                                cd.setDomain(null, bt);
                        } else {
                                printDebug("In ConstantBody, after BaseType, base type is NULL in pass: " + parser_pass + ", constantn_definition: " + cd);
                        }
    jj_consume_token(ASSIGN);
                if (parser_pass == 5) {
                }
    Expression();
                if (parser_pass == 5) {
                }
                active_scope = active_scope_backup;
                active_scope_string = active_scope_extension.getParent_scope_string();
                active_scope_extension = active_scope_extension.getParent();
    jj_consume_token(SEMICOLON);
  }

  static final public void ConstantDecl() throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity active_scope_backup = null;
    try {
                printDebug("In ConstantDecl, starting");
                active_scope_backup = active_scope;
      jj_consume_token(CONSTANT);
      label_12:
      while (true) {
        ConstantBody();
        switch (jj_nt.kind) {
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[35] = jj_gen;
          break label_12;
        }
      }
      jj_consume_token(END_CONSTANT);
      jj_consume_token(SEMICOLON);
                active_scope = active_scope_backup;
// the same as in ConstantBody?
//		active_scope_string = active_scope_extension.getParent_scope_string();
//		active_scope_extension = active_scope_extension.getParent();
                printDebug("In ConstantDecl, ending");
    } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
        if (parser_pass == 1) {
//		printError(e.getMessage());
                printErrorMsg(e.getMessage(), null, true);
                error_count++;
                System.out.println("ERROR RECOVERY: skipping to END_CONSTANT");
        }
        recoverFromParseException(END_CONSTANT, e);
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.186------------ */
  static final public void ConstantFactor() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case HOOK:
    case CONST_E:
    case PI:
    case SELF:
      BuiltInConstant();
      break;
    case SIMPLE_ID:
      InterpretedRef(PI_CONSTANT);
      break;
    default:
      jj_la1[36] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.187------------ */
  static final public String ConstantId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------- ISO 10303-11:A.2.188------------ */
  static final public void ConstructedTypes(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
    if (jj_2_6(2)) {
      EnumerationType(dt);
    } else {
      switch (jj_nt.kind) {
      case EXTENSIBLE:
      case GENERIC_ENTITY:
      case SELECT:
        SelectType(dt);
        break;
      default:
        jj_la1[37] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

// -- removed in DIS version
/*--------- ISO 10303-14:B.2.62 ---*/
/*
void CreateMapDecl() throws jsdai.lang.SdaiException :
{}
{
	<CREATE> InstanceId() ":" TargetEntityReference() ";" [ <WHERE> LogicalExpression() ";" ] (MapAttributeDeclaration())+  <END_CREATE> ";"
}
*/

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.189 ------------ */
  static final public void Declaration() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In Declaration, starting");
        if (active_scope_extension == null) {
        System.out.println("Declaration, active_scope_extension = NULL");
}
    switch (jj_nt.kind) {
    case ENTITY:
      EntityDecl();
      break;
    case SUBTYPE_CONSTRAINT:
      SubtypeConstraintDecl();
      break;
    case FUNCTION:
      FunctionDecl();
      break;
    case PROCEDURE:
      ProcedureDecl();
      break;
    case TYPE:
      TypeDecl();
      break;
    default:
      jj_la1[38] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In Declaration, ending, error_count: " + error_count);
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.411 ------------ */
  static final public void SubtypeConstraintBody(jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc0) throws ParseException, jsdai.lang.SdaiException {
        boolean is_abstract = false;
        jsdai.lang.EEntity ee = null;
        jsdai.SExtended_dictionary_schema.ESubtype_expression constraint = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc;
        jsdai.lang.EEntity se;
        Object pop_inst = null;
        jsdai.SExtended_dictionary_schema.EAndor_subtype_expression andor;
        // pre-X	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands;
                printDebug("In SubtypeConstraintBody, starting");
    switch (jj_nt.kind) {
    case ABSTRACT:
      AbstractSupertype();
                              is_abstract = true;
      break;
    default:
      jj_la1[39] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case TOTAL_OVER:
      TotalOver(sc0);
      break;
    default:
      jj_la1[40] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case LPAREN:
    case ONEOF:
    case SIMPLE_ID:
      SupertypeExpression();
                if (parser_pass == 5) {


                        se = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: SubtypeConstraint: " + se);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }

      ed = sc0.getSuper_type(null);
                        if (se instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) {
                                sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
                                sc.setGeneric_supertype(null, ed);
                                // super_type is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // sc.setSuper_type(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)ed);
                                // }
                                sc.setConstraint(null, (jsdai.SExtended_dictionary_schema.ESubtype_expression)se);
// System.out.println("<SC-BX-1> created: " + sc);
                        } else
                        if (se instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) // SUPERTYPE OF (single_entity)
            {
                                sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
                                sc.setGeneric_supertype(null, ed);
                                // super_type is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // sc.setSuper_type(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)ed);
                                // }
                                andor = (jsdai.SExtended_dictionary_schema.EAndor_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAndor_subtype_expression.class);
                                generic_operands = andor.createGeneric_operands(null);
                                // operands is now derived instead of explicit 
                                // operands = andor.createOperands(null);
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) se);
                                // operands is now derived instead of explicit 
                                // if (!(se instanceof jsdai.SExtended_dictionary_schema.EView_definition)) {
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) se);
                                // }
                                sc.setConstraint(null, (jsdai.SExtended_dictionary_schema.ESubtype_expression)andor);
// System.out.println("<SC-BX-2> created: " + sc);
                        }
                        else { //
                                error_count++;
                                printEDebug("Internal error in SubtypeConstraint");
                        }
                }
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[41] = jj_gen;
      ;
    }
                if (is_abstract) {
                        if (sc0 != null) {
//				if (sc0.testSuper_type(null)) {
//					ed = sc0.getSuper_type(null);
//					ed.setInstantiable(null, false);
//				}
                                if (sc0.testGeneric_supertype(null)) {
                                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)sc0.getGeneric_supertype(null);
// no, we need to set local flag abstract_supertype instead
//					ed.setInstantiable(null, false);
// is it sc or sc0?						sc0.setAbstract_supertype(null, true);
                                }
                        }
                }
                printDebug("In SubtypeConstraintBody, ending");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.412 ------------ */
  static final public void SubtypeConstraintDecl() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc = null;
                printDebug("In SubtypeConstraintDecl, starting");
    sc = SubtypeConstraintHead();
    SubtypeConstraintBody(sc);
    jj_consume_token(END_SUBTYPE_CONSTRAINT);
    jj_consume_token(SEMICOLON);
                printDebug("In SubtypeConstraintDecl, ending");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.413 ------------ */
  static final public jsdai.SExtended_dictionary_schema.ESub_supertype_constraint SubtypeConstraintHead() throws ParseException, jsdai.lang.SdaiException {
        String constraint_id = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc = null;
        jsdai.SExtended_dictionary_schema.ESubtype_constraint_declaration scd = null;
                printDebug("In SubtypeConstraintHead, starting");
    jj_consume_token(SUBTYPE_CONSTRAINT);
    constraint_id = SubtypeConstraintId();
    jj_consume_token(FOR);
    ed = EntityRef(null);
    jj_consume_token(SEMICOLON);
                printDebug("In SubtypeConstraintHead, ending");

                if (parser_pass == 1) {
                        sc = findSubtype_constraint(constraint_id);
                        if (sc != null) {
                                        error_count++;
//					printError("duplicate subtype_constraint name \"" + constraint_id + "\"");
                                        printErrorMsg("" + constraint_id + " - duplicate subtype_constraint name", null, true);
                                        printDebug("duplicate subtype_constraint name \"" + constraint_id + "\"");
                        } else {
                                String wrong_name = findAnyName(constraint_id);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + constraint_id + "\". The same name used for a subtype_constraint and for " + wrong_name);
                                        printErrorMsg("" + constraint_id + " - duplicate subtype constraint name, the name is already in use in the same scope", null, true);
                                        printDebug("duplicate name \"" + constraint_id + "\". The same name used for a subtype_constraint and for " + wrong_name);
                                }
                                sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
                                scd = (jsdai.SExtended_dictionary_schema.ESubtype_constraint_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$subtype_constraint_declaration.class);
                                scd.setDefinition(null, sc);
                                // parent_schema is now derived instead of explicit 
                                // scd.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                scd.setParent(null, sd);
                                sc.setName(null, constraint_id);
                                sc.setAbstract_supertype(null, false);
                                if (!(hm_current_subtype_constraint_declarations.containsKey(constraint_id.toLowerCase()))) {
                                        hm_current_subtype_constraint_declarations.put(constraint_id.toLowerCase(), scd);
                                }

                                if (ed != null) {
                                        // super_type is now derived instead of explicit 
                                        // sc.setSuper_type(null, ed);
                                        sc.setGeneric_supertype(null, ed);
                                }
// System.out.println("<SC-0> created constraint: " + sc);
                        }
                } else { // parser_pass > 1 
                        sc = findSubtype_constraint(constraint_id);
                        if (sc == null) {
                                error_count++;
                                if (parser_pass == 2) {
//					printError("subtype_constraint not found:  \"" + constraint_id + "\"");
                                        printErrorMsg("" + constraint_id + " - subtype constraint not found", null, true);
                                }
                                printDebug("subtype_constraint not found:  \"" + constraint_id + "\"");
                        } else {
                                if (ed != null) {
                                        // super_type is now derived instead of explicit 
                                        // sc.setSuper_type(null, ed);
                                        sc.setGeneric_supertype(null, ed);
                                }
                        }
// System.out.println("<SC-3> found constraint: " + sc + ", pass: " + parser_pass);
                }

                {if (true) return sc;}
    throw new Error("Missing return statement in function");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.414 ------------ */
  static final public String SubtypeConstraintId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
                printDebug("In SubtypeConstraintId, starting");
    t = jj_consume_token(SIMPLE_ID);
                printDebug("In SubtypeConstraintId, ending");
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.415 ------------ */
  static final public void TotalOver(jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.AEntity_definition total_cover = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition sub_ed = null;;
        int index = 1;
                printDebug("In TotalOver, starting");
    jj_consume_token(TOTAL_OVER);
    jj_consume_token(LPAREN);
                if (parser_pass == 3) {
                        total_cover = sc.createTotal_cover(null);
                }
    sub_ed = EntityRef(null);
                if (parser_pass == 3) {
//			total_cover.addByIndex(index, sub_ed);
                        total_cover.addUnordered(sub_ed);
                }
    label_13:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[42] = jj_gen;
        break label_13;
      }
      jj_consume_token(COMMA);
      sub_ed = EntityRef(null);
                if (parser_pass == 3)
                {
//			total_cover.addByIndex(index, sub_ed);
                        total_cover.addUnordered(sub_ed);
                }
    }
    jj_consume_token(RPAREN);
    jj_consume_token(SEMICOLON);
                printDebug("In TotalOver, ending");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.400 ------------ */
  static final public void AbstractSupertype() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In AbstractSupertype, starting");
    jj_consume_token(ABSTRACT);
    jj_consume_token(SUPERTYPE);
    jj_consume_token(SEMICOLON);
                printDebug("In AbstractSupertype, ending");
  }

/*-+-------- ISO 10303-14:B.2.64 ---*/
  static final public void DependentMapDecl() throws ParseException, jsdai.lang.SdaiException {
//	jsdai.SExtended_dictionary_schema.EDependent_map_declaration dmdc = null;
        jsdai.SExtended_dictionary_schema.EMap_declaration dmdc = null;
        jsdai.SExtended_dictionary_schema.EDependent_map_definition dmd = null;
        String map_name = null;
                target_parameter_order_count = 0;
    jj_consume_token(DEPENDENT_MAP);
    map_name = MapId();
    jj_consume_token(AS);
                printDebug("In DependentMapDecl, starting: " + map_name);
                if (parser_pass == 1) {
                        // check if a dependent_map with this name already exists in the extent.
                        dmd = findDependent_map_definition(map_name, null);
                        if (dmd != null) {
                                error_count++;
//				printError("duplicate dependent_map name \"" + map_name + "\"");
                                printErrorMsg("" + map_name + " - duplicate dependent map name", null, true);
                        } else {
                                String wrong_name = findAnyName(map_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + map_name + "\". The same name used for a dependent_map and for " + wrong_name);
                                        printErrorMsg("" + map_name + " - duplicate dependent map name, the name is already in use in the same scope", null, true);
                                }
                                dmd = (jsdai.SExtended_dictionary_schema.EDependent_map_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_map_definition.class);
                                active_scope = dmd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
//				dmdc = (jsdai.SExtended_dictionary_schema.EDependent_map_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$dependent_map_declaration.class);
                                dmdc = (jsdai.SExtended_dictionary_schema.EMap_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$map_declaration.class);


//				dmdc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                dmdc.setParent(null, sd);
                                dmdc.setDefinition(null, dmd);

                                dmd.setName(null, map_name);
                                // supertypes - added this attribute
//				dmd.createSupertypes(null);
//				dmd.createSuper_type(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper()
                        dmd = findDependent_map_definition(map_name, null);
                        active_scope = dmd;
                        if (dmd == null) {
                                error_count++;
//				printError("DependentMapDecl - the dependent_map not found: " + map_name);
                                printErrorMsg("" + map_name + " - the dependent map not found", null, true);
                        }
                }
                // createDocumentationEntity2(md, a_token);

                target_parameter_order_count = 0;
    label_14:
    while (true) {
      TargetParameter(dmd);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[43] = jj_gen;
        break label_14;
      }
    }
    jj_consume_token(SEMICOLON);
    switch (jj_nt.kind) {
    case SUBTYPE:
      MapSubtypeOfClause(dmd);
      break;
    default:
      jj_la1[44] = jj_gen;
      ;
    }
    label_15:
    while (true) {
      DepMapPartition(dmd);
      switch (jj_nt.kind) {
      case FROM:
      case PARTITION:
        ;
        break;
      default:
        jj_la1[45] = jj_gen;
        break label_15;
      }
    }
    jj_consume_token(END_DEPENDENT_MAP);
    jj_consume_token(SEMICOLON);
  }

/*-+-------- ISO 10303-14:B.2.65 ---*/
  static final public void DepBindingDecl(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
    DepFromClause(parent);
    switch (jj_nt.kind) {
    case WHERE:
      WhereClause(null);
      break;
    default:
      jj_la1[46] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case ORDERED_BY:
      OrderedByClause();
      break;
    default:
      jj_la1[47] = jj_gen;
      ;
    }
  }

/*-+-------- ISO 10303-14:B.2.66 ---*/
  static final public void DepFromClause(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(FROM);
    label_16:
    while (true) {
      DepSourceParameter(parent);
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[48] = jj_gen;
        break label_16;
      }
    }
  }

/*--------- ISO 10303-14:B.2.67 ---*/
  static final public void DepMapDeclBody(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
    DepBindingDecl(parent);
    MapProjectClause();
  }

/*--------- ISO 10303-14:B.2.68 ---*/
  static final public void DepMapPartition(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String partition_name = "_implicit_partition_";
        jsdai.lang.EEntity partition = null;
        jsdai.SExtended_dictionary_schema.EDependent_map_partition mp = null;
    switch (jj_nt.kind) {
    case PARTITION:
      jj_consume_token(PARTITION);
      partition_name = PartitionId();
      jj_consume_token(COLON);
      break;
    default:
      jj_la1[49] = jj_gen;
      ;
    }
                if (parser_pass == 1) {
                                mp = (jsdai.SExtended_dictionary_schema.EDependent_map_partition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_map_partition.class);
                                mp.setParent(null, (jsdai.SExtended_dictionary_schema.EDependent_map_definition)parent);
                                mp.setName(null, partition_name);
                                partition = (jsdai.lang.EEntity)mp;
                } else {
                                mp = (jsdai.SExtended_dictionary_schema.EDependent_map_partition)findDependent_map_partition(partition_name, (jsdai.SExtended_dictionary_schema.EDependent_map_definition)parent);
                                partition = (jsdai.lang.EEntity)mp;
                }
    DepMapDeclBody(mp);

  }

/*-+-------- ISO 10303-14:B.2.69 ---*/
  static final public void DepSourceParameter(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String source_parameter_name;
        jsdai.SExtended_dictionary_schema.ESource_parameter sp0 = null;
        jsdai.SExtended_dictionary_schema.EDependent_source_parameter sp = null;
        jsdai.SExtended_dictionary_schema.EData_type er = null; // fix dictionary - need defined_type or simple type
        jsdai.SExtended_dictionary_schema.ESimple_type st = null;
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
    // ignoring multiple SourceParameterIds for now, not sure why they are needed
            source_parameter_name = SourceParameterId();
    label_17:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[50] = jj_gen;
        break label_17;
      }
      jj_consume_token(COMMA);
      SourceParameterId();
    }
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case BINARY:
    case BOOLEAN:
    case INTEGER:
    case LOGICAL:
    case NUMBER:
    case REAL:
    case STRING:
      st = SimpleTypes(null);
      break;
    case SIMPLE_ID:
      dt = TypeReference();
      break;
    default:
      jj_la1[51] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                if (parser_pass == 1) {
                        sp0 = findSource_parameter(source_parameter_name);
                  if (sp0 != null) {
                                // error - should not be found
                        }
                        sp = (jsdai.SExtended_dictionary_schema.EDependent_source_parameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_source_parameter.class);
                        sp.setName(null, source_parameter_name);
//		 	sp.setOrder(null, from_order_count++);
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EDependent_map_partition) {
                                sp.setParent(null, (jsdai.SExtended_dictionary_schema.EDependent_map_partition)parent);
                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_partition) {
                                sp.setParent(null, (jsdai.SExtended_dictionary_schema.EView_partition)parent);
                        } else {
                                // error
                                System.out.println("<DepSourceParameter> - parent unknown: " + parent);
                        }
                } else {
                                sp0 = findSource_parameter(source_parameter_name);
                                if (sp0 == null) {
                                // error - should have been found
                                }
                                if (parser_pass == 4) {
                                        if ((st != null) && (dt == null)) {
                                                sp0.setExtent(null, st);
                                        } else
                                        if ((st == null) && (dt != null)) {
                                                sp0.setExtent(null, dt);
                                        } else {
                                        }
                                        sp0.setOrder(null, from_order_count++);
                                }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.190------------ */
  static final public void DerivedAttr(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute da;
        jsdai.lang.EEntity bt = null;
        Object exp = null;
        Object pop_inst = null;
        //3.0 jsdai.SExtended_dictionary_schema.EJava_code je = null;
        String x_operand = "";
        String error_attr_name = "";
        String error_current_name = "";
        String error_supertype_name = "";
                printDebug("In derived attribute of entity: " + ed.getName(null));
                active_scope = ed; // should be already

    da = AttributeDecl(ed, 1);
    jj_consume_token(COLON);
    bt = BaseType(da);
    jj_consume_token(ASSIGN);
                if (parser_pass > 3) {

                        if (da == null) {
                                // attribute not found, probably redeclaring problem
                                error_attr_name = global_attribute_name;
                                error_current_name = ed.getName(null);
                                if (global_entity2 != null) {
                                        error_supertype_name = global_entity2.getName(null);
                                }
//				error_count++;


                 // printError("redeclaring attribute \"" + error_attr_name + "\" in entity \"" + error_current_name + "\": the attribute not found in supertype entity \"" + error_supertype_name + "\" entity_name + "\"");

//				printError("redeclaring attribute \"" + error_attr_name + "\" in entity  \"" + error_current_name + "\": the attribute not found in the supertype entity \"" + error_supertype_name + "\"");

//RR
//				printErrorMsg("" + error_attr_name + " - redeclaring attribute in entity  \"" + error_current_name + "\": the attribute not found in the supertype entity \"" + error_supertype_name + "\"", null, true);

                        }
                }
                if (parser_pass == 5) {
                }
    Expression();
    jj_consume_token(SEMICOLON);
//		if (parser_pass > 3) {
                if ((parser_pass > 3) && (da != null)) {
                        if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) {
                                ((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
                        } else
                        if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                ((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
                        } else
                        if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                if (da != null) {
                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);
                                } else {
                                        printVerbose("ERROR, derived attribute da is NULL");
                                }
//				((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);
                        } else
                        if (bt instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                // generalized, the entity should be abstract, perhaps it could be checked.
                                ((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.EParameter)bt);

                        }
                        if (parser_pass == 5) {
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.191------------ */
  static final public void DeriveClause(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(DERIVE);
    label_18:
    while (true) {
      DerivedAttr(ed);
      switch (jj_nt.kind) {
      case SELF:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[52] = jj_gen;
        break label_18;
      }
    }
  }

/* - LOOKAHEAD 2 or > - (Column 3) ---------------------------------------------------- ISO 10303-11:A.2.192------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict in [] construct (column 3).
		 Expansion nested within construct and expansion following construct have common prefixes,
		 one of which is <SIMPLE_ID>. Lookahead of 2 or more should be used for the nested expansion.
*/
  static final public jsdai.SExtended_dictionary_schema.EWhere_rule DomainRule(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EWhere_rule wr = null;
        Object exp = null;
        Object pop_inst = null;
  String name = null;
                        printDebug("In DomainRule, parent: " + parent);
    if (jj_2_7(2)) {
      name = Label();
                                              printDebug("Domain rule name: " + name);
      jj_consume_token(COLON);
    } else {
      ;
    }
                        if (name == null) {
                                // optional label missing
                                no_label_nr++;
                                name = "no_label_" + no_label_nr;
                        }

                        if (!domain_rule_labels.add(name)) {
                                printErrorMsg("" + name + " - duplicate where rule label", null, true);
                                error_count++;
                        }
                        if (parser_pass == 5) {
                        } // pass 5

                  X_DomainRuleLogicalExpression jjtn001 = new X_DomainRuleLogicalExpression(JJTDOMAINRULELOGICALEXPRESSION);
                  boolean jjtc001 = true;
                  jjtree.openNodeScope(jjtn001);
                  jjtreeOpenNodeScope(jjtn001);
    try {
      LogicalExpression();
    } catch (Throwable jjte001) {
                  if (jjtc001) {
                    jjtree.clearNodeScope(jjtn001);
                    jjtc001 = false;
                  } else {
                    jjtree.popNode();
                  }
                  if (jjte001 instanceof RuntimeException) {
                    {if (true) throw (RuntimeException)jjte001;}
                  }
                  if (jjte001 instanceof ParseException) {
                    {if (true) throw (ParseException)jjte001;}
                  }
                  if (jjte001 instanceof jsdai.lang.SdaiException) {
                    {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                  }
                  {if (true) throw (Error)jjte001;}
    } finally {
                  if (jjtc001) {
                    jjtree.closeNodeScope(jjtn001, true);
                    jjtreeCloseNodeScope(jjtn001);
                  }
    }
                if (parser_pass == 5) {
                }
                printDebug("In DomainRule, ending: " + wr);
                {if (true) return wr;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.193------------ */
  static final public void Element() throws ParseException, jsdai.lang.SdaiException {
        int rep = 1;
                printDebug("In Element, starting");
    Expression();
    switch (jj_nt.kind) {
    case COLON:
      jj_consume_token(COLON);
      rep = Repetition();
      break;
    default:
      jj_la1[53] = jj_gen;
      ;
    }
                if (parser_pass == 5) {
                }
                printDebug("In Element, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.194 ------------ */
  static final public void EntityBody(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        {
                attribute_order_count = 0;
                explicit_attribute_order_count = 0;
                derived_attribute_order_count = 0;
                inverse_attribute_order_count = 0;
                where_rule_order_count = 0;
        }
    label_19:
    while (true) {
      switch (jj_nt.kind) {
      case SELF:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[54] = jj_gen;
        break label_19;
      }
      ExplicitAttr(ed);
    }
    switch (jj_nt.kind) {
    case DERIVE:
      DeriveClause(ed);
      break;
    default:
      jj_la1[55] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case INVERSE:
      InverseClause(ed);
      break;
    default:
      jj_la1[56] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case UNIQUE:
      UniqueClause(ed);
      break;
    default:
      jj_la1[57] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case WHERE:
                printDebug("before where clause, entity: " + ed.getName(null));
      WhereClause(ed);
      break;
    default:
      jj_la1[58] = jj_gen;
      ;
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.195------------ */
  static final public void EntityConstructor() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        int parameter_counter = 0;
        self_constructor = true;
    ed = EntityRef(null);
    jj_consume_token(LPAREN);
    if (jj_2_8(1)) {
      EntityConstructorParameter();
                                                               parameter_counter++;
      label_20:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[59] = jj_gen;
          break label_20;
        }
        jj_consume_token(COMMA);
        EntityConstructorParameter();
                                                                                                                       parameter_counter++;
      }
    } else {
      ;
    }
    jj_consume_token(RPAREN);
                if (parser_pass == 5) {
                }

                self_constructor = false;
  }

  static final public void EntityConstructorParameter() throws ParseException, jsdai.lang.SdaiException {
    Expression();
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.196 ------------ */
  static final public void EntityDecl() throws ParseException, jsdai.lang.SdaiException {
        {
                self_entity = true;
                printDebug("In EntityDecl, starting");
                scope_stack.push(current_scope);
                current_scope = new Vector();
        }
        jsdai.SExtended_dictionary_schema.EEntity_definition ed;
    try {
      ed = EntityHead();
      EntityBody(ed);
      jj_consume_token(END_ENTITY);
                active_scope = null;
if (active_scope_extension == null) {
        System.out.println("EntityDecl: active_scope_extension = NULL");
}
                active_scope_string = active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();
      jj_consume_token(SEMICOLON);
                printDebug("In EntityDecl, after parsing");
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                }
    } catch (ParseException e) {
                printDebug("In EntityDecl, in ParseException");
//	System.out.println("EXCEPTION: " + e);
        if (parser_pass == 1) {
//		printError(e.getMessage());

                if (!artificial_exception_thrown) {
                        printErrorMsg(e.getMessage(), null, true);
                        error_count++;
                }
                System.out.println("ERROR RECOVERY: skipping to END_ENTITY");
        }
        recoverFromParseException(END_ENTITY, e);
    }
        self_entity = false;
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.197 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition EntityHead() throws ParseException, jsdai.lang.SdaiException {
        String entity_name;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        // have to change complex interface either to the corresponding complex class, or into EDeclaration - more general interface.
//      jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration eld;
        jsdai.SExtended_dictionary_schema.EDeclaration eld;
  Token a_token;
        boolean is_abstract_entity = false;
    /* <ENTITY> EntityId() [SubSuper()] ";" - In ISO, but [] expands to [[] []], so the outer [] not needed? (javaCC ERROR) */
            a_token = jj_consume_token(ENTITY);
    entity_name = EntityId();
                global_entity_name = entity_name.toLowerCase();
                printDebug("Current entity: " + entity_name);
                if (parser_pass == 1) {
                        // check if an entity with this name already exists in the extent.
                        artificial_exception_thrown = false;
                        ed = findEntity_definition(entity_name, null);
                        Token t = getToken(0);
                        if (ed != null) {
                                        error_count++;
//					printError("duplicate entity name \"" + entity_name + "\" at line " + t.beginLine + ", column " + t.beginColumn);
                                        printErrorMsg("" + entity_name + " - duplicate entity name", null, true);
                                        artificial_exception_thrown = true;
                                        {if (true) throw new ParseException();}
                        }       else {
                                String wrong_name = findAnyName(entity_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + entity_name + "\". The same name used for an entity and for " + wrong_name + " at line " + t.beginLine + ", column " + t.beginColumn);
                                        printErrorMsg("" + entity_name + "  duplicate entity name, the name is already in use in the current scope", null, true);
                                }
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_definition.class);
                          active_scope_extension = new ECtScope(active_scope, ed, active_scope_extension, active_scope_string, entity_name, entity_name.toLowerCase());
                                active_scope = ed;
                        active_scope_string = "";
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                eld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);

        if (sd == null) {
//              printDDebug("SD NULL, entity_name: " + entity_name + ", complex: " + is_complex_schema + ", pass: " + parser_pass);
        } else {
        }

                                eld.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // eld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                eld.setDefinition(null, ed);
                                hm_current_entity_declarations.put(entity_name.toLowerCase(), eld);
                                if (flag_oc) {
                                        ed.setName(null, entity_name);
                                } else {
          ed.setName(null, entity_name.toLowerCase());
                                }
//                              ed.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                ed.setInstantiable(null, true); // later must be repalaced to true, must be true for all entities except ABSTRACT
                    ed.setIndependent(null, true); // we probably should work with declarations rather than with definition - if local or used from - true, if not - false
        if (is_complex_schema)
                                        ed.setComplex(null, true); // unnecessary, 0 by default
                                else
                                        ed.setComplex(null, false); // unnecessary, 0 by default
                                ed.setConnotational_subtype(null, false);
                                ed.setAbstract_entity(null, false);
                                ed.createGeneric_supertypes(null);
                                // supertypes is now derived instead of explicit 
                                // ed.createSupertypes(null);
                                // now it is inverse.
                                // ed.createWhere_rules(null);
                                // no longer
                                // ed.createExplicit_attributes(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper()
                        ed = findEntity_definition(entity_name, null);
                  active_scope_extension = new ECtScope(active_scope, ed, active_scope_extension, active_scope_string, entity_name, entity_name.toLowerCase());
                        active_scope = ed;
                active_scope_string = "";
                        if (ed == null) {
                                error_count++;
                                if (parser_pass == 2) {
                                        printErrorMsg("" + entity_name + " - entity not found", null, true);
//					printError("entity not found: " + entity_name);
                                }
                                printDebug("EntityHead - the entity not found: " + entity_name);
                        }
                }
                createDocumentationEntity2(ed, a_token);
    SubSuper(ed);
    jj_consume_token(SEMICOLON);
//	  if (parser_pass == 1) {
//	  	if (is_abstract_entity) {
//	  		ed.setInstantiable(null, false);
//			}
//	  }
                {if (true) return ed;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.198 ------------ */
  static final public String EntityId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image.replace('$', '+'));}
                } else {
                        {if (true) return (t.image.toLowerCase().replace('$', '+'));}
                }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.74 ---*/
  static final public void EntityInstantiationLoop() throws ParseException, jsdai.lang.SdaiException {
        boolean increment_like_present = false;
        String var_id = "";
                printDebug("In EntityInstantiationLoop, starting");

                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
                if (parser_pass == 5) {
                        variable_id_stack.push(var_id);
                }

                scope_stack.push(current_scope);
                current_scope = new Vector();
    jj_consume_token(FOR);
    increment_like_present = InstantiationLoopControl();
    jj_consume_token(SEMICOLON);
    MapProjectClause();
                if (parser_pass == 4) {
                        if (increment_like_present) {
                                active_scope_string = active_scope_extension.getParent_scope_string();
                                active_scope_extension = active_scope_extension.getParent();
                        }
                }
                current_scope = (Vector)scope_stack.pop();

                printDebug("In EntityInstantiationLoop, ending");
  }

/*-+-------- ISO 10303-14:B.2.75 ---*/
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition EntityReference() throws ParseException, jsdai.lang.SdaiException {
        String schema_name = null;
        String entity_name = null;
                printDebug("In EntityReference, starting");
    if (jj_2_9(2)) {
      schema_name = InterpretedId();
      jj_consume_token(DOT);
    } else {
      ;
    }
    entity_name = InterpretedId();
                printDebug("In EntityReference, ending,but before find method");
                {if (true) return findEntityReference(entity_name, schema_name);}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.199------------ */
  static final public String EnumerationId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 or > - (Column 3) ---------------------------------------------------- ISO 10303-11:A.2.200------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict in [] construct (column 3).
		 Expansion nested within construct and expansion following construct have common prefixes,
		 one of which is <SIMPLE_ID>. Lookahead of 2 or more should be used for the nested expansion.
*/

// grammar change is needed here
  static final public void EnumerationReference() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
                printDebug("In EnumerationReference");
    if (jj_2_10(2)) {
      dt = TypeRef(0);
      jj_consume_token(DOT);
    } else {
      ;
    }
    EnumerationRef(dt);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.201------------ */


// new 
  static final public void EnumerationType(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEnumeration_type et = null;
        // String element;
        jsdai.lang.A_string elements = null;
        // int index = 1;
        boolean is_extensible = false;
        boolean is_extension = false;
        Vector elementz = new Vector();
        jsdai.SExtended_dictionary_schema.EDefined_type enum_super = null;
    switch (jj_nt.kind) {
    case EXTENSIBLE:
      jj_consume_token(EXTENSIBLE);
                       is_extensible = true;
      break;
    default:
      jj_la1[60] = jj_gen;
      ;
    }
    jj_consume_token(ENUMERATION);

    switch (jj_nt.kind) {
    case BASED_ON:
    case OF:
      switch (jj_nt.kind) {
      case OF:
        jj_consume_token(OF);
        elementz = EnumerationItems(elementz);
        break;
      case BASED_ON:
        enum_super = EnumerationExtension(elementz);
                                                                                                         is_extension = true;
        break;
      default:
        jj_la1[61] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[62] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (is_extensible) {
                                if (is_extension) {
                                        // extended_enumeration_type+extensible_enumeration_type
                                                et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtended_enumeration_type$extensible_enumeration_type.class);
                                } else {
                                        // extensible_enumeration_type
                                        et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtensible_enumeration_type.class);
                                }
                        } else {
                                if (is_extension) {
                                        // extended_enumeration_type
                                                et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtended_enumeration_type.class);
                                } else {
                                        // enumeration_type - rather weird, perhaps we needed non-extensible enumeration type in dictionary too.
                                        et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEnumeration_type.class);
                                }
                        }
                        et.setName(null, "_ENUMERATION_" + dt.getName(null));
//		elements = et.createElements(null);
                        elements = et.createLocal_elements(null);

                        // dt.setDomain(null, et); // why two times - se below

                        for (int i = 0; i < elementz.size(); i++) {
                                elements.addByIndex(i+1, (String)elementz.elementAt(i));
//				elements.addUnordered((String)elementz.elementAt(i));
                        }
                        if (isDTDomainValid(dt, et)) {
                                dt.setDomain(null, et);
                        } else {
                                error_count++;
                                printErrorMsg("" + dt.getName(null) + " - invalid underlying type", null, true);
                        }

                        if (is_extension) {
                                if (et instanceof jsdai.SExtended_dictionary_schema.EExtended_enumeration_type) {
                                        if (enum_super != null) {
                                                if (enum_super.testDomain(null)) {
                                jsdai.SExtended_dictionary_schema.EEnumeration_type enum_super_domain = (jsdai.SExtended_dictionary_schema.EEnumeration_type)enum_super.getDomain(null);
                          if (enum_super_domain instanceof jsdai.SExtended_dictionary_schema.EExtensible_enumeration_type) {
//								((jsdai.SExtended_dictionary_schema.EExtended_enumeration_type)et).setIs_based_on(null, (jsdai.SExtended_dictionary_schema.EExtensible_enumeration_type)enum_super.getDomain(null));
                                                                ((jsdai.SExtended_dictionary_schema.EExtended_enumeration_type)et).setIs_based_on(null, enum_super);
                                                        } else {
//								printError("enumeration type " + enum_super.getName(null) + " must be EXTENSIBLE: " + enum_super_domain);
                error_count++;
                                                                printErrorMsg("" + enum_super.getName(null) + " - enumeration type must be EXTENSIBLE: " + enum_super_domain, null, true);
                                                                printDebug("The enumeration type: " + enum_super.getName(null) + " must be EXTENSIBLE: " + enum_super_domain);
                                                        }
                                                } else {
                                                }
                                        } else {

                                        }
                                } else {
                                        // something wrong here - internal error
                                }
                        }
                } else
                if (parser_pass == 4) {
                        et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)dt.getDomain(null);
                        if (is_extension) {
                                if (et instanceof jsdai.SExtended_dictionary_schema.EExtended_enumeration_type) {
                                        if (enum_super != null) {
                                                if (enum_super.testDomain(null)) {
                                jsdai.SExtended_dictionary_schema.EEnumeration_type enum_super_domain = (jsdai.SExtended_dictionary_schema.EEnumeration_type)enum_super.getDomain(null);
                          if (enum_super_domain instanceof jsdai.SExtended_dictionary_schema.EExtensible_enumeration_type) {
                                                                if (!(((jsdai.SExtended_dictionary_schema.EExtended_enumeration_type)et).testIs_based_on(null))) {
//									((jsdai.SExtended_dictionary_schema.EExtended_enumeration_type)et).setIs_based_on(null, (jsdai.SExtended_dictionary_schema.EExtensible_enumeration_type)enum_super_domain);
                                                                        ((jsdai.SExtended_dictionary_schema.EExtended_enumeration_type)et).setIs_based_on(null, enum_super);
                                                                }
                                                        } else {
                error_count++;
                                                                printErrorMsg("" + enum_super.getName(null) + " - enumeration type must be EXTENSIBLE: " + enum_super_domain, null, true);
                                                                // printError("The enumeration type: " + enum_super.getName(null) + " must be EXTENSIBLE: " + enum_super_domain);
                                                                printDebug("The enumeration type: " + enum_super.getName(null) + " must be EXTENSIBLE: " + enum_super_domain);
                                                        }
                                                } else {
                                                }
                                        } else {

                                        }
                                } else {
                                        // something wrong here - internal error
                                }
                        }
                }
  }

// in this version, return  is no longer really needed
  static final public Vector EnumerationItems(Vector elementz) throws ParseException, jsdai.lang.SdaiException {
        String element;
        int index = 1;
    jj_consume_token(LPAREN);
    element = EnumerationId();
                if (parser_pass == 3) {
                        elementz.addElement(element);
                }
    label_21:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[63] = jj_gen;
        break label_21;
      }
      jj_consume_token(COMMA);
      element = EnumerationId();
                if (parser_pass == 3) {
                        // duplicate element names are now allowed but evaluate to the same value
//			if (isEnumerationElementNotUnique(elements, element)) {
//				error_count++;
//				printError("duplicate enumeration element name \"" + element + "\" in enumeration: " + dt.getName(null));
//			}
                        elementz.addElement(element);
                }
    }
    jj_consume_token(RPAREN);
                {if (true) return elementz;}
    throw new Error("Missing return statement in function");
  }

// jsdai.lang.A_string EnumerationExtension(jsdai.SExtended_dictionary_schema.EDefined_type dt, jsdai.SExtended_dictionary_schema.EEnumeration_type et, jsdai.lang.A_string elements) throws jsdai.lang.SdaiException :
  static final public jsdai.SExtended_dictionary_schema.EDefined_type EnumerationExtension(Vector elementz) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EDefined_type enum_super = null;
    jj_consume_token(BASED_ON);
    enum_super = TypeRef(0);
    switch (jj_nt.kind) {
    case WITH:
      jj_consume_token(WITH);
      EnumerationItems(elementz);
      break;
    default:
      jj_la1[64] = jj_gen;
      ;
    }
        // further implementation depends on the approach	
                {if (true) return enum_super;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.202------------ */
  static final public void EscapeStmt() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In EscapeStmt starting");
    jj_consume_token(ESCAPE);
    jj_consume_token(SEMICOLON);
                printDebug("In EscapeStmt ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.203------------ */
  static final public void ExplicitAttr(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute a;
        jsdai.SExtended_dictionary_schema.EExplicit_attribute ea = null;
        jsdai.SExtended_dictionary_schema.AExplicit_attribute aa = null;
        jsdai.lang.EEntity bt = null;
        int i = 1;
        boolean optional_flag = false;
        String error_attr_name = "";
        String error_current_name = "";
        String error_supertype_name = "";
    a = AttributeDecl(ed, 0);
                if (parser_pass > 3) {
                        if (a == null) {
                                // attribute not found, probably redeclaring problem
                                error_attr_name = global_attribute_name;
                                error_current_name = ed.getName(null);
                                if (global_entity2 != null) {
                                        error_supertype_name = global_entity2.getName(null);
                                }
//				error_count++;
                 // printError("redeclaring attribute \"" + error_attr_name + "\" in entity \"" + error_current_name + "\": the attribute not found in supertype entity \"" + error_supertype_name + "\" entity_name + "\"");

//				printError("redeclaring attribute \"" + error_attr_name + "\" in entity  \"" + error_current_name + "\": the attribute not found in the supertype entity \"" + error_supertype_name + "\"");

//				printErrorMsg("" + error_attr_name + " - redeclaring attribute in entity  \"" + error_current_name + "\": the attribute not found in the supertype entity \"" + error_supertype_name + "\"", null, true);

                        } else {
                                if (!(a instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute)) {
                                        printWarningMsg("" + a.getName(null) + " - not explicit, in entity: " + ed.getName(null), null, true);
                                }

                        }
                }

                if (parser_pass >= 3) {
                        if (a instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                ea = (jsdai.SExtended_dictionary_schema.EExplicit_attribute)a;
                        } else {
//				System.out.println("ExplicitAttr - not explicit - entity: " + ed + ", attribute: " + a);
                                ea = null;
                        }
                        i = 1;
                        aa = new jsdai.SExtended_dictionary_schema.AExplicit_attribute();
                        if (ea != null) {
                                aa.addByIndex(i++, ea);
                        } else {
                                printVerbose("ERROR: explicit attribute ea is NULL");
                        }
                }
    label_22:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[65] = jj_gen;
        break label_22;
      }
      jj_consume_token(COMMA);
      a = AttributeDecl(ed, 0);
                if (parser_pass >= 3) {
                        if (a instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                ea = (jsdai.SExtended_dictionary_schema.EExplicit_attribute)a;
                        } else {
                                ea = null;
                        }
//			ea = (jsdai.SExtended_dictionary_schema.EExplicit_attribute)a;
                        if (ea != null) {
                                aa.addByIndex(i++, ea);
                        } else {
                                printVerbose("ERROR: explicit attribute ea is NULL");
                        }
                }
    }
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
                             optional_flag = true;
      break;
    default:
      jj_la1[66] = jj_gen;
      ;
    }
    bt = BaseType(a);
    jj_consume_token(SEMICOLON);
                if (parser_pass >= 3) {
//System.out.println(">>>>> base type: " + bt);
                        jsdai.lang.SdaiIterator attr_iter = aa.createIterator();
                        while (attr_iter.next()) {
                                ea = aa.getCurrentMember(attr_iter);
                                if (bt == null) {
printDDebug("XP: ERROR - explicit atttribute daclaration, base type - null: " + ea.getName(null) + ", t: " + bt);
                                } else
                                if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) {
//System.out.println(">>>>> domain - simple type: " + bt);
                                        ea.setDomain(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
                                } else
                                if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
printDDebug("XP: explicit atttribute daclaration, base type - aggregate: " + ea.getName(null) + ", t: " + bt);
                                        ea.setDomain(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
                                } else
                                if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
printDDebug("XP: explicit atttribute daclaration, base type - named type: " + ea.getName(null) + ", t: " + bt);
                                        ea.setDomain(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);
                                } else
                                if (bt instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                        // express amendment generalized base type issue
                                        ea.setDomain(null, (jsdai.SExtended_dictionary_schema.EParameter)bt);
                                } else {
printDDebug("XP: ERROR - explicit atttribute daclaration, base type - unknown type: " + ea.getName(null) + ", t: " + bt);
                                }
                                ea.setOptional_flag(null, optional_flag);
//System.out.println("SET OPTIONAL 03, attribute: " + ea);
                        }
                }
//	System.out.println("@@@33 ending: entity: " + ed + ", attribute: "  + ea);

  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.204------------ */
  static final public X_Expression Expression() throws ParseException, jsdai.lang.SdaiException {
        Object operand1 = null;
        Object operand2 = null;
        Object result = "";
        String x_operand1 = "";
        String x_operand2 = "";
        double op1double;
        double op2double;
        int op1int;
        int op2int;
        int operation = 0;
        String x_result = "";
        int op_nr = 0;
        int nr_of_operands = 0;
                printDebug("In Expression before SimpleExpression");
    SimpleExpression();
                printDebug("In Expression after SimpleExpression");
                if (parser_pass == 5) {
                }
    if (jj_2_11(2)) {
      operation = RelOpExtended();
      SimpleExpression();
                printDebug("In Expression after the second SimpleExpression");

                if (parser_pass == 5) {
                }
    } else {
      ;
    }
                if (parser_pass == 5) {
                }
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.79 ---*/
  static final public void ExpressionOrWild() throws ParseException, jsdai.lang.SdaiException {
    if (jj_2_12(1)) {
      Expression();
    } else {
      switch (jj_nt.kind) {
      case OP_UNDERSCORE:
        jj_consume_token(OP_UNDERSCORE);
        break;
      default:
        jj_la1[67] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

/*--------- ISO 10303-14:B.2.80 ---*/
  static final public jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ExtentReference() throws ParseException, jsdai.lang.SdaiException {
        String schema_name = null;
        String object_name = null;
    if (jj_2_13(2)) {
      schema_name = InterpretedId();
      jj_consume_token(DOT);
    } else {
      ;
    }
    object_name = InterpretedId();
                {if (true) return findEntity_or_view_definition(object_name, schema_name);}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.205------------ */
  static final public void Factor() throws ParseException, jsdai.lang.SdaiException {
        Object operand1 = null;
        Object operand2 = null;
        String x_operand1 = "";
        String x_operand2 = "";
        String x_result = "";
        boolean power_present = false;
                printDebug("In Factor before SimpleFactor");
    SimpleFactor();
                printDebug("In Factor after SimpleFactor");
                if (parser_pass == 5) {
                }
    if (jj_2_14(2)) {
      jj_consume_token(STARS);
      SimpleFactor();
                power_present = true;
                printDebug("In Factor after second SimpleFactor");
                if (parser_pass == 5) {
                }
    } else {
      ;
    }
                if (parser_pass == 5) {
                }
  }

/*--------- ISO 10303-14:B.2.82 ---*/
  static final public void ForeachExpr() throws ParseException, jsdai.lang.SdaiException {
        ECtVariable var = null;
        String variable_id = null;
        jsdai.lang.EEntity variable_parameter_type = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type = null;
        String var_id = "";
        String variable_key = "";
                printDebug("In ForEachExpr, starting");
                variable_uid++;
//		System.out.println("<OOO> In ForEachExpr, starting in pass: " + parser_pass + ", variable_uid: " + variable_uid);
                var_id += "_implicit_" + variable_uid + "_";
                scope_stack.push(current_scope);
                current_scope = new Vector();
    jj_consume_token(EACH);
    variable_id = VariableId();
                if (parser_pass == 4) {

// System.out.println("<OAO> In ForEachExpr, starting in pass: " + parser_pass + ", variable_uid: " + variable_uid + ", variable_id: " + variable_id);


                        variable_type = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);

                        variable_type.setName(null, "_implicit_variable_");

                        // variable_type.setParameter_type(....)  -- TODO if needed 

                  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension, active_scope_string, "" + variable_uid, variable_id);
                        active_scope_string = "";
//			active_scope = null;  // not using on schema level (yet)

                        variable_key = constructImplicitVariableKey(variable_id, variable_uid);

// System.out.println("<--ForEachExpr--> - constructing variable_key: " + variable_key + ", variable_id: " + variable_id + ", variable_uid: " + variable_uid);

//			var = new ECtVariable(variable_id, variable_type, function_depth, variable_key, active_scope, true, 1, (String)variable_id_stack.peek());
                        var = new ECtVariable(variable_id, variable_type, function_depth, variable_key, active_scope, true, 1, "");
//			var = new ECtVariable(variable_id, variable_type, (String)variable_id_stack.peek());

                        if (variable_key != null) {
                                if (!(hm_current_variables.containsKey(variable_key))) {
                                        hm_current_variables.put(variable_key, var);
                                } else {
                                        // error - perhaps more than one variable with the same name in a function
                                }
                        } else {
                                System.out.println("INTERNAL ERROR - ImplicitVariable in ForEachExpr: " + variable_id + "  - wrong active scope: " + active_scope);
                        }


                        current_scope.addElement(var);

                        if (expression_instances) {
                                // pop_inst_aggr_src = expression_stack.pop();
                        }
                } else { // other passes - added to handle interpreted IDs

//		  active_scope_extension = new ECtScope(active_scope, active_scope, active_scope_extension, active_scope_string, "query_expression$", variable_id));
// 			active_scope_string = "";

                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);

                }
    jj_consume_token(IN);
    Expression();

    switch (jj_nt.kind) {
    case WHERE:
      WhereClause(active_scope);
      break;
    default:
      jj_la1[68] = jj_gen;
      ;
    }

    jj_consume_token(RETURN);
    Expression();
                current_scope = (Vector)scope_stack.pop();
                // variable_id_stack.pop(); // for pass 5 only if at all

                if (parser_pass == 4) {
                        active_scope_string =  active_scope_extension.getParent_scope_string();
                        active_scope_extension = active_scope_extension.getParent();
                }
                printDebug("In ForEachExpr, ending");
  }

/*--------- ISO 10303-14:B.2.83 ---*/
  static final public void ForloopExpr() throws ParseException, jsdai.lang.SdaiException {
        Object operand = null;
        String var_id = "";
        boolean increment_present = false;
                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
                if (parser_pass == 5) {
                        variable_id_stack.push(var_id);
                }
                printDebug("In ForLoopExpr, starting");

                scope_stack.push(current_scope);
                current_scope = new Vector();
    // RepeatControl() <RETURN> MapAttrAssgnmtExpr()
            increment_present = RepeatControl();
    jj_consume_token(RETURN);
    Expression();
                if (parser_pass == 4) {
                        if (increment_present) {
                                active_scope_string = active_scope_extension.getParent_scope_string();
                                active_scope_extension = active_scope_extension.getParent();
                        }
                }
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                        variable_id_stack.pop();
                }
                printDebug("In ForLoopExpr, ending");


//		current_scope = (Vector)scope_stack.pop();

  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.206------------ */
  static final public jsdai.lang.EEntity FormalParameter(jsdai.SExtended_dictionary_schema.AParameter parameters, boolean var_present, /* jsdai.SSdai_expressions_schema.AVariable fp_parameters,*/ jsdai.lang.EEntity owner) throws ParseException, jsdai.lang.SdaiException {
        String par_name;
        Vector par_names = new Vector();
        jsdai.lang.EEntity pt = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        // jsdai.SSdai_expressions_schema.EEntity_variable ev = null;
        int parameter_counter = 0;
        jsdai.SExtended_dictionary_schema.EParameter par2 = null;
                printDebug("In FormalParameter, starting");
    par_name = ParameterId();
                parameter_counter++;
                par_names.addElement(par_name);
    label_23:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[69] = jj_gen;
        break label_23;
      }
      jj_consume_token(COMMA);
      par_name = ParameterId();
                        parameter_counter++;
                        par_names.addElement(par_name);
    }
    jj_consume_token(COLON);
    par = ParameterType();
                if (parser_pass == 5) {
                        if (parameters != null) {
// printDDebug("Last parameter name: " + par_name);
if (par == null) {
;//     printDDebug("par is NUL");
} else {
;//     printDDebug("par is NOT null");
}
if (par_names == null) {
;//     printDDebug("par_names is NUL");
} else {
;//     printDDebug("par_names is NOT null, number: " + par_names.size());
}

                                if (par != null) {
                                        par.setName(null, (String)par_names.elementAt(0));

                                        current_scope.addElement(par);
                                        parameters.addByIndex(parameters.getMemberCount()+1,par);
                                        for (int i = 1; i < parameter_counter; i++) {
                                                par2 = (jsdai.SExtended_dictionary_schema.EParameter)par.copyApplicationInstance(model);
                                                par2.setName(null, (String)par_names.elementAt(i));
                                                current_scope.addElement(par2);
                                                parameters.addByIndex(parameters.getMemberCount()+1, par2);
                                        }
                                } else {
                                        printVerbose("ERROR: formal parameter par NULL");
                                }
                        }
                        if (expression_instances) {
                                if (pt != null) {
                                        if (pt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                                for (int i = 0; i < par_names.size(); i++) {
                                                        String par_name1 = (String)par_names.elementAt(i);
                                                  // ev = (jsdai.SSdai_expressions_schema.EEntity_variable)expression_model.createEntityInstance(jsdai.SSdai_expressions_schema.CEntity_variable.class);
                                                        // ev.setOwner(null, owner);
                                                        // ev.setVariable_name(null, par_name1);
                                                        // ev.setDefinition(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)pt);
                // fp_parameters.addByIndex(fp_parameters.getMemberCount()+i+1, ev);
                                                        // current_scope.addElement(ev);
            }
                                        } else {
                                                printDebug("In Formal Parameter - not entity");
                                        }
                                }
                        }
                }

                printDebug("In FormalParameter, ending");
                {if (true) return pt;} // really needed at all?

    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.85 ---*/
  static final public void ForwardPathQualifier() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(FPATH);
    AttributeRef(null, null, -1, null);
    if (jj_2_15(2147483647)) {
      PathCondition();
    } else {
      ;
    }
  }

/*-+-------- ISO 10303-14:B.2.86 ---*/
  static final public void ForExpr() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(FOR);
    switch (jj_nt.kind) {
    case EACH:
      ForeachExpr();
      break;
    case RETURN:
    case UNTIL:
    case WHILE:
    case SIMPLE_ID:
      ForloopExpr();
      break;
    default:
      jj_la1[70] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*-+-------- ISO 10303-14:B.2.87 ---*/
  static final public void FromClause(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
                printDebug("In FromClause, starting, parent: " + parent);
                from_order_count = 0;
    jj_consume_token(FROM);
    label_24:
    while (true) {
      SourceParameter(parent);
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[71] = jj_gen;
        break label_24;
      }
    }
printDebug("In FromClause, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.207------------ */
  static final public Object FunctionCall() throws ParseException, jsdai.lang.SdaiException {
        int built_in_id = -1;
        Vector arguments = new Vector();
        Vector expressions = new Vector();
        int arg_count = -1;
        Object result = null;
        Object function_instance = null;
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
                printDebug("Starting FunctionCall");
    switch (jj_nt.kind) {
    case ABS:
    case ACOS:
    case ASIN:
    case ATAN:
    case BLENGTH:
    case COS:
    case EXISTS:
    case EXP:
    case EXTENT:
    case FORMAT:
    case HIBOUND:
    case HIINDEX:
    case LENGTH:
    case LOBOUND:
    case LOG:
    case LOG10:
    case LOG2:
    case LOINDEX:
    case NVL:
    case ODD:
    case ROLESOF:
    case SIN:
    case SIZEOF:
    case SQRT:
    case TAN:
    case TYPEOF:
    case USEDIN:
    case VALUE:
    case VALUE_IN:
    case VALUE_UNIQUE:
      built_in_id = BuiltInFunction();
      break;
    case SIMPLE_ID:
      fd = FunctionRef();
      break;
    default:
      jj_la1[72] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    if (jj_2_16(2147483647)) {
      arg_count = ActualParameterList(arguments, expressions);
    } else {
      ;
    }
                if (parser_pass == 1) {
                        switch (built_in_id) {
                                case -1: // not a built in function
                                        break;
                                case  0: // unknown built in function, internal error
                                        break;
                                case  1: // ABS - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ABS", null, true);

                                        }
                                        // create instance of abs_function, assign it to function_instance variable.
                                        // set the operand attribute with the value from expressions (Parameter5 from ActualParameterList5() - extract the first Element5 of Vector)
                                        if (expression_instances) {
// printDebug("before creating abs_function instance");
                                                // abs_f = (jsdai.SIso13584_expressions_schema.EAbs_function)expression_model.createEntityInstance(jsdai.SIso13584_expressions_schema.CAbs_function.class);
// printDebug("after creating abs_function instance");
                                                // Object arg_inst = expressions.elementAt(0);
                                                // if (arg_inst instanceof jsdai.SIso13584_expressions_schema.ENumeric_expression) {
                                                        // abs_f.setOperand(null, (jsdai.SIso13584_expressions_schema.ENumeric_expression)arg_inst);
                                                // } else {
                                                        // printError("INSTANTIATING EXPRESSIONS: ABS built-in function argument is not a numeric_expression");
                                                // }
                                                // function_instance = abs_f;
                                        }
                                        break;
                                case  2: // ACOS - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ACOS", null, true);

                                        }
                                        // acos_function
                                        break;
                                case  3: // ASIN - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ASIN", null, true);

                                        }
                                        // asin_function
                                        break;
                                case  4: // ATAN - 2
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ATAN", null, true);

                                        }
                                        break;
                                case  5: // BLENGTH - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function BLENGTH", null, true);

                                        }
                                        break;
                                case  6: // COS  - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function COS", null, true);

                                        }
                                        // cos_function
                                        break;
                                case  7: // EXISTS  - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function EXISTS", null, true);

                                        }
                                        break;
                                case  8: // EXP - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function EXP", null, true);

                                        }
                                        // exp_function
                                        break;
                                case  9: // FORMAT - 2
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function FORMAT", null, true);

                                        }
                                        break;
                                case 10: // HIBOUND - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function HIBOUND", null, true);

                                        }
                                        break;
                                case 11: // HIINDEX - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function HIINDEX", null, true);

                                        }
                                        break;
                                case 12: // LENGTH - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LENGTH", null, true);

                                        }
                                        break;
                                case 13: // LOBOUND  - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOBOUND", null, true);

                                        }
                                        break;
                                case 14: // LOINDEX - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOINDEX", null, true);

                                        }
                                        break;
                                case 15: // LOG - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOG", null, true);

                                        }
                                        // log_function
                                        break;
                                case 16: // LOG2 - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOG2", null, true);

                                        }
                                        // log2_function
                                        break;
                                case 17: // LOG10 - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOG10", null, true);

                                        }
                                        // log10_function
                                        break;
                                case 18: // NVL - 2
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function NVL", null, true);

                                        }
                                        break;
                                case 19: // ODD - 1 
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ODD", null, true);

                                        }
                                        break;
                                case 20: // ROLESOF - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ROLESOF", null, true);

                                        }
                                        break;
                                case 21: // SIN - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function SIN", null, true);

                                        }
                                        break;
                                case 22: // SIZEOF - 1
                                        if (arg_count != 1) {
System.out.println("argument count: "  + arg_count);
                                                error_count++;
//						printErrorMsg5("function call has wrong number of arguments for built-in function SIZEOF", null, true);
System.out.println("> argument count: "  + arg_count);
                                                printErrorMsg5("function call has wrong number of arguments for built-in function SIZEOF: " + arg_count, null, true);
System.out.println(">> argument count: "  + arg_count);

                                        }
                                        break;
                                case 23: // SQRT - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function SQRT", null, true);

                                        }
                                        // square_root_function
                                        break;
                                case 24: // TAN - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function TAN", null, true);

                                        }
                                        // tan_function
                                        break;
                                case 25: // TYPEOF - 1 parameter
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function TYPEOF", null, true);

                                        }
                                        break;
                                case 26: // USEDIN  - 2 parameters
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function USEDIN", null, true);

                                        }
                                        break;
                                case 27: // VALUE - 1 parameter
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function VALUE", null, true);

                                        }
                                        break;
                                case 28: // VALUE_IN - 2  parameters
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function VALUE_IN", null, true);

                                        }
                                        break;
                                case 29: // VALUE_UNIQUE - 1 parameter
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function VALUE_UNIQUE", null, true);

                                        }
                                        break;
                                case 30: // EXTENT - ?  - this is Express X, look up the number of parameters
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has a wrong number of arguments for built-in function EXTENT", null, true);
                                        }
                                        break;
                                default: // must be an internal error.
                                        break;
                        }
                }
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.208------------ */
  static final public void FunctionDecl() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
    try {
                printDebug("In FunctionDecl, starting");
                scope_stack.push(current_scope);
                current_scope = new Vector();
      fd = FunctionHead();
      AlgorithmHead();
                                                  X_ListOfStmt jjtn001 = new X_ListOfStmt(JJTLISTOFSTMT);
                                                  boolean jjtc001 = true;
                                                  jjtree.openNodeScope(jjtn001);
                                                  jjtreeOpenNodeScope(jjtn001);
      try {
        label_25:
        while (true) {
          Stmt();
          switch (jj_nt.kind) {
          case SEMICOLON:
          case ALIAS:
          case BEGIN:
          case CASE:
          case ESCAPE:
          case IF:
          case INSERT:
          case REMOVE:
          case REPEAT:
          case RETURN:
          case KW_SKIP:
          case SIMPLE_ID:
            ;
            break;
          default:
            jj_la1[73] = jj_gen;
            break label_25;
          }
        }
      } catch (Throwable jjte001) {
                                                  if (jjtc001) {
                                                    jjtree.clearNodeScope(jjtn001);
                                                    jjtc001 = false;
                                                  } else {
                                                    jjtree.popNode();
                                                  }
                                                  if (jjte001 instanceof RuntimeException) {
                                                    {if (true) throw (RuntimeException)jjte001;}
                                                  }
                                                  if (jjte001 instanceof ParseException) {
                                                    {if (true) throw (ParseException)jjte001;}
                                                  }
                                                  if (jjte001 instanceof jsdai.lang.SdaiException) {
                                                    {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                                                  }
                                                  {if (true) throw (Error)jjte001;}
      } finally {
                                                  if (jjtc001) {
                                                    jjtree.closeNodeScope(jjtn001, true);
                                                    jjtreeCloseNodeScope(jjtn001);
                                                  }
      }
      jj_consume_token(END_FUNCTION);
                function_depth--;
                if (function_depth > 0) {
                        active_scope = getParentFunctionProcedureRuleDefinition(fd);
                active_scope_string = active_scope_extension.getParent_scope_string();
                  active_scope_extension = active_scope_extension.getParent();
                } else {
                        active_scope = null;
                active_scope_string = active_scope_extension.getParent_scope_string();
                  active_scope_extension = active_scope_extension.getParent();
                }
      jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                printDebug("In FunctionDecl, ending");
                if (parser_pass == 5) {
                }
    } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
        if (parser_pass == 1) {
//		printError(e.getMessage());
                printErrorMsg(e.getMessage(), null, true);
                error_count++;
                System.out.println("ERROR RECOVERY: skipping to END_FUNCTION");
        }
        recoverFromParseException(END_FUNCTION, e);
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.209------------ */
  static final public jsdai.SExtended_dictionary_schema.EFunction_definition FunctionHead() throws ParseException, jsdai.lang.SdaiException {
        String name = null;
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration fund;
        // jsdai.SSdai_expressions_schema.EExpress_function ef = null;
        // jsdai.SSdai_expressions_schema.AVariable ef_parameters = null;
        jsdai.SExtended_dictionary_schema.EParameter rpt = null;
//      jsdai.lang.EEntity rt = null;
        jsdai.SExtended_dictionary_schema.EData_type rt = null;
        jsdai.SExtended_dictionary_schema.AParameter parameters = null;
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
        String key = "";
                printDebug("In FunctionHead, starting");
    jj_consume_token(FUNCTION);
                    function_depth++;
    name = FunctionId();
                if ((parser_pass == 5) && (function_depth > 1)){
//			printWarning("nested functions not yet supported. Inner function: " + name + " in " + active_scope);

// now supported
//			printWarningMsg("" + name + " - inner function, nested functions not yet supported. Inner function", null, true);
                }
                if (parser_pass == 1) {
                        printVerbose("Function: " + name);
                        // construct full name: outer$inner

//			fd = findFunction_definition(name);
                        fd = findFunction_definitionX(name);
                        Token t = getToken(0);
                        if (fd != null) {
                                                error_count++;
//						printError("duplicate function name \"" + name + "\" at line " + t.beginLine + ", column " + t.beginColumn);
                                                printErrorMsg("" + name + " - duplicate function name", null, true);
                        } else {
                                String wrong_name = findAnyName(name);
                                if (wrong_name != null) {
                                                error_count++;
//						printError("duplicate name \"" + name + "\". The same name used for a function and for " + wrong_name + " at line " + t.beginLine + ", column " + t.beginColumn);
                                                printErrorMsg("" + name + " - duplicate function name, the same name is already in use in the current scope", null, true);
                                }
                        }
                  if (function_depth == 1) {
                                fd = (jsdai.SExtended_dictionary_schema.EFunction_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_definition.class);
                                fund = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_declaration$local_declaration.class);
                                fund.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // fund.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                fund.setDefinition(null, fd);
                          active_scope_extension = new ECtScope(active_scope, fd, active_scope_extension, active_scope_string, name, name.toLowerCase());
                                active_scope = fd;
                        active_scope_string = "";
                                hm_current_function_declarations.put(name.toLowerCase(), fund);
                                if (flag_oc) {
                                        fd.setName(null, name);
                                } else {
                                        fd.setName(null, name.toLowerCase());
                                }
                                parameters = fd.createParameters(null);
                        } else {

                                fd = (jsdai.SExtended_dictionary_schema.EFunction_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_definition.class);
                                fund = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_declaration$inner_declaration.class);
                                fund.setDefinition(null, fd);
                                fund.setParent(null, sd);
                                if ((active_scope instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) ||
                                                (active_scope instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule)) {
                                        ((jsdai.SExtended_dictionary_schema.EInner_declaration)fund).setScope(null,active_scope);
                                        key = constructFunctionKey(name);
                                } else {
                                        // probably inner functions on the same level in parallel
System.out.println("ATTENTION! scope not set: " + fund);
                                 key = name.toLowerCase();
                                }
                          active_scope_extension = new ECtScope(active_scope, fd, active_scope_extension, active_scope_string, name, key);
                                active_scope = fd;
                        active_scope_string = "";
                                                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // fund.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                hm_current_function_declarations.put(key, fund);
                                if (flag_oc) {
                                        fd.setName(null, name);
                                } else {
                                        fd.setName(null, name.toLowerCase());
                                }
                                parameters = fd.createParameters(null);


                        }
                } else {
                        if (function_depth == 1) {
//				fd = findFunction_definition(name);
                                fd = findFunction_definitionX(name);
                          active_scope_extension = new ECtScope(active_scope, fd, active_scope_extension, active_scope_string, name, name.toLowerCase());
                                active_scope = fd;
                        active_scope_string = "";
                                if (fd == null) {
                                        error_count++;
                                        if (parser_pass == 2) {
//						printError("function not found: " + name);
                                                printErrorMsg("" + name + " - function not found", null, true);
                                        }
                                        printDebug("FunctionHead - function not found: " + name);
                                } else {
                                        parameters = fd.getParameters(null);
                                }
                        } else {

//				fd = findFunction_definition(name);
                                fd = findFunction_definitionX(name);
                          active_scope_extension = new ECtScope(active_scope, fd, active_scope_extension, active_scope_string, name, constructFunctionKey(name));
                                active_scope = fd;
                        active_scope_string = "";
                                if (fd == null) {
//					error_count++;
//					printErrorMsg5("" + name + " - function not found", null, true);
                                        printDebug("FunctionHead5 - function not found: " + name);
                                } else {
                                        parameters = fd.getParameters(null);
                                }


                        }
                        if (parser_pass == 5) {
                                if (expression_instances) {
                                  // ef = (jsdai.SSdai_expressions_schema.EExpress_function)expression_model.createEntityInstance(jsdai.SSdai_expressions_schema.CExpress_function.class);
                                        // ef.setDefinition(null, fd);
                                        // ef_parameters = ef.createParameters(null);
                                }
                        }
                }
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      FormalParameter(parameters, false, /* ef_parameters, ef*/ null);
      label_26:
      while (true) {
        switch (jj_nt.kind) {
        case SEMICOLON:
          ;
          break;
        default:
          jj_la1[74] = jj_gen;
          break label_26;
        }
        jj_consume_token(SEMICOLON);
        FormalParameter(parameters, false, /* ef_parameters, ef */ null);
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[75] = jj_gen;
      ;
    }
    jj_consume_token(COLON);
    rpt = ParameterType();
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
//                      jjtThis.name = name;
                        if (rpt != null) {
                                if (rpt.testParameter_type(null)) {
                                        rt = rpt.getParameter_type(null);
                                } else {
                                        printDDebug("Oo> parameter_type unset in function_head: " + name);
                                }
                        }
//                      jjtThis.return_type = rt;
                        if (fd != null) {
                                if (rt != null) {
                                        fd.setReturn_type(null, rt);
                                } else {
                                        printDDebug("In FunctionHead, rt is NULL, function: " + name);
                                }
                        }
                        printVerbose("Function: " + name);
                        if (expression_instances) {
                                // if (rt != null) {
                                        // if (rt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) {
                                                // ef.setReturn_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)rt);
                                        // } else
                                        // if (rt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                                // ef.setReturn_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)rt);
                                        // }
                                // }
                        }
                        if (function_depth == 1) {
//				String function_description = "";
                                String function_description = " ";
                                int local_function_depth = 1;
                        for (int i = 1; ; i++) {
                                        Token t = getToken(i);
                                        if (t.kind == FUNCTION) {
                                                local_function_depth++;
                                        }
                                        if (t.kind == END_FUNCTION) {
                                                local_function_depth--;
                                                if (local_function_depth == 0) {
                                                 // printDDebug("Break, function depth: " + local_function_depth);
                                                 break;
                                                } else {
                                                 ; // printDDebug("Continue, function depth: " + local_function_depth);
                                                }

                                        }
                                        if (first_token) {
                                                start_token = t;
                                                end_token = t;
                                                first_token = false;
                                        } else {
                                                end_token = t;
                                        }
                                        // is it really needed to convert to lowercase here?
                                        if (flag_oc) {
                                                function_description += t.image + " ";
                                        } else {
                                                function_description += t.image.toLowerCase() + " ";
                                        }
//					function_description += t.image;
                        }
                                // printDDebug("Function: " + function_description);
                                createExpressEntity(fd, function_description, start_token, end_token);
//				createExpressEntity(fd, function_description);
                        }
                }

                printDebug("In FunctionHead, ending: " + name);
                // return ef;
                {if (true) return fd;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.210------------ */
  static final public String FunctionId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
// printDDebug("## FUNCTION: " + t.image.toLowerCase());
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.211------------ */
// extended - GenericEntityType ----
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralizedTypes(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        // jsdai.lang.EEntity gt = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.lang.EEntity ae = null;
                printDebug("In GeneralizedTypes, starting");
    switch (jj_nt.kind) {
    case GENERIC_ENTITY:
      par = GenericEntityType();
      break;
    case AGGREGATE:
      par = AggregateType();
      break;
    case ARRAY:
    case BAG:
    case LIST:
    case SET:
      par = GeneralAggregationTypes();
      break;
    case GENERIC:
      par = GenericType();
      break;
    default:
      jj_la1[76] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In GeneralizedTypes, ending: " + par + ", in pass: " + parser_pass);
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.212------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralAggregationTypes() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter par = null;
                printDebug("In GeneralAggregationTypes, starting");
    switch (jj_nt.kind) {
    case ARRAY:
      par = GeneralArrayType();
      break;
    case BAG:
      par = GeneralBagType();
      break;
    case LIST:
      par = GeneralListType();
      break;
    case SET:
      par = GeneralSetType();
      break;
    default:
      jj_la1[77] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In GeneralAggregationTypes, ending");
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.213------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralArrayType() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.EArray_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        String bound_name;
        jsdai.lang.EEntity bt;
        boolean optional = false;
        boolean unique = false;
                printDebug("In GeneralArrayType, starting");
    jj_consume_token(ARRAY);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec();
      break;
    default:
      jj_la1[78] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    switch (jj_nt.kind) {
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
                                                         optional = true;
      break;
    default:
      jj_la1[79] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case UNIQUE:
      jj_consume_token(UNIQUE);
                                                                                       unique = true;
      break;
    default:
      jj_la1[80] = jj_gen;
      ;
    }
    par = ParameterType();
                if (parser_pass == 5) {
                        at = (jsdai.SExtended_dictionary_schema.EArray_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CArray_type.class);
                        bound_name = getBoundString(1, bounds, optional, unique);
                        at.setName(null, "_GENERALARRAY" + bound_name + _data_type_name);
                        _data_type_name = "_GENERALARRAY"  + bound_name + _data_type_name;
                        // better check these bounds for array
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_index(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_index(null, bounds[1]);
                        }       else {
//				printWarning("Undefined upper index of an array");
                                printWarningMsg("" + "" + " - undefined upper index of an array", null, true);
                                printDebug("Undefined upper index of an array");
//      at.unsetUpper_index(null);  // no need for that it is unset after creating
                        }
                        // set element_type
                        at.setUnique_flag(null, unique);
                        at.setOptional_flag(null, optional);
// System.out.println("SET OPTIONAL 04, attribute: " + at);
                        if (par.testParameter_type(null)) {
                                at.setElement_type(null, par.getParameter_type(null));
                        } else {
                                printDDebug("Oo> parameter_type unset in general_array_type: ARRAY OF " + par);
                        }
//                      bt = par.getParameter_type(null);
//                      if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type)
//                              at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//                      else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type)
//                              at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//                      else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//                              at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_general_array_type_");

                }
                printDebug("In GeneralArrayType, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.95 ---*/
  static final public void GeneralAttributeQualifier() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(DOT);
    AttributeRef(null, null, -1, null);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.214------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralBagType() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.EBag_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        String bound_name;
        int bound_value;
        jsdai.lang.EEntity bt;
                printDebug("In GeneralBagType, starting");
    jj_consume_token(BAG);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec();
      break;
    default:
      jj_la1[81] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    par = ParameterType();
//System.out.println("<RR>generalbag element type: " + par + ", pass: " + parser_pass);
                if (parser_pass == 5) {

                        boolean must_create = false;
                        if (bounds[1] != null) {
                                if (bounds[1] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[1]).getBound_value(null);
                                        if (bound_value != Integer.MIN_VALUE) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }
                        if (bounds[0] != null) {
                                if (bounds[0] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[0]).getBound_value(null);
                                        if (bound_value != 0) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }

                        if (par != null) {
                                if (par.testParameter_type(null)) {
                                        if (par.getParameter_type(null) != _st_generic) {
                                                must_create = true;
                                        }
                        } else {
                                // why unset?
                                must_create = true;
                        }
                  } else {
                    // not standart type, but, on the other hand, something wrong here
                        must_create = true;
                  }

                        if (must_create) {


                        at = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
                        bound_name = getBoundString(0, bounds, false, false);
                        at.setName(null, "_GENERALBAG" + bound_name + _data_type_name);
                        _data_type_name = "_GENERALBAG" + bound_name + _data_type_name;
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        }       else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                        // set element_type
                        if (par.testParameter_type(null)) {
                                at.setElement_type(null, par.getParameter_type(null));
                        } else {
                                printDDebug("Oo> parameter_type unset in general_bag_type: BAG OF " + par);
                        }

                  } else {
                        at = _st_bag_generic;
//				_data_type_name = "_BAG_GENERIC";
                                _data_type_name = "_GENERALBAG_0_GENERIC";
                  }


//      bt = par.getParameter_type(null);
//	    if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type)
//  	    at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//      else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type)
//  	    at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//      else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//    	  at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_general_bag_type_");
                }


                printDebug("In GeneralBagType, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.215------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralListType() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.EList_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        String bound_name;
        int bound_value;
        jsdai.lang.EEntity bt;
        boolean unique = false;
                printDebug("In GeneralListType, starting");
    jj_consume_token(LIST);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec();
      break;
    default:
      jj_la1[82] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    switch (jj_nt.kind) {
    case UNIQUE:
      jj_consume_token(UNIQUE);
                                                      unique = true;
      break;
    default:
      jj_la1[83] = jj_gen;
      ;
    }
    par = ParameterType();
                if (parser_pass == 5) {

                        boolean must_create = false;
                        if (unique) {
                                must_create = true;
                        }
                        if (bounds[1] != null) {
                                if (bounds[1] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[1]).getBound_value(null);
                                        if (bound_value != Integer.MIN_VALUE) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }
                        if (bounds[0] != null) {
                                if (bounds[0] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[0]).getBound_value(null);
                                        if (bound_value != 0) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }

                        if (par != null) {
                                if (par.testParameter_type(null)) {
                                        if (par.getParameter_type(null) != _st_generic) {
                                                must_create = true;
                                        }
                        } else {
                                // why unset?
                                must_create = true;
                        }
                  } else {
                    // not standart type, but, on the other hand, something wrong here
                        must_create = true;
                  }

                        if (must_create) {


                        at = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
printDDebug(".oO0Oo. LIST TYPE CREATED - GeneralListType pass 4");
                        bound_name = getBoundString(2, bounds, false, unique);
                        at.setName(null, "_GENERALLIST" + bound_name + _data_type_name);
                        _data_type_name = "_GENERALLIST"  + bound_name + _data_type_name;
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        } else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                        // set element_type
                        at.setUnique_flag(null, unique);
                        if (par.testParameter_type(null)) {
                                at.setElement_type(null, par.getParameter_type(null));
                        } else {
//		  		printDDebug("Oo> parameter_type unset i_type: LIST OF " + par);
                        }


                  } else {
                        at = _st_list_generic;
//				_data_type_name = "_LIST_GENERIC";
                                _data_type_name = "_GENERALLIST_0_GENERIC";
                  }

//    bt = par.getParameter_type(null);
//    if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type)
//	    at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//    else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type)
//  	  at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//    else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//    	at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_general_list_type_");
                }


                printDebug("In GeneralListType, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.98 ---*/
// not needed 
  static final public Object GeneralOrMapCall() throws ParseException, jsdai.lang.SdaiException {
        Token t = null;
        jsdai.SExtended_dictionary_schema.ETarget_parameter tp = null;
        Object reference = null;
        String name = null;
                printDebug("In GeneralOrMapCall, starting");
    if (jj_2_17(2147483647)) {
      t = jj_consume_token(SIMPLE_ID);
      jj_consume_token(OP_AT);
                if (t != null) {
                        name = t.image;
                }
    } else {
      ;
    }
    reference = MapCall();
                printDebug("In GeneralOrMapCall, ending");
                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

// not needed anymore

/* - LOOKAHEAD 2 - (Columns 3 & 20) --------------------------------------------------- ISO 10303-11:A.2.216------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at columns 3 and 20.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/
  static final public Object GeneralRef() throws ParseException, jsdai.lang.SdaiException {
        Object return_value = null;
        String name;
                printDebug("In GeneralRef, starting");
    // making changes in the grammar:
            // (LOOKAHEAD(2) return_value = ParameterRef() | return_value = VariableRef() )
                    name = InterpretedId();
//			if (parser_pass == 5) {

//				return_value = findInterpretedId(name);
                                return_value = findInterpretedIdX(name);
//			}

                printDebug("In GeneralRef, ending, name: " + name + ", result: " + return_value + ", parser pass: " + parser_pass);
                {if (true) return return_value;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.100 ---*/
  static final public void GeneralSchemaAliasId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    // SchemaId() | SchemaMapId() | SchemaViewId()
            t = jj_consume_token(SIMPLE_ID);
  }

/*--------- ISO 10303-14:B.2.101 ---*/
  static final public jsdai.SExtended_dictionary_schema.EGeneric_schema_definition GeneralSchemaRef() throws ParseException, jsdai.lang.SdaiException {
  // jsdai.SExtended_dictionary_schema.EGeneric_schema_definition result = null;
  Object result = null;
    //      SchemaRef() | SchemaMapRef() | SchemaViewRef()
    //      SchemaRef()
            result = InterpretedRef(PI_SCHEMA_OR_SCHEMA_MAP_OR_SCHEMA_VIEW);
                {if (true) return (jsdai.SExtended_dictionary_schema.EGeneric_schema_definition)result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.217------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralSetType() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.ESet_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        int bound_value;
        jsdai.lang.EEntity bt;
        String bound_name;
                printDebug("In GeneralSetType, starting");
    jj_consume_token(SET);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec();
      break;
    default:
      jj_la1[84] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    par = ParameterType();
                if (parser_pass == 5) {
                        // see perhaps general set of generic
                        // both bounds must be missing or bound 1 must be 0 and bound 2 must be ?
                        // and the par paramete_type must be standart express type generic
                        // if not - create

                        boolean must_create = false;
                        boolean is_generic = false;
                        if (bounds[1] != null) {
                                if (bounds[1] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[1]).getBound_value(null);
                                        if (bound_value != Integer.MIN_VALUE) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }
                        if (bounds[0] != null) {
                                if (bounds[0] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[0]).getBound_value(null);
                                        if (bound_value != 0) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }

                        if (par != null) {
                                if (par.testParameter_type(null)) {
                                        if ((par.getParameter_type(null) != _st_generic) && (par.getParameter_type(null) != _st_string)) {
                                                must_create = true;
                                        } else {
                                                if (par.getParameter_type(null) == _st_generic) {
                                                        is_generic = true;
                                                }
                                        }
                        } else {
                                // why unset?
                                must_create = true;
                        }
                  } else {
                    // not standart type, but, on the other hand, something wrong here
                        must_create = true;
                  }

                        if (must_create) {
                                at = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
                                bound_name = getBoundString(2, bounds, false, false);
                                at.setName(null, "_GENERALSET" + bound_name + _data_type_name);
                                _data_type_name = "_GENERALSET"  + bound_name + _data_type_name;
                                if (bounds[0] == null) {
                                        b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, 0);
                                        bounds[0] = b1;
                                }
                                at.setLower_bound(null, bounds[0]);
                                if (bounds[1] != null) {
                                        at.setUpper_bound(null, bounds[1]);
                                }       else {
                                        at.unsetUpper_bound(null);  // no need for that it is unset after creating
                                }
                                // set element_type
                                if (par != null) {
                                        if (par.testParameter_type(null)) {
                                                at.setElement_type(null, par.getParameter_type(null));
                                        } else {
                                                printDDebug("Oo> parameter_type unset in general_set_type: SET OF " + par);
                                        }
                                }
                  } else {
                    // again, do we need separate types for generic set and for set?
                    // currently, the same one in dictionary for standard set/generalset type
                    if (is_generic) {
                                at = _st_set_generic;
//					_data_type_name = "_SET_GENERIC";
                                        _data_type_name = "_GENERALSET_0_GENERIC";
                        } else {
                                at = _st_set_string;
//					_data_type_name = "_SET_STRING";
                                        _data_type_name = "_GENERALSET_0_STRING";
                        }
                  }
//    bt = par.getParameter_type(null);
//    if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type)
//	    at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//    else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type)
//  	  at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//    else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//     at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_general_set_type_");


                }
                printDebug("In GeneralSetType, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ Extension to EXPRESS, E2?------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GenericEntityType() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter par = null;
//	jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EData_type ed = null;
        jsdai.SExtended_dictionary_schema.EEntity_declaration edc = null;
        String label = null;
        jsdai.SExtended_dictionary_schema.EDeclaration eld = null;
        jsdai.lang.A_string labels = null;
                printDebug("In GenericEntityType, starting");
    jj_consume_token(GENERIC_ENTITY);
    switch (jj_nt.kind) {
    case COLON:
      jj_consume_token(COLON);
      label = TypeLabel();
      break;
    default:
      jj_la1[85] = jj_gen;
      ;
    }
                _data_type_name = "_ENTITY";
                if (parser_pass == 5) {
                        par = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        par.setName(null, "_generic_entity_");
                        // ed = findEntity_definition("Entity");
                        // changed generic entity from entity_definition to data_type because of bootstrapping problems in lang
//			ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)_st_entity;
                        ed = _st_entity;
//                      if (ed == null) {
//                              ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_definition.class);
//                              eld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
//                              eld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//                              eld.setDefinition(null, ed);
//                              ed.setName(null, "Entity");
//                              ed.setInstantiable(null, false); // guessing
//                              ed.setComplex(null, false);
//                              ed.createSupertypes(null);
                                // now it is inverse
                                // ed.createWhere_rules(null);
                                // no longer
                                // ed.createExplicit_attributes(null);
//                      }
                        par.setParameter_type(null, ed);
                        if (label != null) {
                                labels = par.createType_labels(null);
                                labels.addByIndex(1, label);
                                // par.setType_label(null, label);
                        }
                }
                printDebug("In GenericEntityType, ending");
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.218------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GenericType() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.EData_type gt = null;
        String label = null;
        jsdai.lang.A_string labels = null;
                printDebug("In GenericType, starting");
    jj_consume_token(GENERIC);
    switch (jj_nt.kind) {
    case COLON:
      jj_consume_token(COLON);
      label = TypeLabel();
      break;
    default:
      jj_la1[86] = jj_gen;
      ;
    }
                        _data_type_name = "_GENERIC";
                        if (parser_pass == 5) {
                        par = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        par.setName(null, "_generic_");
                        gt = _st_generic;
                        // gt = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                        par.setParameter_type(null, gt);
                        if (label != null) {
                                labels = par.createType_labels(null);
                                labels.addByIndex(1, label);
//                              par.setType_label(null, label);
                        }
                }
                printDebug("In GenericType, ending: " + par + ", in pass: " + parser_pass);
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.219------------ */
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition GroupQualifier() throws ParseException, jsdai.lang.SdaiException {
 jsdai.SExtended_dictionary_schema.EEntity_definition ed;
                printDebug("In GroupQualifier, starting");
    jj_consume_token(BACKSLASH);
    ed = EntityRef(null);
                if (ed == null) {
                        printDebug("In GroupQualifier, Entity Reference is null");
                }

                if (parser_pass == 5) {
                }
                printDebug("In GroupQualifier, ending");
                {if (true) return ed;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.105 ---*/
  static final public void IdentifiedByClause() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(IDENTIFIED_BY);
    label_27:
    while (true) {
      IdParameter();
      jj_consume_token(SEMICOLON);
      if (jj_2_18(2147483647)) {
        ;
      } else {
        break label_27;
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.106  ---*/
  static final public void IdParameter() throws ParseException, jsdai.lang.SdaiException {
    if (jj_2_19(2)) {
      IdParameterId();
      jj_consume_token(COLON);
    } else {
      ;
    }
    Expression();
  }

/*--------- ISO 10303-14:B.2.107  ---*/
  static final public void IdParameterId() throws ParseException, jsdai.lang.SdaiException {
    ParameterId();
  }

/*-+-------- ISO 10303-14:B.2.108  ---*/
  static final public void IfExpr() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(IF);
    LogicalExpression();

    jj_consume_token(THEN);
    Expression();

    label_28:
    while (true) {
      switch (jj_nt.kind) {
      case ELSIF:
        ;
        break;
      default:
        jj_la1[87] = jj_gen;
        break label_28;
      }
      jj_consume_token(ELSIF);
      LogicalExpression();
      Expression();

    }
    switch (jj_nt.kind) {
    case ELSE:
      jj_consume_token(ELSE);
      Expression();

      break;
    default:
      jj_la1[88] = jj_gen;
      ;
    }
    jj_consume_token(END_IF);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.220------------ */
  static final public void IfStmt() throws ParseException, jsdai.lang.SdaiException {
        Object operand = null;
        Object pop_inst = null;
        int if_count = 0;
        int else_count = 0;
                printDebug("In IfStmt, starting");
//              system.out.println("<><> if count: " + if_count + ", else count: " + else_count);

    jj_consume_token(IF);
               X_IfCondition jjtn001 = new X_IfCondition(JJTIFCONDITION);
               boolean jjtc001 = true;
               jjtree.openNodeScope(jjtn001);
               jjtreeOpenNodeScope(jjtn001);
    try {
      LogicalExpression();
    } catch (Throwable jjte001) {
               if (jjtc001) {
                 jjtree.clearNodeScope(jjtn001);
                 jjtc001 = false;
               } else {
                 jjtree.popNode();
               }
               if (jjte001 instanceof RuntimeException) {
                 {if (true) throw (RuntimeException)jjte001;}
               }
               if (jjte001 instanceof ParseException) {
                 {if (true) throw (ParseException)jjte001;}
               }
               if (jjte001 instanceof jsdai.lang.SdaiException) {
                 {if (true) throw (jsdai.lang.SdaiException)jjte001;}
               }
               {if (true) throw (Error)jjte001;}
    } finally {
               if (jjtc001) {
                 jjtree.closeNodeScope(jjtn001, true);
                 jjtreeCloseNodeScope(jjtn001);
               }
    }
                if (parser_pass == 5) {
                }
    jj_consume_token(THEN);
    label_29:
    while (true) {
      Stmt();
                         if_count++;
      switch (jj_nt.kind) {
      case SEMICOLON:
      case ALIAS:
      case BEGIN:
      case CASE:
      case ESCAPE:
      case IF:
      case INSERT:
      case REMOVE:
      case REPEAT:
      case RETURN:
      case KW_SKIP:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[89] = jj_gen;
        break label_29;
      }
    }
    switch (jj_nt.kind) {
    case ELSE:
      jj_consume_token(ELSE);
      label_30:
      while (true) {
        Stmt();
                                                        else_count++;
        switch (jj_nt.kind) {
        case SEMICOLON:
        case ALIAS:
        case BEGIN:
        case CASE:
        case ESCAPE:
        case IF:
        case INSERT:
        case REMOVE:
        case REPEAT:
        case RETURN:
        case KW_SKIP:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[90] = jj_gen;
          break label_30;
        }
      }
      break;
    default:
      jj_la1[91] = jj_gen;
      ;
    }
    jj_consume_token(END_IF);
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
                }
                printDebug("In IfStmt, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.221------------ */
  static final public int Increment() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.222------------ */
  static final public void IncrementControl() throws ParseException, jsdai.lang.SdaiException {
        ECtVariable var = null;
        String variable_id = null;
        jsdai.lang.EEntity variable_parameter_type = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type = null;
        boolean increment_present = false;
        String variable_key = "";
    variable_id = VariableId();

    jj_consume_token(ASSIGN);
    Bound1(false);
    jj_consume_token(TO);
    Bound2(false);
    switch (jj_nt.kind) {
    case BY:
      jj_consume_token(BY);
      Increment();
                                                                                              increment_present = true;
      break;
    default:
      jj_la1[92] = jj_gen;
      ;
    }
                if (parser_pass == 4) {
                        variable_type = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        variable_type.setName(null, "_implicit_variable_");
                        // variable_type.setParameter_type(null, variable_parameter_type);

// System.out.println("<<>> active_scope: " + active_scope);

                  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension, active_scope_string, "" + variable_uid, variable_id);
                        active_scope_string = "";
//			active_scope = null;  // not using on schema level (yet)

                        variable_key = constructImplicitVariableKey(variable_id, variable_uid);

//			var = new ECtVariable(variable_id, variable_type, function_depth, variable_key, active_scope, true, 1, (String)variable_id_stack.peek());
                        var = new ECtVariable(variable_id, variable_type, function_depth, variable_key, active_scope, true, 1, "");
//			var = new ECtVariable(variable_id, variable_type, (String)variable_id_stack.peek());

                        if (variable_key != null) {
                                if (!(hm_current_variables.containsKey(variable_key))) {
                                        hm_current_variables.put(variable_key, var);
                                } else {
                                        // error - perhaps more than one variable with the same name in a function
                                }
                        } else {
                                System.out.println("INTERNAL ERROR - ImplicitVariable in IncrementControl: " + variable_id + "  - wrong active scope: " + active_scope);
                        }


//			var = new ECtVariable(variable_id, variable_type, (String)variable_id_stack.peek());
                        current_scope.addElement(var);

                } else { // other passes - added to handle interpreted IDs
                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.223------------ */
  static final public int Index() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.224------------ */
  static final public int Index1() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = Index();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.225------------ */
  static final public int Index2() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = Index();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.226------------ */
  static final public Object IndexQualifier(Object general_reference) throws ParseException, jsdai.lang.SdaiException {
        int ind1 = Integer.MIN_VALUE;
        int ind2 = Integer.MIN_VALUE;
//	jsdai.lang.EEntity reference = null;
        Object reference = null;
//	jsdai.SExtended_dictionary_schema.EData_type gen_data = null;
        Object gen_data = null;
                printDebug("In IndexQualifier, starting");
    jj_consume_token(LBRACKET);
    ind1 = Index1();
    switch (jj_nt.kind) {
    case COLON:
      jj_consume_token(COLON);
      ind2 = Index2();
      break;
    default:
      jj_la1[93] = jj_gen;
      ;
    }
    jj_consume_token(RBRACKET);
                if (parser_pass == 5) {
                }
                printDebug("In IndexQualifier, ending");
                {if (true) return gen_data;}
    throw new Error("Missing return statement in function");
  }

// REMOVED IN DIS
/*--------- ISO 10303-14:B.2.116  ---*/
/*
String InstanceId() throws jsdai.lang.SdaiException :
{
	Token t;
}
{
	t = <SIMPLE_ID>
	{
		return (t.image.toLowerCase());
		}
}
*/

/*--------- ISO 10303-14:B.2.117  ---*/
  static final public int InstantiationForeachControl() throws ParseException, jsdai.lang.SdaiException {
        ECtVariable var1 = null;
        ECtVariable var2 = null;
        String iterator_name;
        String index_name;
        jsdai.SExtended_dictionary_schema.EParameter variable_type1 = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type2 = null;
        String variable_key1 = "";
        String variable_key2 = "";

        String variable_id = null;
        String var_id = "";

        ECtScope active_scope_extension_prev = null;
// ---

                printDebug("In InstantiationForeachControl, starting");

//0		variable_uid++;
//0		var_id += "_implicit_" + variable_uid + "_";
//		variable_id_stack.push(var_id);
//0		scope_stack.push(current_scope);
//0		current_scope = new Vector();

    jj_consume_token(EACH);
    iterator_name = VariableId();
    jj_consume_token(IN);
    SourceAttributeReference();
    jj_consume_token(INDEXING);
    index_name = VariableId();
                if (parser_pass == 4) {
                        variable_type1 = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        variable_type1.setName(null, "_implicit_variable_");

                        active_scope_extension_prev = active_scope_extension;

                  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension, active_scope_string, "" + variable_uid, iterator_name);
                        active_scope_string = "";

                        variable_key1 = constructImplicitVariableKey(iterator_name, variable_uid);
                        var1 = new ECtVariable(iterator_name, variable_type1, 0, variable_key1, active_scope, true, 1, "");
                        if (variable_key1 != null) {
                                if (!(hm_current_variables.containsKey(variable_key1))) {
                                        hm_current_variables.put(variable_key1, var1);
                                } else {
                                        // error - perhaps more than one variable with the same name in a function
                                }
                        } else {
                                System.out.println("INTERNAL ERROR - ImplicitVariable - iterator in InstantiationForeachControl: " + iterator_name + "  - wrong active scope: " + active_scope);
                        }
                        current_scope.addElement(var1);

                        variable_type2 = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        variable_type2.setName(null, "_implicit_variable_");



//		  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension_prev, active_scope_string, "" + variable_uid, index_name);
// 			active_scope_string = "";

//		  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension_prev, active_scope_string, "" + variable_uid, index_name);
// 			active_scope_string = "";

                                active_scope_extension.set2ndId("" + variable_uid);
                                active_scope_extension.set2ndKey(index_name);

                        variable_key2 = constructImplicitVariableKey(index_name, variable_uid);
                        var2 = new ECtVariable(index_name, variable_type2, 0, variable_key2, active_scope, true, 1, "");
                        if (variable_key2 != null) {
                                if (!(hm_current_variables.containsKey(variable_key2))) {
                                        hm_current_variables.put(variable_key2, var2);
                                } else {
                                        // error - perhaps more than one variable with the same name in a function
                                }
                        } else {
                                System.out.println("INTERNAL ERROR - ImplicitVariable - index in InstantiationForeachControl: " + index_name + "  - wrong active scope: " + active_scope);
                        }
                        current_scope.addElement(var2);

                } else {
                        var1 = new ECtVariable(iterator_name, null);
                        current_scope.addElement(var1);
                        var2 = new ECtVariable(index_name, null);
                        current_scope.addElement(var2);
                }
                {if (true) return (2);}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.118  ---*/
  static final public boolean InstantiationLoopControl() throws ParseException, jsdai.lang.SdaiException {
        boolean increment_present = false;
        int increments_present = 0;
                printDebug("In InstantiationLoopControl, starting");


//0		variable_uid++;
//		var_id += "_implicit_" + variable_uid + "_";

//0		scope_stack.push(current_scope);
//0		current_scope = new Vector();

    switch (jj_nt.kind) {
    case EACH:
      increments_present = InstantiationForeachControl();
      break;
    default:
      jj_la1[94] = jj_gen;
      increment_present = RepeatControl();
    }
                if (increments_present > 0) increment_present = true;
                printDebug("In InstantiationLoopControl, ending");
                {if (true) return increment_present;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.227------------ */
  static final public jsdai.SExtended_dictionary_schema.EInteger_type IntegerType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EInteger_type it = null;
    jj_consume_token(INTEGER);
                if (parser_pass == 3) {
                        // it = (jsdai.SExtended_dictionary_schema.EInteger_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_type.class);
                        it = _st_integer;
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (it == null) {
                                // it = (jsdai.SExtended_dictionary_schema.EInteger_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_type.class);
                                it = _st_integer;
                printDDebug("In integer_type, pass > 3, dd = null: " + it);
                        }
                }
                printDDebug("In integer_type, ending: " + it);
                {if (true) return it;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.228 ------------ */
  static final public void InterfaceSpecification(Vector used_vector, Vector referenced_vector) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case REFERENCE2:
      Reference2Clause(referenced_vector);
      break;
    case REFERENCE:
      ReferenceClause(referenced_vector);
      break;
    case USE:
      UseClause(used_vector);
      break;
    default:
      jj_la1[95] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.229------------ */
  static final public void Interval() throws ParseException, jsdai.lang.SdaiException {
        Object low = null;
        Object item = null;
        Object high = null;
        Object result = null;
        Object pop_inst_low = null;
        Object pop_inst_item = null;
        Object pop_inst_high = null;
        Object exp_inst_result = null;
                printDebug("In Interval, starting");
    jj_consume_token(LBRACE);
    IntervalLow();
                if (parser_pass == 5) {
                }
    IntervalOp();
    IntervalItem();
                if (parser_pass == 5) {
                }
    IntervalOp();
    IntervalHigh();
                if (parser_pass == 5) {
                }
    jj_consume_token(RBRACE);
                if (parser_pass == 5) {
                }
                printDebug("In Interval, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.230------------ */
  static final public void IntervalHigh() throws ParseException, jsdai.lang.SdaiException {
    SimpleExpression();
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.231------------ */
  static final public void IntervalItem() throws ParseException, jsdai.lang.SdaiException {
    SimpleExpression();
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.232------------ */
  static final public void IntervalLow() throws ParseException, jsdai.lang.SdaiException {
    SimpleExpression();
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.233------------ */
  static final public void IntervalOp() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case LT:
      jj_consume_token(LT);
      break;
    case LE:
      jj_consume_token(LE);
      break;
    default:
      jj_la1[96] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.234------------ */
  static final public void InverseAttr(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute a;
        jsdai.SExtended_dictionary_schema.EAttribute a2;
        jsdai.SExtended_dictionary_schema.EInverse_attribute ia;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed2;
        jsdai.SExtended_dictionary_schema.EExplicit_attribute ar = null;
//  jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        boolean duplicates = false;
        int bag_set = -1;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
    a = AttributeDecl(ed, 2);
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case BAG:
    case SET:
      switch (jj_nt.kind) {
      case SET:
        jj_consume_token(SET);
                 duplicates = false; bag_set = 0;
        break;
      case BAG:
        jj_consume_token(BAG);
                                                          duplicates = true; bag_set = 1;
        break;
      default:
        jj_la1[97] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      switch (jj_nt.kind) {
      case LBRACKET:
        bounds = BoundSpec();
        break;
      default:
        jj_la1[98] = jj_gen;
        ;
      }
      jj_consume_token(OF);
      break;
    default:
      jj_la1[99] = jj_gen;
      ;
    }
    ed2 = EntityRef(null);
    jj_consume_token(FOR);
    a2 = AttributeRef(ed, ed2, 3, null);
    jj_consume_token(SEMICOLON);
                if (parser_pass > 3)
                {
                        ia = (jsdai.SExtended_dictionary_schema.EInverse_attribute)a;

// ERROR the direct attribute of the referencing entity must be explicit attribute
// System.out.println("<><> a2: " + a2.getName(null) + ", entity: " + a2.getParent_entity(null).getName(null));
                        if (a2 instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                ar = (jsdai.SExtended_dictionary_schema.EExplicit_attribute)a2;
                        } else {
                                error_count++;
                                Token t = getToken(0);
                        int line = t.beginLine;
                        int column = t.beginColumn;
                                if (a2 instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
//					printError("On line " + line + ", column " + column + ": An attempt to use in the declaration of an inverse attribute a derived attribute as the direct attribute of the referencing entity. Direct attribute: " + a2.getName(null));
                                        printErrorMsg("" + a2.getName(null) + " - an attempt to use in the declaration of an inverse attribute a derived attribute as the direct attribute of the referencing entity", null, true);
                                } else {
//					printError("On line " + line + ", column " + column + ": An attempt to use in the declaration of an inverse attribute not an explicit attribute as the direct attribute of the referencing entity. Direct attribute: " + a2);
// this one
                                        printErrorMsg("" + a2 + " - an attempt to use in the declaration of an inverse attribute not an explicit attribute as the direct attribute of the referencing entity", null, true);
                                }
                                printDebug("error in InverseAttr, not explicit: " + a2 + ", in pass " + parser_pass );
                        }

                        if (ia != null) {
                                if (ed2 != null) {
                                                ia.setDomain(null, ed2);
                                } else {
                                        printVerbose("ERROR - inverse attribute domain ed2 is null");
                                }
                                if (ar != null) {
                                        ia.setInverted_attr(null, ar);
                                } else {
                                        printVerbose("ERROR - inverse attribute inverted_attr ar is null");
                                }
                                if (bag_set < 0) { // single entity, no set or bag
                                        duplicates = false;
                                        ia.unsetMin_cardinality(null);  // not really needed.
                                        ia.unsetMax_cardinality(null);  // not really needed.
                                }
                                else {
                                        if (bounds[0] == null) {
                                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                                b1.setBound_value(null, 0);
                                                bounds[0] = b1;
                                        }
                                        ia.setMin_cardinality(null,bounds[0]);
                                        if (bounds[1] != null) {
                                                ia.setMax_cardinality(null,bounds[1]);
                                        }
                                }
                                ia.setDuplicates(null, duplicates);

                        } else {
                                printVerbose("ignoring previous errors, ERROR: inverse attribute ia is NULL");
                        }

                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.235------------ */
  static final public void InverseClause(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(INVERSE);
    label_31:
    while (true) {
      InverseAttr(ed);
      switch (jj_nt.kind) {
      case SELF:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[100] = jj_gen;
        break label_31;
      }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.236------------ */
  static final public String Label() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.237------------ */
  static final public jsdai.SExtended_dictionary_schema.EList_type ListType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EList_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        jsdai.lang.EEntity bt;
        String bound_name;
        boolean unique = false;
    jj_consume_token(LIST);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec();
      break;
    default:
      jj_la1[101] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    switch (jj_nt.kind) {
    case UNIQUE:
      jj_consume_token(UNIQUE);
                                                     unique = true;
      break;
    default:
      jj_la1[102] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (whose != null) {
                          if (!(whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute)) {
//					at = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//					at.setUnique_flag(null, unique); 
                                }
//				bound_name = getBoundString(0, bounds, false, unique);
//				at.setName(null, "_LIST" + bound_name + _data_type_name);
//				_data_type_name = "_LIST"  + bound_name + _data_type_name;
                        }
                } else
                if (parser_pass == 4) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//				bound_name = getBoundString(0, bounds, false, unique);
//				at.setName(null, "_LIST" + bound_name + _data_type_name);
//				_data_type_name = "_LIST"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                        }
                } else
                if (parser_pass == 5) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//				bound_name = getBoundString(0, bounds, false, unique);
//				at.setName(null, "_LIST" + bound_name + _data_type_name);
//				_data_type_name = "_LIST"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                        }
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        } else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                }
                if ((parser_pass == 5) && (at == null)) {
                        printDDebug("XP ########### ListType is NULL: " + _data_type_name);
                }
    bt = BaseType(at);
                if (parser_pass > 3) {
                        // set element_type
//			if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        if (!(at.testElement_type(null))) {
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EData_type) {
                                        at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EData_type)bt);
                                } else {
                                  // express amendment issue
                                        printDDebug("in listType, error while setting Element_type, base type: " + bt + "list type: " +at);
                                }
                        }
                }
                bound_name = getBoundString(0, bounds, false, unique);
                _data_type_name = "_LIST"  + bound_name + _data_type_name;
                if (at != null) {
                        at.setName(null, _data_type_name);
                }
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.238------------ */
  static final public void Literal() throws ParseException, jsdai.lang.SdaiException {
        Token t = null;
        String s;
        Integer l;
        int logical_value;
        Double d;
        BitSet b;
        String str_value;
        String x_operand = "";
        jsdai.lang.Binary blt = null;
                printDebug("In Literal, starting");
    switch (jj_nt.kind) {
    case BINARY_LITERAL:
      t = jj_consume_token(BINARY_LITERAL);
                printDebug("In Binary literal: " + t.image);

                if (parser_pass == 5) {
                }
      break;
    case INTEGER_LITERAL:
      t = jj_consume_token(INTEGER_LITERAL);
                printDebug("In Integer literal: " + t.image);
                if (parser_pass == 5) {
                }
      break;
    case FALSE:
    case TRUE:
    case UNKNOWN:
      logical_value = LogicalLiteral();
                if (parser_pass == 5) {
                }
      break;
    case REAL_LITERAL:
      t = jj_consume_token(REAL_LITERAL);
                printDebug("In Real literal: " + t.image);
                if (parser_pass == 5) {
                }
      break;
    case ENCODED_STRING_LITERAL:
    case SIMPLE_STRING_LITERAL:
      str_value = StringLiteral();
                if (parser_pass == 5) {
                }
      break;
    default:
      jj_la1[103] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.239------------ */
  static final public void LocalDecl() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In LocalDecl, starting");
    jj_consume_token(LOCAL);
    label_32:
    while (true) {
      LocalVariable();
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[104] = jj_gen;
        break label_32;
      }
    }
    jj_consume_token(END_LOCAL);
    jj_consume_token(SEMICOLON);
                printDebug("In LocalDecl, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.240------------ */
  static final public void LocalVariable() throws ParseException, jsdai.lang.SdaiException {
        Object operand = null;
        Object pop_inst = null;
        Vector variable_ids = new Vector();
        String str = null;
        jsdai.SExtended_dictionary_schema.EParameter par_type = null;
        ECtVariable var = null;
        String variable_key = null;
                printDebug("In LocalVariable, starting");
    str = VariableId();
                            variable_ids.addElement(str);
    label_33:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[105] = jj_gen;
        break label_33;
      }
      jj_consume_token(COMMA);
      str = VariableId();
                                                                                  variable_ids.addElement(str);
    }
    jj_consume_token(COLON);
    par_type = ParameterType();
    switch (jj_nt.kind) {
    case ASSIGN:
      jj_consume_token(ASSIGN);
      Expression();
                if (parser_pass == 5) {
                }
      break;
    default:
      jj_la1[106] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 4) {
if (par_type == null) {
        ; // printDDebug("#123: parameter type = NULL");
} else {
        ; // printDDebug("#123: parameter type NOT NULL");
}
                        // make ECtVariable instances and add them to the current_scope
                        for (int i = 0; i < variable_ids.size(); i++) {
                                String id = (String)variable_ids.elementAt(i);
                                variable_key = constructVariableParameterKey(id);
                                var = new ECtVariable(id, par_type, function_depth, variable_key, active_scope);
//if (id.equalsIgnoreCase("result")) {
//	System.out.println(">>>>>>>>>>>>>>>> var: " + id + ", par_type: " + par_type + ", key: " + variable_key + ", scope: " + active_scope);
//}
                                if (variable_key != null) {
                                        if (!(hm_current_variables.containsKey(variable_key))) {
                                                hm_current_variables.put(variable_key, var);
                                        } else {
                                                // error - perhaps more than one variable with the same name in a function
                                        }
                                } else {
                                        System.out.println("INTERNAL ERROR - LocalVariable, 1st: " + str + ", current: " + id + "  - wrong active scope: " + active_scope);
                                }
                                current_scope.addElement(var);
                        }
                } else { // other passes - added to handle interpreted IDs
                        // find it, it is already created		

/*
			for (int i = 0; i < variable_ids.size(); i++) {
				String id = (String)variable_ids.elementAt(i);
		//		var = new ECtVariable(id, par_type);
System.out.println("<about to find var, 02, name: " + id); 
				var = findVariableX(id);
				current_scope.addElement(var);
			}
*/
                }
                printDebug("In LocalVariable, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.241------------ */
  static final public void LogicalExpression() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In LogicalExpression, starting");
    Expression();
                printDebug("In LogicalExpression, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.242------------ */
  static final public int LogicalLiteral() throws ParseException {
        int return_value = -1;
                printDebug("In Logical literal");
    switch (jj_nt.kind) {
    case FALSE:
      jj_consume_token(FALSE);
                return_value = 1;
                if (parser_pass == 5) {
                        argument_stack.push(new Integer(0));
                        printStack("PUSH: Literal: <LOGICAL_LITERAL>: FALSE");
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
      break;
    case TRUE:
      jj_consume_token(TRUE);
                return_value = 2;
                if (parser_pass == 5) {
                        argument_stack.push(new Integer(1));
                        printStack("PUSH: Literal: <LOGICAL_LITERAL>: TRUE");
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
      break;
    case UNKNOWN:
      jj_consume_token(UNKNOWN);
                return_value = 3;
                if (parser_pass == 5) {
                        argument_stack.push(new Integer(2));
                        printStack("PUSH: Literal: <LOGICAL_LITERAL>: UNKNOWN");
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
      break;
    default:
      jj_la1[107] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return return_value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.243------------ */
  static final public jsdai.SExtended_dictionary_schema.ELogical_type LogicalType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ELogical_type lt = null;
    jj_consume_token(LOGICAL);
                if (parser_pass == 3) {
                        // lt = (jsdai.SExtended_dictionary_schema.ELogical_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLogical_type.class);
                        lt = _st_logical;
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (lt == null) {
                                // lt = (jsdai.SExtended_dictionary_schema.ELogical_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLogical_type.class);
                                lt = _st_logical;
                        }
                }
                {if (true) return lt;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.133  ---*/
  static final public void MapAttributeDeclaration() throws ParseException, jsdai.lang.SdaiException {
        Object general_reference = null;
        Object qualified_reference = null;
        Object operand = null;
                printDebug("In MapAttributeDeclaration, starting");
    //	[ TargetParameterRef() [ IndexQualifier() ] [ GroupQualifier() ] "." ] AttributeRef(null, null, -1, null) [ IndexQualifier() ] ":=" MapAttrAssgnmtExpr() ";"
            // <SIMPLE_ID> choice conflict, better to reach "." here, but expression in index qualifier, number unknown
            // have to fix IndexQualifier() argument
    
    
    
    // Antano	[  LOOKAHEAD(TargetParameterRef() [ IndexQualifier(null) ] [ GroupQualifier() ] "." ) TargetParameterRef() [ IndexQualifier(null) ] [ GroupQualifier() ] "." ] AttributeRef(null, null, -1, null) [ IndexQualifier(null) ] ":=" Expression() ";"
    
    
    //previous	[  LOOKAHEAD(TargetParameterRef() [ IndexQualifier(null) ] [ GroupQualifier() ] "." ) TargetParameterRef() [ IndexQualifier(null) ] [ GroupQualifier() ] "." ] AttributeRef(null, null, -1, null) [ IndexQualifier(null) ] ":=" Expression() ";"
    
    //	[  LOOKAHEAD(TargetParameterRef() [ IndexQualifier(null) ] [ GroupQualifier() ] "." ) TargetParameterRef() [ IndexQualifier(null) ] [ GroupQualifier() ] "." ] AttributeRef(null, null, -1, null) [ IndexQualifier(null) ] ":=" Expression() ";"
    
    
    //	[  LOOKAHEAD(TargetParameterRef() [ IndexQualifier(null) ] [ GroupQualifier() ] "." ) general_reference = TargetParameterRef() 
    
    //	general_reference = TargetParameterRef() 
            general_reference = TargetParameterRefStrict();
                if (parser_pass == 5) {
                }
    label_34:
    while (true) {
      switch (jj_nt.kind) {
      case LBRACKET:
      case DOT:
      case BPATH:
      case FPATH:
      case BACKSLASH:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[108] = jj_gen;
        break label_34;
      }
      qualified_reference = Qualifier(general_reference);
                general_reference = qualified_reference;
                if (parser_pass == 5) {
                }
    }
    jj_consume_token(ASSIGN);
    Expression();
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
                }
                printDebug("In MapAttributeDeclaration, ending");
  }

/*--------- ISO 10303-14:B.2.134  ---*/
// eliminated
/*
void MapAttrAssgnmtExpr() throws jsdai.lang.SdaiException :
{}
{
	Expression() | IfExpr() | CaseExpr() | ForExpr()
}
*/

/*-+-------- ISO 10303-14:B.2.135  ---*/
// Object MapCall(jsdai.SExtended_dictionary_schema.ETarget_parameter tp) throws jsdai.lang.SdaiException :
//Object MapCall(String target_parameter_name) throws jsdai.lang.SdaiException :
  static final public Object MapCall() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EMap_definition md = null;
        jsdai.SExtended_dictionary_schema.EMap_or_view_partition partition = null;
  // here target_parameter can be found from its name and map definition md
        jsdai.SExtended_dictionary_schema.ETarget_parameter tp = null;
//		printDebug("In MapCall, starting, target parameter name: " + target_parameter_name);
                printDebug("In MapCall, starting");
    if (jj_2_20(2147483647)) {
      tp = TargetParameterRef();
      jj_consume_token(OP_AT);
    } else {
      ;
    }
    md = MapRef();
    switch (jj_nt.kind) {
    case BACKSLASH:
      partition = PartitionQualification(md);
      break;
    default:
      jj_la1[109] = jj_gen;
      ;
    }
    jj_consume_token(LPAREN);
    ExpressionOrWild();
    label_35:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[110] = jj_gen;
        break label_35;
      }
      jj_consume_token(COMMA);
      ExpressionOrWild();
    }
    jj_consume_token(RPAREN);
                printDebug("In MapCall, ending");
        {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.136  ---*/
  static final public void MapDecl() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EMap_definition md = null;
        jsdai.SExtended_dictionary_schema.EMap_declaration mdc = null;
        String map_name;
                target_parameter_order_count = 0;
                scope_stack.push(current_scope);
                current_scope = new Vector();
    jj_consume_token(MAP);
    map_name = MapId();
    jj_consume_token(AS);
                printDebug("In MapDecl, starting: " + map_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        md = findMap_definition(map_name, null);
                        if (md != null) {
                                error_count++;
//				printError("duplicate map name \"" + map_name + "\"");
                                printErrorMsg("" + map_name + " - duplicate map name", null, true);
                        } else {
                                String wrong_name = findAnyName(map_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + map_name + "\". The same name used for a map and for " + wrong_name);
                                        printErrorMsg("" + map_name + " - duplicate map name, the name is already in use in the current scope", null, true);
                                }
                                md = (jsdai.SExtended_dictionary_schema.EMap_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CMap_definition.class);


                          active_scope_extension = new ECtScope(active_scope, md, active_scope_extension, active_scope_string, map_name, map_name.toLowerCase());
                                active_scope = md;
                        active_scope_string = "";


printDDebug("active_scope in map 1: " + active_scope);
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                mdc = (jsdai.SExtended_dictionary_schema.EMap_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$map_declaration.class);


//				mdc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                mdc.setParent(null, sd);
                                mdc.setDefinition(null, md);

                                md.setName(null, map_name);
                                // supertypes - added this attribute
//				md.createSupertypes(null);
//				md.createSuper_type(null);
                        }
                } else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper()
                        md = findMap_definition(map_name, null);

                  active_scope_extension = new ECtScope(active_scope, md, active_scope_extension, active_scope_string, map_name, map_name.toLowerCase());
                        active_scope = md;
                active_scope_string = "";


                        if (parser_pass == 5) {
                        }

printDDebug("active_scope in map 2: " + active_scope);
                        if (md == null) {
                                error_count++;
//				printError("MapDecl - the map not found: " + map_name);
                                printErrorMsg("" + map_name + "- map not found", null, true);
                        }
                }
                // createDocumentationEntity2(md, a_token);

                target_parameter_order_count = 0;
    label_36:
    while (true) {
      TargetParameter(md);
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[111] = jj_gen;
        break label_36;
      }
    }
    switch (jj_nt.kind) {
    case FOR:
    case FROM:
    case IDENTIFIED_BY:
    case LOCAL:
    case ORDERED_BY:
    case PARTITION:
    case RETURN:
    case SELECT:
    case WHERE:
      BindingHeader(md);
      MapDeclBody();
      label_37:
      while (true) {
        switch (jj_nt.kind) {
        case FOR:
        case FROM:
        case IDENTIFIED_BY:
        case LOCAL:
        case ORDERED_BY:
        case PARTITION:
        case RETURN:
        case SELECT:
        case WHERE:
          ;
          break;
        default:
          jj_la1[112] = jj_gen;
          break label_37;
        }
        BindingHeader(md);
        MapDeclBody();
      }
      break;
    case SUBTYPE:
      MapSubtypeOfClause(md);
      SubtypeBindingHeader(md);
      MapDeclBody();
      label_38:
      while (true) {
        switch (jj_nt.kind) {
        case PARTITION:
        case WHERE:
          ;
          break;
        default:
          jj_la1[113] = jj_gen;
          break label_38;
        }
        SubtypeBindingHeader(md);
        MapDeclBody();
      }
      break;
    default:
      jj_la1[114] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    jj_consume_token(END_MAP);
                active_scope = null;
if (active_scope_extension == null) {
        System.out.println("MapDecl: active_scope_extension = NULL");
}
                active_scope_string = active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();
    jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                printDebug("In MapDecl, ending");
  }

/*-+-------- ISO 10303-14:B.2.137  ---*/
  static final public void MapDeclBody() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In MapDeclBody, starting");
    switch (jj_nt.kind) {
    case FOR:
      label_39:
      while (true) {
        EntityInstantiationLoop();
        if (jj_2_21(2147483647)) {
          ;
        } else {
          break label_39;
        }
      }
      break;
    case SELECT:
      MapProjectClause();
      break;
    case RETURN:
      jj_consume_token(RETURN);
      Expression();
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[115] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In MapDeclBody, ending");
  }

/*--------- ISO 10303-14:B.2.138  ---*/
  static final public String MapId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.139  ---*/
  static final public void MapProjectClause() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In MapProjectClause, starting");
    jj_consume_token(SELECT);
    label_40:
    while (true) {
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[116] = jj_gen;
        break label_40;
      }
      MapAttributeDeclaration();
    }
                printDebug("In MapProjectClause, ending");
  }

/*--------- ISO 10303-14:B.2.140  ---*/
  static final public jsdai.SExtended_dictionary_schema.EMap_definition MapRef() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EMap_definition result = null;
        String name;
    name = MapId();
                result = findMap_definition(name, null);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.141  ---*/
  static final public jsdai.SExtended_dictionary_schema.EMap_definition MapReference() throws ParseException, jsdai.lang.SdaiException {
        Object map_reference = null;
    if (jj_2_22(2)) {
      InterpretedRef(PI_SCHEMA_MAP);
      jj_consume_token(DOT);
    } else {
      ;
    }
    map_reference = InterpretedRef(PI_MAP);
                {if (true) return (jsdai.SExtended_dictionary_schema.EMap_definition)map_reference;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.142  ---*/
  static final public void MapSubtypeOfClause(jsdai.SExtended_dictionary_schema.EMap_definition md) throws ParseException, jsdai.lang.SdaiException {
        // Object supertype_obj = null;
        jsdai.SExtended_dictionary_schema.EMap_definition supertype = null;
        jsdai.SExtended_dictionary_schema.AMap_definition supertypes = null;
                printDebug("In MapSubtypeOfClause, starting");
    jj_consume_token(SUBTYPE);
    jj_consume_token(OF);
    jj_consume_token(LPAREN);
    supertype = MapReference();
    jj_consume_token(RPAREN);
    jj_consume_token(SEMICOLON);
                if (parser_pass == 2) {
//			supertypes = md.createSupertypes(null);
//			supertypes = md.createSuper_type(null);
//			supertypes.addByIndex(1, supertype);		

//		supertype = (jsdai.SExtended_dictionary_schema.EMap_definition)supertype_obj;
// System.out.println(" map supertype: " + supertype);
                                md.setSuper_type(null, supertype);
                }
                printDebug("In MapSubtypeOfClause, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.244------------ */
  static final public int MultiplicationLikeOp() throws ParseException, jsdai.lang.SdaiException {
        int operation = 0;
    switch (jj_nt.kind) {
    case STAR:
      jj_consume_token(STAR);
              operation = 1;
      break;
    case SLASH:
      jj_consume_token(SLASH);
                                       operation = 2;
      break;
    case DIV:
      jj_consume_token(DIV);
                                         operation = 3;
      break;
    case MOD:
      jj_consume_token(MOD);
                                         operation = 4;
      break;
    case AND:
      jj_consume_token(AND);
                                         operation = 5;
      break;
    case 213:
      jj_consume_token(213);
                                        operation = 6;
      break;
    default:
      jj_la1[117] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                                        {if (true) return operation;}
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 17) --------------------------------------------------- ISO 10303-11:A.2.245------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at columns 3 and 17.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/
//  (LOOKAHEAD(2) a_type = EntityRef() | a_type = TypeRef(0))
//  TypeRef()

// new interpreted identifier NamedTypeRef() introduced into the grammar instead of EntityRef() | TypeRef)
// must also cover ViewRef() now for ExpressX
  static final public jsdai.SExtended_dictionary_schema.ENamed_type NamedTypes(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ENamed_type nt = null;
                        printDebug("In NamedTypes, starting is pass " + parser_pass + ", from: " + whose);
    nt = NamedTypeRef();
                        if (nt != null) {
                                if (nt.testName(null)) {
                                        _data_type_name = "_" + nt.getName(null);
                                }
                                printDebug("In NamedTypes, ending in pass: " + parser_pass + ": " + nt.getName(null));
                        } else {
                                printDebug("In NamedTypes, ending - null ");
                        }

                        {if (true) return nt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ introduced by eRRe ------------ */
  static final public String NamedTypeId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 23 & 36) ------------------------------------------------ ISO 10303-11:A.2.246------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at columns 23 and 36.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/
  static final public jsdai.SExtended_dictionary_schema.EDeclaration NamedTypeOrRename(jsdai.lang.SdaiModel interfaced_model) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESchema_definition interfaced_schema = null;
        String named_type_name;
  String alias_name = null;
        jsdai.SExtended_dictionary_schema.ENamed_type nt = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
    named_type_name = NamedTypeId();
                if (parser_pass == 2) {
                        if (interfaced_model != null) {
                                interfaced_schema = getSchema_definitionFromModel(interfaced_model);
                        }
                        ed = findInterfacedEntity_definition(interfaced_model, named_type_name);
                        if (ed == null) {
                                dt = findInterfacedDefined_type(interfaced_model, named_type_name);
                                if (dt == null) {
                                        error_count++;
                                        if (interfaced_schema != null ) {
//						printError("interfaced named type \"" + named_type_name + "\" not found in schema: " + interfaced_schema.getName(null).toLowerCase());
                                                printErrorMsg("" + named_type_name + " - interfaced named type not found in schema: " + interfaced_schema.getName(null), null, true);
                                                printDebug("USE FROM: interfaced named type \"" + named_type_name + "\" not found in model: " + interfaced_model.getName());
                                        } else {
//						printError("interfaced named type \"" + named_type_name + "\" not found because schema itself not found");
                                                printErrorMsg("" + named_type_name + " - interfaced named type not found because the interfaced schema itself not found", null, true);
                                                printDebug("USE FROM: interfaced named type \"" + named_type_name + "\" not found in model: NULL");
                                        }
                                } else {
//                                      tdc = checkTypeUsedDeclaration(dt);
//                                      if (tdc == null ) {
                                        if (neededTypeUsedDeclaration(dt)) {
                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CType_declaration$used_declaration.class);
                                                dc.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                // }
                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)dt);
                                                if (!(hm_current_type_declarations.containsKey(named_type_name.toLowerCase()))) {
                                                        hm_current_type_declarations.put(named_type_name.toLowerCase(), dc);
                                                }
                                                dt.setTemp(FLAG_USED);
                                        }
                                }
                        } else { // entity_definition
//                                      edc = checkEntityUsedDeclaration(ed);
//                                      if (edc == null ) {
                                        if (neededEntityUsedDeclaration(ed)) {
                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$used_declaration.class);
                                                dc.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                // }
                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)ed);
                                                if (!(hm_current_entity_declarations.containsKey(named_type_name.toLowerCase()))) {
                                                        hm_current_entity_declarations.put(named_type_name.toLowerCase(), dc);
                                                }
                                                Object t_object = ed.getTemp();
                                                if (t_object == null) {
                                                        ed.setTemp(FLAG_USED);
                                                } else {
                                                        if (t_object instanceof ECtRenamed) {
                                                          if (((ECtRenamed)t_object).interfaced_flag == null) {
                                                                        ((ECtRenamed)t_object).interfaced_flag = FLAG_USED;
                                                                } else {
                                                                        // already set
                                                                }
                                                        } else
                                                        if (t_object instanceof Integer) {
                                                                // already set
                                                        } else {
                                                                System.out.println("<ExpressCompiler> INTERNAL ERROR - NamedTypeOrRename - temp_object: " + t_object + ", entity: " + ed);
                                                        }
                                                }
                                        }
                        }
                } else
                if (parser_pass == 3) {
                } else
                if (parser_pass == 4) {
                } else
                if (parser_pass == 5) {
                }
    switch (jj_nt.kind) {
    case AS:
      jj_consume_token(AS);
      if (jj_2_23(2)) {
        alias_name = EntityId();
      } else {
        switch (jj_nt.kind) {
        case SIMPLE_ID:
          alias_name = TypeId();
          break;
        default:
          jj_la1[118] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
      break;
    default:
      jj_la1[119] = jj_gen;
      ;
    }
                if (parser_pass == 2) {
                        if ((alias_name != null) && (dc != null)) {
                                ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dc).setAlias_name(null, alias_name);
                                if (ed != null) {
                                        hm_current_entity_declarations.put(alias_name.toLowerCase(), dc);
                                } else
                                if (dt != null) {
                                        hm_current_type_declarations.put(alias_name.toLowerCase(), dc);
                                }
                        }

//                      if (dc instanceof jsdai.SExtended_dictionary_schema.EEntity_declaration$used_declaration) {
//                              dc.set
//                      } else
//                      if (dc instanceof jsdai.SExtended_dictionary_schema.EType_declaration$used_declaration) (
//                      }
                }
                {if (true) return dc;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.247------------ */
  static final public void NullStmt() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In NullStmt starting");
    jj_consume_token(SEMICOLON);
                printDebug("In NullStmt ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.248------------ */
  static final public jsdai.SExtended_dictionary_schema.ENumber_type NumberType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ENumber_type nt = null;
    jj_consume_token(NUMBER);
                if (parser_pass == 3) {
                        // nt = (jsdai.SExtended_dictionary_schema.ENumber_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNumber_type.class);
                        nt = _st_number;
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (nt == null) {
                                // nt = (jsdai.SExtended_dictionary_schema.ENumber_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNumber_type.class);
                                nt = _st_number;
                        }
                }
                {if (true) return nt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.249------------ */
  static final public int NumericExpression() throws ParseException, jsdai.lang.SdaiException {
        int value = Integer.MIN_VALUE;
        Object argument = null;
        Object x_argument = null;
    SimpleExpression();
                if (parser_pass == 5) {
                        if (argument_stack.empty()) {
                                printVerbose("ERROR: empty stack in NumericExpression");
                        } else {
                                argument = argument_stack.pop();
                        }
                        printStack("POP: NumericExpression: " + argument);
                        if (expression_instances) {
                                // x_argument = expression_stack.pop();
                        }
                        if (argument instanceof Integer) {
                                value = ((Integer)argument).intValue();
                                numeric_expression_calculated = true;
                        } else
                        if (argument instanceof Number) {
                                value = ((Number)argument).intValue();
                                // not sure if ever happens
                                numeric_expression_calculated = false;
                        }
                        else {
                                value = Integer.MIN_VALUE;
                                numeric_expression_calculated = false;
                        }
                }
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.250------------ */
  static final public void OneOf() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EOneof_subtype_expression oneof = null;;
// pre-X	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.lang.EEntity ee;
        Object pop_inst = null;
    jj_consume_token(ONEOF);
    jj_consume_token(LPAREN);
    SupertypeExpression();
                if (parser_pass == 5) {
                        oneof = (jsdai.SExtended_dictionary_schema.EOneof_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.COneof_subtype_expression.class);
                        generic_operands = oneof.createGeneric_operands(null);
                        // operands is now derived instead of explicit 
                        // operands = oneof.createOperands(null);
                        ee = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: OneOf: " + ee);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                        if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression)  { // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                // operands is now derived instead of explicit 
                                // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                        } else
                        if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                // operands is now derived instead of explicit 
                                // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                        } else
                        if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                        } else  {
                                error_count++;
                                printEDebug("Internal error in OneOf 1");
                        }
                }
    label_41:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[120] = jj_gen;
        break label_41;
      }
      jj_consume_token(COMMA);
      SupertypeExpression();
                if (parser_pass == 5) {
                        ee = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: OneOf: " + ee);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                        if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression)  { // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                // operands is now derived instead of explicit 
                                // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                        } else
                        if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {  // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                // operands is now derived instead of explicit 
                                // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                        } else
                        if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) {  // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                        } else {
                                error_count++;
                                printEDebug("Internal error in OneOf 2");
                        }
                }
    }
    jj_consume_token(RPAREN);
                if (parser_pass == 5) {
                        argument_stack.push(oneof);
                        printStack("PUSH: OneOF: " + oneof);
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
  }

/*-+-------- ISO 10303-14:B.2.149  ---*/
  static final public void OrderedByClause() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(ORDERED_BY);
    Expression();
    label_42:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[121] = jj_gen;
        break label_42;
      }
      jj_consume_token(COMMA);
      Expression();
    }
    jj_consume_token(SEMICOLON);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.251------------ */
  static final public Object [] Parameter() throws ParseException, jsdai.lang.SdaiException {
        Object [] results = new Object[2];
        results[0] = null;
        results[1] = null;
                printDebug("Starting Parameter");
    Expression();
                if (parser_pass == 5) {
                }
                printDebug("Ending Parameter");
                {if (true) return results;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.252------------ */
  static final public String ParameterId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
                printDebug("In ParameterId, starting");
    t = jj_consume_token(SIMPLE_ID);
                printDebug("In ParameterId, ending: " + t.image);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.253------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter ParameterType() throws ParseException, jsdai.lang.SdaiException {
//      jsdai.lang.EEntity pt = null;
        jsdai.SExtended_dictionary_schema.EData_type pt = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        String parameter_key = null;
                printDebug("In ParameterType, starting");
    switch (jj_nt.kind) {
    case AGGREGATE:
    case ARRAY:
    case BAG:
    case GENERIC_ENTITY:
    case GENERIC:
    case LIST:
    case SET:
      par = GeneralizedTypes(null);
      break;
    case SIMPLE_ID:
      pt = NamedTypes(null);
      break;
    case BINARY:
    case BOOLEAN:
    case INTEGER:
    case LOGICAL:
    case NUMBER:
    case REAL:
    case STRING:
      pt = SimpleTypes(null);
      break;
    default:
      jj_la1[122] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                if (parser_pass == 4) {
                        if (pt != null) {
                                // par must be null, of course, NamedTypes() or SimpleTypes() was chosen. Parameter instance must be created now.
//                              if (create_instances) {
                                        par = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                                        par.setParameter_type(null, pt);
                                        par.setName(null, "_named_or_simple_");


        // we cannot repeat the same name in hashmap, but we may need separate instances because pt may be different
        // assume that we will not be searching for these parameters by name anyway, so any unique id is ok.
                                parameter_key = constructVariableParameterKey(par.getPersistentLabel().substring(1).toLowerCase());
                                if (parameter_key != null) {
                                        if (!(hm_current_parameters.containsKey(parameter_key))) {
                                                hm_current_parameters.put(parameter_key, par);
                                        } else {
                                                // error - not possible, used unque identifier here
                                        }
                                } else {
//					System.out.println("INTERNAL ERROR - wrong active scope: " + active_scope);
                                        System.out.println("INTERNAL ERROR - ParameterType, parameter: " + par + "  - wrong active scope: " + active_scope);
                                }


//                              }
                        } else {
//				System.out.println("@#PT parameter type null ERROR or generalized type");
                        }
                }
                if (par == null) {
                        printDebug("In ParameterType, ending - null");
                } else {
                        printDebug("In ParameterType, ending - OK");
                }
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.153  ---*/
  static final public String PartitionId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.154  ---*/
  static final public jsdai.SExtended_dictionary_schema.EMap_or_view_partition PartitionQualification(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EMap_or_view_partition result = null;
    jj_consume_token(BACKSLASH);
    result = PartitionRef(parent);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.155  ---*/
  static final public void PathCondition() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(LBRACE);
    ExtentReference();
    switch (jj_nt.kind) {
    case BIT_OR:
      jj_consume_token(BIT_OR);
      LogicalExpression();
      break;
    default:
      jj_la1[123] = jj_gen;
      ;
    }
    jj_consume_token(RBRACE);
  }

/*-+-------- ISO 10303-14:B.2.156  ---*/
  static final public void PathQualifier() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case FPATH:
                printDebug("In PathQualifier, starting");
      ForwardPathQualifier();
      break;
    case BPATH:
      BackwardPathQualifier();
                printDebug("In PathQualifier, ending");
      break;
    default:
      jj_la1[124] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.254------------ */
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition Population() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                printDebug("In Population, starting");
    ed = EntityRef(null);
                if (parser_pass == 5) {
                }
                printDebug("In Population, ending");
                {if (true) return ed;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.255------------ */
  static final public int PrecisionSpec() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.256------------ */
  static final public void Primary() throws ParseException, jsdai.lang.SdaiException {
        Object reference = null;
                printDebug("In Primary");
    switch (jj_nt.kind) {
    case FALSE:
    case TRUE:
    case UNKNOWN:
    case BINARY_LITERAL:
    case ENCODED_STRING_LITERAL:
    case INTEGER_LITERAL:
    case REAL_LITERAL:
    case SIMPLE_STRING_LITERAL:
      Literal();
      break;
    default:
      jj_la1[125] = jj_gen;
      if (jj_2_25(1)) {
        reference = QualifiableFactor();
        label_43:
        while (true) {
          if (jj_2_24(2)) {
            ;
          } else {
            break label_43;
          }
          reference = Qualifier(reference);
        }
      } else {
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.257------------ */
  static final public void ProcedureCallStmt() throws ParseException, jsdai.lang.SdaiException {
        int builtin_proc_id = -1;
        Vector arguments = new Vector();
        Vector expressions = new Vector();
        int argument_count = -1;
        Object operand = null;
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
                printDebug("In ProcedureCallStmt, starting");
    switch (jj_nt.kind) {
    case INSERT:
    case REMOVE:
      builtin_proc_id = BuiltInProcedure();
      break;
    case SIMPLE_ID:
      pd = ProcedureRef();
      break;
    default:
      jj_la1[126] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    switch (jj_nt.kind) {
    case LPAREN:
      argument_count = ActualParameterList(arguments, expressions);
      break;
    default:
      jj_la1[127] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
                }
                printDebug("Ending ProcedureCallStmt: " + builtin_proc_id);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.258------------ */
  static final public void ProcedureDecl() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
    try {
                scope_stack.push(current_scope);
                current_scope = new Vector();
      pd = ProcedureHead();
      AlgorithmHead();
                                               X_ListOfStmt jjtn001 = new X_ListOfStmt(JJTLISTOFSTMT);
                                               boolean jjtc001 = true;
                                               jjtree.openNodeScope(jjtn001);
                                               jjtreeOpenNodeScope(jjtn001);
      try {
        label_44:
        while (true) {
          switch (jj_nt.kind) {
          case SEMICOLON:
          case ALIAS:
          case BEGIN:
          case CASE:
          case ESCAPE:
          case IF:
          case INSERT:
          case REMOVE:
          case REPEAT:
          case RETURN:
          case KW_SKIP:
          case SIMPLE_ID:
            ;
            break;
          default:
            jj_la1[128] = jj_gen;
            break label_44;
          }
          Stmt();
        }
      } catch (Throwable jjte001) {
                                               if (jjtc001) {
                                                 jjtree.clearNodeScope(jjtn001);
                                                 jjtc001 = false;
                                               } else {
                                                 jjtree.popNode();
                                               }
                                               if (jjte001 instanceof RuntimeException) {
                                                 {if (true) throw (RuntimeException)jjte001;}
                                               }
                                               if (jjte001 instanceof ParseException) {
                                                 {if (true) throw (ParseException)jjte001;}
                                               }
                                               if (jjte001 instanceof jsdai.lang.SdaiException) {
                                                 {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                                               }
                                               {if (true) throw (Error)jjte001;}
      } finally {
                                               if (jjtc001) {
                                                 jjtree.closeNodeScope(jjtn001, true);
                                                 jjtreeCloseNodeScope(jjtn001);
                                               }
      }
      jj_consume_token(END_PROCEDURE);
//	active_scope = null;
                function_depth--;
                if (function_depth > 0) {
                        active_scope = getParentFunctionProcedureRuleDefinition(pd);
                active_scope_string = active_scope_extension.getParent_scope_string();
                        active_scope_extension = active_scope_extension.getParent();
                } else {
                        active_scope = null;
                active_scope_string = active_scope_extension.getParent_scope_string();
                        active_scope_extension = active_scope_extension.getParent();
                }
      jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                }
    } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
        if (parser_pass == 1) {
//		printError(e.getMessage());
                printErrorMsg(e.getMessage(), null, true);
                error_count++;
                System.out.println("ERROR RECOVERY: skipping to END_PROCEDURE");
        }
        recoverFromParseException(END_PROCEDURE, e);
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.259------------ */
  static final public jsdai.SExtended_dictionary_schema.EProcedure_definition ProcedureHead() throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration prod;
        String key = "";

        jsdai.SExtended_dictionary_schema.AParameter parameters = null;
        boolean var_present = false;
    jj_consume_token(PROCEDURE);
                     function_depth++;
    name = ProcedureId();
                if (parser_pass == 1) {
                        printVerbose("Procedure: " + name);
//			pd = findProcedure(name);
//			pd = findProcedure_definition(name);
                        pd = findProcedure_definitionX(name);
                        Token t = getToken(0);
                        if (pd != null) {
                                                error_count++;
//						printError("duplicate procedure name \"" + name + "\" at line " + t.beginLine + ", column " + t.beginColumn);
                                                printErrorMsg("" + name + " - duplicate procedure name", null, true);
                        } else {
                                String wrong_name = findAnyName(name);
                                if (wrong_name != null) {
                                                error_count++;
//						printError("duplicate name \"" + name + "\". The same name used for a procedure and for " + wrong_name + " at line " + t.beginLine + ", column " + t.beginColumn);
                                                printErrorMsg("" + name + " - duplicate procedure name, the name is already in use in the current scope", null, true);
                                }
                        }
                  if (function_depth == 1) {

                                pd = (jsdai.SExtended_dictionary_schema.EProcedure_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CProcedure_definition.class);
                          active_scope_extension = new ECtScope(active_scope, pd, active_scope_extension, active_scope_string, name, name.toLowerCase());
                                active_scope = pd;
                        active_scope_string = "";
                          prod = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$procedure_declaration.class);
                                prod.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // prod.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                prod.setDefinition(null, pd);
// System.out.println("adding outer procedure with key: " + name.toLowerCase() + ", declaration: " + prod); 
                                if (!(hm_current_procedure_declarations.containsKey(name.toLowerCase()))) {
                                        hm_current_procedure_declarations.put(name.toLowerCase(), prod);
                                }
                                if (flag_oc) {
                                        pd.setName(null, name);
                                } else {
                                        pd.setName(null, name.toLowerCase());
                                }
                                parameters = pd.createParameters(null);
                        } else { // inner procedure

                                pd = (jsdai.SExtended_dictionary_schema.EProcedure_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CProcedure_definition.class);
                          prod = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInner_declaration$procedure_declaration.class);
                                prod.setDefinition(null, pd);
                                prod.setParent(null, sd);
                                if ((active_scope instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) ||
                                                (active_scope instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule)) {
                                        ((jsdai.SExtended_dictionary_schema.EInner_declaration)prod).setScope(null,active_scope);
                                        key = constructProcedureKey(name);
                                } else {
                                        // probably inner procedure on the same level in parallel
System.out.println("ATTENTION! scope not set: " + prod);
                                        key = name.toLowerCase();
                                }



                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // prod.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                          active_scope_extension = new ECtScope(active_scope, pd, active_scope_extension, active_scope_string, name, key);
                                active_scope = pd;
                        active_scope_string = "";
//System.out.println("adding inner procedure with key: " + key + ", declaration: " + prod); 
                                if (!(hm_current_procedure_declarations.containsKey(key))) {
                                        hm_current_procedure_declarations.put(key, prod);
                                }
                                if (flag_oc) {
                                        pd.setName(null, name);
                                } else {
                                        pd.setName(null, name.toLowerCase());
                                }
                                parameters = pd.createParameters(null);
                        }

                } else {
//			pd = findProcedure(name);
                        if (function_depth == 1) {

//				pd = findProcedure_definition(name);
                                pd = findProcedure_definitionX(name);
                          active_scope_extension = new ECtScope(active_scope, pd, active_scope_extension, active_scope_string, name, name.toLowerCase());
                                active_scope = pd;
                        active_scope_string = "";
                                if (pd == null) {
                                        error_count++;
                                        if (parser_pass == 2) {
//					printError("procedure not found: " + name);
                                                printErrorMsg("" + name + " - procedure not found", null, true);
                                        }
                                        printDebug("ProcedureHead - procedure not found: " + name);
                                } else {
                                        parameters = pd.getParameters(null);
                                }
                        } else { // inner procedure
//				pd = findProcedure_definition(name);
                                pd = findProcedure_definitionX(name);
                          active_scope_extension = new ECtScope(active_scope, pd, active_scope_extension, active_scope_string, name, constructProcedureKey(name));
                                active_scope = pd;
                        active_scope_string = "";
                                if (pd == null) {
//					error_count++;
                                        if (parser_pass == 2) {
//					printError("procedure not found: " + name);
//						printErrorMsg("" + name + " - procedure not found", null, true);
                                        }
                                        printDebug("ProcedureHead - procedure not found: " + name);
                                } else {
                                        parameters = pd.getParameters(null);
                                }
                        }
                }
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
               var_present = false;
      switch (jj_nt.kind) {
      case VAR:
        jj_consume_token(VAR);
                                            var_present = true;
        break;
      default:
        jj_la1[129] = jj_gen;
        ;
      }
      FormalParameter(parameters, var_present, /* null,*/ null);
      label_45:
      while (true) {
        switch (jj_nt.kind) {
        case SEMICOLON:
          ;
          break;
        default:
          jj_la1[130] = jj_gen;
          break label_45;
        }
        jj_consume_token(SEMICOLON);
                                                                                                                                  var_present = false;
        switch (jj_nt.kind) {
        case VAR:
          jj_consume_token(VAR);
                                                                                                                                                              var_present = true;
          break;
        default:
          jj_la1[131] = jj_gen;
          ;
        }
        FormalParameter(parameters, var_present, /* null,*/ null);
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[132] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
        }
        {if (true) return pd;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.260------------ */
  static final public String ProcedureId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 20, 20 & 39, 39 & 56, 56 & 71) ------------------------ ISO 10303-11:A.2.261------------ */
// here, the bnf must be modified to handle interpreted identifiers.
  static final public Object QualifiableFactor_old() throws ParseException, jsdai.lang.SdaiException {
                Object reference = null;
                Object function_call = null;
                printDebug("In QualifiableFactor");
                int which_selected = 0;
                Token t = null;
                String name = null;
                global_name = null;
                Object constant = null;
                jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                if (flag_oc) {
                  name = getToken(1).image;
                } else {
                  name = getToken(1).image.toLowerCase();
                }
                printDebug("In QualifiableFactor - token: " + name);
    if (jj_2_26(2147483647)) {
      function_call = FunctionCall();
                                                                                            which_selected = 1;
    } else if (getToken(1).kind == Compiler2Constants.SIMPLE_ID) {
      reference = QFInterpretedId(name);
                                                                                                                 which_selected = 3;
    } else {
      switch (jj_nt.kind) {
      case HOOK:
      case CONST_E:
      case PI:
      case SELF:
        //	    BuiltInConstant(){which_selected = 2;})
                constant = BuiltInConstant();
                                     which_selected = 2;
        break;
      default:
        jj_la1[133] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                switch (which_selected) {
                        case 0:
                                printDebug("In QualifiableFactor nothing selected: " + name);
                                break;
                        case 1:
                                printDebug("In QualifiableFactor selected FunctionCall: " + name);
                                if (parser_pass == 5) {
                                        // stack is pushed in FunctionCall
                                        reference = function_call;
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        case 2:
                                printDebug("In QualifiableFactor selected BuiltInConstant: " + name);
                                if (parser_pass == 5) {
                                        // stack is pushed in BuiltInConstant
                                        reference = constant;
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        case 3:
                                printDebug("In QualifiableFactor selected InterpretedId: " + name);
                                break;
                        default:
                                printDebug("In QualifiableFactor - error: " + name);
                                break;
                }


                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

///// ----------------- S
  static final public Object QualifiableFactor() throws ParseException, jsdai.lang.SdaiException {
                Object reference = null;
                printDebug("In QualifiableFactor");
                int which_selected = 0;
                Token t = null;
                String name = null;
                global_name = null;
                Object constant = null;
                jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                jsdai.SExtended_dictionary_schema.EEntity_definition pop_ed = null;
                jsdai.SExtended_dictionary_schema.EParameter par = null;
                jsdai.SExtended_dictionary_schema.EAttribute attr = null;
                ECtVariable var = null;
                if (flag_oc) {
                  name = getToken(1).image;
                } else {
                  name = getToken(1).image.toLowerCase();
                }
                printDebug("In QualifiableFactor - token: " + name);
// System.out.println("@#Q in QualifiableFactor - active scope: " + active_scope);		
                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
    }
//    ahead = whatsAhead(this);

    if (jj_2_27(2147483647)) {
      reference = BuiltInConstant();
                        printDebug("In QualifiableFactor selected BuiltInConstant: " + name);
                        if (parser_pass == 5) {
                                // stack is pushed in BuiltInConstant
                                // reference = constant;
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isAttributeRef()) {
      attr = AttributeRef(null, ed, 4, null);
// System.out.println("@#A AttributeRef in QualifiableFactor, ed: " + ed);
                        printDebug("In QualifiableFactor selected Attribute: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(attr);
                                reference = attr;
                                if (attr != null) {
                                        printStack("PUSH: QF attribute: " + attr.getName(null));
                                        if (expression_instances) {
                                                String x_operand = attr.getName(null);
                                        }
                                } else {
                                        printVerbose("ERROR: QF attribute is NULL");
                                }
                        }
    } else if (isConstantRef()) {
      reference = ConstantRef();
                        printDebug("In QualifiableFactor selected Constant: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(reference);
                                // reference = constant;
                                printStack("PUSH: QF constant: " + reference);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isFunctionCall()) {
      reference = FunctionCall();
                        printDebug("In QualifiableFactor selected FunctionCall: " + name);
                        if (parser_pass == 5) {
                                // stack is pushed in FunctionCall
                                // reference = function_call;
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isViewAttributeRef()) {
      reference = ViewAttributeRef();
                        printDebug("In QualifiableFactor selected ViewAttributeRef: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(reference);
                                printStack("PUSH: QF view_attribute_ref: " + reference);
                        }
    } else if (isSourceParameterRef()) {
      reference = SourceParameterRef();
                        printDebug("In QualifiableFactor selected SourceParameterRef: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(reference);
                                printStack("PUSH: QF source_parameter_ref: " + reference);
                        }
    } else if (isTargetParameterRef()) {
      reference = TargetParameterRef();
                        printDebug("In QualifiableFactor selected TargetParameterRef: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(reference);
                                printStack("PUSH: QF target_parameter_ref: " + reference);
                        }
    } else if (isViewCall()) {
      reference = ViewCall();
                        printDebug("In QualifiableFactor selected ViewCall: " + name);
                        if (parser_pass == 5) {
                                // is stack pushed in ViewCall? to see how to implement
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isParameterRef()) {
      par = ParameterRef();
                        printDebug("In QualifiableFactor selected Parameter: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(par);
                                reference = par;
                                printStack("PUSH: QF parameter: " + par);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isVariableRefX()) {
      var = VariableRef();
                        printDebug("In QualifiableFactor selected Variable: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(var);
                                reference = var;
                                printStack("PUSH: QF variable: " + var);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isPopulation()) {
      pop_ed = Population();
                        printDebug("In QualifiableFactor selected Population: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(pop_ed);
                                reference = pop_ed;
                                printStack("PUSH: QF population: " + pop_ed.getName(null));
                        }
    } else if (isMapCall()) {
      reference = MapCall();
                        printDebug("In QualifiableFactor selected MapCall: " + name);
                        if (parser_pass == 5) {
                                // is pushed in MapCall - to be implemented
                                // reference = view_call;
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else {
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        // hopefully it will not happen in pass 5
                        reference = UnrecognizedReference();
                        printDebug("In QualifiableFactor nothing selected: " + name);
                        if (parser_pass == 5) {
                                // is pushed in MapCall - to be implemented
                                // reference = view_call;
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
        break;
      default:
        jj_la1[134] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

  static final public Object UnrecognizedReference() throws ParseException, jsdai.lang.SdaiException {
        Token t;
                        printDebug("In UnrecognizedReference, starting in pass: " + parser_pass);
    //    <SIMPLE_ID> [ "(" Expression() ")" [";"] ]
        t = jj_consume_token(SIMPLE_ID);
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      if (jj_2_28(1)) {
        Expression();
      } else {
        ;
      }
      label_46:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[135] = jj_gen;
          break label_46;
        }
        jj_consume_token(COMMA);
        Expression();
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[136] = jj_gen;
      ;
    }
                // if goes here in pass 5, empty stack exeption may occur.
                if (parser_pass == 5) {
                        argument_stack.push(null);
                }
                printDebug("In UnrecognizedReference, ending: " + t.image);
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public Object QualifiableFactor_new_abandoned() throws ParseException, jsdai.lang.SdaiException {
                Object reference = null;
                Object function_call = null;
                printDebug("In QualifiableFactor");
                int which_selected = 0;
                Token t = null;
                String name = null;
                global_name = null;
                Object constant = null;
                jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                if (flag_oc) {
                  name = getToken(1).image;
                } else {
                  name = getToken(1).image.toLowerCase();
                }
                printDebug("In QualifiableFactor - token: " + name);
                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
    }
    ahead = whatsAhead();
    if (ahead == WA_ATTRIBUTE_REF) {
      reference = AttributeRef(null, ed, 4, null);

    } else if (ahead == WA_BUILTIN_CONSTANT) {
      reference = BuiltInConstant();

    } else if (ahead == WA_CONSTANT_REF) {
      reference = ConstantRef();

    } else if (ahead == WA_FUNCTION_CALL) {
      reference = FunctionCall();

    } else if (ahead == WA_POPULATION) {
      reference = Population();

    } else if (ahead == WA_VIEW_ATTRIBUTE_REF) {
      reference = ViewAttributeRef();

    } else if (ahead == WA_VIEW_CALL) {
      reference = ViewCall();

    } else if (ahead == WA_PARAMETER_REF) {
      reference = ParameterRef();

    } else if (ahead == WA_VARIABLE_REF) {
      reference = VariableRef();

    } else if (ahead == WA_MAP_CALL) {
      reference = MapCall();

    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
/*
		switch (which_selected) {
			case 0:
				printDebug("In QualifiableFactor nothing selected: " + name);
				break;
			case 1:
				printDebug("In QualifiableFactor selected FunctionCall: " + name);
				if (parser_pass == 5) {
					// stack is pushed in FunctionCall
					reference = function_call;
					if (expression_instances) {
						// expression_stack.push(null);
					}
				}
				break;
			case 2:
				printDebug("In QualifiableFactor selected BuiltInConstant: " + name);
				if (parser_pass == 5) {
					// stack is pushed in BuiltInConstant
					reference = constant;
					if (expression_instances) {
						// expression_stack.push(null);
					}
				}
				break;
			case 3:
				printDebug("In QualifiableFactor selected InterpretedId: " + name);
				break;
			default:
				printDebug("In QualifiableFactor - error: " + name);
				break;
		}

*/
                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

///////////// E
  static final public Object QFInterpretedId(String name) throws ParseException, jsdai.lang.SdaiException {
        Object reference = null;
        choice = 0;
        int chosen = 0;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EConstant_definition con = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        ECtVariable var = null;
        Object constant = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        Object varpar = null;
        String attr_key = null;
//              printDDebug("interpreted ID name in QF: " + name);
                if (parser_pass == 1) {
                } else
                if (parser_pass == 2) {
                } else
                if ((parser_pass == 3) || (parser_pass == 4)) {
                        ed = findEntity_definition(name, null);
                        if (ed != null) { // interpreted ID is entity ID
                                choice = 1;
                        } else {
                                // not an entity
                                // con = findConstant(name);
                                // why the old for was still used?
                                con = findConstant_definitionX(name);
                                if (con != null) { // interpreted ID is constant ID
                                        choice = 3;
                                } else {
                                // attribute - not in pass 3, parameter, variable - not yet applicable, by default - variable (?)
                                        choice = 5;
                                }
                        }
                }       else
                if (parser_pass == 5) {
                        ed = findEntity_definition(name, null);
                        if (ed != null) { // interpreted ID is entity ID
                                choice = 1;
                        } else {
                                // not an entity
//				con = findConstant_definition(name);
                                con = findConstant_definitionX(name);
                                if (con != null) { // interpreted ID is constant ID
                                        choice = 3;
                                } else {

                                        if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
printDDebug("QF entity-attribute: " + ed.getName(null));
// System.out.println("@X 11 name: " + name + ", ed: " + ed);
                                                attr = findAttribute(name, ed, -1, null, attr_key); // currently, 0, 1, or 2 is ignored, any attribute is returned.
                                                if (attr != null) { // interpreted ID is an attribute
                                                        choice = 2;
                                                }
                                        } else {


                                                // varpar = findInNestedScope(name);
//						varpar = findInterpretedId(name);
                                                varpar = findInterpretedIdX(name);
                                                if (varpar == null) {
                                                        // seems like an error.
                                                } else {
                                                        if (varpar instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                                                par = (jsdai.SExtended_dictionary_schema.EParameter)varpar;
                                                                choice = 4;
                                                        } else
                                                        if (varpar instanceof ECtVariable) {
                                                                var = (ECtVariable)varpar;
                                                                choice = 5;
                                                        } else {
                                                                // seems like an error as well. Although I may need to modify the part about constants in QFInterpretedId.
                                                  }

                                                }
                                                // parameter or variable - not yet applicable, default - variable
                                                // choice = 5;
                                        }
                                }
                        }
                }
//              printDDebug("QF choice nr: " + choice);

    if (choice == 1) {
      ed = Population();
                                                     chosen = 1;
    } else if (choice == 2) {
      attr = AttributeRef(null, ed, 4, null);
                                                                                 chosen = 2;
    } else if (choice == 3) {
      constant = ConstantRef();
                                                                   chosen = 3;
    } else if (choice == 4) {
      par = ParameterRef();
                                                               chosen = 4;
    } else {
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        var = VariableRef();
                                     chosen = 5;
        break;
      default:
        jj_la1[137] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                switch (chosen) {
                        case 0:
                                printDebug("In QF nothing selected");
                                break;
                        case 1:
                                printDebug("In QF selected Population");
                                if (parser_pass == 5) {
                                        argument_stack.push(ed);
                                        reference = ed;
                                        printStack("PUSH: QF population: " + ed.getName(null));
                                }
                                break;
                        case 2:
                                printDebug("In QF selected Attribute");
                                if (parser_pass == 5) {
                                        argument_stack.push(attr);
                                        reference = attr;
                                        if (attr != null) {
                                                printStack("PUSH: QF attribute: " + attr.getName(null));
                                                if (expression_instances) {
                                                //String x_operand = (String)expression_stack.pop();
                                                        String x_operand = attr.getName(null);
//            x_operand = "this.get" + x_operand.substring(0,1).toUpperCase() + x_operand.substring(1).toLowerCase() + "(null)";
            // x_operand = "get" + x_operand.substring(0,1).toUpperCase() + x_operand.substring(1).toLowerCase() + "(null)";
                                                // expression_stack.push(x_operand);
                                                // printXStack("PUSH: QF attribute: " + x_operand);
                                                }
                                        } else {
                                                printVerbose("ERROR: QF attribute is NULL");
                                        }
//					printStack("PUSH: QF attribute: " + attr.getName(null));
                                }
                                break;
                        case 3:
                                printDebug("In QF selected Constant");
                                if (parser_pass == 5) {
                                        argument_stack.push(constant);
                                        reference = constant;
                                        printStack("PUSH: QF constant: " + constant);
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        case 4:
                                printDebug("In QF selected Parameter");
                                if (parser_pass == 5) {
                                        argument_stack.push(par);
                                        reference = par;
                                        printStack("PUSH: QF parameter: " + par);
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        case 5:
                                printDebug("In QF selected Variable");
                                if (parser_pass == 5) {
                                        argument_stack.push(var);
                                        reference = var;
                                        printStack("PUSH: QF variable: " + var);
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        default:
                                printDebug("In QF - error");
                                break;
                }
                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.262------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute QualifiedAttribute(jsdai.SExtended_dictionary_schema.EEntity_definition ed, int attr_type) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr2 = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed2 = null;
        Token a_token;
    a_token = jj_consume_token(SELF);
    ed2 = GroupQualifier();
    attr2 = AttributeQualifier(ed, ed2, attr_type, null);
           if (attr2 == null) {
//     	 System.out.println("<D2008> in QualifiedAttribute attr2 is null in pass: " + parser_pass);	   	
//     	 System.out.println("<D2008> GroupQualifier ed2: " + ed2);	   	
//     	 System.out.println("<D2008> ed: " + ed + ", attr_type: " + attr_type);	   	
           }

                 if (parser_pass == 1) {
                 }
                 else { // pass 2

//if (parser_pass == 4) {
//	System.out.println("in QualifiedAttribute - after AttributeQualifier, GroupQualifier: " + ed2 + ", attr2: " + attr2);
//}		 

                 }
                 createDocumentationEntity3(attr2, a_token);
// if (attr2 == null)
// printDDebug("After createDocumentation in QualifiedAttribute - null");
// else
// printDDebug("After createDocumentation in QualifiedAttribute: " + attr2.getName(null));
                 {if (true) return attr2;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.263------------ */
  static final public Object Qualifier(Object general_reference) throws ParseException, jsdai.lang.SdaiException {
        Object reference = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.EData_type gen_data = null;

        printDebug("In Qualifier, starting, general_reference: " + general_reference);


        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)general_reference;
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                jsdai.lang.EEntity ref_type = null;
                if (((jsdai.SExtended_dictionary_schema.EParameter)general_reference).testParameter_type(null)) {
                        ref_type = ((jsdai.SExtended_dictionary_schema.EParameter)general_reference).getParameter_type(null);
// System.out.println("@#Q: parameter type: " + ref_type);
                } else {
                        printDDebug("Oo> parameter_type unset in qualifier: qualifier = parameter: " + general_reference);
                }
                if (ref_type instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)ref_type;
                } else {
                        if (ref_type instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                if (((jsdai.SExtended_dictionary_schema.EAggregation_type)ref_type).testElement_type(null)) {
                                        gen_data = ((jsdai.SExtended_dictionary_schema.EAggregation_type)ref_type).getElement_type(null);
                                        if (gen_data instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
printDDebug("OoO parameter, Entity in aggregate: " + gen_data.getName(null));
                                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)gen_data;
                                        } else {
                                                printDDebug("OoO parameter, NOT entity in aggregate: " + gen_data.getName(null));
                                        }
                                } else {
                                        printDDebug("OoO parameter, In aggregate element type not set");
                                }
                        } {
                                printDDebug("OoO parameter, NOT entity, not aggregate");
                        }

                }
        } else
        if (general_reference instanceof ECtVariable) {
                jsdai.SExtended_dictionary_schema.EParameter par_type;
                jsdai.lang.EEntity ref_type = null;
                par_type = ((ECtVariable)general_reference).getType();

    if (par_type == null) {
        printDDebug("HiHa variable parameter type NULL: " + general_reference);
    } else
                if (par_type.testParameter_type(null)) {
                        ref_type = par_type.getParameter_type(null);
                } else {
                        printDDebug("Oo> parameter_type unset in qualifier: qualifier = variable: " + general_reference);
                }
                if (ref_type == null) {
                        printDDebug("OoO variable type is NULL, possibly implicit: " + general_reference);
                } else
                if (ref_type instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)ref_type;
                } else {
                        if (ref_type instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                if (((jsdai.SExtended_dictionary_schema.EAggregation_type)ref_type).testElement_type(null)) {
                                        gen_data = ((jsdai.SExtended_dictionary_schema.EAggregation_type)ref_type).getElement_type(null);
                                        if (gen_data instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
printDDebug("OoO variable, Entity in aggregate: " + gen_data.getName(null));
                                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)gen_data;
                                        } else {
                                                printDDebug("OoO variable, NOT entity in aggregate: " + gen_data.getName(null));
                                        }
                                } else {
                                        printDDebug("OoO variable, In aggregate element type not set");
                                }
                        } else {
                                printDDebug("OoO variable, NOT entity, not aggregate");
                        }

                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                if (((jsdai.SExtended_dictionary_schema.EAggregation_type)general_reference).testElement_type(null)) {
                        gen_data = ((jsdai.SExtended_dictionary_schema.EAggregation_type)general_reference).getElement_type(null);
                        if (gen_data instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
printDDebug("OoO aggregate, Entity in aggregate: " + gen_data.getName(null));
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)gen_data;
                        } else {
                                printDDebug("OoO aggregate, NOT entity in aggregate: " + gen_data.getName(null));
                        }
                } else {
                                printDDebug("OoO aggregate, element not set");
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)general_reference).testDomain(null)) {
                        jsdai.lang.EEntity domain =  ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)general_reference).getDomain(null);
                        general_reference = domain;
                        if (domain instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)domain;
                        }
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)general_reference).testDomain(null)) {
                        jsdai.lang.EEntity domain =  ((jsdai.SExtended_dictionary_schema.EDerived_attribute)general_reference).getDomain(null);
                        general_reference = domain;
                        if (domain instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)domain;
                        }
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)general_reference).testDomain(null)) {
                        jsdai.lang.EEntity domain =  ((jsdai.SExtended_dictionary_schema.EInverse_attribute)general_reference).getDomain(null);
                        general_reference = domain;
                        if (domain instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)domain;
                        }
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.ESource_parameter) {
                jsdai.SExtended_dictionary_schema.ESource_parameter sp = (jsdai.SExtended_dictionary_schema.ESource_parameter)general_reference;
                if (sp.testExtent(null)) {
                                jsdai.lang.EEntity domain =  ((jsdai.SExtended_dictionary_schema.ESource_parameter)general_reference).getExtent(null);
                                general_reference = domain;
                                //			ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)sp.getExtent(null); 
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)domain;
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.ETarget_parameter) {
                jsdai.SExtended_dictionary_schema.ETarget_parameter tp = (jsdai.SExtended_dictionary_schema.ETarget_parameter)general_reference;
                if (tp.testExtent(null)) {
                                ed =  tp.getExtent(null);
                }
        } else
        if (general_reference == null) {
                printDDebug("OoO General reference is NULL");
        } else {
                printDDebug("OoO NOT variable, NOT parameter, NOT entity, NOT aggregate: " + general_reference);
        }
    switch (jj_nt.kind) {
    case DOT:
      reference = AttributeQualifier(ed, ed, 5, general_reference);
      break;
    case BACKSLASH:
      reference = GroupQualifier();
      break;
    case LBRACKET:
      reference = IndexQualifier(general_reference);
      break;
    case BPATH:
    case FPATH:
      PathQualifier();
      break;
    case SIMPLE_ID:
      ViewAttributeRef();
      break;
    default:
      jj_la1[138] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                if (reference == null) {
                        printDebug("In Qualifier, ending with reference = null");
                } else {
                        printDebug("In Qualifier, ending with OK reference");
                }
        // if (reference == null) {
        //      reference = general_reference;
        // }	
        {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.264------------ */
  static final public void QueryExpression() throws ParseException, jsdai.lang.SdaiException {
        Object aggregate_source = null; // should be entity_definition
        Object log_exp = null;
        Object query_result = null;
        Object pop_inst_aggr_src = null;
        Object pop_inst_log_exp = null;
        ECtVariable var = null;
        String variable_id = null;
        jsdai.lang.EEntity variable_parameter_type = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type = null;
        String var_id = "";
        String variable_key = "";
                printDebug("In QueryExpression, starting");
                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
                if (parser_pass == 5) {
                        variable_id_stack.push(var_id);
                }
                scope_stack.push(current_scope);
                current_scope = new Vector();
    jj_consume_token(QUERY);
    jj_consume_token(LPAREN);
    variable_id = VariableId();
    jj_consume_token(214);
    AggregateSource();
                if (parser_pass == 4) {

                        variable_type = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);

                        variable_type.setName(null, "_implicit_variable_");

//			aggregate_source = argument_stack.pop();

                        printStack("POP: AggregateSource in Query: " + aggregate_source);
                        printDDebug("aggregate_source : " + aggregate_source);

                        if (aggregate_source instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute){
                                        printDDebug("getDomain: attr domain: " + ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)aggregate_source).getDomain(null));
                                        variable_type.setParameter_type(null, (jsdai.SExtended_dictionary_schema.EData_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)aggregate_source).getDomain(null));
                        }else
                        if (aggregate_source instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute){
                                        printDDebug("getDomain: attr domain: " + ((jsdai.SExtended_dictionary_schema.EDerived_attribute)aggregate_source).getDomain(null));
                                        variable_type.setParameter_type(null, (jsdai.SExtended_dictionary_schema.EData_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)aggregate_source).getDomain(null));
                        }else
                        if (aggregate_source instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute){
                                        printDDebug("getDomain: attr domain: " + ((jsdai.SExtended_dictionary_schema.EInverse_attribute)aggregate_source).getDomain(null));
                                        variable_type.setParameter_type(null, (jsdai.SExtended_dictionary_schema.EData_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)aggregate_source).getDomain(null));
                        }
                        if (aggregate_source instanceof ECtVariable){
//				printDDebug("getDomain: attr domain: " + ((ECtVariable)aggregate_source).getType());
//				variable_type.setParameter_type(null, ((ECtVariable)aggregate_source).getType().getParameter_type(null));
                                jsdai.SExtended_dictionary_schema.EParameter tmp = ((ECtVariable)aggregate_source).getType();
                                if (tmp.testParameter_type(null)) {
                                        variable_type.setParameter_type(null, tmp.getParameter_type(null));
                                } else {
                                        printDDebug("Oo> parameter_type unset in query_expression, aggregate_source is variable: " + aggregate_source);
                                }
                        }


                  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension, active_scope_string, "" + variable_uid, variable_id);
                        active_scope_string = "";
//			active_scope = null;  // not using on schema level (yet)

                        variable_key = constructImplicitVariableKey(variable_id, variable_uid);

// System.out.println("<--QUERY--> - constructing variable_key: " + variable_key + ", variable_id: " + variable_id + ", variable_uid: " + variable_uid);

//			var = new ECtVariable(variable_id, variable_type, function_depth, variable_key, active_scope, true, 1, (String)variable_id_stack.peek());
                        var = new ECtVariable(variable_id, variable_type, function_depth, variable_key, active_scope, true, 1, "");
//			var = new ECtVariable(variable_id, variable_type, (String)variable_id_stack.peek());

                        if (variable_key != null) {
                                if (!(hm_current_variables.containsKey(variable_key))) {
                                        hm_current_variables.put(variable_key, var);
                                } else {
                                        // error - perhaps more than one variable with the same name in a function
                                }
                        } else {
                                System.out.println("INTERNAL ERROR - ImplicitVariable in QueryExpression: " + variable_id + "  - wrong active scope: " + active_scope);
                        }


                        current_scope.addElement(var);

                        printStack("POP: AggregateSource in Query: " + aggregate_source);
                        if (expression_instances) {
                                // pop_inst_aggr_src = expression_stack.pop();
                        }
                } else { // other passes - added to handle interpreted IDs

//		  active_scope_extension = new ECtScope(active_scope, active_scope, active_scope_extension, active_scope_string, "query_expression$", variable_id));
// 			active_scope_string = "";

                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);

                }
           X_QueryLogicalExpression jjtn001 = new X_QueryLogicalExpression(JJTQUERYLOGICALEXPRESSION);
           boolean jjtc001 = true;
           jjtree.openNodeScope(jjtn001);
           jjtreeOpenNodeScope(jjtn001);
    try {
      jj_consume_token(BIT_OR);
      LogicalExpression();
    } catch (Throwable jjte001) {
           if (jjtc001) {
             jjtree.clearNodeScope(jjtn001);
             jjtc001 = false;
           } else {
             jjtree.popNode();
           }
           if (jjte001 instanceof RuntimeException) {
             {if (true) throw (RuntimeException)jjte001;}
           }
           if (jjte001 instanceof ParseException) {
             {if (true) throw (ParseException)jjte001;}
           }
           if (jjte001 instanceof jsdai.lang.SdaiException) {
             {if (true) throw (jsdai.lang.SdaiException)jjte001;}
           }
           {if (true) throw (Error)jjte001;}
    } finally {
           if (jjtc001) {
             jjtree.closeNodeScope(jjtn001, true);
             jjtreeCloseNodeScope(jjtn001);
           }
    }
                if (parser_pass == 5) {
                }
    jj_consume_token(RPAREN);
                if (parser_pass == 4) {
                        active_scope_string =  active_scope_extension.getParent_scope_string();
                        active_scope_extension = active_scope_extension.getParent();
                }
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                        variable_id_stack.pop();
                }

                printDebug("In QueryExpression, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.265------------ */
  static final public jsdai.SExtended_dictionary_schema.EReal_type RealType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EReal_type rt = null;
        int precision = 0;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        boolean precision_present = false;
    jj_consume_token(REAL);
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      precision = PrecisionSpec();
                                                precision_present = true;
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[139] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if ((!precision_present) || (precision == Integer.MIN_VALUE)) {
                                rt = _st_real;
                        } else {
                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                _data_type_name = "_REAL_" + precision;
                                rt.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, precision);
                                rt.setPrecision(null, b1);
                        }
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (rt == null) {
                                if ((!precision_present) || (precision == Integer.MIN_VALUE)) {
                                        rt = _st_real;
                                } else {
                                        rt = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                        _data_type_name = "_REAL_" + precision;
                                        rt.setName(null, _data_type_name);
                                        b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, precision);
                                        rt.setPrecision(null, b1);
                                }
                        }
                }
                if ((parser_pass == 5) && (precision_present) && (precision != Integer.MIN_VALUE)) {
                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                _data_type_name = "_REAL_" + precision;
                                rt.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, precision);
                                rt.setPrecision(null, b1);
                }
                {if (true) return rt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.266------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute ReferencedAttribute(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute a;
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      a = AttributeRef(null, ed, 4, null);
      break;
    case SELF:
      a = QualifiedAttribute(ed, 4);
      break;
    default:
      jj_la1[140] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
// System.out.println("AttributeRef,4, ed: " + ed + ", a: " + a);
                {if (true) return a;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.267------------ */
/*  ISO 10303-14.B.2.168 */
  static final public void ReferenceClause(Vector referenced_vector) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EGeneric_schema_definition reference_schema = null;
        String reference_schema_str;
        jsdai.lang.SdaiModel interfaced_model = null;
        boolean items_listed = false;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
        Vector items_vector;
        jsdai.SExtended_dictionary_schema.EReference_from_specification rfs = null;
//	jsdai.SExtended_dictionary_schema.AReferenced_declaration items = null;
        jsdai.SExtended_dictionary_schema.AInterfaced_declaration items = null;
    jj_consume_token(REFERENCE);
    jj_consume_token(FROM);
    reference_schema = SchemaRefOrRename();
          if (reference_schema != null) {
                if (reference_schema.getName(null).equalsIgnoreCase("mixed_complex_types")) {
                                error_count++;
                                printErrorMsg("REFERENCE FROM " + reference_schema.getName(null) + " - this special schema should not be interfaced explicitly", null, true);
                }
          }

                items_vector = new Vector();
// what is that? next line, as found:
//		interfaced_model = reference_schema.findEntityInstanceSdaiModel();
                interfaced_model = findReferencedModel(reference_schema);
                if ((interfaced_model == null) && (parser_pass != 1)) {
                        error_count++;
                        if (parser_pass == 2) {
                                if (reference_schema != null) {
//					printError("interfaced schema not found: " + reference_schema.getName(null).toLowerCase());
                                        printErrorMsg("" + reference_schema.getName(null) + " - interfaced schema not found", null, true);
                                } else {
                                        printEDebug("interfaced schema not found, its name not determined");
                                }
                        }
                        printDebug("REFERENCEd FROM schema not found: " + reference_schema);
                }

// 		if ((parser_pass == 2) && (interfaced_model != null)) {
                if (interfaced_model != null) {
                        if (interfaced_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                                interfaced_model.startReadOnlyAccess();
                        }
                }
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      dc = ResourceOrRename(interfaced_model);
                                                      items_listed = true; items_vector.addElement(dc);
      label_47:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[141] = jj_gen;
          break label_47;
        }
        jj_consume_token(COMMA);
        dc = ResourceOrRename(interfaced_model);
                                                                                                                                                        items_vector.addElement(dc);
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[142] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case AS:
      jj_consume_token(AS);
      switch (jj_nt.kind) {
      case SOURCE:
        jj_consume_token(SOURCE);
        break;
      case TARGET:
        jj_consume_token(TARGET);
        break;
      default:
        jj_la1[143] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[144] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 2) {
                        rfs = (jsdai.SExtended_dictionary_schema.EReference_from_specification)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReference_from_specification.class);
                        jsdai.SExtended_dictionary_schema.ESchema_definition asd = getSchema_definitionFromModel(interfaced_model);
                        if (asd != null) {
                                rfs.setForeign_schema(null, asd);  // generic_schema_definition;
                        }
                        rfs.setCurrent_schema(null, sd); // generic_schema_definition;
                        if (!items_listed) {
                                if (interfaced_model != null) {
                                        createAllReferencedDeclarations(interfaced_model);
                                        referenced_vector.addElement(interfaced_model);
                                }
                        } else {
                                items = rfs.createItems(null);
//System.out.println("XXXOOOO: " + items);
                                for (int i = 0; i < items_vector.size(); i++) {
//System.out.println("XXXOO: " + items_vector.elementAt(i));
//					 items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));
//					items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EInterfaced_declaration)items_vector.elementAt(i));
//					((jsdai.SExtended_dictionary_schema.AReferenced_declaration)items).addByIndex(i, (jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));
                                        Object ivi = items_vector.elementAt(i);
                                        if (ivi != null) {
                                                items.addUnordered((jsdai.SExtended_dictionary_schema.EReferenced_declaration)ivi);
                                        }
                                }
                                if (items.getMemberCount() == 0) {
                                        rfs.deleteApplicationInstance();
                                }
                        }
                }
  }

/* REFERENCE-USE */
  static final public void Reference2Clause(Vector referenced_vector) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EGeneric_schema_definition reference_schema = null;
        String reference_schema_str;
        jsdai.lang.SdaiModel interfaced_model = null;
        boolean items_listed = false;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
        Vector items_vector;
        jsdai.SExtended_dictionary_schema.EReference_from_specification rfs = null;
//	jsdai.SExtended_dictionary_schema.AReferenced_declaration items = null;
        jsdai.SExtended_dictionary_schema.AInterfaced_declaration items = null;
    jj_consume_token(REFERENCE2);
    jj_consume_token(FROM);
    reference_schema = SchemaRefOrRename();
          if (reference_schema != null) {
                if (reference_schema.getName(null).equalsIgnoreCase("mixed_complex_types")) {
                                error_count++;
                                printErrorMsg("REFERENCE FROM " + reference_schema.getName(null) + " - this special schema should not be interfaced explicitly", null, true);
                }
          }

                items_vector = new Vector();
// what is that? next line, as found:
//		interfaced_model = reference_schema.findEntityInstanceSdaiModel();
                interfaced_model = findReferencedModel(reference_schema);
                if ((interfaced_model == null) && (parser_pass != 1)) {
                        error_count++;
                        if (parser_pass == 2) {
                                if (reference_schema != null) {
//					printError("interfaced schema not found: " + reference_schema.getName(null).toLowerCase());
                                        printErrorMsg("" + reference_schema.getName(null) + " - interfaced schema not found", null, true);
                                } else {
                                        printEDebug("interfaced schema not found, its name not determined");
                                }
                        }
                        printDebug("REFERENCEd FROM schema not found: " + reference_schema);
                }

// 		if ((parser_pass == 2) && (interfaced_model != null)) {
                if (interfaced_model != null) {
                        if (interfaced_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                                interfaced_model.startReadOnlyAccess();
                        }
                }
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      dc = ResourceOrRename(interfaced_model);
                                                      items_listed = true; items_vector.addElement(dc);
      label_48:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[145] = jj_gen;
          break label_48;
        }
        jj_consume_token(COMMA);
        dc = ResourceOrRename(interfaced_model);
                                                                                                                                                        items_vector.addElement(dc);
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[146] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case AS:
      jj_consume_token(AS);
      switch (jj_nt.kind) {
      case SOURCE:
        jj_consume_token(SOURCE);
        break;
      case TARGET:
        jj_consume_token(TARGET);
        break;
      default:
        jj_la1[147] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[148] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 2) {
                        rfs = (jsdai.SExtended_dictionary_schema.EReference_from_specification)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReference_from_specification.class);
                        jsdai.SExtended_dictionary_schema.ESchema_definition asd = getSchema_definitionFromModel(interfaced_model);
                        if (asd != null) {
                                rfs.setForeign_schema(null, asd);  // generic_schema_definition;
                        }
                        rfs.setCurrent_schema(null, sd); // generic_schema_definition;
                        if (!items_listed) {
                                if (interfaced_model != null) {
                                        createAllReferencedDeclarations(interfaced_model);
                                        referenced_vector.addElement(interfaced_model);
                                }
                        } else {
                                items = rfs.createItems(null);
//System.out.println("XXXOOOO: " + items);
                                for (int i = 0; i < items_vector.size(); i++) {
//System.out.println("XXXOO: " + items_vector.elementAt(i));
//					 items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));
//					items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EInterfaced_declaration)items_vector.elementAt(i));
//					((jsdai.SExtended_dictionary_schema.AReferenced_declaration)items).addByIndex(i, (jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));
                                        Object ivi = items_vector.elementAt(i);
                                        if (ivi != null) {
                                                items.addUnordered((jsdai.SExtended_dictionary_schema.EReferenced_declaration)ivi);
                                        }
                                }
                                if (items.getMemberCount() == 0) {
                                        rfs.deleteApplicationInstance();
                                }
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.268------------ */
  static final public int RelOp() throws ParseException, jsdai.lang.SdaiException {
        int op = 0;
    switch (jj_nt.kind) {
    case LT:
      jj_consume_token(LT);
              op = 1;
      break;
    case GT:
      jj_consume_token(GT);
                              op = 2;
      break;
    case LE:
      jj_consume_token(LE);
                                                op = 3;
      break;
    case GE:
      jj_consume_token(GE);
                                                                 op = 4;
      break;
    case NE:
      jj_consume_token(NE);
                                                                                  op = 5;
      break;
    case EQ:
      jj_consume_token(EQ);
                                                                                                  op = 6;
      break;
    case 215:
      jj_consume_token(215);
                                                                                                                     op = 7;
      break;
    case 216:
      jj_consume_token(216);
                                                                                                                                       op = 8;
      break;
    default:
      jj_la1[149] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return op;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.269------------ */
  static final public int RelOpExtended() throws ParseException, jsdai.lang.SdaiException {
        int op = 0;
    switch (jj_nt.kind) {
    case EQ:
    case GT:
    case LT:
    case LE:
    case GE:
    case NE:
    case 215:
    case 216:
      op = RelOp();
      break;
    case IN:
      jj_consume_token(IN);
                              op = 9;
      break;
    case LIKE:
      jj_consume_token(LIKE);
                                                op = 10;
      break;
    default:
      jj_la1[150] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return op;}
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 18, 18 & 31, 31 & 46, 46 & 62) ------------------------ ISO 10303-11:A.2.270------------ */
/*
void RenameId() :
{}
{
	LOOKAHEAD(2) ConstantId() | LOOKAHEAD(2) EntityId() | LOOKAHEAD(2) FunctionId() | LOOKAHEAD(2) ProcedureId() | TypeId()
}
*/
  static final public String RenameId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.271------------ */
  static final public boolean RepeatControl() throws ParseException, jsdai.lang.SdaiException {
        Object while_op = null;
        Object until_op = null;
        Object pop_inst_while = null;
        Object pop_inst_until = null;
        boolean increment_present = false;
                printDebug("In RepeatControl, starting");
                increment_present = false;
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      IncrementControl();
                             increment_present = true;
      break;
    default:
      jj_la1[151] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case WHILE:
      WhileControl();
                if (parser_pass == 5) {
                        while_op = argument_stack.pop();
                        printStack("POP: RepeatControl, while: " + while_op);
                        if (expression_instances) {
                                // pop_inst_while = expression_stack.pop();
                        }
                }
      break;
    default:
      jj_la1[152] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case UNTIL:
      UntilControl();
                if (parser_pass == 5) {
                        until_op = argument_stack.pop();
                        printStack("POP: RepeatControl, until: " + until_op);
                        if (expression_instances) {
                                // pop_inst_until = expression_stack.pop();
                        }
                }
      break;
    default:
      jj_la1[153] = jj_gen;
      ;
    }
                printDebug("In RepeatControl, ending");
                {if (true) return increment_present;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.272------------ */
  static final public void RepeatStmt() throws ParseException, jsdai.lang.SdaiException {
        Object operand = null;
        String var_id = "";
        boolean increment_present = false;
                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
                if (parser_pass == 5) {
                        variable_id_stack.push(var_id);
                }
                printDebug("In RepeatStmt, starting");

                scope_stack.push(current_scope);
                current_scope = new Vector();
    jj_consume_token(REPEAT);
    increment_present = RepeatControl();
    jj_consume_token(SEMICOLON);
    label_49:
    while (true) {
      Stmt();
      switch (jj_nt.kind) {
      case SEMICOLON:
      case ALIAS:
      case BEGIN:
      case CASE:
      case ESCAPE:
      case IF:
      case INSERT:
      case REMOVE:
      case REPEAT:
      case RETURN:
      case KW_SKIP:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[154] = jj_gen;
        break label_49;
      }
    }
    jj_consume_token(END_REPEAT);
    jj_consume_token(SEMICOLON);
                if (parser_pass == 4) {
                        if (increment_present) {
                                active_scope_string = active_scope_extension.getParent_scope_string();
                                active_scope_extension = active_scope_extension.getParent();
                        }
                }
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                        variable_id_stack.pop();
                }
                printDebug("In RepeatStmt, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.273------------ */
  static final public int Repetition() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.274------------ */
  static final public jsdai.SExtended_dictionary_schema.EDeclaration ResourceOrRename(jsdai.lang.SdaiModel interfaced_model) throws ParseException, jsdai.lang.SdaiException {
  String alias_name = null;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
    dc = ResourceRef(interfaced_model);
    switch (jj_nt.kind) {
    case AS:
      jj_consume_token(AS);
      alias_name = RenameId();
      break;
    default:
      jj_la1[155] = jj_gen;
      ;
    }
                if (parser_pass == 2) {
                        if ((alias_name != null) && (dc != null))
                        {
                                ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dc).setAlias_name(null, alias_name);
                                if (dc instanceof jsdai.SExtended_dictionary_schema.EEntity_declaration) {
                                        hm_current_entity_declarations.put(alias_name.toLowerCase(), dc);
                                } else
                                if (dc instanceof jsdai.SExtended_dictionary_schema.EType_declaration) {
                                        hm_current_type_declarations.put(alias_name.toLowerCase(), dc);
                                } else
                                if (dc instanceof jsdai.SExtended_dictionary_schema.EFunction_declaration) {
                                        hm_current_function_declarations.put(alias_name.toLowerCase(), dc);
                                } else
                                if (dc instanceof jsdai.SExtended_dictionary_schema.EProcedure_declaration) {
                                        hm_current_procedure_declarations.put(alias_name.toLowerCase(), dc);
                                } else
                                if (dc instanceof jsdai.SExtended_dictionary_schema.EConstant_declaration) {
                                        hm_current_constant_declarations.put(alias_name.toLowerCase(), dc);
                                } else
                                if (dc instanceof jsdai.SExtended_dictionary_schema.ESubtype_constraint_declaration) {
                                        hm_current_subtype_constraint_declarations.put(alias_name.toLowerCase(), dc);
                                } else
                                if (dc instanceof jsdai.SExtended_dictionary_schema.ERule_declaration) {
                                        hm_current_rule_declarations.put(alias_name.toLowerCase(), dc);
                                }

                        }
                }
                {if (true) return dc;}
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 19, 19 & 33, 33 & 49, 49 & 66) ------------------------ ISO 10303-11:A.2.275------------ */
/*  ISO 10303-14.B.2.176 */
// also must handle ViewRef and MapRef for Express X
  static final public jsdai.SExtended_dictionary_schema.EDeclaration ResourceRef(jsdai.lang.SdaiModel interfaced_model) throws ParseException, jsdai.lang.SdaiException {
  jsdai.SExtended_dictionary_schema.ESchema_definition interfaced_schema = null;
  String referenced_type_name = null;
        jsdai.SExtended_dictionary_schema.ENamed_type nt = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
        jsdai.SExtended_dictionary_schema.EConstant_definition cd = null;
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
        jsdai.SExtended_dictionary_schema.EGlobal_rule gr = null;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
    // this is stupid as only ConstantRef() is actually always chosen, no matter how many lookahead symbols.
            // better to write and use only one not confusing non-terminal symbol instead
    
    //  ConstantRef() | EntityRef() | FunctionRef() | ProcedureRef() | TypeRef(3)
    
                    referenced_type_name = InterpretedId();
                if (parser_pass == 2) {
// System.out.println("X__X in ResourceRef, interpreted id: " + referenced_type_name);
                        if (interfaced_model != null) {
                                interfaced_schema = getSchema_definitionFromModel(interfaced_model);
                        }
                        ed = findInterfacedEntity_definition(interfaced_model, referenced_type_name);
// System.out.println("X__X in ResourceRef, interfaced entity definition: " + ed);
printDDebug("#@# ResourceRef: ed: " + ed);
                        if (ed == null) {
                                dt = findInterfacedDefined_type(interfaced_model, referenced_type_name);
                                if (dt == null) {
                                        cd = findInterfacedConstant(interfaced_model, referenced_type_name);
                                        if (cd == null) {
                                                fd = findInterfacedFunction(interfaced_model, referenced_type_name);
                                                if (fd == null) {
                                                        pd = findInterfacedProcedure(interfaced_model, referenced_type_name);
                                                        if (pd == null) {
                                                                gr = findInterfacedRule(interfaced_model, referenced_type_name);
                                                                if (gr == null) {
                                                                        error_count++;
                                                                        if (interfaced_schema != null) {
//										printError("interfaced EXPRESS type \"" + referenced_type_name + "\" not found in schema: " + interfaced_schema.getName(null).toLowerCase());
                                                                                printErrorMsg("" + referenced_type_name + "- interfaced EXPRESS type not found in schema: " + interfaced_schema.getName(null), null, true);
                                                                        } else {
//										printError("interfaced EXPRESS type \"" + referenced_type_name + "\" not found in schema which itself was not found");
                                                                                printErrorMsg("" + referenced_type_name + " - interfaced EXPRESS type not found in a schema which itself was not found", null, true);
                                                                        }
                                                                        if (interfaced_model != null) {
                                                                                printDebug("REFERENCE FROM: interfaced express type \"" + referenced_type_name + "\" not found in model: " + interfaced_model.getName());
                                                                        } else {
                                                                                printDebug("REFERENCE FROM: interfaced express type \"" + referenced_type_name + "\" not found in model which itself was not found");
                                                                        }
                                                                } else {
                                                                printDebug("interfaced rule: " + referenced_type_name);
                                                                /*
									if (neededRuleReferencedDeclaration(gr)) {
										dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReferenced_declaration$rule_declaration.class);
										dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
										dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EGlobal_rule)gr);
										gr.setTemp(FLAG_REFERENCED);
									}
								*/
                                                                }
                                                        } else {
                                                                if (neededProcedureReferencedDeclaration(pd)) {
                                                                        dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CProcedure_declaration$referenced_declaration.class);
                                                                        dc.setParent(null, sd);
                                                                        // parent_schema is now derived instead of explicit 
                                                                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                                                // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                                        // }
                                                                        dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EProcedure_definition)pd);
                                                                        if (!(hm_current_procedure_declarations.containsKey(referenced_type_name.toLowerCase()))) {
                                                                                hm_current_procedure_declarations.put(referenced_type_name.toLowerCase(), dc);
                                                                        }
                                                                        pd.setTemp(FLAG_REFERENCED);
                                                                }
                                                        }
                                                } else {
                                                        if (neededFunctionReferencedDeclaration(fd)) {
                                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_declaration$referenced_declaration.class);
                                                                dc.setParent(null, sd);
                                                                // parent_schema is now derived instead of explicit 
                                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                                // }
                                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EFunction_definition)fd);
                                                                if (!(hm_current_function_declarations.containsKey(referenced_type_name.toLowerCase()))) {
                                                                        hm_current_function_declarations.put(referenced_type_name.toLowerCase(), dc);
                                                                }
                                                                fd.setTemp(FLAG_REFERENCED);
                                                        }
                                                }
                                        } else {
                                                if (neededConstantReferencedDeclaration(cd)) {
                                                        dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CConstant_declaration$referenced_declaration.class);
                                                        dc.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                                // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        // }
                                                        if (!(hm_current_constant_declarations.containsKey(referenced_type_name.toLowerCase()))) {
                                                                hm_current_constant_declarations.put(referenced_type_name.toLowerCase(), dc);
                                                        }
                                                        dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EConstant_definition)cd);
                                                        cd.setTemp(FLAG_REFERENCED);
                                                }
                                        }
                                } else {
//                                      tdc = checkTypeReferencedDeclaration(dt);
//                                      if (tdc == null ) {
                                        if (neededTypeReferencedDeclaration(dt)) {
                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReferenced_declaration$type_declaration.class);
                                                dc.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                // }
                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)dt);
                                                if (!(hm_current_type_declarations.containsKey(referenced_type_name.toLowerCase()))) {
                                                        hm_current_type_declarations.put(referenced_type_name.toLowerCase(), dc);
                                                }
                                                dt.setTemp(FLAG_REFERENCED);
                                        }
                                }
                        } else { // entity_definition
//                                      edc = checkEntityReferencedDeclaration(ed);
//                                      if (edc == null ) {
// System.out.println("X__X in ResourceRef, entity definition: " + ed.getName(null));
                                        if (neededEntityReferencedDeclaration(ed)) {
// System.out.println("X__X in ResourceRef, entity definition - creating declaration ");
                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$referenced_declaration.class);
                                                dc.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                // }
                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)ed);
// System.out.println("X__X in ResourceRef, entity definition - created declaration: " + dc);
                                                if (!(hm_current_entity_declarations.containsKey(referenced_type_name.toLowerCase()))) {
// System.out.println("X__X in ResourceRef, entity definition - HashMap key does not exist, adding: " + referenced_type_name.toLowerCase());
                                                        hm_current_entity_declarations.put(referenced_type_name.toLowerCase(), dc);
                                                } else {
// System.out.println("X__X in ResourceRef, entity definition - HashMap key already exists: " + referenced_type_name.toLowerCase());
                                                        jsdai.SExtended_dictionary_schema.EEntity_declaration edc11 = (jsdai.SExtended_dictionary_schema.EEntity_declaration)hm_current_entity_declarations.get(referenced_type_name.toLowerCase());
// System.out.println("X__X in ResourceRef, entity definition - HashMap key already exists, retrieved declaration: " + edc11);
                                                }
                                                Object t_object = ed.getTemp();
                                                if (t_object == null) {
                                                        ed.setTemp(FLAG_REFERENCED);
                                                } else {
                                                        if (t_object instanceof ECtRenamed) {
                                                                if (((ECtRenamed)t_object).interfaced_flag == null) {
                                                                        ((ECtRenamed)t_object).interfaced_flag = FLAG_REFERENCED;
                                                                } else {
                                                                        // already set
                                                                }
                                                        } else
                                                        if (t_object instanceof Integer) {
                                                                // already set
                                                        } else {
                                                                System.out.println("<ExpressCompiler> INTERNAL ERROR - ResourceRef - temp_object: " + t_object + ", entity: " + ed);
                                                        }
                                                }

                                        } else {
// System.out.println("X__X in ResourceRef, entity definition - NOT creating declaration, not needed ");
                                        }
                        }
                } else
                if (parser_pass == 3) {
                } else
                if (parser_pass == 4) {
                } else
                if (parser_pass == 5) {
                }
                {if (true) return dc;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.276------------ */
  static final public void ReturnStmt() throws ParseException, jsdai.lang.SdaiException {
        Object operand = null;
        Object pop_inst = null;
                printDebug("In ReturnStmt, starting");
    jj_consume_token(RETURN);
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      Expression();
                if (parser_pass == 5) {
                }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[156] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                printDebug("In ReturnStmt, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.277 ------------ */
  static final public void RuleDecl() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EGlobal_rule gr;
    try {
                scope_stack.push(current_scope);
                current_scope = new Vector();
      gr = RuleHead();
      AlgorithmHead();
      label_50:
      while (true) {
        switch (jj_nt.kind) {
        case SEMICOLON:
        case ALIAS:
        case BEGIN:
        case CASE:
        case ESCAPE:
        case IF:
        case INSERT:
        case REMOVE:
        case REPEAT:
        case RETURN:
        case KW_SKIP:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[157] = jj_gen;
          break label_50;
        }
        Stmt();
      }
      WhereClause(gr);
      jj_consume_token(END_RULE);
                active_scope = null;
          active_scope_string = active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();
                function_depth = 0;
      jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                }
    } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
        if (parser_pass == 1) {
//		printError(e.getMessage());
                printErrorMsg(e.getMessage(), null, true);
                error_count++;
                System.out.println("ERROR RECOVERY: skipping to END_RULE");
        }
        recoverFromParseException(END_RULE, e);
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.278------------ */
  static final public jsdai.SExtended_dictionary_schema.EGlobal_rule RuleHead() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EGlobal_rule gr = null;
        jsdai.SExtended_dictionary_schema.AEntity_definition aed = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed;
//      jsdai.SExtended_dictionary_schema.ELocal_declaration$rule_declaration lrd;
        jsdai.SExtended_dictionary_schema.EDeclaration lrd;
        int index = 1;
        String name;
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
    jj_consume_token(RULE);
                 function_depth++;
    name = RuleId();
    jj_consume_token(FOR);
    jj_consume_token(LPAREN);
    ed = EntityRef(null);
// System.out.println("<> global rule: " + name);
                if (parser_pass == 1) {
printVerbose("Global Rule: " + name);
                        gr = (jsdai.SExtended_dictionary_schema.EGlobal_rule)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CGlobal_rule.class);
                  active_scope_extension = new ECtScope(active_scope, gr, active_scope_extension, active_scope_string, name, name.toLowerCase());
                active_scope_string = "";
                        active_scope = gr;
                  lrd = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$rule_declaration.class);
                        lrd.setParent(null, sd);
                        // parent_schema is now derived instead of explicit 
                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                // lrd.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                        // }
                        lrd.setDefinition(null, gr);
                        if (!(hm_current_rule_declarations.containsKey(name.toLowerCase()))) {
                                hm_current_rule_declarations.put(name.toLowerCase(), lrd);
                        }
                        if (flag_oc) {
                                gr.setName(null, name);
                        } else {
                                gr.setName(null, name.toLowerCase());
                        }
//                      gr.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                        // now it is inverse
                        // gr.createWhere_rules(null);
      aed = gr.createEntities(null);
      if (ed != null) {
//      	aed.addByIndex(index++, ed);
                        }
                } else {
                        gr = findGlobal_rule(name);
                        aed = gr.getEntities(null);
                        if (parser_pass == 3) {
                if (ed != null) {
                aed.addByIndex(index++, ed);
                                }
                        }
                  active_scope_extension = new ECtScope(active_scope, gr, active_scope_extension, active_scope_string, name, name.toLowerCase());
                active_scope_string = "";
                        active_scope = gr;
                }
    label_51:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[158] = jj_gen;
        break label_51;
      }
      jj_consume_token(COMMA);
      ed = EntityRef(null);
                if (parser_pass == 3) {
      if (ed != null) {
        aed.addByIndex(index++, ed);
                        }
                } else {
                }
    }
    jj_consume_token(RPAREN);
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
                        if (function_depth == 1) {
//				String rule_description = "";
                                String rule_description = " ";
                                int local_function_depth = 1;
                        for (int i = 1; ; i++) {
                                        Token t = getToken(i);
                                        if (t.kind == RULE) {
                                                local_function_depth++;
                                        }
                                        if (t.kind == END_RULE) {
                                                local_function_depth--;
                                                if (local_function_depth == 0) {
                                                 // printDDebug("Break, function depth: " + local_function_depth);
                                                 break;
                                                } else {
                                                 ; // printDDebug("Continue, function depth: " + local_function_depth);
                                                }

                                        }
                                        if (first_token) {
                                                start_token = t;
                                                end_token = t;
                                                first_token = false;
                                        } else {
                                                end_token = t;
                                        }
                                        // is it really needed here?
                                        if (flag_oc) {
                                                rule_description += t.image + " ";
                                        } else {
                                                rule_description += t.image.toLowerCase() + " ";
                                        }
//					rule_description += t.image;
                        }
                                // printDDebug("Global rule: " + rule_description);
                                createExpressEntity(gr, rule_description, start_token, end_token);
//				createExpressEntity(gr, rule_description);
                        }
    }
                {if (true) return gr;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.279------------ */
  static final public String RuleId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.280 ------------ */
  static final public void SchemaBody(Vector used_vector, Vector referenced_vector) throws ParseException, jsdai.lang.SdaiException {
        if (active_scope_extension == null) {
        System.out.println("SchemaBody: active_scope_extension = NULL");
}
    label_52:
    while (true) {
      switch (jj_nt.kind) {
      case REFERENCE2:
      case REFERENCE:
      case USE:
        ;
        break;
      default:
        jj_la1[159] = jj_gen;
        break label_52;
      }
      InterfaceSpecification(used_vector, referenced_vector);
    }
    switch (jj_nt.kind) {
    case CONSTANT:
      ConstantDecl();
      break;
    default:
      jj_la1[160] = jj_gen;
      ;
    }
    label_53:
    while (true) {
      switch (jj_nt.kind) {
      case ENTITY:
      case FUNCTION:
      case PROCEDURE:
      case RULE:
      case SUBTYPE_CONSTRAINT:
      case TYPE:
        ;
        break;
      default:
        jj_la1[161] = jj_gen;
        break label_53;
      }
      switch (jj_nt.kind) {
      case ENTITY:
      case FUNCTION:
      case PROCEDURE:
      case SUBTYPE_CONSTRAINT:
      case TYPE:
        Declaration();
        break;
      case RULE:
        RuleDecl();
        break;
      default:
        jj_la1[162] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

/* -------------------------------------------------------------------Amendment--------------10303-11:A.2.406 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute RedeclaredAttribute(jsdai.SExtended_dictionary_schema.EEntity_definition ed, int attr_type) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition already_ed = null;
        Token new_name = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr_current = null;
        Object temp_object = null;
        ECtRenamed renamed = null;
                flag_in_redeclaring = true;

                if (parser_pass == 3) {
                        if (ed != null) {
                                temp_object = ed.getTemp();
                                if (temp_object != null) { // probably already exists, we were in attribute redeclaring already for this entity
                                        if (temp_object instanceof ECtRenamed) {
                                                renamed = (ECtRenamed)temp_object;
                                                // renamed.activate();
                                                renamed.newAttribute(ed);
// System.out.println("<><>ACTIVATED<><> already present - ed: " + ed);
                                                ed.setTemp(renamed);
                                        } else {
                                                // hm, what could be there?
                                                if (temp_object instanceof Integer) {
                                                        renamed = new ECtRenamed(ed, (Integer)temp_object);
                                                        ed.setTemp(renamed);
// System.out.println("<><>ACTIVATED<><> new, prev - Integer - ed: " + ed);
                                                } else {
                                                        System.out.println("<ExpressCompiler> INTERNAL ERROR - RedeclaredAttribute - temp object: " + temp_object + ", entity: " + ed);
                                                }
                                        }
                                } else { // create a new one
                                        renamed = new ECtRenamed(ed);
                                        ed.setTemp(renamed);
// System.out.println("<><>ACTIVATED<><> new, clean - ed: " + ed);
                                }
                        }
                } // parser_pass

    attr = QualifiedAttribute(ed, attr_type);
    switch (jj_nt.kind) {
    case RENAMED:
      jj_consume_token(RENAMED);
      new_name = AttributeId();
      break;
    default:
      jj_la1[163] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (ed != null) {
                                temp_object = ed.getTemp();
                                if (temp_object != null) {
                                if (temp_object instanceof ECtRenamed) {
                                                renamed = (ECtRenamed)temp_object;
                                                if (new_name != null) {
                                                        // add this attribute 
                                                        renamed.add(new_name.image);
// System.out.println("<><>DE-ACTIVATED<><> ed: " + ed + ", new name: " + new_name.image);
                                                } else {
                                                        // discard this attribute, it is not renamed
                                                        renamed.discard();
// System.out.println("<><>DE-ACTIVATED<><> ed: " + ed + ",attr: " + attr);
                                                }
                                                ed.setTemp(renamed);
                                        } else {
                                                // hm, what could be there? an internal error?
                                                // at this stage, interfacing flags should already be replaced by ECtRenamed, so what is it, really?
                                                System.out.println("<ExpressCompiler> INTERNAL ERROR - RedeclaredAttribute - temp: " + temp_object + ", entity: " + ed);
                                        }
                                } else {
                                        // INTERNAL ERROR: it should have been not null already, just look above
                                                System.out.println("<ExpressCompiler> INTERNAL ERROR - RedeclaredAttribute - temp is NULL, entity: " + ed);
                                }
                        }
        }




                if (new_name != null) {
//System.out.println("<KUKU>: " + new_name.image + ", ed: " + ed.getName(null));
                 already_ed = moreThanOneAttributeWithTheSameNameRenamed(new_name.image, ed);
                 // RR2008 - this check temporarily removed, it seems we already made the changes in between passes 3 and 4
                 // this check perhaps can be added into the resolving method between passes 3 and 4
                 already_ed = null;
                 if (already_ed != null) {
                                error_count++;
                                if (already_ed == ed) {
                                        printErrorMsg("" + new_name.image +  " - attempting to rename attribute, but an attribute with the same name already exists in entity " + ed.getName(null), null, true);
                                } else {
                                        printErrorMsg("" + new_name.image +  " - attempting to rename attribute in " + ed.getName(null) + " , but an attribute with the same name already exists in supertype " + already_ed.getName(null), null, true);
                                }
                 }

                        if (attr != null ) {
                          temp_object = attr.getTemp();
                          if (temp_object != null) {
                                if (temp_object instanceof String) {
                                                if (((String)temp_object).equalsIgnoreCase(new_name.image)) {
                                                        // ok, already named in the previous pass
                                                attr.setTemp(new_name.image); // this is not really needed
                                                } else {
              // INVESTIGATING the RENAMING ISSUE
                                                // System.out.println("RENAMED - already renamed - original name: " + attr.getName(null) + ", renamed to: " + temp_object + ", attempting to rename to: " + new_name.image + ", parser pass: " + parser_pass);
                                                // attr.setTemp(new_name.image);
                                        }
                                } else {
                                        System.out.println("RENAMED - hm, what is it? : " + temp_object);
                                        attr.setTemp(new_name.image);
                          }
                          } else {
//				  System.out.println("<D2008>SETTING RENAMED - setting Temp object< in pass: " + parser_pass + ",  new name: " + new_name + ", attribute: " + attr);
                                attr.setTemp(new_name.image);
                                }
// System.out.println("in RedeclaredAttribute @@@ new name: " + new_name.image + ", attr: " + attr + ", pass: " + parser_pass);

                        } else {
                          if (parser_pass == 4) {
// 					System.out.println("<D2008>ERROR IS IT< in pass 4  in RedeclaredAttribute - @@@ new name: " + new_name.image + ", NULL - QualifiedAttribute returned NULL, ed: " + ed);
                                }
                        }

                        // alternative would be to use a separate attribute alias_name in attribute
                        // but it is not really necessary, because it is always possible to get the original name from the redeclared attribute
                        // however, the old name is also available in the same scope, therefore it is better to have an additional name.
                        // Question: which name should be returned by getName()? old or new? If new - better to change the name, if old - better
                        // to have an additional attribute alias_name. Perhaps.
// System.out.println("@X 11 attr: " + attr);
// System.out.println("@X 12 new name: " + new_name.image + ", ed: " + ed);

//			attr_current = findAttribute(new_name.image, ed, attr_type, null);

// System.out.println("@X 13 attr_current: " + attr_current);

//			if (attr_current != null) {

                                // already exists, do nothing
                                // attr_current.setName(null, new_name.image);

//			} else {

//				if (attr != null) {
                                        // String old_name = attr.getName(null);
//					attr.setName(null, new_name.image);
// System.out.println("@X 14 new attr: " + attr + ", old name: " + old_name);
//				}
//			}
                } // new_name not null
// System.out.println("@@@3 RedeclaredAttribute ending: " + attr);
                flag_in_redeclaring = false;
                {if (true) return attr;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ Amendment ------------ */
  static final public void LanguageVersionId() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(LBRACE);
    label_54:
    while (true) {
      switch (jj_nt.kind) {
      case LPAREN:
      case RPAREN:
      case INTEGER_LITERAL:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[164] = jj_gen;
        break label_54;
      }
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        jj_consume_token(SIMPLE_ID);
        break;
      case INTEGER_LITERAL:
        jj_consume_token(INTEGER_LITERAL);
        break;
      case LPAREN:
        jj_consume_token(LPAREN);
        break;
      case RPAREN:
        jj_consume_token(RPAREN);
        break;
      default:
        jj_la1[165] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    jj_consume_token(RBRACE);
  }

  static final public void AllSchemasInLoop() throws ParseException, jsdai.lang.SdaiException {
    try {
      switch (jj_nt.kind) {
      case LBRACE:
        LanguageVersionId();
        break;
      default:
        jj_la1[166] = jj_gen;
        ;
      }
      switch (jj_nt.kind) {
      case SCHEMA:
        SchemaDecl();
        break;
      case SCHEMA_MAP:
        SchemaMapDecl();
        break;
      case SCHEMA_VIEW:
        SchemaViewDecl();
        break;
      case LPAREN:
      case RPAREN:
      case LBRACE:
      case RBRACE:
      case LBRACKET:
      case RBRACKET:
      case SEMICOLON:
      case COMMA:
      case DOT:
      case COLON:
      case EQ:
      case ASSIGN:
      case GT:
      case LT:
      case HOOK:
      case LE:
      case GE:
      case NE:
      case PLUS:
      case MINUS:
      case STAR:
      case STARS:
      case SLASH:
      case BACKSLASH:
      case BIT_OR:
      case OP_AT:
      case COMPLEX_AND:
      case OP_UNDERSCORE:
      case ABS:
      case ABSTRACT:
      case ACOS:
      case AGGREGATE:
      case ALIAS:
      case AND:
      case ANDOR:
      case ARRAY:
      case AS:
      case ASIN:
      case ATAN:
      case BAG:
      case BASED_ON:
      case BEGIN:
      case BINARY:
      case BLENGTH:
      case BOOLEAN:
      case BY:
      case CASE:
      case CONSTANT:
      case CONST_E:
      case CONTEXT:
      case COS:
      case CREATE:
      case DEPENDENT_MAP:
      case DERIVE:
      case DIV:
      case EACH:
      case ELSE:
      case ELSIF:
      case END:
      case END_ALIAS:
      case END_CASE:
      case END_CONSTANT:
      case END_CONTEXT:
      case END_CREATE:
      case END_DEPENDENT_MAP:
      case END_ENTITY:
      case END_FUNCTION:
      case END_IF:
      case END_LOCAL:
      case END_MAP:
      case END_MODEL:
      case END_PROCEDURE:
      case END_REPEAT:
      case END_RULE:
      case END_SCHEMA:
      case END_SCHEMA_MAP:
      case END_SCHEMA_VIEW:
      case END_SUBTYPE_CONSTRAINT:
      case END_TYPE:
      case END_VIEW:
      case ENTITY:
      case ENUMERATION:
      case ESCAPE:
      case EXISTS:
      case EXP:
      case EXTENSIBLE:
      case EXTENT:
      case FALSE:
      case FIXED:
      case FOR:
      case FORMAT:
      case FROM:
      case FUNCTION:
      case GENERIC_ENTITY:
      case GENERIC:
      case HIBOUND:
      case HIINDEX:
      case IDENTIFIED_BY:
      case IF:
      case IN:
      case INDEXING:
      case INSERT:
      case INTEGER:
      case INVERSE:
      case LENGTH:
      case LIKE:
      case LIST:
      case LOBOUND:
      case LOCAL:
      case LOG:
      case LOG10:
      case LOG2:
      case LOGICAL:
      case LOINDEX:
      case MAP:
      case MOD:
      case MODEL:
      case NOT:
      case NUMBER:
      case NVL:
      case ODD:
      case OF:
      case ONEOF:
      case OPTIONAL:
      case OR:
      case ORDERED_BY:
      case OTHERWISE:
      case PARTITION:
      case PI:
      case PROCEDURE:
      case QUERY:
      case REAL:
      case REFERENCE:
      case REMOVE:
      case RENAMED:
      case REPEAT:
      case RETURN:
      case ROLESOF:
      case RULE:
      case SELECT:
      case SELF:
      case SET:
      case SIN:
      case SIZEOF:
      case SOURCE:
      case SUBTYPE_CONSTRAINT:
      case KW_SKIP:
      case SQRT:
      case STRING:
      case SUBTYPE:
      case SUPERTYPE:
      case TAN:
      case TARGET:
      case THEN:
      case TO:
      case TOTAL_OVER:
      case TRUE:
      case TYPE:
      case TYPEOF:
      case UNIQUE:
      case UNKNOWN:
      case UNTIL:
      case USE:
      case USEDIN:
      case VALUE:
      case VALUE_IN:
      case VALUE_UNIQUE:
      case VAR:
      case VIEW:
      case WITH:
      case WHERE:
      case WHILE:
      case XOR:
      case BINARY_LITERAL:
      case ENCODED_STRING_LITERAL:
      case INTEGER_LITERAL:
      case REAL_LITERAL:
      case SIMPLE_ID:
      case SIMPLE_STRING_LITERAL:
      case BIT:
      case DIGIT:
      case DIGITS:
      case ENCODED_CHARACTER:
      case HEX_DIGIT:
      case LETTER:
      case NOT_PAREN_STAR_QUOTE_SPECIAL:
      case NOT_QUOTE:
      case OCTET:
      case SIGN:
        GarbageDeclaration();
        break;
      default:
        jj_la1[167] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    } catch (ParseException e) {
//	System.out.println("OHOHO ERROR trying to recover");
        System.out.println("EXCEPTION: " + e);
                error_count++;
        System.out.println("ERROR RECOVERY: between schemas, skipping to the next schema");
        recoverToNextSchema(e);
    }
  }

  static final public void GarbageDeclaration_old() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case TYPE:
      jj_consume_token(TYPE);
      break;
    case END_SCHEMA:
      jj_consume_token(END_SCHEMA);
      break;
    default:
      jj_la1[168] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
//		System.out.println("ERROR: garbage between schemas");
                if (recoverToTheNextSchema(null) < 0) {if (true) return;}
  }

// may need two cases for including/excluding express amendment additional keywords, according to the switch,
// because if they are disabled in the scanner, there might be problems here

//  END_MODEL, END_CONTEXT ?
  static final public void GarbageDeclaration() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      break;
    case RPAREN:
      jj_consume_token(RPAREN);
      break;
    case LBRACE:
      jj_consume_token(LBRACE);
      break;
    case RBRACE:
      jj_consume_token(RBRACE);
      break;
    case LBRACKET:
      jj_consume_token(LBRACKET);
      break;
    case RBRACKET:
      jj_consume_token(RBRACKET);
      break;
    case SEMICOLON:
      jj_consume_token(SEMICOLON);
      break;
    case COMMA:
      jj_consume_token(COMMA);
      break;
    case DOT:
      jj_consume_token(DOT);
      break;
    case COLON:
      jj_consume_token(COLON);
      break;
    case EQ:
      jj_consume_token(EQ);
      break;
    case ASSIGN:
      jj_consume_token(ASSIGN);
      break;
    case GT:
      jj_consume_token(GT);
      break;
    case LT:
      jj_consume_token(LT);
      break;
    case HOOK:
      jj_consume_token(HOOK);
      break;
    case LE:
      jj_consume_token(LE);
      break;
    case GE:
      jj_consume_token(GE);
      break;
    case NE:
      jj_consume_token(NE);
      break;
    case PLUS:
      jj_consume_token(PLUS);
      break;
    case MINUS:
      jj_consume_token(MINUS);
      break;
    case STAR:
      jj_consume_token(STAR);
      break;
    case STARS:
      jj_consume_token(STARS);
      break;
    case SLASH:
      jj_consume_token(SLASH);
      break;
    case BACKSLASH:
      jj_consume_token(BACKSLASH);
      break;
    case BIT_OR:
      jj_consume_token(BIT_OR);
      break;
    case OP_AT:
      jj_consume_token(OP_AT);
      break;
    case COMPLEX_AND:
      jj_consume_token(COMPLEX_AND);
      break;
    case OP_UNDERSCORE:
      jj_consume_token(OP_UNDERSCORE);
      break;
    case ABS:
      jj_consume_token(ABS);
      break;
    case ABSTRACT:
      jj_consume_token(ABSTRACT);
      break;
    case ACOS:
      jj_consume_token(ACOS);
      break;
    case AGGREGATE:
      jj_consume_token(AGGREGATE);
      break;
    case ALIAS:
      jj_consume_token(ALIAS);
      break;
    case AND:
      jj_consume_token(AND);
      break;
    case ANDOR:
      jj_consume_token(ANDOR);
      break;
    case ARRAY:
      jj_consume_token(ARRAY);
      break;
    case AS:
      jj_consume_token(AS);
      break;
    case ASIN:
      jj_consume_token(ASIN);
      break;
    case ATAN:
      jj_consume_token(ATAN);
      break;
    case BAG:
      jj_consume_token(BAG);
      break;
    case BASED_ON:
      jj_consume_token(BASED_ON);
      break;
    case BEGIN:
      jj_consume_token(BEGIN);
      break;
    case BINARY:
      jj_consume_token(BINARY);
      break;
    case BLENGTH:
      jj_consume_token(BLENGTH);
      break;
    case BOOLEAN:
      jj_consume_token(BOOLEAN);
      break;
    case BY:
      jj_consume_token(BY);
      break;
    case CASE:
      jj_consume_token(CASE);
      break;
    case CONSTANT:
      jj_consume_token(CONSTANT);
      break;
    case CONST_E:
      jj_consume_token(CONST_E);
      break;
    case CONTEXT:
      jj_consume_token(CONTEXT);
      break;
    case COS:
      jj_consume_token(COS);
      break;
    case CREATE:
      jj_consume_token(CREATE);
      break;
    case DEPENDENT_MAP:
      jj_consume_token(DEPENDENT_MAP);
      break;
    case DERIVE:
      jj_consume_token(DERIVE);
      break;
    case DIV:
      jj_consume_token(DIV);
      break;
    case EACH:
      jj_consume_token(EACH);
      break;
    case ELSE:
      jj_consume_token(ELSE);
      break;
    case ELSIF:
      jj_consume_token(ELSIF);
      break;
    case END:
      jj_consume_token(END);
      break;
    case END_ALIAS:
      jj_consume_token(END_ALIAS);
      break;
    case END_CASE:
      jj_consume_token(END_CASE);
      break;
    case END_CONSTANT:
      jj_consume_token(END_CONSTANT);
      break;
    case END_CONTEXT:
      jj_consume_token(END_CONTEXT);
      break;
    case END_CREATE:
      jj_consume_token(END_CREATE);
      break;
    case END_DEPENDENT_MAP:
      jj_consume_token(END_DEPENDENT_MAP);
      break;
    case END_ENTITY:
      jj_consume_token(END_ENTITY);
      break;
    case END_FUNCTION:
      jj_consume_token(END_FUNCTION);
      break;
    case END_IF:
      jj_consume_token(END_IF);
      break;
    case END_LOCAL:
      jj_consume_token(END_LOCAL);
      break;
    case END_MAP:
      jj_consume_token(END_MAP);
      break;
    case END_MODEL:
      jj_consume_token(END_MODEL);
      break;
    case END_PROCEDURE:
      jj_consume_token(END_PROCEDURE);
      break;
    case END_REPEAT:
      jj_consume_token(END_REPEAT);
      break;
    case END_RULE:
      jj_consume_token(END_RULE);
      break;
    case END_SCHEMA:
      jj_consume_token(END_SCHEMA);
      break;
    case END_SCHEMA_MAP:
      jj_consume_token(END_SCHEMA_MAP);
      break;
    case END_SCHEMA_VIEW:
      jj_consume_token(END_SCHEMA_VIEW);
      break;
    case END_SUBTYPE_CONSTRAINT:
      jj_consume_token(END_SUBTYPE_CONSTRAINT);
      break;
    case END_TYPE:
      jj_consume_token(END_TYPE);
      break;
    case END_VIEW:
      jj_consume_token(END_VIEW);
      break;
    case ENTITY:
      jj_consume_token(ENTITY);
      break;
    case ENUMERATION:
      jj_consume_token(ENUMERATION);
      break;
    case ESCAPE:
      jj_consume_token(ESCAPE);
      break;
    case EXISTS:
      jj_consume_token(EXISTS);
      break;
    case EXP:
      jj_consume_token(EXP);
      break;
    case EXTENSIBLE:
      jj_consume_token(EXTENSIBLE);
      break;
    case EXTENT:
      jj_consume_token(EXTENT);
      break;
    case FALSE:
      jj_consume_token(FALSE);
      break;
    case FIXED:
      jj_consume_token(FIXED);
      break;
    case FOR:
      jj_consume_token(FOR);
      break;
    case FORMAT:
      jj_consume_token(FORMAT);
      break;
    case FROM:
      jj_consume_token(FROM);
      break;
    case FUNCTION:
      jj_consume_token(FUNCTION);
      break;
    case GENERIC_ENTITY:
      jj_consume_token(GENERIC_ENTITY);
      break;
    case GENERIC:
      jj_consume_token(GENERIC);
      break;
    case HIBOUND:
      jj_consume_token(HIBOUND);
      break;
    case HIINDEX:
      jj_consume_token(HIINDEX);
      break;
    case IDENTIFIED_BY:
      jj_consume_token(IDENTIFIED_BY);
      break;
    case IF:
      jj_consume_token(IF);
      break;
    case IN:
      jj_consume_token(IN);
      break;
    case INDEXING:
      jj_consume_token(INDEXING);
      break;
    case INSERT:
      jj_consume_token(INSERT);
      break;
    case INTEGER:
      jj_consume_token(INTEGER);
      break;
    case INVERSE:
      jj_consume_token(INVERSE);
      break;
    case LENGTH:
      jj_consume_token(LENGTH);
      break;
    case LIKE:
      jj_consume_token(LIKE);
      break;
    case LIST:
      jj_consume_token(LIST);
      break;
    case LOBOUND:
      jj_consume_token(LOBOUND);
      break;
    case LOCAL:
      jj_consume_token(LOCAL);
      break;
    case LOG:
      jj_consume_token(LOG);
      break;
    case LOG10:
      jj_consume_token(LOG10);
      break;
    case LOG2:
      jj_consume_token(LOG2);
      break;
    case LOGICAL:
      jj_consume_token(LOGICAL);
      break;
    case LOINDEX:
      jj_consume_token(LOINDEX);
      break;
    case MAP:
      jj_consume_token(MAP);
      break;
    case MOD:
      jj_consume_token(MOD);
      break;
    case MODEL:
      jj_consume_token(MODEL);
      break;
    case NOT:
      jj_consume_token(NOT);
      break;
    case NUMBER:
      jj_consume_token(NUMBER);
      break;
    case NVL:
      jj_consume_token(NVL);
      break;
    case ODD:
      jj_consume_token(ODD);
      break;
    case OF:
      jj_consume_token(OF);
      break;
    case ONEOF:
      jj_consume_token(ONEOF);
      break;
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
      break;
    case OR:
      jj_consume_token(OR);
      break;
    case ORDERED_BY:
      jj_consume_token(ORDERED_BY);
      break;
    case OTHERWISE:
      jj_consume_token(OTHERWISE);
      break;
    case PARTITION:
      jj_consume_token(PARTITION);
      break;
    case PI:
      jj_consume_token(PI);
      break;
    case PROCEDURE:
      jj_consume_token(PROCEDURE);
      break;
    case QUERY:
      jj_consume_token(QUERY);
      break;
    case REAL:
      jj_consume_token(REAL);
      break;
    case REFERENCE:
      jj_consume_token(REFERENCE);
      break;
    case REMOVE:
      jj_consume_token(REMOVE);
      break;
    case RENAMED:
      jj_consume_token(RENAMED);
      break;
    case REPEAT:
      jj_consume_token(REPEAT);
      break;
    case RETURN:
      jj_consume_token(RETURN);
      break;
    case ROLESOF:
      jj_consume_token(ROLESOF);
      break;
    case RULE:
      jj_consume_token(RULE);
      break;
    case SELECT:
      jj_consume_token(SELECT);
      break;
    case SELF:
      jj_consume_token(SELF);
      break;
    case SET:
      jj_consume_token(SET);
      break;
    case SIN:
      jj_consume_token(SIN);
      break;
    case SIZEOF:
      jj_consume_token(SIZEOF);
      break;
    case SOURCE:
      jj_consume_token(SOURCE);
      break;
    case SUBTYPE_CONSTRAINT:
      jj_consume_token(SUBTYPE_CONSTRAINT);
      break;
    case KW_SKIP:
      jj_consume_token(KW_SKIP);
      break;
    case SQRT:
      jj_consume_token(SQRT);
      break;
    case STRING:
      jj_consume_token(STRING);
      break;
    case SUBTYPE:
      jj_consume_token(SUBTYPE);
      break;
    case SUPERTYPE:
      jj_consume_token(SUPERTYPE);
      break;
    case TAN:
      jj_consume_token(TAN);
      break;
    case TARGET:
      jj_consume_token(TARGET);
      break;
    case THEN:
      jj_consume_token(THEN);
      break;
    case TO:
      jj_consume_token(TO);
      break;
    case TOTAL_OVER:
      jj_consume_token(TOTAL_OVER);
      break;
    case TRUE:
      jj_consume_token(TRUE);
      break;
    case TYPE:
      jj_consume_token(TYPE);
      break;
    case TYPEOF:
      jj_consume_token(TYPEOF);
      break;
    case UNIQUE:
      jj_consume_token(UNIQUE);
      break;
    case UNKNOWN:
      jj_consume_token(UNKNOWN);
      break;
    case UNTIL:
      jj_consume_token(UNTIL);
      break;
    case USE:
      jj_consume_token(USE);
      break;
    case USEDIN:
      jj_consume_token(USEDIN);
      break;
    case VALUE:
      jj_consume_token(VALUE);
      break;
    case VALUE_IN:
      jj_consume_token(VALUE_IN);
      break;
    case VALUE_UNIQUE:
      jj_consume_token(VALUE_UNIQUE);
      break;
    case VAR:
      jj_consume_token(VAR);
      break;
    case VIEW:
      jj_consume_token(VIEW);
      break;
    case WITH:
      jj_consume_token(WITH);
      break;
    case WHERE:
      jj_consume_token(WHERE);
      break;
    case WHILE:
      jj_consume_token(WHILE);
      break;
    case XOR:
      jj_consume_token(XOR);
      break;
    case BINARY_LITERAL:
      jj_consume_token(BINARY_LITERAL);
      break;
    case ENCODED_STRING_LITERAL:
      jj_consume_token(ENCODED_STRING_LITERAL);
      break;
    case INTEGER_LITERAL:
      jj_consume_token(INTEGER_LITERAL);
      break;
    case REAL_LITERAL:
      jj_consume_token(REAL_LITERAL);
      break;
    case SIMPLE_ID:
      jj_consume_token(SIMPLE_ID);
      break;
    case SIMPLE_STRING_LITERAL:
      jj_consume_token(SIMPLE_STRING_LITERAL);
      break;
    case BIT:
      jj_consume_token(BIT);
      break;
    case DIGIT:
      jj_consume_token(DIGIT);
      break;
    case DIGITS:
      jj_consume_token(DIGITS);
      break;
    case ENCODED_CHARACTER:
      jj_consume_token(ENCODED_CHARACTER);
      break;
    case HEX_DIGIT:
      jj_consume_token(HEX_DIGIT);
      break;
    case LETTER:
      jj_consume_token(LETTER);
      break;
    case NOT_PAREN_STAR_QUOTE_SPECIAL:
      jj_consume_token(NOT_PAREN_STAR_QUOTE_SPECIAL);
      break;
    case NOT_QUOTE:
      jj_consume_token(NOT_QUOTE);
      break;
    case OCTET:
      jj_consume_token(OCTET);
      break;
    case SIGN:
      jj_consume_token(SIGN);
      break;
    default:
      jj_la1[169] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
//		System.out.println("ERROR: garbage between schemas");
                if (recoverToTheNextSchema(null) < 0) {if (true) return;}
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.281 ------------ */
  static final public X_AllSchemas AllSchemas() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In AllSchemas, starting, pass: " + parser_pass);
                if (first_parsed_file) {
                        current_scope = new Vector();
                }
                schema_depth = 0;
                // current_scope.addElement("Universal Scope");
                // scope_stack.push(current_scope);
                // printScopeStack();

    AllSchemasInLoop();
    label_55:
    while (true) {
      switch (jj_nt.kind) {
      case LPAREN:
      case RPAREN:
      case LBRACE:
      case RBRACE:
      case LBRACKET:
      case RBRACKET:
      case SEMICOLON:
      case COMMA:
      case DOT:
      case COLON:
      case EQ:
      case ASSIGN:
      case GT:
      case LT:
      case HOOK:
      case LE:
      case GE:
      case NE:
      case PLUS:
      case MINUS:
      case STAR:
      case STARS:
      case SLASH:
      case BACKSLASH:
      case BIT_OR:
      case OP_AT:
      case COMPLEX_AND:
      case OP_UNDERSCORE:
      case ABS:
      case ABSTRACT:
      case ACOS:
      case AGGREGATE:
      case ALIAS:
      case AND:
      case ANDOR:
      case ARRAY:
      case AS:
      case ASIN:
      case ATAN:
      case BAG:
      case BASED_ON:
      case BEGIN:
      case BINARY:
      case BLENGTH:
      case BOOLEAN:
      case BY:
      case CASE:
      case CONSTANT:
      case CONST_E:
      case CONTEXT:
      case COS:
      case CREATE:
      case DEPENDENT_MAP:
      case DERIVE:
      case DIV:
      case EACH:
      case ELSE:
      case ELSIF:
      case END:
      case END_ALIAS:
      case END_CASE:
      case END_CONSTANT:
      case END_CONTEXT:
      case END_CREATE:
      case END_DEPENDENT_MAP:
      case END_ENTITY:
      case END_FUNCTION:
      case END_IF:
      case END_LOCAL:
      case END_MAP:
      case END_MODEL:
      case END_PROCEDURE:
      case END_REPEAT:
      case END_RULE:
      case END_SCHEMA:
      case END_SCHEMA_MAP:
      case END_SCHEMA_VIEW:
      case END_SUBTYPE_CONSTRAINT:
      case END_TYPE:
      case END_VIEW:
      case ENTITY:
      case ENUMERATION:
      case ESCAPE:
      case EXISTS:
      case EXP:
      case EXTENSIBLE:
      case EXTENT:
      case FALSE:
      case FIXED:
      case FOR:
      case FORMAT:
      case FROM:
      case FUNCTION:
      case GENERIC_ENTITY:
      case GENERIC:
      case HIBOUND:
      case HIINDEX:
      case IDENTIFIED_BY:
      case IF:
      case IN:
      case INDEXING:
      case INSERT:
      case INTEGER:
      case INVERSE:
      case LENGTH:
      case LIKE:
      case LIST:
      case LOBOUND:
      case LOCAL:
      case LOG:
      case LOG10:
      case LOG2:
      case LOGICAL:
      case LOINDEX:
      case MAP:
      case MOD:
      case MODEL:
      case NOT:
      case NUMBER:
      case NVL:
      case ODD:
      case OF:
      case ONEOF:
      case OPTIONAL:
      case OR:
      case ORDERED_BY:
      case OTHERWISE:
      case PARTITION:
      case PI:
      case PROCEDURE:
      case QUERY:
      case REAL:
      case REFERENCE:
      case REMOVE:
      case RENAMED:
      case REPEAT:
      case RETURN:
      case ROLESOF:
      case RULE:
      case SCHEMA:
      case SCHEMA_MAP:
      case SCHEMA_VIEW:
      case SELECT:
      case SELF:
      case SET:
      case SIN:
      case SIZEOF:
      case SOURCE:
      case SUBTYPE_CONSTRAINT:
      case KW_SKIP:
      case SQRT:
      case STRING:
      case SUBTYPE:
      case SUPERTYPE:
      case TAN:
      case TARGET:
      case THEN:
      case TO:
      case TOTAL_OVER:
      case TRUE:
      case TYPE:
      case TYPEOF:
      case UNIQUE:
      case UNKNOWN:
      case UNTIL:
      case USE:
      case USEDIN:
      case VALUE:
      case VALUE_IN:
      case VALUE_UNIQUE:
      case VAR:
      case VIEW:
      case WITH:
      case WHERE:
      case WHILE:
      case XOR:
      case BINARY_LITERAL:
      case ENCODED_STRING_LITERAL:
      case INTEGER_LITERAL:
      case REAL_LITERAL:
      case SIMPLE_ID:
      case SIMPLE_STRING_LITERAL:
      case BIT:
      case DIGIT:
      case DIGITS:
      case ENCODED_CHARACTER:
      case HEX_DIGIT:
      case LETTER:
      case NOT_PAREN_STAR_QUOTE_SPECIAL:
      case NOT_QUOTE:
      case OCTET:
      case SIGN:
        ;
        break;
      default:
        jj_la1[170] = jj_gen;
        break label_55;
      }
      AllSchemasInLoop();
    }
                // current__scope = scope_stack.pop();
         printDebug("In AllSchemas, ending, pass: " + parser_pass);
         if (_st_real == null) {
                 printDebug("In AllSchemas, ending, pass: " + parser_pass + ", _st_real is NULL");
         } else {
                 printDebug("In AllSchemas, ending, pass: " + parser_pass + ", _st_real is OK");
         }
        {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public void SchemaDecl() throws ParseException, jsdai.lang.SdaiException {
        String schema_name;
        String version_name = null;
        Token a_token;
        Vector used_vector = null;
        Vector referenced_vector = null;
    try {
                Token t;
                express_x = false;
                scope_stack.push(current_scope);
                current_scope = new Vector();
                function_depth = 0;
      a_token = jj_consume_token(SCHEMA);
                             schema_depth++;
      schema_name = SchemaId();
                global_schema_name = schema_name.toLowerCase();
                printVerbose0("Parsing schema: " + schema_name + " in pass " + parser_pass);
//		printVerbose("Starting parsing schema: " + schema_name + " in pass " + parser_pass);
                if ((parser_pass == 1) && (!is_complex_schema)) {
                        compiled_schemas.addElement(schema_name);
//                      if (model == null) {
                                model_name = schema_name.toUpperCase() + "_DICTIONARY_DATA";
                                compiled_models.addElement(model_name);
// listModels();
// printDDebug("Creating model: : " + model_name);


                                model = repository.findSdaiModel(model_name);
                                // model = findModel(schema_name);
                                if (model != null) {
                                        if ((flag_replace_schema) && (model.getMode() == jsdai.lang.SdaiModel.READ_ONLY)) {
                                                model.deleteSdaiModel();
                                                jsdai.lang.SdaiModel relatedModel =
                                                        repository.findSdaiModel("_EXPRESS_" + schema_name.toUpperCase());
                                                if(relatedModel != null) {
                                                        relatedModel.deleteSdaiModel();
                                                }
                                                relatedModel =
                                                        repository.findSdaiModel("_DOCUMENTATION_" + schema_name.toUpperCase());
                                                if(relatedModel != null) {
                                                        relatedModel.deleteSdaiModel();
                                                }
                                        } else {
                                                error_count++;
                                                Token tt = getToken(0);
//						printError("Duplicate schema name: " + schema_name + " at line " + tt.beginLine + ", column " + tt.beginColumn);
                                                printErrorMsg("" + schema_name + " - duplicate schema name", null, true);
                                                do {
                                                        t = getToken(1);
                                                        if (t.kind != Compiler2Constants.END_SCHEMA) {
                                                                getNextToken();
                                                        }
                                                        // t = getNextToken();
                                                } while (t.kind != Compiler2Constants.END_SCHEMA);
                                                {if (true) return;}
                                        }
                                }
                                model = repository.createSdaiModel(model_name, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                                model.startReadWriteAccess();
                                sd = (jsdai.SExtended_dictionary_schema.ESchema_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSchema_definition.class);
                                if (flag_oc) {
                                        sd.setName(null, schema_name);
                                } else {
                                        sd.setName(null, schema_name.toUpperCase());
                                }
                          active_scope_extension = new ECtScope(active_scope, sd, active_scope_extension, active_scope_string, schema_name, schema_name.toLowerCase());
//System.out.println("new active_scope_extension: " + active_scope_extension);
                                active_scope_string = "";
                                active_scope = null;  // not using on schema level (yet)

                                hm_current_entity_declarations = new HashMap();
                                hm_current_type_declarations = new HashMap();
                                hm_current_function_declarations = new HashMap();
                                hm_current_procedure_declarations = new HashMap();
                                hm_current_rule_declarations = new HashMap();
                                hm_current_constant_declarations = new HashMap();
                                hm_current_subtype_constraint_declarations = new HashMap();
                                hm_current_variables = new HashMap();
                                hm_current_parameters = new HashMap();

// System.out.println("Model created in pass 1: " + model);				

                                Object hm = hm_entity_declarations.put(model, hm_current_entity_declarations);
                                if (hm != null) {
                                        System.out.println("ERROR: entity declaration hashmap for this schema already exists: " + schema_name);
                                }
                                hm = hm_type_declarations.put(model, hm_current_type_declarations);
                                if (hm != null) {
                                        System.out.println("ERROR: type declaration hashmap for this schema already exists: " + schema_name);
                                }
                                hm = hm_function_declarations.put(model, hm_current_function_declarations);
                                if (hm != null) {
                                        System.out.println("ERROR: function declaration hashmap for this schema already exists: " + schema_name);
                                }
                                hm = hm_procedure_declarations.put(model, hm_current_procedure_declarations);
                                if (hm != null) {
                                        System.out.println("ERROR: procedure declaration hashmap for this schema already exists: " + schema_name);
                                }
                                hm = hm_rule_declarations.put(model, hm_current_rule_declarations);
                                if (hm != null) {
                                        System.out.println("ERROR: rule declaration hashmap for this schema already exists: " + schema_name);
                                }
                                hm = hm_constant_declarations.put(model, hm_current_constant_declarations);
                                if (hm != null) {
                                        System.out.println("ERROR: constant declaration hashmap for this schema already exists: " + schema_name);
                                }
                                hm = hm_subtype_constraint_declarations.put(model, hm_current_subtype_constraint_declarations);
                                if (hm != null) {
                                        System.out.println("ERROR: subtype_constraint declaration hashmap for this schema already exists: " + schema_name);
                                }
                                hm = hm_parameters.put(model, hm_current_parameters);
                                if (hm != null) {
                                        System.out.println("ERROR: parameter hashmap for this schema already exists: " + schema_name);
                                }
                                hm = hm_variables.put(model, hm_current_variables);
                                if (hm != null) {
                                        System.out.println("ERROR: variable hashmap for this schema already exists: " + schema_name);
                                }

                                // add simple types:
                                if (model_name.equalsIgnoreCase("SDAI_DICTIONARY_SCHEMA_DICTIONARY_DATA")) {
                                        if (flag_xt_sdai) {
                                                // create instances of each simple data type
                                                _st_integer = (jsdai.SExtended_dictionary_schema.EInteger_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_type.class);
                                                _st_integer.setName(null, "_INTEGER");
                                                _st_real = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                                _st_real.setName(null, "_REAL");
                                                _st_number = (jsdai.SExtended_dictionary_schema.ENumber_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNumber_type.class);
                                                _st_number.setName(null, "_NUMBER");
                                                _st_logical = (jsdai.SExtended_dictionary_schema.ELogical_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLogical_type.class);
                                                _st_logical.setName(null, "_LOGICAL");
                                                _st_boolean = (jsdai.SExtended_dictionary_schema.EBoolean_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBoolean_type.class);
                                                _st_boolean.setName(null, "_BOOLEAN");
                                                _st_string = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                                _st_string.setName(null, "_STRING");
                                                _st_string.setFixed_width(null, false);
                                                _st_binary = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                                _st_binary.setName(null, "_BINARY");
                                                _st_binary.setFixed_width(null, false);
                                                _st_generic = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                                                _st_generic.setName(null, "_GENERIC");
                                                // because entity_definition causes bootstrapping problems, here is a temp implementation:
                                                _st_entity = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                                                _st_entity.setName(null, "_ENTITY");
//                _st_entity = (jsdai.SExtended_dictionary_schema.EEntity_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_definition.class);
//                                              _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
//                                              _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//                                              _std_entity.setDefinition(null, _st_entity);
//                                              _st_entity.setName(null, "_ENTITY");
//                                              _st_entity.setInstantiable(null, false);
//                                              _st_entity.setComplex(null, false);
//                                              _st_entity.createSupertypes(null);

//                                  _st_list_string  = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//printDDebug(".oO0Oo. LIST TYPE CREATED - for standard pass 1");
//                                              _st_list_string.setName(null, "_LIST_STRING");

//                                              jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
//                                              jsdai.SExtended_dictionary_schema.EInteger_bound b1;
//                                              b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
//                                              b1.setBound_value(null, 0);
//                                              bounds[0] = b1;
//                                              _st_list_string.setLower_bound(null, bounds[0]);
//                                              _st_list_string.unsetUpper_bound(null);  // no need for that it is unset after creating
//                                              _st_list_string.setUnique_flag(null, false);
//                                              _st_list_string.setElement_type(null, _st_string);


                                    _st_list_generic  = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
// printDDebug(".oO0Oo. LIST TYPE CREATED - for standard pass 1");
//						_st_list_generic.setName(null, "_LIST_GENERIC");
                                                _st_list_generic.setName(null, "_GENERALLIST_0_GENERIC");

                                                jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
                                                jsdai.SExtended_dictionary_schema.EInteger_bound b1;
                                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                                b1.setBound_value(null, 0);
                                                bounds[0] = b1;
                                                _st_list_generic.setLower_bound(null, bounds[0]);
                                                _st_list_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_list_generic.setUnique_flag(null, false);
                                                _st_list_generic.setElement_type(null, _st_generic);

                                    _st_set_generic  = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//						_st_set_generic.setName(null, "_SET_GENERIC");
                                                _st_set_generic.setName(null, "_GENERALSET_0_GENERIC");

                                                _st_set_generic.setLower_bound(null, bounds[0]);
                                                _st_set_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_set_generic.setElement_type(null, _st_generic);

                                    _st_set_string  = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//						_st_set_string.setName(null, "_SET_STRING");
                                                _st_set_string.setName(null, "_GENERALSET_0_STRING");

                                                _st_set_string.setLower_bound(null, bounds[0]);
                                                _st_set_string.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_set_string.setElement_type(null, _st_string);

                                    _st_bag_generic  = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//						_st_bag_generic.setName(null, "_BAG_GENERIC");
                                                _st_bag_generic.setName(null, "_GENERALBAG_0_GENERIC");

                                                _st_bag_generic.setLower_bound(null, bounds[0]);
                                                _st_bag_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_bag_generic.setElement_type(null, _st_generic);

                                    _st_aggregate_generic  = (jsdai.SExtended_dictionary_schema.EAggregation_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregation_type.class);
                                                _st_aggregate_generic.setName(null, "_AGGREGATE_GENERIC");

                                                _st_aggregate_generic.setElement_type(null, _st_generic);

                                                _st_schema = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
                                                _st_model  = model;

                                                if (flag_xt_declarations) {
                                                        _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_integer.setDefinition(null, _st_integer);
                                                        _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_real.setParent(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_real.setDefinition(null, _st_real);
                                                        _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_number.setDefinition(null, _st_number);
                                                        _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_logical.setDefinition(null, _st_logical);
                                                        _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_boolean.setDefinition(null, _st_boolean);
                                                        _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_string.setDefinition(null, _st_string);
                                                        _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_binary.setDefinition(null, _st_binary);
                                                        _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_generic.setDefinition(null, _st_generic);
                                                        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_entity.setDefinition(null, _st_entity);
//            _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//            _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//            _std_list_string.setDefinition(null, _st_list_string);
                                                        _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_list_generic.setParent(null, sd);
                                                                // parent_schema is now derived instead of explicit 
                                                        // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_list_generic.setDefinition(null, _st_list_generic);

                                                _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_generic.setDefinition(null, _st_set_generic);
                                                _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_string.setDefinition(null, _st_set_string);
                                                _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_bag_generic.setDefinition(null, _st_bag_generic);
                                                _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                                }
                                        } else {
                                                if (flag_xt_declarations) {
                                                        _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_integer.setDefinition(null, _st_integer);
                                                        _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_real.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_real.setDefinition(null, _st_real);
                                                        _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_number.setDefinition(null, _st_number);
                                                        _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_logical.setDefinition(null, _st_logical);
                                                        _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_boolean.setDefinition(null, _st_boolean);
                                                        _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        //_std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_string.setDefinition(null, _st_string);
                                                        _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_binary.setDefinition(null, _st_binary);
                                                        _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_generic.setDefinition(null, _st_generic);
                                                        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_entity.setDefinition(null, _st_entity);
//            _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//    	      _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//	          _std_list_string.setDefinition(null, _st_list_string);
                                                        _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_list_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_list_generic.setDefinition(null, _st_list_generic);
                                                _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_generic.setDefinition(null, _st_set_generic);
                                                _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_string.setDefinition(null, _st_set_string);
                                                _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_bag_generic.setDefinition(null, _st_bag_generic);
                                                _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                                }
                                        }
                                } else
                                if (model_name.equalsIgnoreCase("EXTENDED_DICTIONARY_SCHEMA_DICTIONARY_DATA")) {
                                        if (!flag_xt_sdai) {
                                                // create instances of each simple data type
                                                _st_integer = (jsdai.SExtended_dictionary_schema.EInteger_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_type.class);
                                                _st_integer.setName(null, "_INTEGER");
                                                _st_real = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                                _st_real.setName(null, "_REAL");
                                                _st_number = (jsdai.SExtended_dictionary_schema.ENumber_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNumber_type.class);
                                                _st_number.setName(null, "_NUMBER");
                                                _st_logical = (jsdai.SExtended_dictionary_schema.ELogical_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLogical_type.class);
                                                _st_logical.setName(null, "_LOGICAL");
                                                _st_boolean = (jsdai.SExtended_dictionary_schema.EBoolean_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBoolean_type.class);
                                                _st_boolean.setName(null, "_BOOLEAN");
                                                _st_string = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                                _st_string.setName(null, "_STRING");
                                                _st_string.setFixed_width(null, false);
                                                _st_binary = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                                _st_binary.setName(null, "_BINARY");
                                                _st_binary.setFixed_width(null, false);
                                                _st_generic = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                                                _st_generic.setName(null, "_GENERIC");
                                                // because entity_definition causes bootstrapping problems, here is a temp implementation:
                                                _st_entity = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                                                _st_entity.setName(null, "_ENTITY");
//          _st_entity = (jsdai.SExtended_dictionary_schema.EEntity_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_definition.class);
//	        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
//          _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//          _std_entity.setDefinition(null, _st_entity);
//	        _st_entity.setName(null, "_ENTITY");
//          _st_entity.setInstantiable(null, false);
//          _st_entity.setComplex(null, false);
//          _st_entity.createSupertypes(null);

// 		     _st_list_string  = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//printDDebug(".oO0Oo. LIST TYPE CREATED - for standard pass 1");
//         _st_list_string.setName(null, "_LIST_STRING");

//         jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
//         jsdai.SExtended_dictionary_schema.EInteger_bound b1;
//         b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
//         b1.setBound_value(null, 0);
//         bounds[0] = b1;
//    	   _st_list_string.setLower_bound(null, bounds[0]);
//  	     _st_list_string.unsetUpper_bound(null);  // no need for that it is unset after creating
//         _st_list_string.setUnique_flag(null, false);
//    	   _st_list_string.setElement_type(null, _st_string);

                                    _st_list_generic  = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
// printDDebug(".oO0Oo. LIST TYPE CREATED - for standard pass 1");
//						_st_list_generic.setName(null, "_LIST_GENERIC");
                                                _st_list_generic.setName(null, "_GENERALLIST_0_GENERIC");

                                                jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
                                                jsdai.SExtended_dictionary_schema.EInteger_bound b1;
                                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                                b1.setBound_value(null, 0);
                                                bounds[0] = b1;
                                                _st_list_generic.setLower_bound(null, bounds[0]);
                                                _st_list_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_list_generic.setUnique_flag(null, false);
                                                _st_list_generic.setElement_type(null, _st_generic);

                                    _st_set_generic  = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//						_st_set_generic.setName(null, "_SET_GENERIC");
                                                _st_set_generic.setName(null, "_GENERALSET_0_GENERIC");

                                                _st_set_generic.setLower_bound(null, bounds[0]);
                                                _st_set_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_set_generic.setElement_type(null, _st_generic);

                                    _st_set_string  = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//						_st_set_string.setName(null, "_SET_STRING");
                                                _st_set_string.setName(null, "_GENERALSET_0_STRING");

                                                _st_set_string.setLower_bound(null, bounds[0]);
                                                _st_set_string.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_set_string.setElement_type(null, _st_string);

                                    _st_bag_generic  = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//						_st_bag_generic.setName(null, "_BAG_GENERIC");
                                                _st_bag_generic.setName(null, "_GENERALBAG_0_GENERIC");

                                                _st_bag_generic.setLower_bound(null, bounds[0]);
                                                _st_bag_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_bag_generic.setElement_type(null, _st_generic);

                                    _st_aggregate_generic  = (jsdai.SExtended_dictionary_schema.EAggregation_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregation_type.class);
                                                _st_aggregate_generic.setName(null, "_AGGREGATE_GENERIC");

                                                _st_aggregate_generic.setElement_type(null, _st_generic);

                                                _st_schema = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
                                                _st_model  = model;

                                                if (flag_xt_declarations) {
                                                        _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_integer.setDefinition(null, _st_integer);
                                                        _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_real.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_real.setDefinition(null, _st_real);
                                                        _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_number.setDefinition(null, _st_number);
                                                        _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_logical.setDefinition(null, _st_logical);
                                                        _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_boolean.setDefinition(null, _st_boolean);
                                                        _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_string.setDefinition(null, _st_string);
                                                        _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_binary.setDefinition(null, _st_binary);
                                                        _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_generic.setDefinition(null, _st_generic);
                                                        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_entity.setDefinition(null, _st_entity);
//            _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//            _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//  	        _std_list_string.setDefinition(null, _st_list_string);
                                                        _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_list_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_list_generic.setDefinition(null, _st_list_generic);
                                                _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_generic.setDefinition(null, _st_set_generic);
                                                _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_string.setDefinition(null, _st_set_string);
                                                _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_bag_generic.setDefinition(null, _st_bag_generic);
                                                _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                                } // declarations
                                        } else {
                                                if (flag_xt_declarations) {
                                                        _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_integer.setDefinition(null, _st_integer);
                                                        _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_real.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_real.setDefinition(null, _st_real);
                                                        _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_number.setDefinition(null, _st_number);
                                                        _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_logical.setDefinition(null, _st_logical);
                                                        _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_boolean.setDefinition(null, _st_boolean);
                                                        _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_string.setDefinition(null, _st_string);
                                                        _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_binary.setDefinition(null, _st_binary);
                                                        _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_generic.setDefinition(null, _st_generic);
                                                        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_entity.setDefinition(null, _st_entity);
//            _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//            _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//            _std_list_string.setDefinition(null, _st_list_string);
                                                        _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_list_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_list_generic.setDefinition(null, _st_list_generic);
                                                _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_generic.setDefinition(null, _st_set_generic);
                                                _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_string.setDefinition(null, _st_set_string);
                                                _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_bag_generic.setDefinition(null, _st_bag_generic);
                                                _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                                }
                                        }
                                } else {
                                        if (flag_xt_declarations) {
                                                _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_integer.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_integer.setDefinition(null, _st_integer);
                                                _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_real.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_real.setDefinition(null, _st_real);
                                                _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_number.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_number.setDefinition(null, _st_number);
                                                _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_logical.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_logical.setDefinition(null, _st_logical);
                                                _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_boolean.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_boolean.setDefinition(null, _st_boolean);
                                                _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_string.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_string.setDefinition(null, _st_string);
                                                _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_binary.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_binary.setDefinition(null, _st_binary);
                                                _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_generic.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_generic.setDefinition(null, _st_generic);
                                                _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_entity.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_entity.setDefinition(null, _st_entity);
// 	        _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//          _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//  	      _std_list_string.setDefinition(null, _st_list_string);
                                                _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_list_generic.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_list_generic.setDefinition(null, _st_list_generic);
                                        _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                _std_set_generic.setDefinition(null, _st_set_generic);
                                        _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_set_string.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                _std_set_string.setDefinition(null, _st_set_string);
                                        _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_bag_generic.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                _std_bag_generic.setDefinition(null, _st_bag_generic);
                                        _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_aggregate_generic.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                        }
                                }
//			} // not duplicate
 //                      }
                } else {
                        if (is_complex_schema) {
                                schema_name = schema_name.substring(3);
// printDDebug("##RR COMPLEX SCHEMA: " + schema_name);
                        }
                        model = findModel(schema_name);
                        if (model == null) {
                                if (parser_pass == 2) {
//					printError("schema not found: " + schema_name);
                                        error_count++;
                                        printErrorMsg("" + schema_name + " - schema not found", null, true);
                                }
                                printDebug("schema not found: " + schema_name);
                        }
                        sd = getSchema_definitionFromModel(model);


                  active_scope_extension = new ECtScope(active_scope, sd, active_scope_extension, active_scope_string, schema_name, schema_name.toLowerCase());
// System.out.println("2 new active_scope_extenion: " + active_scope_extension);
                        active_scope_string = "";
                        active_scope = null;  // not using on schema level (yet)
// if (sd == null)
// printDDebug("##RR SCHEMA DEFINITION NOT FOUND");
//                      sd = (jsdai.SExtended_dictionary_schema.ESchema_definition)model.getDefined_schema();
                        hm_current_entity_declarations = (HashMap)hm_entity_declarations.get(model);
                        hm_current_type_declarations = (HashMap)hm_type_declarations.get(model);
                        hm_current_function_declarations = (HashMap)hm_function_declarations.get(model);
                        hm_current_procedure_declarations = (HashMap)hm_procedure_declarations.get(model);
                        hm_current_rule_declarations = (HashMap)hm_rule_declarations.get(model);
                        hm_current_constant_declarations = (HashMap)hm_constant_declarations.get(model);
                        hm_current_subtype_constraint_declarations = (HashMap)hm_subtype_constraint_declarations.get(model);
                        hm_current_parameters = (HashMap)hm_parameters.get(model);
                        hm_current_variables = (HashMap)hm_variables.get(model);

                }
                createDocumentationEntity2(sd, a_token);
      switch (jj_nt.kind) {
      case SIMPLE_STRING_LITERAL:
        version_name = SchemaVersionId();
        break;
      default:
        jj_la1[171] = jj_gen;
        ;
      }
// System.out.println("Schema version: " + version_name);
                if (parser_pass == 1) {
                        if (version_name != null) {
                                sd.setIdentification(null, version_name);
                        }
                }
        if ((parser_pass == 2) && (!is_complex_schema)) {
                used_vector = new Vector();
                referenced_vector = new Vector();
                used_vectors.addElement(used_vector);
                referenced_vectors.addElement(referenced_vector);
                model_vector.addElement(model); // probably not really necessary, the same order in the repository.
        }
         if (_st_real == null) {
                 printDebug("In SchemaDecl before body, pass: " + parser_pass + ", _st_real is NULL");
         } else {
                 printDebug("In SchemaDecl before body, pass: " + parser_pass + ", _st_real is OK");
         }
      jj_consume_token(SEMICOLON);
      SchemaBody(used_vector, referenced_vector);
      jj_consume_token(END_SCHEMA);
                                                                       schema_depth--;
      jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                active_scope = null;
                active_scope_string = active_scope_extension.getParent_scope_string();
                active_scope_extension = active_scope_extension.getParent();

         if (_st_real == null) {
                 printDebug("In SchemaDecl, ending, pass: " + parser_pass + ", _st_real is NULL");
         } else {
                 printDebug("In SchemaDecl, ending, pass: " + parser_pass + ", _st_real is OK");
         }
    } catch (ParseException e) {
        // recoverFromParseException(END_SCHEMA, e);
//  System.out.println(e.getMessage());

        // this exception is not reported as an error (commented out), because this error is usually (always? - try to make sure!)
        //  is a secondary error when in recovery skipping to the end of something and END_SCHEMA is encountered
        // or rather, it is already encountered and the token END_SCHEMA is already consumed, no way to put it back (or is there?)

        // no, the END_SCHEMA was not yet consumed, the issue fixed in the recovery, trying to enable this error reporting,
        // will see what happens, may be other places left where the token is consumed - risky
        printErrorMsg(e.getMessage(), null, true);
        if (recoverToTheNextSchema(e) < 0) {if (true) return;}
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.282 ------------ */
  static final public String SchemaId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.182  ---*/
  static final public void SchemaMapBodyElement() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case FUNCTION:
      FunctionDecl();
      break;
    case PROCEDURE:
      ProcedureDecl();
      break;
    default:
      jj_la1[172] = jj_gen;
      if (jj_2_29(2147483647)) {
        ViewDecl();
      } else {
        switch (jj_nt.kind) {
        case MAP:
          MapDecl();
          break;
        case DEPENDENT_MAP:
          DependentMapDecl();
          break;
        case RULE:
          RuleDecl();
          break;
        default:
          jj_la1[173] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.183  ---*/
  static final public void SchemaMapBodyElementList() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In SchemaMapBodyElementList");
    label_56:
    while (true) {
      SchemaMapBodyElement();
      switch (jj_nt.kind) {
      case DEPENDENT_MAP:
      case FUNCTION:
      case MAP:
      case PROCEDURE:
      case RULE:
      case VIEW:
        ;
        break;
      default:
        jj_la1[174] = jj_gen;
        break label_56;
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.184  ---*/
  static final public void SchemaMapDecl() throws ParseException, jsdai.lang.SdaiException {
        String schema_map_name;
        String version_name = null;
        Token a_token;
        Vector used_vector = null;
        Vector referenced_vector = null;
                express_x = true;
                printDebug("In SchemaMapDecl");
                scope_stack.push(current_scope);
                current_scope = new Vector();
                function_depth = 0;
    a_token = jj_consume_token(SCHEMA_MAP);
    schema_map_name = SchemaMapId();
                printVerbose("Starting parsing schema_map: " + schema_map_name + " in pass " + parser_pass);
                if (parser_pass == 1) {
//                      if (model == null) {
                                model_name = schema_map_name.toUpperCase() + "_DICTIONARY_DATA";
// listModels();
// System.out.println("Creating model: : " + model_name);
                                model = findModel(schema_map_name);
                                if (model != null) {
                                        error_count++;
//					printError("Duplicate schema_map name: " + schema_map_name);
                                        printErrorMsg("" + schema_map_name + " - duplicate schema map name", null, true);
                                }
                                model = repository.createSdaiModel(model_name, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                                model.startReadWriteAccess();
                                sd = (jsdai.SExtended_dictionary_schema.ESchema_map_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSchema_map_definition.class);

                          active_scope_extension = new ECtScope(active_scope, sd, active_scope_extension, active_scope_string, schema_map_name, schema_map_name.toLowerCase());
                                active_scope_string = "";
                                active_scope = null;  // not using on schema (or schema_map) level (yet)


                                if (flag_oc) {
                                        sd.setName(null, schema_map_name);
                                } else {
                                        sd.setName(null, schema_map_name.toUpperCase());
                                }




//		createDocumentationEntity2(sd, a_token);

                } else {
                        if (is_complex_schema) {
                                schema_map_name = schema_map_name.substring(3);
                        }
                        model = findModel(schema_map_name);
                        if (model == null) {
//				printError("schema_map not found: " + schema_map_name);
                                printErrorMsg("" + schema_map_name + "- schema map not found", null, true);
                        }
                        sd = getGeneric_schema_definitionFromModel(model);

                  active_scope_extension = new ECtScope(active_scope, sd, active_scope_extension, active_scope_string, schema_map_name, schema_map_name.toLowerCase());
                        active_scope_string = "";
                        active_scope = null;  // not using on schema (or schema_map) level (yet)


                        if (expression_instances) {
//				jjtThis.model = model;
//				jjtThis.schema_map_name = schema_map_name;
//				jjtThis.schema_definition = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
                        }
                }
                // createDocumentationEntity2(sd, a_token);
        if (parser_pass == 2) {

    // needed for chained use froms to work correctly
                used_vector = new Vector();
                used_vectors.addElement(used_vector);

                referenced_vector = new Vector();
                referenced_vectors.addElement(referenced_vector);
                model_vector.addElement(model); // probably not really necessary, the same order in the repository.
        }
    jj_consume_token(SEMICOLON);
    label_57:
    while (true) {
      ReferenceClause(referenced_vector);
      switch (jj_nt.kind) {
      case REFERENCE:
        ;
        break;
      default:
        jj_la1[175] = jj_gen;
        break label_57;
      }
    }
    switch (jj_nt.kind) {
    case CONSTANT:
      ConstantDecl();
      break;
    default:
      jj_la1[176] = jj_gen;
      ;
    }
    SchemaMapBodyElementList();
    jj_consume_token(END_SCHEMA_MAP);
    jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                active_scope = null;
                active_scope_string = active_scope_extension.getParent_scope_string();
                active_scope_extension = active_scope_extension.getParent();

                express_x = false;
  }

/*--------- ISO 10303-14:B.2.185  ---*/
  static final public String SchemaMapId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.186  ---*/
// String SchemaRefOrRename() throws jsdai.lang.SdaiException :
  static final public jsdai.SExtended_dictionary_schema.EGeneric_schema_definition SchemaRefOrRename() throws ParseException, jsdai.lang.SdaiException {
  // String schema_name = null;
  jsdai.SExtended_dictionary_schema.EGeneric_schema_definition gsd = null;
    if (jj_2_30(2)) {
      GeneralSchemaAliasId();
      jj_consume_token(COLON);
    } else {
      ;
    }
    gsd = GeneralSchemaRef();
            // if we operate not with name string here, we need to keep info about alias for further references to th schema by alias id.	
            if (gsd == null) {
                printDDebug("SchemaRefOrRename - NULL in pass " + parser_pass);
            }
            {if (true) return gsd;}
            // return schema_name;

    throw new Error("Missing return statement in function");
  }

/*-+------- ISO 10303-14:B.2.187  ---*/
  static final public void SchemaViewBodyElement() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case FUNCTION:
      FunctionDecl();
      break;
    case PROCEDURE:
      ProcedureDecl();
      break;
    case VIEW:
      ViewDecl();
      break;
    case RULE:
      RuleDecl();
      break;
    default:
      jj_la1[177] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*-+-------- ISO 10303-14:B.2.188  ---*/
  static final public void SchemaViewBodyElementList() throws ParseException, jsdai.lang.SdaiException {
    label_58:
    while (true) {
      SchemaViewBodyElement();
      switch (jj_nt.kind) {
      case FUNCTION:
      case PROCEDURE:
      case RULE:
      case VIEW:
        ;
        break;
      default:
        jj_la1[178] = jj_gen;
        break label_58;
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.189  ---*/
  static final public void SchemaViewDecl() throws ParseException, jsdai.lang.SdaiException {
        String schema_view_name;
        String version_name = null;
        Token a_token;
        Vector used_vector = null;
        Vector referenced_vector = null;
                express_x = true;
                printDebug("In SchemaViewDecl");
                scope_stack.push(current_scope);
                current_scope = new Vector();
                function_depth = 0;
    a_token = jj_consume_token(SCHEMA_VIEW);
    schema_view_name = SchemaViewId();
                printVerbose("Starting parsing schema_view: " + schema_view_name + " in pass " + parser_pass);
                if (parser_pass == 1) {
//                      if (model == null) {
                                model_name = schema_view_name.toUpperCase() + "_DICTIONARY_DATA";
// listModels();
// System.out.println("Creating model: : " + model_name);
                                model = findModel(schema_view_name);
                                if (model != null) {
                                        error_count++;
//					printError("Duplicate schema_view name: " + schema_view_name);
                                        printErrorMsg("" + schema_view_name + " - duplicate schema view name", null, true);
                                }
                                model = repository.createSdaiModel(model_name, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                                model.startReadWriteAccess();
                                sd = (jsdai.SExtended_dictionary_schema.ESchema_view_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSchema_view_definition.class);
                                if (flag_oc) {
                                        sd.setName(null, schema_view_name);
                                } else {
                                        sd.setName(null, schema_view_name.toUpperCase());
                                }
// System.out.println("#@# Model and schema_definition created for schema_view. model: " + model + ", schema: " + sd);




//		createDocumentationEntity2(sd, a_token);

                } else {
                        if (is_complex_schema) {
                                schema_view_name = schema_view_name.substring(3);
                        }
                        model = findModel(schema_view_name);
                        if (model == null) {
//				printError("schema_view not found: " + schema_view_name);
                                printErrorMsg("" + schema_view_name + " - schema_view not found", null, true);
                        }
                        sd = getGeneric_schema_definitionFromModel(model);
                        if (expression_instances) {
//				jjtThis.model = model;
//				jjtThis.schema_view_name = schema_view_name;
//				jjtThis.schema_definition = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
                        }
                }
                // createDocumentationEntity2(sd, a_token);



                if (parser_pass == 2) {

      // needed for chained use from to work correctly		
                        used_vector = new Vector();
                        used_vectors.addElement(used_vector);

                        referenced_vector = new Vector();
                        referenced_vectors.addElement(referenced_vector);
                        model_vector.addElement(model); // probably not really necessary, the same order in the repository.
                }

// System.out.println("#@# schema_view. Model: " + model + ", schema: " + sd + ", pass: " + parser_pass);	

    jj_consume_token(SEMICOLON);
    label_59:
    while (true) {
      switch (jj_nt.kind) {
      case REFERENCE:
        ;
        break;
      default:
        jj_la1[179] = jj_gen;
        break label_59;
      }
      ReferenceClause(referenced_vector);
    }
    switch (jj_nt.kind) {
    case CONSTANT:
      ConstantDecl();
      break;
    default:
      jj_la1[180] = jj_gen;
      ;
    }
    SchemaViewBodyElementList();
    jj_consume_token(END_SCHEMA_VIEW);
    jj_consume_token(SEMICOLON);
                express_x = false;
  }

/*--------- ISO 10303-14:B.2.190  ---*/
  static final public String SchemaViewId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------ Our extension, in accordance with express 1.2 ------------------------------------*/
  static final public String SchemaVersionId() throws ParseException {
        Token t;
        String image;
    t = jj_consume_token(SIMPLE_STRING_LITERAL);
                image = t.image;
                {if (true) return image.substring(1, image.length()-1);}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.283------------ */
  static final public void Selector() throws ParseException, jsdai.lang.SdaiException {
    Expression();
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.284------------ */
  static final public void SelectType(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESelect_type st = null;
        jsdai.SExtended_dictionary_schema.ANamed_type selections = null;
        jsdai.SExtended_dictionary_schema.ENamed_type selection;
        boolean is_extensible = false;
        boolean is_entity = false;
        boolean is_extension = false;
        // selections - SET OF NAMED_TYPE
        Vector selectionz = new Vector();
        jsdai.SExtended_dictionary_schema.EDefined_type select_super = null;
                printVerbose("SelectType starting in pass " + parser_pass + ", defined type: " + dt);
    switch (jj_nt.kind) {
    case EXTENSIBLE:
      jj_consume_token(EXTENSIBLE);
                       is_extensible = true;
      break;
    default:
      jj_la1[181] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case GENERIC_ENTITY:
      jj_consume_token(GENERIC_ENTITY);
                                                                  is_entity = true;
      break;
    default:
      jj_la1[182] = jj_gen;
      ;
    }
    jj_consume_token(SELECT);
    switch (jj_nt.kind) {
    case LPAREN:
    case BASED_ON:
      switch (jj_nt.kind) {
      case LPAREN:
        selectionz = SelectList(selectionz);
        break;
      case BASED_ON:
        select_super = SelectExtension(dt, st, selectionz);
                                                                                                      is_extension = true;
        break;
      default:
        jj_la1[183] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[184] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (is_extensible) {
                          if (is_entity) {
                                if (is_extension) {
                                                // entity_select_type+extended_select_type+extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_select_type$extended_select_type$extensible_select_type.class);
                                } else {
                                                // entity_select_type+extensible_select_type			  	}
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_select_type$extensible_select_type.class);
                                }
                          } else {
                                if (is_extension) {
                                                // extended_select_type+extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtended_select_type$extensible_select_type.class);
                                } else {
                                                // extensible_select_type			  	}
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtensible_select_type.class);
                                }
                          }
                        } else {
                          if (is_entity) {
                                if (is_extension) {
                                                // entity_select_type+extended_select_type+non_extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_select_type$extended_select_type$non_extensible_select_type.class);
                                } else {
                                                // entity_select_type+non_extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_select_type$non_extensible_select_type.class);
                                }
                          } else {
                                if (is_extension) {
                                                // extended_select_type+non_extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtended_select_type$non_extensible_select_type.class);



                                } else {
                                                // non_extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNon_extensible_select_type.class);
                                }
                          }
                        }
                        st.setName(null, "_SELECT_" + dt.getName(null));
                        selections = st.createLocal_selections(null);
                        for (int i = 0; i < selectionz.size(); i++) {
                                Object sze = selectionz.elementAt(i);
                                if (sze != null) {
                                        selections.addUnordered((jsdai.SExtended_dictionary_schema.ENamed_type)sze);
                                }
                        }
                        jsdai.SExtended_dictionary_schema.ANamed_type sel2 = st.getLocal_selections(null);
                        for (int k = 1; k < sel2.getMemberCount()+1; k++) {
                        }

                        if (isDTDomainValid(dt, st)) {
                                dt.setDomain(null, st);
                        } else {
                                error_count++;
                                printErrorMsg("" + dt.getName(null) + " - invalid underlying type", null, true);
                        }

                        if (is_extension) {
                                if (st instanceof jsdai.SExtended_dictionary_schema.EExtended_select_type) {
                                        if (select_super != null) {
                                                if (select_super.testDomain(null)) {
                                jsdai.SExtended_dictionary_schema.ESelect_type select_super_sel = (jsdai.SExtended_dictionary_schema.ESelect_type)select_super.getDomain(null);
                          if (select_super_sel instanceof jsdai.SExtended_dictionary_schema.EExtensible_select_type) {
//								((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).setIs_based_on(null, (jsdai.SExtended_dictionary_schema.EExtensible_select_type)select_super_sel);
                                                                ((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).setIs_based_on(null, select_super);
                                                        } else {
//								printError("select type: " + select_super.getName(null) + " must be EXTENSIBLE: " + select_super_sel);
                                                                error_count++;
//								printErrorMsg("" + select_super_sel + " - select type: " + select_super.getName(null) + " must be EXTENSIBLE", null, true);
                                                                printErrorMsg("" + select_super.getName(null) + " - select type must be EXTENSIBLE", null, true);
                                                                printDebug("The select type: " + select_super.getName(null) + " must be EXTENSIBLE: " + select_super_sel);
                                                        }
                                                } else {
//							System.out.println("pass 3, based-on domain unset: extended: " + st + ", based_on: " + select_super);

                                                }
                                        } else {
//						System.out.println("pass 3, based-on NULL: " + st);
                                        }
                                } else {
                                        // something wrong here - internal error
//					System.out.println("pass 3, IE-extension-not-extended: " + st);
                                }


                        } else {
                        }
                } else
                if (parser_pass == 4) {
                        st = (jsdai.SExtended_dictionary_schema.ESelect_type)dt.getDomain(null);
                        if (is_extension) {
                                if (st instanceof jsdai.SExtended_dictionary_schema.EExtended_select_type) {
                                        if (select_super != null) {
                                                if (select_super.testDomain(null)) {
                                jsdai.SExtended_dictionary_schema.ESelect_type select_super_sel = (jsdai.SExtended_dictionary_schema.ESelect_type)select_super.getDomain(null);
                          if (select_super_sel instanceof jsdai.SExtended_dictionary_schema.EExtensible_select_type) {
                                                                if (!(((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).testIs_based_on(null))) {
//									((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).setIs_based_on(null, (jsdai.SExtended_dictionary_schema.EExtensible_select_type)select_super_sel);
                                                                        ((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).setIs_based_on(null, select_super);
                                                                } else {
                                                                }
                                                        } else {
                                                                // why error message was removed?
                                                                error_count++;
//								printErrorMsg("" + select_super_sel + " - select type: " + select_super.getName(null) + " must be EXTENSIBLE", null, true);
                                                                printErrorMsg("" + select_super.getName(null) + " - select type must be EXTENSIBLE", null, true);
        //							printError("The select type: " + select_super.getName(null) + " must be EXTENSIBLE: " + select_super_sel);
                                                                printDebug("The select type: " + select_super.getName(null) + " must be EXTENSIBLE: " + select_super_sel);
                                                        }
                                                } else {
//							System.out.println("pass 4, based-on domain unset: extended: " + st + ", based_on: " + select_super);
                                                }
                                        } else {
//						System.out.println("pass 4, based-on NULL: " + st);

                                        }
                                } else {
//					System.out.println("pass 4, IE-extension-not-extended: " + st);
                                }


                        } else {
                        }
                        if (is_entity) {
                                // check if selection list contains non-entities, that would be an error
// System.out.println("PROBLEM with based_on: dt " + dt + ", st: "  + st);

//				if (!isEntitySelect(st)) {
//					error_count++;
//					printErrorMsg("" + dt.getName(null) + " - GENERIC_ENTITY select type contains non-entities", null, true);
//				}
                        }
                }
                printVerbose("SelectType ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.285------------ */

// in this version, return  is no longer really needed
  static final public Vector SelectList(Vector selectionz) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESelect_type st = null;
        jsdai.SExtended_dictionary_schema.ENamed_type selection;
                printVerbose("SelectList starting in pass " + parser_pass + ", vector: " + selectionz);
    jj_consume_token(LPAREN);
    selection = NamedTypes(null);
                if (parser_pass == 3) {
//			selections.addUnordered(selection);
                        selectionz.addElement(selection);
                }
    label_60:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[185] = jj_gen;
        break label_60;
      }
      jj_consume_token(COMMA);
      selection = NamedTypes(null);
                if (parser_pass == 3) {
//			selections.addUnordered(selection);
                        selectionz.addElement(selection);
                }
    }
    jj_consume_token(RPAREN);
                printVerbose("SelectList ending in pass " + parser_pass);
                {if (true) return (selectionz);}
    throw new Error("Missing return statement in function");
  }

// Vector SelectExtension(jsdai.SExtended_dictionary_schema.EDefined_type dt, jsdai.SExtended_dictionary_schema.ESelect_type st, Vector selectionz, jsdai.SExtended_dictionary_schema.EDefined_type select_super) throws jsdai.lang.SdaiException :
  static final public jsdai.SExtended_dictionary_schema.EDefined_type SelectExtension(jsdai.SExtended_dictionary_schema.EDefined_type dt, jsdai.SExtended_dictionary_schema.ESelect_type st, Vector selectionz) throws ParseException, jsdai.lang.SdaiException {
         jsdai.SExtended_dictionary_schema.EDefined_type select_super = null;
                printVerbose("SelectExtension starting in pass " + parser_pass + ", defined type: " + dt);
    jj_consume_token(BASED_ON);
    select_super = TypeRef(0);
    switch (jj_nt.kind) {
    case WITH:
      jj_consume_token(WITH);
      selectionz = SelectList(selectionz);
      break;
    default:
      jj_la1[186] = jj_gen;
      ;
    }
                // not really needed, Vector is updated through the parameter anyway
//		return selectionz;
                printVerbose("SelectExtension ending in pass " + parser_pass);
// System.out.println("select_super: " + select_super);
                {if (true) return select_super;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.285------------ */
  static final public jsdai.SExtended_dictionary_schema.ESet_type SetType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESet_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        jsdai.lang.EEntity bt;
        String bound_name;
                printDebug("In SetType, starting in pass " + parser_pass);
    jj_consume_token(SET);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec();
      break;
    default:
      jj_la1[187] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (whose != null) {
                          if (!(whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute)) {
//					at = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
                                }
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_SET" + bound_name + _data_type_name);
//				data_type_name = "_SET"  + bound_name;
//				_data_type_name = "_SET"  + bound_name + _data_type_name;
                        }
                } else
                if (parser_pass == 4) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_SET" + bound_name + _data_type_name);
//				_data_type_name = "_SET"  + bound_name + _data_type_name;
//				data_type_name = "_SET"  + bound_name;
                        }
                }
    jj_consume_token(OF);
    bt = BaseType(at);
                if (parser_pass > 3) {
                        // set element_type
//			if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        if (!(at.testElement_type(null))) {
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EData_type) {
                                        at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EData_type)bt);
                                } else {
                                        // express amendment issue
                                }
                        }
                }
                bound_name = getBoundString(0, bounds, false, false);
                _data_type_name = "_SET"  + bound_name + _data_type_name;
                if (at != null) {
                        at.setName(null, _data_type_name);
                }
                printDebug("In SetType, ending : " + at + ", in pass " + parser_pass);
// System.out.println(">SetType< pass: " + parser_pass + ", instance: " + at);
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.286------------ */
  static final public void Sign() throws ParseException {
    switch (jj_nt.kind) {
    case PLUS:
      jj_consume_token(PLUS);
      break;
    case MINUS:
      jj_consume_token(MINUS);
      break;
    default:
      jj_la1[188] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.287------------ */
  static final public void SimpleExpression() throws ParseException, jsdai.lang.SdaiException {
        Object operand1 = null;
        Object operand2;
        String x_operand1 = "";
        String x_operand2 = "";
        double op1double;
        double op2double;
        int op1int;
        int op2int;
        int operation;
        Object exp_instance = null;
        String x_result = "";
        int op_nr = 0;
        int nr_of_operands = 0;
    Term();
                if (parser_pass == 5) {
                }
    label_61:
    while (true) {
      if (jj_2_31(2)) {
        ;
      } else {
        break label_61;
      }
      operation = AddLikeOp();
      Term();
         if (parser_pass == 5) {
         }
    }
                if (parser_pass == 5) {
                }
  }

/* - LOOKAHEAD 4 or > - (Columns 1-28 & 2-3, 1-50 & 2-3) ------------------------------ ISO 10303-11:A.2.288------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at 1-28 and 2-3 respectively.
		 A common prefix is <SIMPLE_ID> "(" "["
		 Lookahead of 4 or more should be used for the earlier expansion.
*/
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at 1-50 and 2-3 respectively.
		 A common prefix is <SIMPLE_ID> "." <SIMPLE_ID>
		 Lookahead of 4 or more should be used for the earlier expansion.
*/

/* ISO 1030-14.B.2.194*/
// added CaseExpr() and ForExpr()
  static final public void SimpleFactor() throws ParseException, jsdai.lang.SdaiException {
        int t = 0;
        Object operand1 = "";
        String x_operand1 = "";
        double op1double;
        int op1int;
        int chosen = 0;
        int kind = 0;
        String name = "";
                printDebug("In SimpleFactor, starting");
                if (flag_oc) {
                  global_name1_global = getToken(1).image;
                  global_name2_global = getToken(2).image;
                  global_name3_global = getToken(3).image;
                } else {
                  global_name1_global = getToken(1).image.toLowerCase();
                  global_name2_global = getToken(2).image.toLowerCase();
                  global_name3_global = getToken(3).image.toLowerCase();
                }
                global_kind1_global = getToken(1).kind;
                global_kind2_global = getToken(2).kind;
                global_kind3_global = getToken(3).kind;

// System.out.println("in SimpleFactor: "  + global_name1_global + " " + global_name2_global + " " + global_name3_global);

    switch (jj_nt.kind) {
    case LBRACKET:
      AggregateInitializer();
                                        chosen = 1;
      break;
    default:
      jj_la1[191] = jj_gen;
      if (isEntityConstructor()) {
        EntityConstructor();
                                                                        chosen = 8;
      } else {
        switch (jj_nt.kind) {
        case LBRACE:
          Interval();
                            chosen = 3;
          break;
        case QUERY:
          QueryExpression();
                                   chosen = 4;
          break;
        case CASE:
          CaseExpr();
                            chosen = 9;
          break;
        case FOR:
          ForExpr();
                           chosen = 10;
          break;
        case IF:
          IfExpr();
                          chosen = 11;
          break;
        default:
          jj_la1[192] = jj_gen;
          if (isEnumerationReference()) {
            EnumerationReference();
                                                                              chosen = 2;
          } else if (jj_2_33(1)) {
            switch (jj_nt.kind) {
            case PLUS:
            case MINUS:
            case NOT:
              t = UnaryOp();
                                        chosen = 5;
              break;
            default:
              jj_la1[189] = jj_gen;
              ;
            }
            switch (jj_nt.kind) {
            case LPAREN:
              jj_consume_token(LPAREN);
              Expression();
                                                  chosen = 6;
              jj_consume_token(RPAREN);
              break;
            default:
              jj_la1[190] = jj_gen;
              if (jj_2_32(1)) {
                Primary();
                                           chosen = 7;
              } else {
                jj_consume_token(-1);
                throw new ParseException();
              }
            }
                                if (parser_pass == 5) {
                                }
          } else {
            jj_consume_token(-1);
            throw new ParseException();
          }
        }
      }
    }
                // unary stuff goes here
                //System.out.println("XX--XX chosen: " + chosen);
         if (parser_pass == 5) {
                switch (chosen) {
                        case 0:
                                printDebug("In SimpleFactor - nothing was chosen");
                                break;
                        case 1:
                                printDebug("In SimpleFactor - AggregateInitializer");
                                break;
                        case 2:
                                printDebug("In SimpleFactor - EnumeratiionReference");
                                break;
                        case 3:
                                printDebug("In SimpleFactor - Interval");
                                break;
                        case 4:
                                printDebug("In SimpleFactor - QueryExpression");
                                break;
                        case 5:
                                printDebug("In SimpleFactor - UnaryOp");
                                break;
                        case 6:
                                printDebug("In SimpleFactor - Expression");
                                break;
                        case 7:
                                printDebug("In SimpleFactor - Primary");
                                break;
                        case 8:
                                printDebug("In SimpleFactor - EntityConstructor");
                                break;
                        case 9:
                                printDebug("In SimpleFactor - CaseExpr");
                                break;
                        case 10:
                                printDebug("In SimpleFactor - ForExpr");
                                break;
                        case 11:
                                printDebug("In SimpleFactor - IfExpr");
                                break;
                        default:
                                printDebug("In SimpleFactor - error");
                                break;
                }
                if (t == 2) {
                        if (argument_stack.empty()) {
                                printVerbose("ERROR, empty stack in simple factor");
                        } else {
                                operand1 = argument_stack.pop();
                        }
                        printStack("POP: SimpleFactor: " + operand1);
                        if (expression_instances) {
                                // x_operand1 = (String)expression_stack.pop();
                                // printXStack("POP: SimpleFactor, operand1: " + x_operand1);
                        }
                        if (operand1 instanceof Integer) {
                                op1int = ((Integer)operand1).intValue();
                                op1int = -op1int;
                                operand1 = new Integer(op1int);
                        }
                        else if (operand1 instanceof Number) {
                                op1double = ((Number)operand1).doubleValue();
                                op1double = -op1double;
                                operand1 = new Double(op1double);
                        }
                        argument_stack.push(operand1);
                        printStack("PUSH: SimpleFactor: " + operand1);
                        if (expression_instances) {
                                // expression_stack.push(x_operand1);
                                // printXStack("PUSH: SimpleFactor, operand1: " + x_operand1);
                        }
                }
         }
// System.out.println("SimpleFactor - ending");	 

  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.289------------ */
  static final public jsdai.SExtended_dictionary_schema.ESimple_type SimpleTypes(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESimple_type st = null;
                printDebug("In simple type, starting, whose: " + whose);
    switch (jj_nt.kind) {
    case BINARY:
      st = BinaryType(whose);
      break;
    case BOOLEAN:
      st = BooleanType(whose);
      break;
    case INTEGER:
      st = IntegerType(whose);
      break;
    case LOGICAL:
      st = LogicalType(whose);
      break;
    case NUMBER:
      st = NumberType(whose);
      break;
    case REAL:
      st = RealType(whose);
      break;
    case STRING:
      st = StringType(whose);
      break;
    default:
      jj_la1[193] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In simple type, ending, st: " + st);
                if (st != null) {
                        if (st.testName(null)) {
                                _data_type_name = st.getName(null);
                        }
                }
                {if (true) return st;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.290------------ */
  static final public void SkipStmt() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In SkipStmt starting");
    jj_consume_token(KW_SKIP);
    jj_consume_token(SEMICOLON);
                printDebug("In SkipStmt ending");
  }

/* - LOOKAHEAD 2 - (Columns 1-17 & 2-16) ---------------------------------------------- ISO 10303-11:A.2.291------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at 1-17 and 2-16.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/


/*-+-------- ISO 10303-14:B.2.197  ---*/
  static final public void SourceAttributeReference() throws ParseException, jsdai.lang.SdaiException {
    ParameterRef();
    jj_consume_token(DOT);
    AttributeRef(null, null, -1, null);
  }

/*--------- ISO 10303-14:B.2.198  ---*/
  static final public void SourceEntityReference() throws ParseException, jsdai.lang.SdaiException {
    EntityReference();
  }

/*-+-------- ISO 10303-14:B.2.199  ---*/
  static final public void SourceParameter(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String source_parameter_name;
        jsdai.SExtended_dictionary_schema.ESource_parameter sp = null;
        jsdai.SExtended_dictionary_schema.EEntity_or_view_definition evd = null;
    source_parameter_name = SourceParameterId();
    jj_consume_token(COLON);
    evd = ExtentReference();
                // which exactly pass needed here? to check. perhaps ExtentReference requires a pass after interfacing: 4?
                if (parser_pass == 1) {
// System.out.println("IN source_parameter 1");
                        sp = findSource_parameter(source_parameter_name);
                  if (sp != null) {
                                // error - should not be found
                        }
                        sp = (jsdai.SExtended_dictionary_schema.ESource_parameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSource_parameter.class);
                        sp.setName(null, source_parameter_name);
//		 	sp.setOrder(null, from_order_count++);
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EMap_partition) {
                                sp.setParent(null, (jsdai.SExtended_dictionary_schema.EMap_partition)parent);
                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_partition) {
                                sp.setParent(null, (jsdai.SExtended_dictionary_schema.EView_partition)parent);
                        } else {
                                // error
                        }
                } else {
// System.out.println("IN source_parameter 2");
                        sp = findSource_parameter(source_parameter_name);
// System.out.println("### SourceParameter: " + source_parameter_name + " - is it found? : " + sp + ", pass: " + parser_pass);
                        if (sp == null) {
                                // error - should have been found
                        }
                        if (parser_pass == 4) {
// System.out.println("### SourceParameter, setting extent: " + evd );
                                sp.setExtent(null, evd);
                                sp.setOrder(null, from_order_count++);
                        }
                }
  }

/*--------- ISO 10303-14:B.2.200  ---*/
  static final public String SourceParameterId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

  static final public void Stmt() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In Stmt, starting");
    switch (jj_nt.kind) {
    case ALIAS:
      AliasStmt();
      break;
    default:
      jj_la1[194] = jj_gen;
      if (jj_2_34(2147483647)) {
        AssignmentStmt();
      } else {
        switch (jj_nt.kind) {
        case CASE:
          CaseStmt();
          break;
        case BEGIN:
          CompoundStmt();
          break;
        case ESCAPE:
          EscapeStmt();
          break;
        case IF:
          IfStmt();
          break;
        case SEMICOLON:
          NullStmt();
          break;
        case REPEAT:
          RepeatStmt();
          break;
        case RETURN:
          ReturnStmt();
          break;
        case KW_SKIP:
          SkipStmt();
          break;
        case INSERT:
        case REMOVE:
        case SIMPLE_ID:
          ProcedureCallStmt();
          break;
        default:
          jj_la1[195] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
                printDebug("In Stmt, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.292------------ */
  static final public String StringLiteral() throws ParseException, jsdai.lang.SdaiException {
        Token t;
        String s = null;
                printDebug("In String literal");
    switch (jj_nt.kind) {
    case SIMPLE_STRING_LITERAL:
      t = jj_consume_token(SIMPLE_STRING_LITERAL);
                        if (parser_pass == 5) {
                                //				s = t.image;
                                s = handleBackslash(t.image);
                                s = "\"" + s.substring(1,s.length()-1) + "\"";
                                argument_stack.push(s);
                                printStack("PUSH: Literal: <SIMPLE_STRING_LITERAL>: " + s);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
      break;
    case ENCODED_STRING_LITERAL:
      t = jj_consume_token(ENCODED_STRING_LITERAL);
                        // just for now
                        if (parser_pass == 5) {
                                s = t.image;
                                argument_stack.push(s);
                                printStack("PUSH: Literal: <ENCODED_STRING_LITERAL>: " + s);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
      break;
    default:
      jj_la1[196] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                        {if (true) return s;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.293------------ */
  static final public jsdai.SExtended_dictionary_schema.EString_type StringType(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EString_type st = null;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        int width_spec = 0;
        boolean is_fixed = false;
        String str_fixed;
    jj_consume_token(STRING);

    switch (jj_nt.kind) {
    case LPAREN:
      width_spec = WidthSpec();
      break;
    default:
      jj_la1[197] = jj_gen;
      ;
    }
                if (width_spec == Integer.MIN_VALUE) {
                        width_spec = 0;
                }
                if (width_spec < 0) {
                        width_spec = -width_spec;
                        is_fixed = true;
                        str_fixed = "_FIXED";
                } else {
                        is_fixed = false;
                        str_fixed = "";
                }
//System.out.println(">=STRING=< whose: " + whose + ", global schema: " + global_schema_name + ", global entity: " + global_entity_name);
                if (parser_pass == 3) {
                        if (width_spec == 0) {
                                st = _st_string;
                        } else {
                                st = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                _data_type_name = "_STRING_" + width_spec + str_fixed;
//				_data_type_name = "_STRING_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                st.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, width_spec);
                                st.setWidth(null, b1);
                                if (is_fixed) {
                                        st.setFixed_width(null, true);
                                } else {
                                        st.setFixed_width(null, false);
                                }
                        }
                } else
                if (parser_pass > 3) {

                        if (width_spec == 0) {
                                st = _st_string;
                        } else {

                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
//System.out.println(">=domain-1: " + ((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null));
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
//System.out.println(">=domain-2: " + ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null));
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
//System.out.println(">=domain-3: " + ((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null));
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
//System.out.println(">=domain-4: " + ((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null)); 						
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
//System.out.println(">=domain-5: " + ((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null));
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
//System.out.println(">=domain-6: " + ((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null));
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                } else {
//System.out.println(">=STRING=< whose - NONE OF ABOVE: " + whose);
                                }
                        } else {
//System.out.println(">=STRING=< whose - is NULL");
                        }
//System.out.println(">=STRING=< domain done");

                        } // -- if has width_spec
                        if (st == null) {
                                if (width_spec == 0) {  // this can no longer happen, but whatever
                                        st = _st_string;
                                } else {
                                        st = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                        _data_type_name = "_STRING_" + width_spec + str_fixed;
                                        // _data_type_name = "_STRING_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                        st.setName(null, _data_type_name);
                                        b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, width_spec);
                                        st.setWidth(null, b1);
                                        if (is_fixed) {
                                                st.setFixed_width(null, true);
                                        } else {
                                                st.setFixed_width(null, false);
                                        }
                                }
                        }
                }
                if ((parser_pass == 5) && (width_spec != 0)) {
                                st = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                _data_type_name = "_STRING_" + width_spec + str_fixed;
                                // _data_type_name = "_STRING_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                st.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, width_spec);
                                st.setWidth(null, b1);
                                if (is_fixed) {
                                        st.setFixed_width(null, true);
                                } else {
                                        st.setFixed_width(null, false);
                                }
                }

                {if (true) return st;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.294 ------------ */
  static final public void SubSuper(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case ABSTRACT:
    case SUPERTYPE:
      SupertypeConstraint(ed);
      break;
    default:
      jj_la1[198] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case CONNOTATIONAL:
    case SUBTYPE:
      SubtypeDeclaration(ed);
      break;
    default:
      jj_la1[199] = jj_gen;
      ;
    }
  }

  static final public void SubSuperNoAbstract(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case SUPERTYPE:
      SupertypeConstraintNoAbstract(ed);
      break;
    default:
      jj_la1[200] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case CONNOTATIONAL:
    case SUBTYPE:
      SubtypeDeclaration(ed);
      break;
    default:
      jj_la1[201] = jj_gen;
      ;
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.295------------ */
  static final public void SubtypeConstraint(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc;
        jsdai.lang.EEntity se;
        Object pop_inst = null;

        jsdai.SExtended_dictionary_schema.EAndor_subtype_expression andor;
// pre-X	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands;
    jj_consume_token(OF);
    jj_consume_token(LPAREN);
    SupertypeExpression();
    jj_consume_token(RPAREN);
                if (parser_pass == 5) {
                        se = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: SubtypeConstraint: " + se);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }

                        if (se instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) {
                                sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
                                sc.setGeneric_supertype(null, ed);
                                // super_type is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // sc.setSuper_type(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)ed);
                                // }
                                sc.setConstraint(null, (jsdai.SExtended_dictionary_schema.ESubtype_expression)se);
                        } else if (se instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) // SUPERTYPE OF (single_entity)
                        {
                                sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
                                sc.setGeneric_supertype(null, ed);
                                // super_type is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // sc.setSuper_type(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)ed);
                                // }
                                andor = (jsdai.SExtended_dictionary_schema.EAndor_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAndor_subtype_expression.class);
                                generic_operands = andor.createGeneric_operands(null);
                                // operands is now derived instead of explicit 
                                // operands = andor.createOperands(null);
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) se);
                                // operands is now derived instead of explicit 
                                // if (!(se instanceof jsdai.SExtended_dictionary_schema.EView_definition)) {
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) se);
                                // }
                                sc.setConstraint(null, (jsdai.SExtended_dictionary_schema.ESubtype_expression)andor);
                        }
                        else { //
                        error_count++;
                                printEDebug("Internal error in SubtypeConstraint");
                        }
                }
  }

/*-+-------- ISO 10303-14:B.2.205  ---*/
// there is no supertype for map_definition and view_definition
  static final public jsdai.lang.EEntity SubtypeBindingHeader(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String partition_name = "_implicit_partition_"; // partition may be implicit, let's have name "" for it (so far)
        // I would like to have partition entity, supertype of map_partition and view_partition.
        jsdai.SExtended_dictionary_schema.EMap_partition mp = null;
        jsdai.SExtended_dictionary_schema.EView_partition vp = null;
        jsdai.lang.EEntity partition = null;
                printDebug("In SubtypeBindingHeader, starting, parent: " + parent);
//		System.out.println("active_scope in map 10: " + active_scope);

    switch (jj_nt.kind) {
    case PARTITION:
      jj_consume_token(PARTITION);
      partition_name = PartitionId();
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[202] = jj_gen;
      ;
    }
                if (parser_pass == 1) {
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_definition) {
                                vp = (jsdai.SExtended_dictionary_schema.EView_partition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CView_partition.class);
                                vp.setParent(null, (jsdai.SExtended_dictionary_schema.EView_definition)parent);
                                vp.setName(null, partition_name);
                                partition = (jsdai.lang.EEntity)vp;

                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EMap_definition) {
                                mp = (jsdai.SExtended_dictionary_schema.EMap_partition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CMap_partition.class);
                                mp.setParent(null, (jsdai.SExtended_dictionary_schema.EMap_definition)parent);
                                mp.setName(null, partition_name);
                                partition = (jsdai.lang.EEntity)mp;
                        } else {
                                // error
                        }
                }
//		System.out.println("active_scope in map 11: " + active_scope);

    WhereClause(parent);
                printDebug("In SubtypeBindingHeader, ending");
                {if (true) return partition;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.296 ------------ */
  static final public void SubtypeDeclaration(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition super_ed;
// pre-X	jsdai.SExtended_dictionary_schema.AEntity_definition supertypes = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_definition generic_supertypes = null;
        jsdai.SExtended_dictionary_schema.AEntity_definition supertypes = null;
        int index = 1;
        int index_g = 1;
        boolean is_connotational = false;
                if (parser_pass == 3) {
                        generic_supertypes = ed.getGeneric_supertypes(null);
                        if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                if (supertypes != null) {
                                        if (((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).testSupertypes(null)) {
                                                supertypes = ((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).getSupertypes(null);
                                        }
                                }
                        }
                }
    switch (jj_nt.kind) {
    case CONNOTATIONAL:
      jj_consume_token(CONNOTATIONAL);
                          is_connotational = true;
      break;
    default:
      jj_la1[203] = jj_gen;
      ;
    }
    jj_consume_token(SUBTYPE);
    jj_consume_token(OF);
    jj_consume_token(LPAREN);
    super_ed = EntityRef(null);
                if (parser_pass == 3) {
                        if (ed != null) {
                                if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        if (is_connotational) {
                                                ((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).setConnotational_subtype(null, true);
                                        }
                                }
                        }
                        if (super_ed != null) {
                                if (checkCyclicSupertypes((jsdai.SExtended_dictionary_schema.EEntity_definition)ed, super_ed)) {
                                        generic_supertypes.addByIndex(index_g++, super_ed);
                                        if (supertypes != null) {
                                                if (super_ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                                        supertypes.addByIndex(index++, super_ed);
                                                }
                                        }
                                } else {
                                        error_count++;
                                        printErrorMsg("" + super_ed.getName(null) + " - cyclic supertype in entity " + ed.getName(null), null, true);
                                }
                        } else {
                                error_count++;
                                printErrorMsg("" + ed.getName(null) + " - a supertype entity not found for this entity", null, true);
                        }
                }
    label_62:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[204] = jj_gen;
        break label_62;
      }
      jj_consume_token(COMMA);
      super_ed = EntityRef(null);
                if (parser_pass == 3)
                {
                        if (super_ed != null) {
                                if (checkCyclicSupertypes((jsdai.SExtended_dictionary_schema.EEntity_definition)ed, super_ed)) {
                                        generic_supertypes.addByIndex(index_g++, super_ed);
                                        if (supertypes != null) {
                                                if (super_ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                                        supertypes.addByIndex(index++, super_ed);
                                                }
                                        }
                                } else {
                                        error_count++;
                                        printErrorMsg("" + super_ed.getName(null) + " - cyclic supertype in entity " + ed.getName(null), null, true);
                                }
                        } else {
                                error_count++;
                                printErrorMsg("" + ed.getName(null) + " - a supertype entity not found for this entity", null, true);
                        }
                }
    }
    jj_consume_token(RPAREN);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.297------------ */
  static final public void SupertypeConstraint(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case ABSTRACT:
      AbstractSupertypeDeclaration(ed);
      break;
    case SUPERTYPE:
      SupertypeRule(ed);
      break;
    default:
      jj_la1[205] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  static final public void SupertypeConstraintNoAbstract(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    SupertypeRule(ed);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.298------------ */
  static final public void SupertypeExpression() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAndor_subtype_expression andor = null;
// pre-X	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.lang.EEntity ee = null;
        Object pop_inst = null;
        boolean andor_present = false;
    SupertypeFactor();
                if (parser_pass == 5) {
                        ee = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: SupertypeExpression: " + ee);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
    label_63:
    while (true) {
      switch (jj_nt.kind) {
      case ANDOR:
        ;
        break;
      default:
        jj_la1[206] = jj_gen;
        break label_63;
      }
      jj_consume_token(ANDOR);
      SupertypeFactor();
                if (parser_pass == 5) {
                        if (!andor_present) {
                                andor = (jsdai.SExtended_dictionary_schema.EAndor_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAndor_subtype_expression.class);
                                generic_operands = andor.createGeneric_operands(null);
                                // operands is now derived instead of explicit 
                                // operands = andor.createOperands(null);
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                        error_count++;
                                        printEDebug("Internal error in SupertypeExpression 1");
                                }
                                ee = (jsdai.lang.EEntity)argument_stack.pop();
                                printStack("POP: SupertypeExpression: " + ee);
                                if (expression_instances) {
                                        // pop_inst = expression_stack.pop();
                                }
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                        error_count++;
                                        printEDebug("Internal error in SupertypeExpression 2");
                                }
                                andor_present = true;
                        } else {
                                ee = (jsdai.lang.EEntity)argument_stack.pop();
                                printStack("POP: SupertypeExpression: " + ee);
                                if (expression_instances) {
                                        // pop_inst = expression_stack.pop();
                                }
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                error_count++;
                                        printEDebug("Internal error in SupertypeExpression 3");
                                }
                        }
                }
    }
                if (parser_pass == 5) {
                        if (andor_present) {
                                argument_stack.push(andor);
                                printStack("PUSH: SupertypeExpression: " + andor);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        } else {
                                argument_stack.push(ee);
                                printStack("PUSH: SupertypeExpression: " + ee);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.299------------ */
  static final public void SupertypeFactor() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAnd_subtype_expression and = null;
// pre-X 	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.lang.EEntity ee = null;
        Object pop_inst = null;
        boolean and_present = false;
    SupertypeTerm();
                if (parser_pass == 5) {
                        ee = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: SupertypeFactor: " + ee);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
    label_64:
    while (true) {
      switch (jj_nt.kind) {
      case AND:
        ;
        break;
      default:
        jj_la1[207] = jj_gen;
        break label_64;
      }
      jj_consume_token(AND);
      SupertypeTerm();
                if (parser_pass == 5) {
                        if (!and_present) {
                                and = (jsdai.SExtended_dictionary_schema.EAnd_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAnd_subtype_expression.class);
                                generic_operands = and.createGeneric_operands(null);
                                // operands is now derived instead of explicit 
                                // operands = and.createOperands(null);
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                error_count++;
                                        printEDebug("Internal error in SupertypeFactor 1");
                                }
                                ee = (jsdai.lang.EEntity)argument_stack.pop();
                                printStack("POP: SupertypeFactor: " + ee);
                                if (expression_instances) {
                                        // pop_inst = expression_stack.pop();
                                }
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                error_count++;
                                        printEDebug("Internal error in SupertypeFactor 2");
                                }
                                and_present = true;
                        } else {
                                ee = (jsdai.lang.EEntity)argument_stack.pop();
                                printStack("POP: SupertypeFactor: " + ee);
                                if (expression_instances) {
                                        // pop_inst = expression_stack.pop();
                                }
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                                error_count++;
                                                printEDebug("Internal error in SupertypeFactor 3");
                                }
                        }
                }
    }
                if (parser_pass == 5) {
                        if (and_present) {
                                argument_stack.push(and);
                                printStack("PUSH: SupertypeFactor: " + and);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        } else {
                                argument_stack.push(ee);
                                printStack("PUSH: SupertypeFactor: " + ee);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.300------------ */
  static final public void SupertypeRule(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(SUPERTYPE);
    SubtypeConstraint(ed);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.301------------ */
  static final public void SupertypeTerm() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition ed;
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      // Express X needs here ViewRef() instead instead of EntityRef(), so we need something entity_or_view_ref
      // because we now have in the dictionary entity_or_view_definition, so no problem.
       ed = EntityRef(null);
                if (parser_pass == 5) {
                        argument_stack.push(ed);
                        if (ed != null) {
                                printStack("PUSH: SupertypeTerm: entity " + ed.getName(null));
                        } else {
                                printStack("PUSH: SupertypeTerm: entity_definition = null");
                        }
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
      break;
    case ONEOF:
      OneOf();
      break;
    case LPAREN:
      jj_consume_token(LPAREN);
      SupertypeExpression();
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[208] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.302 ------------ */
  static final public void Syntax() throws ParseException, jsdai.lang.SdaiException {
    label_65:
    while (true) {
      SchemaDecl();
      switch (jj_nt.kind) {
      case SCHEMA:
        ;
        break;
      default:
        jj_la1[209] = jj_gen;
        break label_65;
      }
    }
    jj_consume_token(0);
  }

/*-+-------- ISO 10303-14:B.210  ---*/
  static final public void SyntaxX() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case SCHEMA_MAP:
      SchemaMapDecl();
      break;
    case SCHEMA_VIEW:
      SchemaViewDecl();
      break;
    default:
      jj_la1[210] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*-+-------- ISO 10303-14:B.2.211  ---*/
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition TargetEntityReference() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed1 = null;
        // jsdai.SExtended_dictionary_schema.AEntity_definition aed = null;
        Vector entity_definitions = new Vector();
                printDebug("In TargetEntityReference, starting");
    ed = EntityReference();
                                entity_definitions.addElement(ed);
    label_66:
    while (true) {
      switch (jj_nt.kind) {
      case COMPLEX_AND:
        ;
        break;
      default:
        jj_la1[211] = jj_gen;
        break label_66;
      }
      jj_consume_token(COMPLEX_AND);
      ed1 = EntityReference();
                                                                                                            entity_definitions.addElement(ed1);
    }
                if (entity_definitions.size() > 1) {
                        ed = findComplexEntity(entity_definitions);
                }
                printDebug("In TargetEntityReference, ending");
                {if (true) return ed;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.212  ---*/
  static final public void TargetParameter(jsdai.SExtended_dictionary_schema.EMap_definition parent) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESet_type at = null;
        String name;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.ETarget_parameter tp = null;
        jsdai.SExtended_dictionary_schema.EAggregate_target_parameter atp = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        boolean is_aggregate = false;
        Vector parameter_ids = new Vector();
        String id = null;
                printDebug("In TargetParameter, starting, parent map definition: " + parent);
    name = TargetParameterId();
                                    parameter_ids.addElement(name);
    label_67:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[212] = jj_gen;
        break label_67;
      }
      jj_consume_token(COMMA);
      name = TargetParameterId();
                                                                                                       parameter_ids.addElement(name);
    }
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case AGGREGATE:
      jj_consume_token(AGGREGATE);
                                                                                                                                                               is_aggregate = true;
      switch (jj_nt.kind) {
      case LBRACKET:
        bounds = BoundSpec();
        break;
      default:
        jj_la1[213] = jj_gen;
        ;
      }
      jj_consume_token(OF);
      break;
    default:
      jj_la1[214] = jj_gen;
      ;
    }
    ed = TargetEntityReference();
                // determine which min pass required
                if (parser_pass == 1) {

                        for (int i = 0; i < parameter_ids.size(); i++) {
                                id = (String)parameter_ids.elementAt(i);
                                tp = findTarget_parameter(id);
                                if (tp != null) {
                                        // error, the same name
                                }
                                if (is_aggregate) {
                                        atp = (jsdai.SExtended_dictionary_schema.EAggregate_target_parameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregate_target_parameter.class);
                                        tp = atp;
                                } else {
                                        tp = (jsdai.SExtended_dictionary_schema.ETarget_parameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CTarget_parameter.class);
                                }
                                tp.setName(null, id);
                                tp.setParent(null, parent);
//				tp.setOrder(null, target_parameter_order_count++);
                        }


                } else
                if (parser_pass == 4) {
                        if (is_aggregate) {

//				at = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);

                                // at = (jsdai.SExtended_dictionary_schema.EAggregation_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregation_type.class);
                          // name may have to be corrected later
//		  	at.setName(null, "_TARGET_PARAMETER_SET");
//		  	_data_type_name = "_TARGET_PARAMETER_SET";
//		  	if (ed != null) {
//				at.setElement_type(null, ed);
//		  	} else {
//		  		System.out.println("target_parameter aggregate member entity is null");
//		  	}

//				if (bounds[0] == null) {
//					b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
//					b1.setBound_value(null, 0);
//					bounds[0] = b1;
//				} 

//				at.setLower_bound(null, bounds[0]); 
//				if (bounds[1] != null) {
//					at.setUpper_bound(null, bounds[1]); 
//				}	else {
//					at.unsetUpper_bound(null);  // no need for that it is unset after creating
//				}
                        }
                        for (int i = 0; i < parameter_ids.size(); i++) {
                                id = (String)parameter_ids.elementAt(i);


//				tp = findTarget_parameter(id);
// as opposed to the version that requires different target parameter IDs, this solution is very shaky and temporary
// what if there are map calls with specified target parameters at the same time as subtype maps? - problem
                                tp = findTarget_parameterStrict(id);

                        // still need to create aggregate in the case of aggregate
                                // tp.setLower_bound(null,);
                                // tp.setUpper_bound(null,);

/*
				if (is_aggregate) {
					tp.setExtent(null, at);
				} else {
					tp.setExtent(null, ed);
				}
*/


 // System.out.println("ed in TargetParameter in pass 4, before setting extent: " + ed + ", tp: " + tp);

                                tp.setExtent(null, ed);
                        } // for
//  System.out.println("before setting order, for some reason NOT in the loop, in TargetParameter in pass 4, " +  target_parameter_order_count + ", tp: " + tp);
                        tp.setOrder(null, target_parameter_order_count++);
                } else
                if (parser_pass == 5) {

                        for (int i = 0; i < parameter_ids.size(); i++) {
                                id = (String)parameter_ids.elementAt(i);
                                tp = findTarget_parameter(id);


                                if (is_aggregate) {
                                        if (tp instanceof jsdai.SExtended_dictionary_schema.EAggregate_target_parameter) {
                                                atp = (jsdai.SExtended_dictionary_schema.EAggregate_target_parameter)tp;
                                                if (bounds[0] != null) {
                                                        atp.setLower_bound(null, bounds[0]);
                                                }
                                                if (bounds[1] != null) {
                                                        atp.setUpper_bound(null, bounds[1]);
                                                }
                                        } else {
                                                // internal error
                                        }

                                } // if aggregate
                        } // for
                }
                printDebug("In TargetParameter, ending");
  }

/*--------- ISO 10303-14:B.2.213  ---*/
  static final public String TargetParameterId() throws ParseException, jsdai.lang.SdaiException {
        String result = null;
                printDebug("In TargetParameterId, starting");
    result = ParameterId();
                printDebug("In TargetParameterId, ending: " + result);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.214  ---*/
  static final public jsdai.SExtended_dictionary_schema.ETarget_parameter TargetParameterRef() throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.ETarget_parameter result = null;
    name = TargetParameterId();
          printDDebug("IN target_parameter_ref");
                result = findTarget_parameter(name);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

  static final public jsdai.SExtended_dictionary_schema.ETarget_parameter TargetParameterRefStrict() throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.ETarget_parameter result = null;
    name = TargetParameterId();
          printDDebug("IN target_parameter_ref");
                result = findTarget_parameterStrict(name);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

// added by RR, not in part 14
  static final public jsdai.SExtended_dictionary_schema.ESource_parameter SourceParameterRef() throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.ESource_parameter result = null;
    name = SourceParameterId();
                 printDDebug("IN source_parameter_ref");
     result = findSource_parameter(name);
                 {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.303------------ */
  static final public void Term() throws ParseException, jsdai.lang.SdaiException {
        Object operand1 = null;
        Object operand2;
        String x_operand1 = "";
        String x_operand2 = "";
        String x_result = "";
        double op1double;
        double op2double;
        int op1int;
        int op2int;
        int operation;
        int op_nr = 0;
        int nr_of_operands = 0;
    Factor();
                if (parser_pass == 5) {
                        nr_of_operands++;
                        if (argument_stack.empty()) {
                                printVerbose("ERROR: stack empty in term");
                        } else {
                                operand1 = argument_stack.pop();
                        }
                        printStack("POP: Term, operand1: " + operand1);
                        if (expression_instances) {
                                // x_operand1 = (String)expression_stack.pop();
                                // printXStack("POP: Term, operand1: " + x_operand1);
                                // x_result = x_operand1;
                        }
                }
    label_68:
    while (true) {
      if (jj_2_35(2)) {
        ;
      } else {
        break label_68;
      }
      operation = MultiplicationLikeOp();
      Factor();
         if (parser_pass == 5) {
         }
    }
        if (parser_pass == 5) {
        }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.304------------ */
  static final public void TypeDecl() throws ParseException, jsdai.lang.SdaiException {
        String type_name;
        jsdai.SExtended_dictionary_schema.EDefined_type dt;
//      jsdai.SExtended_dictionary_schema.ELocal_declaration$type_declaration ltd;
        jsdai.SExtended_dictionary_schema.EDeclaration ltd;
        Token a_token;
        self_type = true;
    try {
                scope_stack.push(current_scope);
                current_scope = new Vector();
      a_token = jj_consume_token(TYPE);
      type_name = TypeId();
                printDebug("In TypeDecl, starting. Type: " + type_name);
                if (parser_pass == 1) {
                        dt = findDefined_type(type_name);
                        Token t = getToken(0);
                        if (dt != null) {
                                                error_count++;
//						printError("duplicate defined type name \"" + type_name + "\" at line " + t.beginLine + ", column " + t.beginColumn);
                                                printErrorMsg("" + type_name + " - duplicate defined type name", null, true);
                        } else
                        {
                                String wrong_name = findAnyName(type_name);
                                if (wrong_name != null) {
                                                error_count++;
//						printError("duplicate name \"" + type_name + "\". The same name used for a defined type and for " + wrong_name + " at line " + t.beginLine + ", column " + t.beginColumn);
                                                printErrorMsg("" + type_name + "- duplicate type name, the name is already in use in the current scope", null, true);
                                }
                        }
                        dt = (jsdai.SExtended_dictionary_schema.EDefined_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDefined_type.class);
                  active_scope_extension = new ECtScope(active_scope, dt, active_scope_extension, active_scope_string, type_name, type_name.toLowerCase());
                active_scope_string = "";
                        active_scope = dt;
                  ltd = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$type_declaration.class);
                        ltd.setParent(null, sd);
                        // parent_schema is now derived instead of explicit 
                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                // ltd.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                        // }
                        ltd.setDefinition(null, dt);
                        if (flag_oc) {
                                dt.setName(null, type_name);
                        } else {
                                dt.setName(null, type_name.toLowerCase());
                        }
                        hm_current_type_declarations.put(type_name.toLowerCase(), ltd);
//                      dt.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                        // now it is inverse
                        // dt.createWhere_rules(null);
                        createDocumentationEntity2(dt, a_token);
                } else
                {
                        dt = findDefined_type(type_name);
                  active_scope_extension = new ECtScope(active_scope, dt, active_scope_extension, active_scope_string, type_name, type_name.toLowerCase());
                active_scope_string = "";
                        active_scope = dt;
                        if (dt == null) {
                                error_count++;
                                if (parser_pass == 2) {
//					printError("defined type not found: " + type_name);
                                        printErrorMsg("" + type_name + " - defined type not found", null, true);
                                }
                                printDebug("TypeDecl - defined type not found: " + type_name);
                        }

                }
      jj_consume_token(EQ);
      UnderlyingType(dt);
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case WHERE:
        WhereClause(dt);
        break;
      default:
        jj_la1[215] = jj_gen;
        ;
      }
      jj_consume_token(END_TYPE);
                active_scope = null;
                active_scope_string = active_scope_extension.getParent_scope_string();
                active_scope_extension = active_scope_extension.getParent();

                current_scope = (Vector)scope_stack.pop();
                printDebug("In TypeDecl, ending. Type: " + type_name);


// System.out.println("O-O-12 - defined type: " + dt);

      jj_consume_token(SEMICOLON);
    } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
        if (parser_pass == 1) {
//		printError(e.getMessage());
                printErrorMsg(e.getMessage(), null, true);
                error_count++;
                System.out.println("ERROR RECOVERY: skipping to END_TYPE");
        }
//	System.out.println("error_count before: " + error_count);
        recoverFromParseException(END_TYPE, e);
//	System.out.println("error_count after: " + error_count);

    }
        self_type = false;
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.305------------ */
  static final public String TypeId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 19) --------------------------------------------------- ISO 10303-11:A.2.306------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at 3 and 19.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/
  static final public String TypeLabel() throws ParseException, jsdai.lang.SdaiException {
        String label = null;
                printDebug("In TypeLabel, starting");
    //      (label = TypeLabelId() | TypeLabelRef())
            label = TypeLabelId();
                printDebug("In TypeLabel, ending");
                {if (true) return label;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.307------------ */
  static final public String TypeLabelId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.219  ---*/
  static final public jsdai.SExtended_dictionary_schema.EDefined_type TypeReference() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EDefined_type  dt = null;
    if (jj_2_36(2147483647)) {
      SchemaRef();
      jj_consume_token(DOT);
    } else {
      ;
    }
    dt = TypeRef(0);
                {if (true) return dt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.308------------ */
  static final public int UnaryOp() throws ParseException, jsdai.lang.SdaiException {
        int t;
                printDebug("In UnaryOP");
    switch (jj_nt.kind) {
    case PLUS:
      jj_consume_token(PLUS);
              t = 1;
      break;
    case MINUS:
      jj_consume_token(MINUS);
                            t = 2;
      break;
    case NOT:
      jj_consume_token(NOT);
                 t = 3;
      break;
    default:
      jj_la1[216] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return t;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.309------------ */
  static final public void UnderlyingType(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAggregation_type at = null;
        jsdai.SExtended_dictionary_schema.ESimple_type st = null;
        jsdai.SExtended_dictionary_schema.EDefined_type dt2 = null;
    switch (jj_nt.kind) {
    case ENUMERATION:
    case EXTENSIBLE:
    case GENERIC_ENTITY:
    case SELECT:
      ConstructedTypes(dt);
      break;
    case ARRAY:
    case BAG:
    case LIST:
    case SET:
      at = AggregationTypes(dt);
                // if (parser_pass > 3) {  // was == 2
                //	 dt.setDomain(null, at);
                // }
                if ((dt != null) && (at != null)) {
                if (!(dt.testDomain(null))) {
                                if (isDTDomainValid(dt, at)) {
                                        dt.setDomain(null, at);
                                } else {
                                        error_count++;
                                        printErrorMsg("" + dt.getName(null) + " - invalid underlying type", null, true);
                                }
                        }
                }
      break;
    case BINARY:
    case BOOLEAN:
    case INTEGER:
    case LOGICAL:
    case NUMBER:
    case REAL:
    case STRING:
      st = SimpleTypes(dt);
                if (parser_pass > 3) {  // was == 3
                        if (st != null) {
                                if (isDTDomainValid(dt, st)) {
                                        dt.setDomain(null, st);
                                } else {
                                        error_count++;
                                        printErrorMsg("" + dt.getName(null) + " - invalid underlying type", null, true);
                                }
                        } else {
                                printVerbose("ERROR: domain st unset");
                        }
                }
      break;
    case SIMPLE_ID:
      dt2 = TypeRef(0);
                if (parser_pass > 3) {  // was == 3
                        if (isDTDomainValid(dt, dt2)) {
                                dt.setDomain(null, dt2);
                        } else {
                                error_count++;
                                printErrorMsg("" + dt.getName(null) + " - invalid underlying type", null, true);
                        }
                }
      break;
    default:
      jj_la1[217] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.310------------ */
  static final public void UniqueClause(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(UNIQUE);
    label_69:
    while (true) {
      UniqueRule(ed);
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case SELF:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[218] = jj_gen;
        break label_69;
      }
    }
  }

/* - LOOKAHEAD 2 or > - (Column 3) ---------------------------------------------------- ISO 10303-11:A.2.311------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict in [] construct (column 3).
		 Expansion nested within construct and expansion following construct have common prefixes,
		 one of which is <SIMPLE_ID>. Lookahead of 2 or more should be used for the nested expansion.
*/
  static final public void UniqueRule(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        String name = null;
        jsdai.SExtended_dictionary_schema.EUniqueness_rule ur;
        jsdai.SExtended_dictionary_schema.AAttribute aa = null;
        jsdai.SExtended_dictionary_schema.EAttribute a;
        int index = 1;
    if (jj_2_37(2)) {
      name = Label();
      jj_consume_token(COLON);
    } else {
      ;
    }
    a = ReferencedAttribute(ed);
                if (parser_pass == 5) {
                        ur = (jsdai.SExtended_dictionary_schema.EUniqueness_rule)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CUniqueness_rule.class);
                        if (name != null)
                                ur.setLabel(null, name);
                        ur.setParent_entity(null, ed);
                        aa = ur.createAttributes(null);
                        if (a != null)
                                aa.addByIndex(index++, a);
                        else {
                                error_count++;
//				printError("Uniqness rule " + name + " in entity " + ed.getName(null) + ": attribute not found");
                                printErrorMsg("" + name + " - uniqness rule in entity " + ed.getName(null) + ": attribute not found", null, true);
                        }
                }
    label_70:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[219] = jj_gen;
        break label_70;
      }
      jj_consume_token(COMMA);
      a = ReferencedAttribute(ed);
                if (parser_pass == 5) {
                        if (a != null)
                                aa.addByIndex(index++, a);
                        else {
                                error_count++;
//				printError("Uniqness rule " + name + " in entity " + ed.getName(null) + ": attribute not found");
                                printErrorMsg("" + name + " - uniqness rule in entity " + ed.getName(null) + ": attribute not found", null, true);
//				printError("Uniqness rule - attribute not found");
                        }
                }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.312------------ */
  static final public void UntilControl() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(UNTIL);
    LogicalExpression();
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.313------------ */
  static final public void UseClause(Vector used_vector) throws ParseException, jsdai.lang.SdaiException {
  String used_schema;
        jsdai.lang.SdaiModel interfaced_model;
        boolean items_listed = false;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
        Vector items_vector;
        jsdai.SExtended_dictionary_schema.EUse_from_specification ufs = null;
//	jsdai.SExtended_dictionary_schema.AUsed_declaration items = null;
        jsdai.SExtended_dictionary_schema.AInterfaced_declaration items = null;
    jj_consume_token(USE);
    jj_consume_token(FROM);
    used_schema = SchemaRef();
          if (used_schema != null) {
                if (used_schema.equalsIgnoreCase("mixed_complex_types")) {
                                error_count++;
                                printErrorMsg("USE FROM " + used_schema + " - this special schema should not be interfaced explicitly", null, true);
                }
          }
                items_vector = new Vector();
                interfaced_model = findModel(used_schema);
//              if (interfaced_model == null) {
                if ((interfaced_model == null) && (parser_pass != 1)) {
                        error_count++;
                        if (parser_pass == 2) {
                                if (used_schema != null) {
//					printError("interfaced schema not found: " + used_schema);
                                        printErrorMsg("" + used_schema + " - interfaced schema not found", null, true);
                                } else {
//					printError("interfaced schema not found, its name not determined");
                                        printErrorMsg("" + "" + "- interfaced schema not found, its name not determined", null, true);
                                }
                        }
                        printDebug("USEd FROM schema not found: " + used_schema);
                }
// 		if ((parser_pass == 2) && (interfaced_model != null)) {
                if (interfaced_model != null) {
                        if (interfaced_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                                interfaced_model.startReadOnlyAccess();
      }
    }
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      dc = NamedTypeOrRename(interfaced_model);
                                                       items_listed = true; items_vector.addElement(dc);
      label_71:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[220] = jj_gen;
          break label_71;
        }
        jj_consume_token(COMMA);
        dc = NamedTypeOrRename(interfaced_model);
                                                                                                                                                         items_vector.addElement(dc);
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[221] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 2) {
                        ufs = (jsdai.SExtended_dictionary_schema.EUse_from_specification)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CUse_from_specification.class);
                        jsdai.SExtended_dictionary_schema.ESchema_definition asd = getSchema_definitionFromModel(interfaced_model);
                        if (asd != null) {
                                ufs.setForeign_schema(null, asd);  // generic_schema_definition;
                        }
                        ufs.setCurrent_schema(null, sd); // generic_schema_definition;
                        if (!items_listed) {
                                if (interfaced_model != null) {
                                        createAllUsedDeclarations(interfaced_model);
                                        // here the interfaced_model is stored.
                                        used_vector.addElement(interfaced_model);
                                }
                        } else {
                                items = ufs.createItems(null);
                                for (int i = 0; i < items_vector.size(); i++) {
//					items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EUsed_declaration)items_vector.elementAt(i));
//					items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EInterfaced_declaration)items_vector.elementAt(i));
                                        Object ivi = items_vector.elementAt(i);
                                        if (ivi != null) {
                                                items.addUnordered((jsdai.SExtended_dictionary_schema.EUsed_declaration)ivi);
                                        }
                                }
                                if (items.getMemberCount() == 0) {
                                        ufs.deleteApplicationInstance();
                                }
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.314------------ */
  static final public String VariableId() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.223  ---*/
  static final public void ViewAttributeDecl(jsdai.SExtended_dictionary_schema.EIndependent_view_definition vd, jsdai.SExtended_dictionary_schema.EView_partition partition, boolean first_partition) throws ParseException, jsdai.lang.SdaiException {
        String attr_name;
        boolean is_optional = false;
        jsdai.SExtended_dictionary_schema.ESchema_definition ssd = null;
        jsdai.lang.EEntity bt = null;
        jsdai.SExtended_dictionary_schema.EView_attribute va = null;
        jsdai.SExtended_dictionary_schema.EView_partition_attribute vpa = null;
    //      ViewAttributeId() ":" [ <OPTIONAL> ] [ SourceSchemaRef() "." ] BaseType(null) ":=" Expression() ";"
    //	attr_name = ViewAttributeId() ":" [ <OPTIONAL> {is_optional = true;}] [  LOOKAHEAD(2) ssd = (jsdai.SExtended_dictionary_schema.ESchema_definition)InterpretedRef(PI_SOURCE_SCHEMA) "." ] bt = BaseType(ssd) ":=" Expression() ";"
            // <SIMPLE_ID> choice conflict, "." allows to confirm the optional part, lookahead 2 is ok.
            attr_name = ViewAttributeId();
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
                                                        is_optional = true;
      break;
    default:
      jj_la1[222] = jj_gen;
      ;
    }
    if (jj_2_38(2)) {
      ssd = SourceSchemaRef();
      jj_consume_token(DOT);
    } else {
      ;
    }
    bt = BaseType(ssd);
    jj_consume_token(ASSIGN);
    Expression();
    jj_consume_token(SEMICOLON);
                // check which parser pass better to use.
                if (parser_pass == 1) {
                                va = findView_attribute(attr_name, vd);
                                if (va != null) {
                                        // error
                                }

                        if (first_partition) {
                                // if first partition, create both view_attribute and view_partition_attirbute
                                va =  (jsdai.SExtended_dictionary_schema.EView_attribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CView_attribute.class);
//				va.setParent_entity(null, vd);
                                va.setParent(null, vd);
                                va.setName(null, attr_name);
//				va.setOrder(null, view_attribute_order_count++);
                                va.setOptional_flag(null, is_optional);
// System.out.println("SET OPTIONAL 05, attribute: " + va);
                        } else {
                                // if subsequent partition, find view_attribute and create view_partition_attribute
                                va = findView_attribute(attr_name, vd);
                        }
                        vpa = (jsdai.SExtended_dictionary_schema.EView_partition_attribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CView_partition_attribute.class);
                        vpa.setParent_view_attribute(null, va);
                        vpa.setRelated_partition(null, partition);
                } else {
                        va = findView_attribute(attr_name, vd);
                        if (parser_pass == 4) {
                                va.setOrder(null, view_attribute_order_count++);
                        }
                }
  }

/*--------- ISO 10303-14:B.2.224  ---*/
  static final public String ViewAttributeId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.225  ---*/
  static final public void ViewAttrDeclStmtList(jsdai.SExtended_dictionary_schema.EIndependent_view_definition vd, jsdai.SExtended_dictionary_schema.EView_partition partition, boolean first_partition) throws ParseException, jsdai.lang.SdaiException {
                view_attribute_order_count = 0;
    label_72:
    while (true) {
      ViewAttributeDecl(vd, partition, first_partition);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[223] = jj_gen;
        break label_72;
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.226  ---*/
  static final public Object ViewCall() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EView_partition vp = null;
        jsdai.SExtended_dictionary_schema.EMap_or_view_partition partition = null;
                printDebug("In ViewCall, starting");
    vd = ViewReference();
    switch (jj_nt.kind) {
    case BACKSLASH:
      partition = PartitionQualification(vd);
      break;
    default:
      jj_la1[224] = jj_gen;
      ;
    }
    jj_consume_token(LPAREN);
    if (jj_2_39(1)) {
      ExpressionOrWild();
      label_73:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[225] = jj_gen;
          break label_73;
        }
        jj_consume_token(COMMA);
        ExpressionOrWild();
      }
    } else {
      ;
    }
    jj_consume_token(RPAREN);
                printDebug("In ViewCall, ending");
          {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.227  ---*/


//view_decl = VIEW view_id independent_view_decl | dependent_view_decl  END_VIEW ';'
  static final public void ViewDecl() throws ParseException, jsdai.lang.SdaiException {
        String view_name;
        Token a_token;
                scope_stack.push(current_scope);
                current_scope = new Vector();
    a_token = jj_consume_token(VIEW);
    view_name = ViewId();
    switch (jj_nt.kind) {
    case COLON:
      DependentViewDecl(a_token, view_name);
      break;
    case SEMICOLON:
    case ABSTRACT:
    case CONNOTATIONAL:
    case SUBTYPE:
    case SUPERTYPE:
      IndependentViewDecl(a_token, view_name);
      break;
    default:
      jj_la1[226] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    jj_consume_token(END_VIEW);
    jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
  }

// independent_view_decl = root_view_decl | subtype_view_decl
  static final public void IndependentViewDecl(Token a_token, String view_name) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration vld = null;
                printDebug("Current view: " + view_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        vd = findView_definition(view_name, null);
                        if (vd != null) {
                                error_count++;
//				printError("duplicate view name \"" + view_name + "\"");
                                printErrorMsg("" + view_name + " - duplicate view name", null, true);
                        } else {
                                String wrong_name = findAnyName(view_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + view_name + "\". The same name used for a view and for " + wrong_name);
                                        printErrorMsg("" + view_name + " - duplicate view name, the name is already in use in the current scope", null, true);
                                }
                                vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CIndependent_view_definition.class);
                                active_scope = vd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                vld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$view_declaration.class);


//				vld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                vld.setParent(null, sd);
                                vld.setDefinition(null, vd);

                                vd.setName(null, view_name);
                                // supertypes is non-optional attribute, although there are no supertypes in dependent_views.
//				vd.createSupertypes(null);
                                vd.createGeneric_supertypes(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper()
                        vd = findView_definition(view_name, null);
                        active_scope = vd;
                        if (vd == null) {
                                error_count++;
//				printError("ViewDecl - the view not found: " + view_name);
                                printErrorMsg("" + view_name + " - view not found", null, true);
                        }
                }
                // createDocumentationEntity2(vd, a_token);

    switch (jj_nt.kind) {
    case ABSTRACT:
    case SUPERTYPE:
      SupertypeConstraint(vd);
      break;
    default:
      jj_la1[227] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case CONNOTATIONAL:
    case SUBTYPE:
      SubtypeViewDecl(vd);
      break;
    case SEMICOLON:
      RootViewDecl(vd);
      break;
    default:
      jj_la1[228] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

// root_view_decl = [supertype_constraint] ';' binding_header independent_view_project_clause {binding_header independent_view_project_clause}
  static final public void RootViewDecl(jsdai.SExtended_dictionary_schema.EView_definition vd) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity partition_e = null;
        jsdai.SExtended_dictionary_schema.EView_partition partition = null;
    jj_consume_token(SEMICOLON);
    partition_e = BindingHeader(vd);
                                           partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
    IndependentViewProjectClause(vd, partition, true);
    label_74:
    while (true) {
      switch (jj_nt.kind) {
      case FROM:
      case IDENTIFIED_BY:
      case LOCAL:
      case ORDERED_BY:
      case PARTITION:
      case SELECT:
      case WHERE:
        ;
        break;
      default:
        jj_la1[229] = jj_gen;
        break label_74;
      }
      //           LOOKAHEAD(BindingHeader(vd)) partition_e = BindingHeader(vd) {partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;} 
                  partition_e = BindingHeader(vd);
                                             partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
      IndependentViewProjectClause(vd, partition, false);
    }
  }

// subtype_view_decl = [supertype_constraint] subtype_declaration ';' subtype_binding_header independent_view_project_clause {subtype_binding_header independent_view_project_clause}
  static final public void SubtypeViewDecl(jsdai.SExtended_dictionary_schema.EView_definition vd) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity gen_partition = null;
    SubtypeDeclaration(vd);
    jj_consume_token(SEMICOLON);
    gen_partition = SubtypeBindingHeader(vd);
    IndependentViewProjectClause(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, true);
    label_75:
    while (true) {
      switch (jj_nt.kind) {
      case PARTITION:
      case WHERE:
        ;
        break;
      default:
        jj_la1[230] = jj_gen;
        break label_75;
      }
      //	    LOOKAHEAD(SubtypeBindingHeader(vd)) gen_partition = SubtypeBindingHeader(vd) 
                  gen_partition = SubtypeBindingHeader(vd);
      IndependentViewProjectClause(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, false);
    }
  }

// dependent_view_decl = ':' base_type [supertype_constraint] ';' binding_header RETURN expression {binding_header RETURN expression}
  static final public void DependentViewDecl(Token a_token, String view_name) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity bt = null;
        jsdai.lang.EEntity partition_e = null;
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration vld = null;
        jsdai.SExtended_dictionary_schema.EView_partition partition = null;
    jj_consume_token(COLON);
    bt = BaseType(null);
                printDebug("Current view: " + view_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        vd = findView_definition(view_name, null);
                        if (vd != null) {
                                error_count++;
//				printError("duplicate view name \"" + view_name + "\"");
                                printErrorMsg("" + view_name + " - duplicate view name", null, true);
                        } else {
                                String wrong_name = findAnyName(view_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + view_name + "\". The same name used for a view and for " + wrong_name);
                                        printErrorMsg("" + view_name + " - duplicate view name, the name is already in use in the current scope", null, true);
                                }
                                vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_view_definition.class);
                                ((jsdai.SExtended_dictionary_schema.EDependent_view_definition)vd).setDomain(null, bt);
                                active_scope = vd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                vld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$view_declaration.class);


//				vld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                vld.setParent(null, sd);
                                vld.setDefinition(null, vd);

                                vd.setName(null, view_name);
                                // supertypes is non-optional attribute, although there are no supertypes in dependent_views.
//				vd.createSupertypes(null);
                                vd.createGeneric_supertypes(null);
                        }
                } else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper()
                        vd = findView_definition(view_name, null);
                        active_scope = vd;
                        if (vd == null) {
                                error_count++;
//				printError("ViewDecl - the view not found: " + view_name);
                                printErrorMsg("" + view_name + " - view not found", null, true);
                        }
                }
                // createDocumentationEntity2(vd, a_token);

    switch (jj_nt.kind) {
    case ABSTRACT:
    case SUPERTYPE:
      SupertypeConstraint(vd);
      break;
    default:
      jj_la1[231] = jj_gen;
      ;
    }
    partition_e = BindingHeader(vd);
                                         partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
    jj_consume_token(RETURN);
    Expression();
    label_76:
    while (true) {
      switch (jj_nt.kind) {
      case FROM:
      case IDENTIFIED_BY:
      case LOCAL:
      case ORDERED_BY:
      case PARTITION:
      case RETURN:
      case WHERE:
        ;
        break;
      default:
        jj_la1[232] = jj_gen;
        break label_76;
      }
      // the choice problem here
                  partition_e = BindingHeader(vd);
                                             partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
      jj_consume_token(RETURN);
      Expression();
    }
  }

// independent_view_project_clause = SELECT view_attr_decl_stmt_list;
  static final public void IndependentViewProjectClause(jsdai.SExtended_dictionary_schema.EView_definition vd, jsdai.SExtended_dictionary_schema.EView_partition partition, boolean first_partition) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(SELECT);
    ViewAttrDeclStmtList((jsdai.SExtended_dictionary_schema.EIndependent_view_definition)vd, partition, first_partition);
  }

  static final public void ViewDecl_previous() throws ParseException, jsdai.lang.SdaiException {
        String view_name;
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration vld = null;
        Token a_token;
        boolean is_dependent_view = false;
        jsdai.lang.EEntity bt = null;
        jsdai.SExtended_dictionary_schema.EView_partition partition = null;
        jsdai.lang.EEntity partition_e = null;
        jsdai.lang.EEntity gen_partition = null;
    switch (jj_nt.kind) {
    case VIEW:
      //      <VIEW> ViewId() [ ":" BaseType(null) ] [ SupertypeRule() ] ";" ( ViewSubtypeOfClause() ( SubtypeBindingHeader() ViewProjectClause() )+ ) | ( ( BindingHeader() ViewProjectClause() )+ ) <END_VIEW> ";"
      // not making the change from DIS
      //old	<VIEW> ViewId() [ ":" BaseType(null) ] [ SupertypeConstraint(null) ] ";" ( ViewSubtypeOfClause() ( LOOKAHEAD(3) SubtypeBindingHeader() ViewProjectClause() )+ ) | ( ( BindingHeader() ViewProjectClause() )+ ) <END_VIEW> ";"
              a_token = jj_consume_token(VIEW);
      view_name = ViewId();
      switch (jj_nt.kind) {
      case COLON:
        jj_consume_token(COLON);
        bt = BaseType(null);
                                                                          is_dependent_view = true;
        break;
      default:
        jj_la1[233] = jj_gen;
        ;
      }
                printDebug("Current view: " + view_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        vd = findView_definition(view_name, null);
                        if (vd != null) {
                                error_count++;
//				printError("duplicate view name \"" + view_name + "\"");
                                printErrorMsg("" + view_name + " - duplicate view name", null, true);
                        } else {
                                String wrong_name = findAnyName(view_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + view_name + "\". The same name used for a view and for " + wrong_name);
                                        printErrorMsg("" + view_name + " - duplicate view name, the name is already in use in the current scope", null, true);
                                }
                                if (is_dependent_view) {
                                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_view_definition.class);
                                        ((jsdai.SExtended_dictionary_schema.EDependent_view_definition)vd).setDomain(null, bt);
                                } else {
                                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CIndependent_view_definition.class);
                                }
                                active_scope = vd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                vld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$view_declaration.class);


//				vld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                vld.setParent(null, sd);
                                vld.setDefinition(null, vd);

                                vd.setName(null, view_name);
                                // supertypes is non-optional attribute, although there are no supertypes in dependent_views.
//				vd.createSupertypes(null);
                                vd.createGeneric_supertypes(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper()
                        vd = findView_definition(view_name, null);
                        if (vd == null) {
                                error_count++;
//				printError("ViewDecl - the view not found: " + view_name);
                                printErrorMsg("" + view_name + " - view not found", null, true);
                        }
                }
                // createDocumentationEntity2(vd, a_token);

      SubSuper(vd);
      jj_consume_token(SEMICOLON);
      partition_e = BindingHeader(vd);
                                           partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
      ViewProjectClause(vd, partition, true);
      label_77:
      while (true) {
        if (jj_2_40(100)) {
          ;
        } else {
          break label_77;
        }
        partition_e = BindingHeader(vd);
                                                            partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
        ViewProjectClause(vd, partition, false);
      }
      break;
    case PARTITION:
    case WHERE:
      gen_partition = SubtypeBindingHeader(vd);
      ViewProjectClause(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, true);
      label_78:
      while (true) {
        switch (jj_nt.kind) {
        case PARTITION:
        case WHERE:
          ;
          break;
        default:
          jj_la1[234] = jj_gen;
          break label_78;
        }
        //	    LOOKAHEAD(SubtypeBindingHeader(vd)) gen_partition = SubtypeBindingHeader(vd) 
                    gen_partition = SubtypeBindingHeader(vd);
        ViewProjectClause(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, false);
      }
      jj_consume_token(END_VIEW);
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[235] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  static final public void ViewDecl_old() throws ParseException, jsdai.lang.SdaiException {
        String view_name;
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration vld = null;
        Token a_token;
        boolean is_dependent_view = false;
        jsdai.lang.EEntity bt = null;
        jsdai.SExtended_dictionary_schema.EView_partition partition = null;
        jsdai.lang.EEntity partition_e = null;
        jsdai.lang.EEntity gen_partition = null;
    switch (jj_nt.kind) {
    case VIEW:
      //      <VIEW> ViewId() [ ":" BaseType(null) ] [ SupertypeRule() ] ";" ( ViewSubtypeOfClause() ( SubtypeBindingHeader() ViewProjectClause() )+ ) | ( ( BindingHeader() ViewProjectClause() )+ ) <END_VIEW> ";"
      // not making the change from DIS
      //old	<VIEW> ViewId() [ ":" BaseType(null) ] [ SupertypeConstraint(null) ] ";" ( ViewSubtypeOfClause() ( LOOKAHEAD(3) SubtypeBindingHeader() ViewProjectClause() )+ ) | ( ( BindingHeader() ViewProjectClause() )+ ) <END_VIEW> ";"
              a_token = jj_consume_token(VIEW);
      view_name = ViewId();
      switch (jj_nt.kind) {
      case COLON:
        jj_consume_token(COLON);
        bt = BaseType(null);
                                                                          is_dependent_view = true;
        break;
      default:
        jj_la1[236] = jj_gen;
        ;
      }
                printDebug("Current view: " + view_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        vd = findView_definition(view_name, null);
                        if (vd != null) {
                                error_count++;
//				printError("duplicate view name \"" + view_name + "\"");
                                printErrorMsg("" + view_name + " - duplicate view name", null, true);
                        } else {
                                String wrong_name = findAnyName(view_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + view_name + "\". The same name used for a view and for " + wrong_name);
                                        printErrorMsg("" + view_name + " - duplicate view name, the name is already in use in the current scope", null, true);
                                }
                                if (is_dependent_view) {
                                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_view_definition.class);
                                        ((jsdai.SExtended_dictionary_schema.EDependent_view_definition)vd).setDomain(null, bt);
                                } else {
                                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CIndependent_view_definition.class);
                                }
                                active_scope = vd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                vld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$view_declaration.class);

        if (sd == null) {
//              System.out.println("SD NULL, view_name: " + view_name + ", pass: " + parser_pass);
        } else {
        }

//				vld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                vld.setParent(null, sd);
                                vld.setDefinition(null, vd);

                                vd.setName(null, view_name);
                                // supertypes is non-optional attribute, although there are no supertypes in dependent_views.
//				vd.createSupertypes(null);
                                vd.createGeneric_supertypes(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper()
                        vd = findView_definition(view_name, null);
                        if (vd == null) {
                                error_count++;
//				printError("ViewDecl - the view not found: " + view_name);
                                printErrorMsg("" + view_name + " - view not found", null, true);
                        }
                }
                // createDocumentationEntity2(vd, a_token);

printDebug("In ViewDecl, before SubSuper");
      SubSuper(vd);
      jj_consume_token(SEMICOLON);
printDebug("In ViewDecl, after SubSuper");
printDebug("In ViewDecl, starting subtype branch");
      gen_partition = SubtypeBindingHeader(vd);
printDebug("In ViewDecl, subtype branch, before ViewProjectClause");
      ViewProjectClause(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, true);
printDebug("In ViewDecl, subtype branch, after 1st ViewProjectClause");
      label_79:
      while (true) {
        if (jj_2_41(2147483647)) {
          ;
        } else {
          break label_79;
        }
        gen_partition = SubtypeBindingHeader(vd);
        ViewProjectClause(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, false);
      }
      break;
    case FROM:
    case IDENTIFIED_BY:
    case LOCAL:
    case ORDERED_BY:
    case PARTITION:
    case RETURN:
    case SELECT:
    case WHERE:
printDebug("In ViewDecl, starting no-subtype branch");
      partition_e = BindingHeader(vd);
                                         partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
printDebug("In ViewDecl, no-subtype branch, before ViewProjectClause");
      ViewProjectClause(vd, partition, true);
printDebug("In ViewDecl, no-subtype branch, after 1st ViewProjectClause");
      label_80:
      while (true) {
        switch (jj_nt.kind) {
        case FROM:
        case IDENTIFIED_BY:
        case LOCAL:
        case ORDERED_BY:
        case PARTITION:
        case RETURN:
        case SELECT:
        case WHERE:
          ;
          break;
        default:
          jj_la1[237] = jj_gen;
          break label_80;
        }
        partition_e = BindingHeader(vd);
                                           partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
        ViewProjectClause(vd, partition, false);
      }
      jj_consume_token(END_VIEW);
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[238] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*--------- ISO 10303-14:B.2.228  ---*/
  static final public String ViewId() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.229  ---*/
  static final public void ViewProjectClause(jsdai.SExtended_dictionary_schema.EView_definition vd, jsdai.SExtended_dictionary_schema.EView_partition partition, boolean first_partition) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case SELECT:
      jj_consume_token(SELECT);
      ViewAttrDeclStmtList((jsdai.SExtended_dictionary_schema.EIndependent_view_definition)vd, partition, first_partition);
      break;
    case RETURN:
      jj_consume_token(RETURN);
      Expression();
      break;
    default:
      jj_la1[239] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*--------- ISO 10303-14:B.2.230 ---*/
  static final public jsdai.SExtended_dictionary_schema.EView_definition ViewReference() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
    if (jj_2_42(2)) {
      InterpretedRef(PI_SCHEMA_MAP_OR_SCHEMA_VIEW);
      jj_consume_token(DOT);
    } else {
      ;
    }
    InterpretedRef(PI_VIEW);
                {if (true) return vd;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.231  ---*/
// removed -

//R void ViewSubtypeOfClause() throws jsdai.lang.SdaiException :
//R {}
//C {
//	<SUBTYPE> <OF> "(" ViewReference() ( "," ViewReference() )* ")" 
// my correction:
//R	<SUBTYPE> <OF> "(" ViewReference() ( "," ViewReference() )* ")" ";" 
//R }


/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.315------------ */
  static final public void WhereClause(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EWhere_rule wr = null;
        jsdai.SExtended_dictionary_schema.AWhere_rule ar = null;
        int index = 1;
        no_label_nr = 0;
        if (parser_pass == 5) {
        }
                where_rule_order_count = 0;
                active_scope = parent;
                // active scope should not be changed 
                printDebug("In WhereClause, starting, parent: " + parent);
                domain_rule_labels.clear();
    jj_consume_token(WHERE);
    label_81:
    while (true) {
      wr = DomainRule(parent);
      jj_consume_token(SEMICOLON);
      if (isDomainRule()) {
        ;
      } else {
        break label_81;
      }
    }
                printDebug("In WhereClause, ending");
  }

/*-------------------------------*/
/*
void ChoiceConflict () :
{}
{
	<BASED_ON> | <BASED_ON>
}
*/
/*-------------------------------*/


/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.316------------ */
  static final public void WhileControl() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(WHILE);
    LogicalExpression();
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.317------------ */
  static final public int Width() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.318------------ */
  static final public int WidthSpec() throws ParseException, jsdai.lang.SdaiException {
        int wide;
        boolean is_fixed = false;
    jj_consume_token(LPAREN);
    wide = Width();
    jj_consume_token(RPAREN);
    switch (jj_nt.kind) {
    case FIXED:
      jj_consume_token(FIXED);
                                         is_fixed = true;
      break;
    default:
      jj_la1[240] = jj_gen;
      ;
    }
                if (parser_pass == 5) {
                        if (wide > 0) {
                                if (is_fixed) {
                                        wide = -wide;
                                }
                        }

                }
                {if (true) return wide;}
    throw new Error("Missing return statement in function");
  }

/************ 5th pass ----- starts ---------------------------------- **************/


/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.145 ------------*/
  static final public jsdai.SExtended_dictionary_schema.EAttribute AttributeRef5(jsdai.SExtended_dictionary_schema.EEntity_definition ed, jsdai.SExtended_dictionary_schema.EEntity_definition ed2, int attr_type, Object reference) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) AttributeRef */
        X_AttributeRef jjtn000 = new X_AttributeRef(JJTATTRIBUTEREF);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        String attribute_name;
        Token attribute_token;
        String attr_key = null;
        int attr_type_original;
        boolean to_debug = false;
    try {
        printDebug("In AttributeRef5, starting, ed: " + ed + ", ed2: " + ed2 + ", attr. type: " + attr_type + ", reference: " + reference + ", pass: " + parser_pass);
                attr_type_original = attr_type;
                if (attr_type == -40) {
                        attr_type = 0;
                        to_debug = true;
                        System.out.println("to debug explicit in AttributeRef5 - ed: " + ed + ", ed2: " + ed2 + ", reference: " + reference + ", active_scope: " + active_scope);
                }
      attribute_token = AttributeId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (flag_oc) {
                        attribute_name = attribute_token.image;
                } else {
                        attribute_name = attribute_token.image.toLowerCase();
                }

                if (to_debug) {
                        System.out.println("debugging AttributeRef5, attribute_name: " + attribute_name);
                }
//System.out.println("In AttributeRef, starting, ed: " + ed + ", ed2: " + ed2 + ", attr. type: " + attr_type + ", reference: " + reference + ", pass: " + parser_pass);
//System.out.println("attribute name: " + attribute_name);
                printDebug("In AttributeRef5, attribute name: " + attribute_name);
                if (parser_pass == 1) {
                        if (attr_type == 0) { // explicit
// System.out.println("<=EA-3=>");
                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExplicit_attribute.class);
                                attr.setName(null, attribute_name);
                                attr.unsetOrder(null);
                                // attr.setOrder(null, Integer.MIN_VALUE);
                                attr.setParent(null, ed);
                                // currently, ed is declared as entity_definition, but who knows what will happen in the future
                                // parent_entity is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // attr.setParent_entity(null, ed);
                                // }
                        } else
                        if (attr_type == 1) { // derived
// System.out.println("<=DA-3=>");
                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDerived_attribute.class);
                                attr.setName(null, attribute_name);
                                attr.unsetOrder(null);
                                // attr.setOrder(null, Integer.MIN_VALUE);
                                attr.setParent(null, ed);
                                // parent_entity is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // attr.setParent_entity(null, ed);
                                // }
                        } else
                        if (attr_type == 2) { // inverse
// System.out.println("<=IA-3=>");
                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInverse_attribute.class);
                                attr.setName(null, attribute_name);
                                attr.unsetOrder(null);
                                // attr.setOrder(null, Integer.MIN_VALUE);
                                attr.setParent(null, ed);
                                // parent_entity is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // attr.setParent_entity(null, ed);
                                // }
                        }
                } else
                if (parser_pass == 2) {
                } else
                if (parser_pass == 3) {
                } else
                if (parser_pass == 4) {
                        if (attr_type >= 0) {
                                if (attr_type == 3) {
// System.out.println("@X 1 name: " + attribute_name + ", ed: " + ed2);
                                        attr = findAttribute(attribute_name, ed2, 0, ed, attr_key);
                                }
                                else {
// System.out.println("@X 2 name: " + attribute_name + ", ed: " + ed);

//        changed back from ed to ed2, not clear why it was changed to ed in the first place
//					attr = findAttribute(attribute_name, ed, attr_type);
                                        attr = findAttribute(attribute_name, ed2, attr_type, ed, attr_key);
                                }
                        }
                } else
                if (parser_pass == 5) {





                                if (flag_in_redeclaring) {

                                        // restoring back the seemingly correct version
                                        //attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + attribute_name.toLowerCase();
                                        // something very wrong with this
                                        attr_key = "#" + global_schema_name + "_#" + global_entity_ref + "_#_#" + attribute_name.toLowerCase();
                                } else {
                                        // why this was commented out?
                                        //hm_attribute_key = "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                                        attr_key = null;
                                }
                if (to_debug) {
                        System.out.println("debugging AttributeRef5, attr_key: " + attr_key);
                }



//System.out.println("debugging AttributeRef5, attr_key: " + attr_key);

                        if (attr_type >= 0) {
                                if (attr_type == 3) {
                                                // printDDebug("######0 in AttributeRef5 name: " + attribute_name + ", entity name: " + ed2.getName(null) + ", attribute type: " + attr_type);
//System.out.println("@#@# Invoking findAttribute from AttributeRef5, pass = 5, type = 3, name: " + attribute_name + ", ed: " + ed2); 
                                        attr = findAttribute(attribute_name, ed2, 0, ed, attr_key);
// if (attr == null) {
 //System.out.println("attr_type = 3, name: " + attribute_name + ", ed2: " + ed2 + ", ed: " + ed + ", attr: " + attr + ", key: " + attr_key); 
//}
                                }
                                else {
                                                // printDDebug("######else in AttributeRef5 name: " + attribute_name + ", entity name: " + ed2.getName(null) + ", attribute type: " + attr_type);
//		repository.exportClearTextEncoding(p21_file);
//System.out.println("XXXX 01: name: " + attribute_name + ", ed: " + ed2 + ", type: " + attr_type);
//System.out.println("@#@# Invoking findAttribute from AttributeRef5, pass = 5, type != 3, name: " + attribute_name + ", ed: " + ed2); 
//System.out.println("before findAttirbute: " + attr_type + ", name: " + attribute_name + ", ed2: " + ed2 + ", ed: " + ed + ", key: " + attr_key); 
                                        attr = findAttribute(attribute_name, ed2, attr_type_original, ed, attr_key);
//					attr = findAttribute(attribute_name, ed2, attr_type, ed, attr_key);
                if (to_debug) {
                        System.out.println("debugging AttributeRef5, after findAttribute: attribute_name: " + attribute_name + ", ed2: " + ed2 + ", attr_type: " + attr_type + ", ed: " + ed + ", attr_key: " + attr_key + ", result attr: "  + attr);
                }


// if (attr == null) {
// 	System.out.println("attr_type != 3: " + attr_type + ", name: " + attribute_name + ", ed2: " + ed2 + ", ed: " + ed + ", attr: " + attr + ", key: " + attr_key); 
//}
// System.out.println("XXXX 02: attribute: " + attr);
                                }

//System.out.println("haha after findAttribute: " + attr);

/*	
System.out.println("attribute: " + attribute_name);
System.out.println("hm key: " + attr_key);
System.out.println("===== hm_attributes: " + hm_attributes );
Set keyset = hm_attributes.keySet();
Iterator keyset_iterator = keyset.iterator();
System.out.println("\n==============================================\n");
while (keyset_iterator.hasNext()) {
	String a_key = (String)keyset_iterator.next();
System.out.println("a hashmap key: " + a_key + ", value: " + hm_attributes.get(a_key));
}
*/



                          if (attr == null) {
                                if (flag_in_redeclaring) {
// temp solution - to allow continuation
//		 				error_count++;
                                                if (flag_derived_expression) {
                                                        printErrorMsgW("" + attribute_name +  " - attribute not found in entity " + ed2.getName(null) + " in a derived attribute expression", null, true);
                                                } else {
                                                        if (attr_type == 0) {
                                                                // redeclaring attribute is explicit
/*
System.out.println("hm key: " + attr_key);
System.out.println("===== hm_attributes: " + hm_attributes );
Set keyset = hm_attributes.keySet();
Iterator keyset_iterator = keyset.iterator();
System.out.println("\n==============================================\n");
while (keyset_iterator.hasNext()) {
	String a_key = (String)keyset_iterator.next();
System.out.println("a hashmap key: " + a_key + ", value: " + hm_attributes.get(a_key));
}
*/
                // replacing WARNING by ERROR
                                                                error_count++;
//								printErrorMsgW("" + attribute_name +  " -  explicit attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it as explicit", null, true);
                                                                printErrorMsg("" + attribute_name +  " -  explicit attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it as explicit", null, true);

                                                        } else
                                                        if (attr_type == 1) {
                                                                // redeclaring attribute is derived
                                                                // replacing WARNING by ERROR
                                                                error_count++;
                                                                // printErrorMsgW("" + attribute_name +  " - explicit or derived attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it as derived", null, true);
                                                                printErrorMsg("" + attribute_name +  " - explicit or derived attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it as derived", null, true);
                                                        } else
                                                        if (attr_type == 2) {
                                                                // redeclaring attribute is inverse
                                                                // replacing WARNING by ERROR
                                                                error_count++;
                                                                // printErrorMsgW("" + attribute_name +  " - inverse attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it as inverse", null, true);
                                                                printErrorMsg("" + attribute_name +  " - inverse attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it as inverse", null, true);
                                                        } else {
                                                                // may be an internal error
                                                                // replacing WARNING by ERROR
                                                                error_count++;
                                                                // printErrorMsgW("" + attribute_name +  " - attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it", null, true);
                                                                printErrorMsg("" + attribute_name +  " - attribute not found in entity " + ed2.getName(null) + " while attempting to redeclare it", null, true);
                                                        }
                                                }
                                        } else {
//			 			error_count++;
//						printErrorMsg("" + attribute_name +  " - attribute not found in entity " + ed2.getName(null), null, true);

                                                if (flag_print_attribute_not_found_error) {
                                                        // may be wrong reporting 
                                                        printWarningMsg("" + attribute_name +  " - attribute not found in entity ed2: " + ed2 + ", ed: " + ed, null, true);
                                                }

                                        }

//			 			error_count++;
//						printErrorMsg("" + attribute_name +  " - attribute not found in entity " + ed2.getName(null), null, true);
//						printErrorMsg("" + attribute_name +  " - attribute not found in entity: " + ed2 + " (" + ed + ")", null, true);
                                }
                        } else {

                if (hm_attributes != null) {
                        if (attr_key != null) {
                                Object attr_from_hm_object = hm_attributes.get(attr_key);
                                if (attr_from_hm_object != null) {
                                        if (attr_from_hm_object instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
// System.out.println("<= hm_attribute @ work, key: " + attr_key + ", attribute: " + attr_from_hm_object);
                                                attr = (jsdai.SExtended_dictionary_schema.EAttribute)attr_from_hm_object;
                                        }
                                }
                        }
                }

                        }




                        if (expression_instances) {
                                if (attr == null) {
                                        String e_name, e_name2;
                                        if (ed2 != null) {
                                                e_name2 =  ed2.getName(null);
                                        } else {
                                                        e_name2 = "NULL";
                                        }
                                        if (ed != null) {
                                                e_name =  ed.getName(null);
                                        } else {
                                                        e_name = "NULL";
                                        }
                                        printDDebug("## AttributeRef5 - NULL: " + attribute_name + ", ed: " + e_name + ", ed2: " + e_name2 + ", type: " + attr_type);
                                }
// System.out.println("Making node - name: " + attribute_name + ", attribute: " + attr + ", reference: " + reference);
                                jjtn000.attribute = attr;
                                if (attr != null) {
//					jjtThis.name = attr.getName(null);
                                        jjtn000.name = getOriginalAttributeName(attr);
                                } else {
//System.out.println("<EC> attr null: " + attribute_name);
printErrorMsgX("reference to unknown attribute: " + attribute_name, null, true);
                                        jjtn000.name = attribute_name;
                                }
                                jjtn000.reference = reference;

/*
if (attr != null) {
	printDDebug("#__# Before process: " + attr.getName(null));
	if (attr instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
		printDDebug("#__# Before TEST - EXPLICIT ATTRIBUTE");
		boolean test_domain = ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr).testDomain(null);
		printDDebug("#__# AFTER TEST DOMAIN");
		if (test_domain)
			printDDebug("#__# DOMAIN - TRUE");
		else
			printDDebug("#__# DOMAIN - FALSE");

		jsdai.lang.EEntity rr_attr_type = ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr).getDomain(null);
		printDDebug("#__# Before process - AFTER GET DOMAIN");
	}
}
else printDDebug("#__# Before process - attribute is NULL");
printDDebug("#__# JUST Before process");
*/
//                              jjtThis.process();
// printDDebug("#__# After process");
                        }
                }
//              if (attr == null) {
//              printDDebug("##_________## Inside Attribute Ref = NULL");
//              } else {
//                      printDDebug("##_________## Inside Attribute Ref: " + attr.getName(null));
//              }
//System.out.println("AttrRef returning: " + attr);		

/*
System.out.println("+++++++++++ Resolving attribute reference +++++++++++++++++++++++");

System.out.println("attribute_name: " + attribute_name);
System.out.println("ed: " + ed);
System.out.println("ed2: " + ed2);
System.out.println("reference: " + reference);
System.out.println("active_scope: " + active_scope);
System.out.println("attr_key: " + attr_key);

System.out.println("attr_type: " + attr_type);
System.out.println("attr_type_original: " + attr_type_original);

System.out.println("hm_attributes: " + hm_attributes);
System.out.println("---------------------------------------------------------------");
System.out.println("resolved attr: "  + attr);


System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
*/
                {if (true) return attr;}
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------ ISO 10303-11:A.1.5-interpreted identifiers----------- */

/*
	 This is all my idea - the InterpretedId5() is outside the part 11 grammar.

	 the following identifier can not be distinguished by the parser, but could be distinguished by the 1st pass information:

	 attribute_ref
	 constant_ref
	 entity_ref
	 enumeration_ref
	 function_ref
	 parameter_ref
	 procedure_ref
	 schema_ref
	 type_label_ref
	 type_ref
	 variable_ref

	 So it is better to use them only where they are used alone, and InterpretedId5() non-terminal symbol to use when there is
	 a choice between them. That would allow to make them more specialized.

*/

/*
void InterpretedId5() :
{}
{
	ConstantId5()
}
*/
  static final public String InterpretedId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        global_name = t.image;
                        {if (true) return (t.image);}
                } else {
                        global_name = t.image.toLowerCase();
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

  static final public Object InterpretedRef5(int possible_interpretations) throws ParseException, jsdai.lang.SdaiException {
        String name = null;
        Object result = null;
    name = InterpretedId5();
                printDDebug("InterpretedRef5 - name: " + name + ", possible: " + possible_interpretations + ", pass: " + parser_pass);
                result = findInterpretedId2(name, possible_interpretations);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

// temporory Express X interpreted identifiers
  static final public jsdai.SExtended_dictionary_schema.ESchema_definition SourceSchemaRef55() throws ParseException, jsdai.lang.SdaiException {
        Object result = null;
    // SchemaId5()
            result = InterpretedRef5(PI_SOURCE_SCHEMA);
                {if (true) return (jsdai.SExtended_dictionary_schema.ESchema_definition)result;}
    throw new Error("Missing return statement in function");
  }

  static final public Object TargetSchemaRef55() throws ParseException, jsdai.lang.SdaiException {
    SchemaId5();
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public Object DummyQualifiableFactor5() throws ParseException, jsdai.lang.SdaiException {
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public jsdai.SExtended_dictionary_schema.EView_attribute ViewAttributeRef5() throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
    name = ViewAttributeId5();
                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EView_definition) {
                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)active_scope;
                }
                {if (true) return findView_attribute(name, vd);}
    throw new Error("Missing return statement in function");
  }

  static final public Object SchemaMapRef5() throws ParseException, jsdai.lang.SdaiException {
    SchemaMapId5();
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public Object SchemaViewRef55() throws ParseException, jsdai.lang.SdaiException {
    SchemaViewId5();
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

  static final public jsdai.SExtended_dictionary_schema.EMap_or_view_partition PartitionRef5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String name;
        jsdai.SExtended_dictionary_schema.EMap_or_view_partition result = null;
    name = PartitionId5();
                result = findMap_or_view_partition(name, parent);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

// Removed in DIS
/*
Object InstanceRef() throws jsdai.lang.SdaiException :
{}
{
	InstanceId()
	{
		return null;
	}
}
*/
  static final public Object ViewRef5() throws ParseException, jsdai.lang.SdaiException {
    ViewId5();
                {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.146 ------------ */
  static final public Object ConstantRef5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ConstantRef */
  X_ConstantRef jjtn000 = new X_ConstantRef(JJTCONSTANTREF);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);Object result = null;
  jsdai.SExtended_dictionary_schema.EConstant_definition cd = null;
  String name;
    try {
      name = ConstantId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
//		cd = findConstant_definition(name);
                cd = findConstant_definitionX(name);
                if (cd == null) {
                        // printError("Constant not found: " + name);
                }
                result = cd;
                if (parser_pass == 5) {
                        if (cd != null) {
                                jjtn000.name = cd.getName(null);
                        } else {
//System.out.println("<EC> constant null: " + name);
printErrorMsgX("reference to unknown constant: " + name, null, true);
                                jjtn000.name = name;
                        }
                        jjtn000.cd = cd;
                        jjtn000.depth = getConstantDepth(name);
                }
                {if (true) return result;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.147 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition EntityRef5(jsdai.SExtended_dictionary_schema.ESchema_definition optional_schema) throws ParseException, jsdai.lang.SdaiException {
        String entity_name = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                printDebug("In EntityRef5, starting");
    entity_name = EntityId5();
                global_entity_ref = entity_name.toLowerCase();
                printDebug("In EntityRef5, entity: " + entity_name);
                // if parser pass = 2;
                if (parser_pass == 1) {
                } else
                if (parser_pass == 2) {
                } else
                if (parser_pass > 2) {
                        // check if an entity with this name exists in the extent.
                        ed = findEntity_definition(entity_name, optional_schema);
                        if (ed == null) {
                                error_count++;
                                printErrorMsg5("" + entity_name + " - entity not found", null, true);
                                printDebug("entity \"" + entity_name + "\" not found in pass " + parser_pass);
// printDDebug("##1 current schema: " + sd.getName(null) + ", pass: " + parser_pass);
                                _data_type_name = "_ENTITY_NOT_FOUND_" + entity_name;
                        } else {
                                _data_type_name = ed.getName(null);
                        }
                }
                if (ed == null) {
                        printDebug("In EntityRef5, ending with null, pass: " + parser_pass);
                } else {
                        printDebug("In EntityRef5, ending with non-null, pass: " + parser_pass);
                }
                {if (true) return ed;}
    throw new Error("Missing return statement in function");
  }

/*----------------------------------------------------------------------------------- introduced by eRRe ----------------*/
  static final public jsdai.SExtended_dictionary_schema.ENamed_type NamedTypeRef55() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ENamed_type nt = null;
        String named_type_name;
    named_type_name = NamedTypeId5();
                named_type_name = named_type_name.replace('$', '+');
                if (parser_pass == 1) {
                } else
                if (parser_pass == 2) {
                } else
                if (parser_pass > 2) {
                        nt = findNamed_type(named_type_name);
                        if (nt == null) {
                                error_count++;
                                printErrorMsg5("" + named_type_name + " - named_type not found", null, true);
                                printDebug("named type \"" + named_type_name + "\" not found in pass " + parser_pass);
                        }
                }
                {if (true) return nt;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.148 ------------ */
  static final public void EnumerationRef5(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) EnumerationRef */
        X_EnumerationRef jjtn000 = new X_EnumerationRef(JJTENUMERATIONREF);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String name = null;
        Integer enumeration_value_object = null;
        int enumeration_value = 0;
    try {
                printDebug("In EnumerationRef5, starting in pass " + parser_pass);
      name = EnumerationId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        printStack("PUSH: EnumerationRef5 int value: " + enumeration_value);
                        if (dt == null) {
                                dt = findEnumerationType(null, name);
                        }
                        enumeration_value = findEnumerationValue(dt, name);
                        if (enumeration_value <= 0) {
                                printDebug("Enumeration " + dt.getName(null) + " value not found: " + name);
                        }
                        enumeration_value_object = new Integer(enumeration_value);
                        argument_stack.push(enumeration_value_object);
                        if (flag_type_tracking)
                                type_stack.push(new String("_enumeration_"));  // temp solution
                        if (expression_instances) {
                                jjtn000.value = enumeration_value_object.intValue();;
                                if (dt != null) {
//					jjtThis.name = dt.getName(null);
                                        jjtn000.name = name;
                                } else {
//System.out.println("<EC> type null: " + name);
printErrorMsgX("reference to unknown type: " + name, null, true);
                                        jjtn000.name = name;
                                }
                                jjtn000.dt = dt;
                                // placeholder
                                // expression_stack.push(enumeration_value_object);
                        }
                }
                printDebug("In EnumerationRef5: " + name + ", ending in pass " + parser_pass);
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.149 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EFunction_definition FunctionRef5() throws ParseException, jsdai.lang.SdaiException {
        String function_id = null;
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
    function_id = FunctionId5();
                if (parser_pass == 5) {
//			fd = findFunction_definition(function_id);
                        fd = findFunction_definitionX(function_id);
                        if (fd == null) {
                                printDebug("Function not found: " + function_id);
                        }
                }
                {if (true) return fd;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.150 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter ParameterRef5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ParameterRef */
        X_ParameterRef jjtn000 = new X_ParameterRef(JJTPARAMETERREF);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String name;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
    try {
      name = ParameterId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if(parser_pass == 5) {
                        if (expression_instances) {
                                par = findParameter(name);
                                if (par == null) {
//					printError("parameter not found: " + name + " in " + current_scope);
                                        if (function_depth > 1) {
                                                printDebug("parameter not found: " + name + " in " + active_scope);
                                        } else {
                                                printDebug("parameter not found: " + name + " in " + active_scope);
                                        }
                                        printEDebug("Parameter not found: " + name + " in " + current_scope);
                                }
//				jjtThis.name = "_e_" + name;
                                if (par != null) {
                                         jjtn000.name = "_e_" + par.getName(null);
                                } else {
                    // not a good situation
//System.out.println("<EC> parameter null: " + name);
printErrorMsgX("reference to unknown parameter: " + name, null, true);
                                jjtn000.name = "_e_" + name;
                                }
                                jjtn000.parameter = par;
                        }
                }
                {if (true) return par;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.151 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EProcedure_definition ProcedureRef5() throws ParseException, jsdai.lang.SdaiException {
        String procedure_id = null;
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
    procedure_id = ProcedureId5();
                if (parser_pass == 5) {
//			pd = findProcedure_definition(procedure_id);
                        pd = findProcedure_definitionX(procedure_id);
//			pd = findProcedure(procedure_id);
                        if (pd == null) {
                                printDebug("Procedure not found: " + procedure_id);
                        }
                }
                {if (true) return pd;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.152 ------------ */
  static final public String SchemaRef5() throws ParseException, jsdai.lang.SdaiException {
  String schema_name;
    schema_name = SchemaId5();
                if (flag_oc) {
            {if (true) return schema_name;}
                } else {
            {if (true) return schema_name.toLowerCase();}
                }
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.153 ------------ */
  static final public void TypeLabelRef5() throws ParseException, jsdai.lang.SdaiException {
    TypeLabelId5();
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.154 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EDefined_type TypeRef5(int scope) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
        String type_name;
    type_name = TypeId5();
                printDebug("In TypeRef5 starting in pass: " + parser_pass + ": " + type_name);
                if (parser_pass != 1) { // it is  a risky implementation leftover from 2 pass compiler. OK, if TypeRef5(0) is invoked from pass 4.
                        if (scope == 0) {
                                dt = findDefined_type(type_name);
                                if (dt == null) {
                                        if (parser_pass > 2) {
                                                error_count++;
                                                printErrorMsg5("" + type_name + " - type not found", null, true);
                                                printDebug("Type reference - defined type \"" + type_name + "\" not found in pass " + parser_pass);
                                        } else {
                                                // error_count++;
                                                // may not be an error - chained USE FROMs are processed between passes 2 and 3.
                                                // printWarning("Type reference - defined type \"" + type_name + "\" not found in pass " + parser_pass);
                                        }
                                }
                        }
                        else if (scope == 1) {
//        printDDebug("Enumeration scope: " + type_name);
                        }
                        else {
//        printDDebug("Unknown scope: " + type_name);
                        }
                }
                printDebug("In TypeRef5 ending in pass: " + parser_pass);
                {if (true) return dt;}
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------------------------------- ISO 10303-11:A.1.5.155 ------------ */
  static final public ECtVariable VariableRef5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) VariableRef */
        X_VariableRef jjtn000 = new X_VariableRef(JJTVARIABLEREF);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String name;
        ECtVariable var = null;
    try {
      name = VariableId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
// System.out.println("<about to find var, 03, name: " + name); 
                        var = findVariableX(name);
                        if (var == null) {
//				printError("variable not found: " + name + " in " + current_scope);
//				printError("variable not found: " + name + " in " + active_scope);
                                printErrorMsg("" + name + " - variable not found in " + active_scope, null, true);
                                printEDebug("Variable not found: " + name + " in " + current_scope);
                                // printDDebug("Variable not found: " + name);
                        }
                        if (expression_instances) {
                                if (var != null) {
// System.out.println("variable: " + var);
// System.out.println("variable type: " + var.getType());
// System.out.println("variable type name: " + var.getType().getName(null)); 				
                                        if (var.getType().getName(null).equals("_implicit_variable_")) {
// 					jjtThis.name = name;
                                                jjtn000.name = var.getName();
// System.out.println("VR - variable name - implicit: " + name);
                                        } else {
// 					jjtThis.name = "_e_" + name;
                                                jjtn000.name = "_e_" + var.getName();
// System.out.println("VR - variable name - NOT implicit: " + "_e_" + name);
                                        }
                                } else {
//System.out.println("<EC> variable null: " + name);	
printErrorMsgX("reference to unknown variable: " + name, null, true);
                                }
                                jjtn000.variable = var;
                                jjtn000.scope = active_scope;
                                jjtn000.depth = function_depth;
// System.out.println("VR - variable: " + var);
                        }
                }
                {if (true) return var;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/**************************************************************************************************************************
 *                                         ISO 10303-11:A.2 Grammar rules                                                 *
 **************************************************************************************************************************/

/* -----------------------------------------------------------------Amendment---------- ISO 10303-11:A.2.156 ------------ */
  static final public void AbstractSupertypEDeclaration5(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
        boolean has_supertype = false;
    jj_consume_token(ABSTRACT);
    switch (jj_nt.kind) {
    case SUPERTYPE:
      jj_consume_token(SUPERTYPE);
                                   has_supertype = true;
      switch (jj_nt.kind) {
      case OF:
        SubtypeConstraint5(ed);
        break;
      default:
        jj_la1[241] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[242] = jj_gen;
      ;
    }
                if (parser_pass == 5) {
                        if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).setInstantiable(null, false);
//                     		ed.setInstantiable(null, 0);
                                if (!has_supertype) {
                                        ((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).setAbstract_entity(null, true);
                                }
                        }
                }
  }

/* -------------------------------------------------------------------Amendment-------- ISO 10303-11:A.2.401 ------------ */
  static final public jsdai.lang.EEntity ConcreteTypes5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity ae = null;
                printDebug("Starting ConcreteTypes5");
    switch (jj_nt.kind) {
    case ARRAY:
    case BAG:
    case LIST:
    case SET:
      ae = AggregationTypes5(whose);
      break;
    case BINARY:
    case BOOLEAN:
    case INTEGER:
    case LOGICAL:
    case NUMBER:
    case REAL:
    case STRING:
      ae = SimpleTypes5(whose);
      break;
    case SIMPLE_ID:
      ae = NamedTypes5(whose);
      break;
    default:
      jj_la1[243] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("Ending ConcreteTypes5: " + ae);
//System.out.println(">ConcreteTypes5<  returning: " + ae);
                {if (true) return ae;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.157 ------------ */
  static final public int ActualParameterList5(Vector arguments, Vector expressions) throws ParseException, jsdai.lang.SdaiException {
        int argument_count = 0;
        Object argument [] = null;
                printDebug("Starting ActualParameterList5");
    jj_consume_token(LPAREN);
    if (jj_2_43(1)) {
      argument = Parameter5();
                                       argument_count++; arguments.addElement(argument[0]); expressions.addElement(argument[1]);
      label_82:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[244] = jj_gen;
          break label_82;
        }
        jj_consume_token(COMMA);
        argument = Parameter5();
                                                                                                                                                              argument_count++; arguments.addElement(argument[0]);expressions.addElement(argument[1]);
      }
    } else {
      ;
    }
    jj_consume_token(RPAREN);
                printDebug("Ending ActualParameterList5, nr of arguments: " + argument_count);
                {if (true) return argument_count;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.158 ------------ */
  static final public int AddLikeOp5() throws ParseException, jsdai.lang.SdaiException {
        int value = 0;
    switch (jj_nt.kind) {
    case PLUS:
      jj_consume_token(PLUS);
               value = 1;
      break;
    case MINUS:
      jj_consume_token(MINUS);
                                       value = 2;
      break;
    case OR:
      jj_consume_token(OR);
                                        value = 3;
      break;
    case XOR:
      jj_consume_token(XOR);
                                         value = 4;
      break;
    default:
      jj_la1[245] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.159 ------------ */
  static final public void AggregateInitializer5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) AggregateInitializer */
        X_AggregateInitializer jjtn000 = new X_AggregateInitializer(JJTAGGREGATEINITIALIZER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Vector members = new Vector();
        Vector member_types = new Vector();
        Object member = null;
        Object member_type = null;
        Object pop_inst = null;
    try {
                printDebug("In AggregateInitializer5, starting");
      jj_consume_token(LBRACKET);
      if (jj_2_44(1)) {
        Element5();
                if (parser_pass == 5) {
                        member = argument_stack.pop();
                        if (flag_type_tracking)
                                member_type = type_stack.pop();
                        printStack("POP: AggregateInitializer5, 1st member: " + member);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                        members.addElement(member);
                        if (flag_type_tracking)
                                member_types.addElement(member);
                }
        label_83:
        while (true) {
          switch (jj_nt.kind) {
          case COMMA:
            ;
            break;
          default:
            jj_la1[246] = jj_gen;
            break label_83;
          }
          jj_consume_token(COMMA);
          Element5();
                if (parser_pass == 5) {
                        member = argument_stack.pop();
                        if (flag_type_tracking)
                                member_type = type_stack.pop();
                        printStack("POP: AggregateInitializer5, next member: " + member);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                        members.addElement(member);
                        if (flag_type_tracking)
                                member_types.addElement(member);
                }
        }
      } else {
        ;
      }
      jj_consume_token(RBRACKET);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        argument_stack.push(members);
                        if (flag_type_tracking)
                                type_stack.push(member_types); // or should be push here just aggregate type?
                        printStack("PUSH: AggregateInitialize: " + members);
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
                printDebug("In AggregateInitializer5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.160 ------------ */
  static final public void AggregateSource5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) AggregateSource */
  X_AggregateSource jjtn000 = new X_AggregateSource(JJTAGGREGATESOURCE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
                printDebug("In AggregateSource5, starting");
      SimpleExpression5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In AggregateSource5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.161 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter AggregateType5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        String Label5 = "";
        jsdai.SExtended_dictionary_schema.EAggregation_type at = null;
        jsdai.lang.A_string labels = null;
        String bound_name;
        boolean optional = false;
        boolean unique = false;
                printDebug("In AggregateType5, starting");
    jj_consume_token(AGGREGATE);
    switch (jj_nt.kind) {
    case COLON:
      jj_consume_token(COLON);
      Label5 = TypeLabel5();
      break;
    default:
      jj_la1[247] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    par = ParameterType5();
                if (parser_pass == 5) {

                        boolean must_create = false;

                        if (par != null) {
                                if (par.testParameter_type(null)) {
                                        if (par.getParameter_type(null) != _st_generic) {
                                                must_create = true;
                                        }
                        } else {
                                // why unset?
                                must_create = true;
                        }
                  } else {
                    // not standart type, but, on the other hand, something wrong here
                        must_create = true;
                  }

                        if (must_create) {


                        at = (jsdai.SExtended_dictionary_schema.EAggregation_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregation_type.class);
//		  at.setName(null, "_AGGREGATE");
//		  _data_type_name = "_AGGREGATE";
                        at.setName(null, "_AGGREGATE" + _data_type_name);
                        _data_type_name = "_AGGREGATE"  + _data_type_name;

                        if (par != null) {
                          if (par.testParameter_type(null)) {
                                at.setElement_type(null, par.getParameter_type(null));
                          } else {
                                printDDebug("Oo> parameter_type unset in aggregate_type: AGGREGATE OF " + par);
                        }

          /*
		  	if (par.testType_labels(null)) {
					labels = par.getType_labels(null);
				}
		  	if (Label5.length() > 0) {
					if (labels == null) {
						labels = par.createType_labels(null);
					}
					labels.addByIndex(1, Label5);
		 		} else {
					if (labels != null) {
						labels.addByIndex(1, Label5);
					}
		  	}
		*/

                        }
                        // for some reason I replaced the Parameter5 type, probably a bug, if not, don't remember why.
                        // par.setParameter_type(null, at);

                  } else {
                        at = _st_aggregate_generic;
                                _data_type_name = "_AGGREGATE_GENERIC";
                  }

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_PARAMETER_AGGREGATE");
                        _data_type_name = "_PARAMETER_AGGREGATE";

                        if (par.testType_labels(null)) {
                                // need to add those labels to this one
                                jsdai.lang.A_string new_labels = result.createType_labels(null);
        jsdai.lang.A_string labels2 = par.getType_labels(null);
        jsdai.lang.SdaiIterator iter_labels = labels2.createIterator();
        String label = Label5;
                                if (label == null) label = "";
        int label_index = 1;
                                new_labels.addByIndex(label_index++, label);
        while (iter_labels.next()) {
                label  = labels2.getCurrentMember(iter_labels);
                                        new_labels.addByIndex(label_index++, label);
        }


                        } else {
                                // even though element label(s) is/are not present, AGGREGATE itself still may have a label
                                if (Label5 != null) {
                                        if (!Label5.equals("")) {
                                                jsdai.lang.A_string new_labels = result.createType_labels(null);
                                                new_labels.addByIndex(1, Label5);

                                        }
                                }
                        }




                }
                printDebug("In AggregateType5, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.162 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EAggregation_type AggregationTypes5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAggregation_type at;
                printDebug("In AggregationTypes5, starting, whose: " + whose);
    switch (jj_nt.kind) {
    case ARRAY:
      at = ArrayType5(whose);
      break;
    case BAG:
      at = BagType5(whose);
      break;
    case LIST:
      at = ListType5(whose);
      break;
    case SET:
      at = SetType5(whose);
      break;
    default:
      jj_la1[248] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In AggregationTypes5, ending: " + at);
//System.out.println(">AggregationTypes5<  returning: " + at);
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.163 ------------ */
  static final public void AlgorithmHead5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) AlgorithmHead */
  X_AlgorithmHead jjtn000 = new X_AlgorithmHead(JJTALGORITHMHEAD);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
                printDebug("In AlgorithmHead5, starting");
//System.out.println(">BEFORE< current scope: " + current_scope);	

      label_84:
      while (true) {
        switch (jj_nt.kind) {
        case ENTITY:
        case FUNCTION:
        case PROCEDURE:
        case SUBTYPE_CONSTRAINT:
        case TYPE:
          ;
          break;
        default:
          jj_la1[249] = jj_gen;
          break label_84;
        }
        Declaration5();
      }
      switch (jj_nt.kind) {
      case CONSTANT:
        ConstantDecl5();
        break;
      default:
        jj_la1[250] = jj_gen;
        ;
      }
      switch (jj_nt.kind) {
      case LOCAL:
        LocalDecl5();
        break;
      default:
        jj_la1[251] = jj_gen;
        ;
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
//System.out.println(">AFTER< current scope: " + current_scope);	
                printDebug("In AlgorithHead, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.164 ------------ */
  static final public void AliasStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) AliasStmt */
        X_AliasStmt jjtn000 = new X_AliasStmt(JJTALIASSTMT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand = null;
        ECtVariable var = null;
        String variable_id = null;
        jsdai.lang.EEntity variable_parameter_type = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type = null;
    try {
                printDebug("In AliasStmt5, starting");
                scope_stack.push(current_scope);
                current_scope = new Vector();
      jj_consume_token(ALIAS);
      variable_id = VariableId5();
      jj_consume_token(FOR);
      GeneralRef5();
      label_85:
      while (true) {
        switch (jj_nt.kind) {
        case LBRACKET:
        case DOT:
        case BPATH:
        case FPATH:
        case BACKSLASH:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[252] = jj_gen;
          break label_85;
        }
        Qualifier5(null);
      }
      jj_consume_token(SEMICOLON);
      label_86:
      while (true) {
        Stmt5();
        switch (jj_nt.kind) {
        case SEMICOLON:
        case ALIAS:
        case BEGIN:
        case CASE:
        case ESCAPE:
        case IF:
        case INSERT:
        case REMOVE:
        case REPEAT:
        case RETURN:
        case KW_SKIP:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[253] = jj_gen;
          break label_86;
        }
      }
      jj_consume_token(END_ALIAS);
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {

                        variable_type = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        // variable_type.setName(null, "_query_variable_");
                        variable_type.setName(null, "_PARAMETER");
                        _data_type_name = "_PARAMETER";

                        // variable_type.setParameter_type(null, variable_parameter_type);
                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);


//                      operand = argument_stack.pop();
//                      printStack("POP: AliasStmt5, return value: " + operand);

                } else { // other passes - added to handle interpreted IDs
                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);
                }
                current_scope = (Vector)scope_stack.pop();
                printDebug("In AliasStmt5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.165 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EArray_type ArrayType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EArray_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = null;
        jsdai.SExtended_dictionary_schema.EBound bounds [] = null;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        String bound_name;
        // int optional = 0;
        // int unique = 0;
        boolean optional = false;
        boolean unique = false;

        jsdai.lang.EEntity bt;
    jj_consume_token(ARRAY);
    bounds = BoundSpec5();
    jj_consume_token(OF);
    switch (jj_nt.kind) {
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
                                                       optional = true;
      break;
    default:
      jj_la1[254] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case UNIQUE:
      jj_consume_token(UNIQUE);
                                                                                    unique = true;
      break;
    default:
      jj_la1[255] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (whose != null) {
                                at = (jsdai.SExtended_dictionary_schema.EArray_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CArray_type.class);
//				bound_name = getBoundString(1, bounds, optional, unique);
//				at.setName(null, "_ARRAY" + bound_name + _data_type_name);
//				_data_type_name = "_ARRAY"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                                at.setOptional_flag(null, optional);
// System.out.println("SET OPTIONAL 06, attribute: " + at);
                        }
                } else
                if (parser_pass == 4) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EArray_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CArray_type.class);
//				bound_name = getBoundString(1, bounds, optional, unique);
//				at.setName(null, "_ARRAY" + bound_name + _data_type_name);
//				_data_type_name = "_ARRAY"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                                at.setOptional_flag(null, optional);
// System.out.println("SET OPTIONAL 07, attribute: " + at);
                        }
                } else
                if (parser_pass == 5) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EArray_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EArray_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CArray_type.class);
//				bound_name = getBoundString(1, bounds, optional, unique);
//				at.setName(null, "_ARRAY" + bound_name + _data_type_name);
//				_data_type_name = "_ARRAY"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                                at.setOptional_flag(null, optional);
// System.out.println("SET OPTIONAL 08, attribute: " + at);
                        }
                        at.setLower_index(null, bounds[0]);

                        if (bounds[1] != null) {
                                at.setUpper_index(null, bounds[1]);
                        }
                        else { // should never happen for an array.
                                printDebug("Undefined upper Index5 of an array");
                        }
                        // set element_type
                }
    bt = BaseType5(at);
                if (parser_pass > 3) {
//			if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        if (!(at.testElement_type(null))) {
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EData_type) {
                                        at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EData_type)bt);
                                } else
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                        if (((jsdai.SExtended_dictionary_schema.EParameter)bt).testParameter_type(null)) {
                                                at.setElement_type(null, ((jsdai.SExtended_dictionary_schema.EParameter)bt).getParameter_type(null));
                                        } else {
                                        }
                                } else {
                                        // possible express amendment issue
                                }
                        }
                }
                bound_name = getBoundString(1, bounds, optional, unique);
                _data_type_name = "_ARRAY"  + bound_name + _data_type_name;
                if (at != null) {
                        at.setName(null, _data_type_name);
                }
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.166 ------------ */
  static final public void AssignmentStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) AssignmentStmt */
        X_AssignmentStmt jjtn000 = new X_AssignmentStmt(JJTASSIGNMENTSTMT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand = null;
        Object operand_type = null;
        Object pop_inst = null;
        Object general_reference = null;
        Object qualified_reference = null;
    try {
                printDebug("In AssignmentStmt5, starting");
      general_reference = GeneralRef5();
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.general_reference = general_reference;
                        }
                }
      label_87:
      while (true) {
        switch (jj_nt.kind) {
        case LBRACKET:
        case DOT:
        case BPATH:
        case FPATH:
        case BACKSLASH:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[256] = jj_gen;
          break label_87;
        }
        qualified_reference = Qualifier5(general_reference);
                general_reference = qualified_reference;
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.qualifiers.addElement(qualified_reference);
                        }
                }
      }
      jj_consume_token(ASSIGN);
      Expression5();
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        operand = argument_stack.pop();
                        if (flag_type_tracking)
                                operand_type = type_stack.pop();
                        printStack("POP: AssignmentStmt5, return value: " + operand);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
                printDebug("In AssignmentStmt5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.167 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute AttributeDecl5(jsdai.SExtended_dictionary_schema.EEntity_definition ed, int attr_type) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.AExplicit_attribute aea;
        String attribute_name;
        Token attribute_token;
        String attr_key = null;
        boolean to_debug = false;
        int attr_type_original;
                printDebug("In AttributeDecl5, starting");
                attr_type_original = attr_type;
                if (attr_type == -40) {
                        attr_type = 0;
                        to_debug = true;
                        // ok, we do not want to debug non-redeclared cases for now
                        to_debug = false;
                }
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      attribute_token = AttributeId5();
                        if (flag_oc) {
                                attribute_name = attribute_token.image;
                        } else {
                                attribute_name = attribute_token.image.toLowerCase();
                        }
                 if (to_debug) {
                        System.out.println("attribute name: " + attribute_name);
                 }
                 if (parser_pass == 1) {
                         if (attr_type == 0) { // explicit
// System.out.println("<=EA-4=>");
                                 attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExplicit_attribute.class);
//			   attr.setOrder(null, explicit_attribute_order_count++);
                                 // aea = ed.getExplicit_attributes(null);
                                 // aea.addByIndex(aea.getMemberCount() + 1, attr); // + 1 because it is a list?
                         } else
                         if (attr_type == 1) { // derived
// System.out.println("<=DA-4=>");
                                 attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDerived_attribute.class);
//				 attr.setOrder(null, derived_attribute_order_count++);
                         } else
                         if (attr_type == 2) { // inverse
// System.out.println("<=IA-4=>");
                                 attr = (jsdai.SExtended_dictionary_schema.EAttribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInverse_attribute.class);
//				 attr.setOrder(null, inverse_attribute_order_count++);
                         }
                         attr.setName(null, attribute_name);
                         attr.setParent(null, ed);
                         // parent_entity is now derived instead of explicit 
                         // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                 // attr.setParent_entity(null, ed);
                         // }
                         createDocumentationEntity2(attr, attribute_token);
                 } else
                 if (parser_pass == 2) { // pass 2
                 } else
                 if (parser_pass == 3) { // pass 2
                 } else
                 if (parser_pass == 4) { // pass 2
// System.out.println("@X 3 name: " + attribute_name + ", ed: " + ed);
                         attr = findAttribute(attribute_name, ed, attr_type, null, attr_key); // also can check for duplicate attribute names.
                         if (attr_type == 0) { // explicit
                           attr.setOrder(null, explicit_attribute_order_count++);
                         } else
                         if (attr_type == 1) { // derived
//System.out.println(">PARSER setting order - AttributeDecl - order: " + derived_attribute_order_count  + ", pass: " + parser_pass + ", attr: " + attr); 
                                 attr.setOrder(null, derived_attribute_order_count++);
                         } else
                         if (attr_type == 2) { // inverse
                                 attr.setOrder(null, inverse_attribute_order_count++);
                         }
                 } else
                 if (parser_pass > 4) { // pass 2
// System.out.println("@X 4 name: " + attribute_name + ", ed: " + ed);

                         attr_key =  "#" + global_schema_name + "_#" + global_entity_name + "_#_#" + attribute_name.toLowerCase();
                         attr = findAttribute(attribute_name, ed, attr_type, null, attr_key); // also can check for duplicate attribute names.
                        if (to_debug) {
                                System.out.println("findAttribute - attr_key: " + attr_key + ", attribute_name: " + attribute_name + ", ed: " + ed + ", result attr: " + attr);
                        }


                         if (attr_type == 0) { // explicit
                           attr.setOrder(null, explicit_attribute_order_count++);
                         } else
                         if (attr_type == 1) { // derived
//System.out.println(">PARSER setting order - AttributeDecl5 - order: " + derived_attribute_order_count  + ", pass: " + parser_pass + ", attr: " + attr); 
                                 attr.setOrder(null, derived_attribute_order_count++);
                         } else
                         if (attr_type == 2) { // inverse
                                 attr.setOrder(null, inverse_attribute_order_count++);
                         }

//System.out.println("@X 4-2 found attribute: " + attr);
                 }
      break;
    case SELF:
      attr = RedeclaredAttribute5(ed, attr_type_original);
      break;
    default:
      jj_la1[257] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
if (attr == null) {

        if (parser_pass == 1) {
//              printDDebug("######43 in AttributeDecl5 NULL ");
        }
}
//               createDocumentationEntity(attr);
                 _data_type_name = "";
        printDebug("In AttributeDecl5, ending");
                 {if (true) return attr;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.168 ------------ */
  static final public Token AttributeId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
//      if (doc_token == null) doc_token = t;
        {if (true) return (t);}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.169 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute AttributeQualifier5(jsdai.SExtended_dictionary_schema.EEntity_definition ed, jsdai.SExtended_dictionary_schema.EEntity_definition ed2, int attr_type, Object reference) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) AttributeQualifier */
        X_AttributeQualifier jjtn000 = new X_AttributeQualifier(JJTATTRIBUTEQUALIFIER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr2 = null;
        String name;
        String name_original = null;
        String x_operand = "";
        Object mark_obj = null;
        String attr_key = null;
        int attr_type_original;
        boolean to_debug = false;
    try {
        printDebug("In AttributeQualifier5, starting");

                attr_type_original = attr_type;
                if (attr_type == -40) {
                        attr_type = 0;
                        to_debug = true;
                        System.out.println("to debug explicit in AttributeQualifier5 - ed: " + ed + ", ed2: " + ed2 + ", reference: " + reference + ", active_scope: " + active_scope);
                }

// System.out.println("@X 10-500 In attribute Qualifier5, starting");
// System.out.println("@X 10-501 ed: " + ed);
// System.out.println("@X 10-502 ed2: " + ed2);
// System.out.println("@X 10-503 reference: " + reference);
// System.out.println("@X 10-504 type: " + attr_type);
                if (reference == null) {
                        reference = active_scope;
// System.out.println("@X 10-505 new reference: " + reference);
                }
                if (ed2 == null) {
                        if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ed2 = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
// System.out.println("@X 10-506 new e2: " + reference);
                        } else {
                        }
                }
//		 System.out.println("@X 6-1 - before AttributeRef5  - ed: " + ed + ", ed2: " + ed2 + ", reference: " + reference);

      jj_consume_token(DOT);
      attr2 = AttributeRef5(ed, ed2, attr_type_original, reference);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
//		System.out.println("@X 6-2 - after AttributeRef5  - attr2: " + attr2 + ", ed: " + ed + ", ed2: " + ed2 + ", type: " + attr_type_original + ", reference: " + reference);
                if(flag_in_redeclaring) {
//			flag_in_redeclaring = false;
                }
                if (attr2 == null) {
                        if (to_debug) {
                                System.out.println("attr2 = null in AttributeQualifier5");
                        }
                        printDebug("In AttributeQualifier5, ending with attr2 = NULL");
                        {if (true) return null;}
                }
                if (to_debug) {
                        System.out.println("debugging AttributeQualifier5, attr2: " + attr2);
                }
                if (parser_pass == 1) {
                } else
                if (parser_pass == 2) {
                } else
                if (parser_pass == 3) {
                } else
                if (parser_pass == 4) {
                        // if (attr2 == null) return null;
                        if (attr_type < 0) {if (true) return null;}
                        name = attr2.getName(null);
                        if (attr_type == 0) { // explicit
// System.out.println("@X 5 name: " + name + ", ed: " + ed);
                                attr = findAttribute(name, ed, attr_type, ed2, attr_key);
                                ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);
                                 attr.unsetOrder(null);
                        } else
                        if (attr_type == 1) { // derived
// System.out.println("@X 6 name: " + name + ", ed: " + ed);
                                attr = findAttribute(name, ed, attr_type, ed2, attr_key);
                                if (attr2 instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);
//System.out.println(">PARSER setting order - AttributeQualifier5 - order: " + derived_attribute_order_count  + ", pass: " + parser_pass + ", attr: " + attr); 
                                         attr.setOrder(null, derived_attribute_order_count++);

                                } else
                                if (attr2 instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)attr2);
                                 attr.unsetOrder(null);
                                }
//                              if (parser_pass == 4) {
//                                      if (expression_instances) {
//                                              x_operand = (String)expression_stack.pop();
//                                              x_operand += attr.getName(null);
//                                              expression_stack.push(x_operand);
//                                      }
//                              }
                        } else
                        if (attr_type == 2) { // inverse
// printDDebug("######2 in AttributeQ name: " + name + ", entity name: " + ed.getName(null) + ", attribute type: " + attr_type);
// System.out.println("@X 7 name: " + name + ", ed: " + ed);
                                attr = findAttribute(name, ed, attr_type, ed2, attr_key);
                                ((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EInverse_attribute)attr2);
                                 attr.unsetOrder(null);
                        }
                        if (attr_type == 4) { // uniqueness rule
// printDDebug("######4 in AttributeQ name: " + name + ", entity name: " + ed.getName(null) + ", attribute type: " + attr_type);
// System.out.println("@X 8 name: " + name + ", ed: " + ed);
                                attr = findAttribute(name, ed, attr_type, ed2, attr_key);
// no need to set redeclaring for uniqueness rule
//                              if (attr instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
//                                      ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);
//                              } else
//                              if (attr instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
//                                      ((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)attr2);
//                              } else
//                              if (attr instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
//                                      ((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EInverse_attribute)attr2);
//                              }
                        } else
                        if (attr_type == 5) { // expressions, from Qualifier5()
// System.out.println("@X 9 name: " + name + ", ed: " + ed);
                                attr = findAttribute(name, ed, attr_type, ed2, attr_key);
                        }
                } else
                if (parser_pass == 5) {
//		 System.out.println("@X 6-3 - attr_type: " + attr_type);
                        if (attr_type < 0) {if (true) return null;}
                        name = attr2.getName(null);
      name_original = name;
                mark_obj = attr2.getTemp();
        if (mark_obj instanceof String) {
                name = (String) mark_obj;
//				 System.out.println("@X 6-4-A - replacing name to RENAMED - name: " + name);
        }


// System.out.println("@X 10 attr2: " + attr2);
// System.out.println("@X 10 name: " + name + ", ed: " + ed);
//		 System.out.println("@X 6-4 - before findAttribute - name: " + name + ", ed: " + ed + ", ed2: " + ed2);


                                        attr_key = "#" + global_schema_name + "_#" + global_entity_name + "_#" + global_entity_ref + "_#" + name_original.toLowerCase();
// System.out.println("<=OOOOO-pass5 attr_key: " + attr_key);
                        attr = findAttribute(name, ed, attr_type, ed2, attr_key);
// System.out.println("<= pass 5 redeclaring: " + attr + ", redeclared: " + attr2);

       // moved from here, because redeclaring still has its domain unset, if redeclared is RENAMED
       // but have to provide the necessary information to the proper location
       global_redeclaring = attr;
       global_redeclared = attr2;

//			if (!(isRedeclared_attrCompatible(attr, attr2))) { 
//				error_count++;
//				printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
//			}



                        if (attr_type == 0) { // explicit
                                if (attr2 instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (isRedeclared_attrCompatible(attr, attr2)) {
                                                if (attr == attr2) {
                                                        printErrorMsg("" + attr.getName(null) + " - attribute is redeclaring itself (5), entity: " + attr.getParent(null).getName(null), null, true);
                                                        error_count++;
                                                } else {
//System.out.println("OXO- redeclaring attr: " + attr + ", redeclared attr2: " + attr2);
//System.out.println("OXO- ed: " + ed + ", ed2: " + ed2 + ", reference: " + reference);
                                                        ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);
//System.out.println("OXO-OK");
                                                }
                                        } else {
                                                error_count++;
//						printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
                                        }
                                }       else {
                                        error_count++;
                                        Token t = getToken(0);
                                int line = t.beginLine;
                                int column = t.beginColumn;
                                        if (attr2 instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                                String attr_name_err = "";
                                                String entity_name_err = "";
                                                if (attr != null) {
                                                        if (attr instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                                                attr_name_err = attr.getName(null);
                                                        }
                                                        // parent_entity no longer explicit
                                                        // if (attr.testParent_entity(null)) {
                                                                // entity_name_err = attr.getParent_entity(null).getName(null);
                                                        // }
                                                        if (attr.testParent(null)) {
                                                                entity_name_err = attr.getParent(null).getName(null);
                                                        }
                                                }
//						printError("on line " + line + ", column " + column  + ": probably an attempt to redeclare a derived attribute as explicit. Entity: " + entity_name_err + ", attribute: " + attr_name_err);
                                                printErrorMsg("" + attr_name_err +  " - in entity " + entity_name_err + ", probably an attempt to redeclare a derived attribute as explicit", null, true);
                                        } else {
//						printError("on line " + line + ", column " + column  + ": this attribute must be explicit: " + attr2);
                                                printErrorMsg("" + attr2 + " - this attribute must be explicit", null, true);
                                        }
                                        printDebug("error in AttributeQualifier, not explicit: " + attr2 + ", in pass " + parser_pass);
                                }
                                 attr.unsetOrder(null);
                        } else
                        if (attr_type == 1) { // derived
                                if (attr2 instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (isRedeclared_attrCompatible(attr, attr2)) {
                                                if (attr == attr2) {
                                                        printErrorMsg("" + attr.getName(null) + " - attribute is redeclaring itself (6), entity: " + attr.getParent(null).getName(null), null, true);
                                                        error_count++;
                                                } else {
                                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2);
                                                }
                                        } else {
                                                error_count++;
//						printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
                                        }
//					 if (!attr.testOrder(null)) {
//System.out.println(">WARNING - PARSER setting order - AttributeQualifier5-2 - order: " + derived_attribute_order_count  + ", pass: " + parser_pass + ", attr: " + attr); 
                                                attr.setOrder(null, derived_attribute_order_count++);
//					 }
// System.out.println("DONE 5 - order set: attr: " + attr);				

                                } else
                                if (attr2 instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (isRedeclared_attrCompatible(attr, attr2)) {
                                                if (attr == attr2) {
                                                        printErrorMsg("" + attr.getName(null) + " - attribute is redeclaring itself (7), entity: " + attr.getParent(null).getName(null), null, true);
                                                        error_count++;
                                                } else {
                                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)attr2);
                                                }
                                        } else {
                                                error_count++;
//						printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
                                        }
                                 attr.unsetOrder(null);
                                } else {
// System.out.println("KLAIDA 5: attr2: " + attr2);				
                                }
//                              if (parser_pass == 4) {
//                                      if (expression_instances) {
//                                              x_operand = (String)expression_stack.pop();
//                                              x_operand += attr.getName(null);
//                                              expression_stack.push(x_operand);
//                                      }
//                              }
                        } else
                        if (attr_type == 2) { // inverse
                                if (isRedeclared_attrCompatible(attr, attr2)) {
                                                if (attr == attr2) {
                                                        printErrorMsg("" + attr.getName(null) + " - attribute is redeclaring itself (8), entity: " + attr.getParent(null).getName(null), null, true);
                                                        error_count++;
                                                } else {
                                                        ((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr).setRedeclaring(null, (jsdai.SExtended_dictionary_schema.EInverse_attribute)attr2);
                                                }
              } else {
                                        error_count++;
//					printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared attribute in entity " + attr.getParent(null).getName(null), null, true);
              }
                                 attr.unsetOrder(null);
                        }
                        if (attr_type == 4) { // uniqueness rule
                        } else
                        if (attr_type == 5) { // expressions, from Qualifier()
                        }




//		 System.out.println("@X 6-5 - after findAttribute - attr: " + attr);
// System.out.println("@X 10-100 original: " + attr2 + ", found: " + attr);
                }
                printDebug("In AttributeQualifier5, ending, attr: " + attr);
//		 System.out.println("@X 6-6 - so, returning - attr: " + attr);
                {if (true) return attr;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/*-+------- ISO 10303-14: B2.40 -------------------------------------------------------------------------------------------*/
  static final public void BackwardPathQualifier5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) BackwardPathQualifier */
        X_BackwardPathQualifier jjtn000 = new X_BackwardPathQualifier(JJTBACKWARDPATHQUALIFIER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object reference = null;
        int attr_type = -1;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed2 = null;
    try {
      jj_consume_token(BPATH);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        AttributeRef5(ed, ed2, attr_type, reference);
        break;
      default:
        jj_la1[258] = jj_gen;
        ;
      }
      PathCondition5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.170 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EBag_type BagType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EBag_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        jsdai.lang.EEntity bt;
        String bound_name;
    jj_consume_token(BAG);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec5();
      break;
    default:
      jj_la1[259] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (whose != null) {
                                at = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_BAG" + bound_name + _data_type_name);
//				_data_type_name = "_BAG"  + bound_name + _data_type_name;
                        }
                }
                else
                if (parser_pass == 4) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_BAG" + bound_name + _data_type_name);
//				_data_type_name = "_BAG" + bound_name + _data_type_name;
                        }
                } else
                if (parser_pass == 5) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EBag_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_BAG" + bound_name + _data_type_name);
//				_data_type_name = "_BAG" + bound_name + _data_type_name;
                        }
                        if (bounds[0] == null) {
                                // should I do this or not? 
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        } else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                }
    jj_consume_token(OF);
    bt = BaseType5(at);
//System.out.println("<RR><PASS 5> bag element type: " + bt + ", pass: " + parser_pass);
                if (parser_pass > 3) {
//			if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        if (!(at.testElement_type(null))) {
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EData_type) {
                                        at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EData_type)bt);
                                } else
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                        if (((jsdai.SExtended_dictionary_schema.EParameter)bt).testParameter_type(null)) {
                                                at.setElement_type(null, ((jsdai.SExtended_dictionary_schema.EParameter)bt).getParameter_type(null));
                                        } else {
                                        }
                                } else {
                                }
                        }
                }
                bound_name = getBoundString(0, bounds, false, false);
                _data_type_name = "_BAG"  + bound_name + _data_type_name;
                if (at != null) {
                        at.setName(null, _data_type_name);
                }
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.171 ------------ */
// changed according to Amendment - 171

// CHOICE CONFLICT between aggregates and generalized aggregates
/*
    ARRAY OF ParameterType5
    ARRAY OF BaseType5
	
*/
  static final public jsdai.lang.EEntity BaseType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity ae;
                printDebug("In BaseType5, starting, whose: " + whose);
    if (jj_2_45(2147483647)) {
      ae = ConcreteTypes5(whose);
    } else {
      switch (jj_nt.kind) {
      case AGGREGATE:
      case ARRAY:
      case BAG:
      case GENERIC_ENTITY:
      case GENERIC:
      case LIST:
      case SET:
        ae = GeneralizedTypes5(whose);
        break;
      default:
        jj_la1[260] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                printDebug("In BaseType5, ending: " + ae);
//System.out.println(">BaseType5<  returning: " + ae);
                {if (true) return ae;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.172 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EBinary_type BinaryType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EBinary_type bt = null;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        int width_spec = 0;
        boolean is_fixed = false;
        String str_fixed;
    jj_consume_token(BINARY);

    switch (jj_nt.kind) {
    case LPAREN:
      width_spec = WidthSpec5();
      break;
    default:
      jj_la1[261] = jj_gen;
      ;
    }
                if (width_spec == Integer.MIN_VALUE) {
                        width_spec = 0;
                }
                if (width_spec < 0) {
                        width_spec = -width_spec;
                        is_fixed = true;
                        str_fixed = "_FIXED";
                } else {
                        is_fixed = false;
                        str_fixed = "";
                }
                if (parser_pass == 3) {
                        if (width_spec == 0) {
                                bt = _st_binary;
                        } else {
                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                _data_type_name = "_Binary_" + width_spec + str_fixed;
                                // _data_type_name = "_Binary_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                bt.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, width_spec);
                                bt.setWidth(null, b1);
                                if (is_fixed) {
                                        bt.setFixed_width(null, true);
                                } else {
                                        bt.setFixed_width(null, false);
                                }
                        }
                }
                if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (bt == null) {
                                if (width_spec == 0) {
                                        bt = _st_binary;
                                } else {
                                        bt = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                        _data_type_name = "_Binary_" + width_spec + str_fixed;
                                        // _data_type_name = "_Binary_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                        bt.setName(null, _data_type_name);
                                        b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, width_spec);
                                        bt.setWidth(null, b1);
                                        if (is_fixed) {
                                                bt.setFixed_width(null, true);
                                        } else {
                                                bt.setFixed_width(null, false);
                                        }
                                }
                        }
                }
                if ((parser_pass == 5) && (width_spec != 0)) {
                                bt = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                _data_type_name = "_Binary_" + width_spec + str_fixed;
                                // _data_type_name = "_Binary_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                bt.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, width_spec);
                                bt.setWidth(null, b1);
                                if (is_fixed) {
                                        bt.setFixed_width(null, true);
                                } else {
                                        bt.setFixed_width(null, false);
                                }

                }
                {if (true) return bt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.172 ------------ */

/*-------- ISO 10303-14: B2.44 -------------------------------------------------------------------------------------------*/
  static final public jsdai.lang.EEntity BindingHeader5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) BindingHeader */
        X_BindingHeader jjtn000 = new X_BindingHeader(JJTBINDINGHEADER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String partition_name = "_implicit_partition_"; // partition may be implicit, let's have name "_implicit_partition_" for it (so far)
        // I would like to have partition entity, supertype of map_partition and view_partition.
        jsdai.SExtended_dictionary_schema.EMap_partition mp = null;
        jsdai.SExtended_dictionary_schema.EView_partition vp = null;
        jsdai.lang.EEntity partition = null;
    try {
printDebug("In BindingHeader5, starting, parent: " + parent);
      switch (jj_nt.kind) {
      case PARTITION:
        jj_consume_token(PARTITION);
        partition_name = PartitionId5();
        jj_consume_token(SEMICOLON);
        break;
      default:
        jj_la1[262] = jj_gen;
        ;
      }
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_definition) {
                                vp = findView_partition(partition_name, (jsdai.SExtended_dictionary_schema.EView_definition)parent);
                                partition = (jsdai.lang.EEntity)vp;
                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EMap_definition) {
                                mp = findMap_partition(partition_name, (jsdai.SExtended_dictionary_schema.EMap_definition)parent);
                                partition = (jsdai.lang.EEntity)mp;
                        } else {
                                // error
                        }
                        if (expression_instances) {
                                jjtn000.partition = (jsdai.SExtended_dictionary_schema.EMap_or_view_partition)partition;
                        }
      switch (jj_nt.kind) {
      case FROM:
        FromClause5(partition);
        break;
      default:
        jj_la1[263] = jj_gen;
        ;
      }
      switch (jj_nt.kind) {
      case LOCAL:
        LocalDecl5();
        break;
      default:
        jj_la1[264] = jj_gen;
        ;
      }
      switch (jj_nt.kind) {
      case WHERE:
        WhereClause5(parent);
        break;
      default:
        jj_la1[265] = jj_gen;
        ;
      }
      switch (jj_nt.kind) {
      case IDENTIFIED_BY:
        IdentifiedByClause5();
        break;
      default:
        jj_la1[266] = jj_gen;
        ;
      }
      switch (jj_nt.kind) {
      case ORDERED_BY:
        OrderedByClause5();
        break;
      default:
        jj_la1[267] = jj_gen;
        ;
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In BindingHeader5, ending");
                {if (true) return partition;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.173 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EBoolean_type BooleanType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EBoolean_type bt = null;
    jj_consume_token(BOOLEAN);
                if (parser_pass == 3) {
                        // bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBoolean_type.class);
                        bt = _st_boolean;
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (bt == null) {
                                // bt = (jsdai.SExtended_dictionary_schema.EBoolean_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBoolean_type.class);
                                bt = _st_boolean;
                        }
                }
                {if (true) return bt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.174 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EBound Bound15(boolean make_pdb) throws ParseException, jsdai.lang.SdaiException {
        int value;
        jsdai.SExtended_dictionary_schema.EBound b1 = null;
        String bound_description = null;
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
                if (parser_pass == 5) {
                        bound_description = " ";
                        for (int i = 1; ; i++) {
                                Token t = getToken(i);
                                if (
//					t.kind == SEMICOLON   ||
                                        t.kind == COLON         ||
//					t.kind == RBRACKET    ||
                                        t.kind == TO         //   ||
//					t.kind == BY          ||
//					t.kind == WHILE       ||
//					t.kind == UNTIL       ||
//					t.kind == RETURN      
                                ) {
                                        break;
                                }
                                if (flag_oc) {
                                        bound_description += t.image + " ";
                                } else {
                                        bound_description += t.image.toLowerCase() + " ";
                                }
                                if (first_token) {
                                        start_token = t;
                                        end_token = t;
                                        first_token = false;
                                } else {
                                        end_token = t;
                                }
                        }
                }
          X_PopulationDependentBound jjtn001 = new X_PopulationDependentBound(JJTPOPULATIONDEPENDENTBOUND);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
          jjtreeOpenNodeScope(jjtn001);
    try {
      value = NumericExpression5();
          jjtree.closeNodeScope(jjtn001,  ( ! numeric_expression_calculated ) && make_pdb);
          jjtc001 = false;
          jjtreeCloseNodeScope(jjtn001);
                if (parser_pass == 5) {
                        if (numeric_expression_calculated) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                // this line is probably not needed for aggregate bound and dangerous in other cases, better remove
                                if (value == Integer.MIN_VALUE) value = 0;
                                b1.setBound_value(null, value);
                        } else {
                                b1 = (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CPopulation_dependent_bound.class);
                                jjtn001.pdb = (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1;
                                // schema_name, entity_name, method_name
                                ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setSchema_name(null, sd.getName(null));
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope).getName(null));
                                        jjtn001.entity = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
                                } else
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EFunction_definition)active_scope).getName(null));
                                        jjtn001.function = (jsdai.SExtended_dictionary_schema.EFunction_definition)active_scope;
                                } else
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EProcedure_definition) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EProcedure_definition)active_scope).getName(null));
                                        jjtn001.procedure = (jsdai.SExtended_dictionary_schema.EProcedure_definition)active_scope;
                                } else
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EGlobal_rule)active_scope).getName(null));
                                        jjtn001.rule = (jsdai.SExtended_dictionary_schema.EGlobal_rule)active_scope;
                                }
                                ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b1).setMethod_name(null, getPDBname());
                                createExpressEntity(b1, bound_description, start_token, end_token);
                        }
                }
                {if (true) return b1;}
    } catch (Throwable jjte001) {
          if (jjtc001) {
            jjtree.clearNodeScope(jjtn001);
            jjtc001 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte001 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte001;}
          }
          if (jjte001 instanceof ParseException) {
            {if (true) throw (ParseException)jjte001;}
          }
          if (jjte001 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte001;}
          }
          {if (true) throw (Error)jjte001;}
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001,  ( ! numeric_expression_calculated ) && make_pdb);
            jjtreeCloseNodeScope(jjtn001);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.175------------ */
  static final public jsdai.SExtended_dictionary_schema.EBound Bound25(boolean make_pdb) throws ParseException, jsdai.lang.SdaiException {
        int value;
        jsdai.SExtended_dictionary_schema.EBound b2 = null;
        String bound_description = null;
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
                if (parser_pass == 5) {
                        bound_description = " ";
                        for (int i = 1; ; i++) {
                                Token t = getToken(i);
                                if (t.kind == SEMICOLON   ||
//					t.kind == COLON       ||
                                        t.kind == RBRACKET      ||
//					t.kind == TO          ||
                                        t.kind == BY            ||
                                        t.kind == WHILE         ||
                                        t.kind == UNTIL         ||
                                        t.kind == RETURN
                                ) {
                                        break;
                                }
                                if (flag_oc) {
                                        bound_description += t.image + " ";
                                } else {
                                        bound_description += t.image.toLowerCase() + " ";
                                }
                                if (first_token) {
                                        start_token = t;
                                        end_token = t;
                                        first_token = false;
                                } else {
                                        end_token = t;
                                }
                        }
                }
          X_PopulationDependentBound jjtn001 = new X_PopulationDependentBound(JJTPOPULATIONDEPENDENTBOUND);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
          jjtreeOpenNodeScope(jjtn001);
    try {
      value = NumericExpression5();
          jjtree.closeNodeScope(jjtn001,  ( ! numeric_expression_calculated ) && make_pdb);
          jjtc001 = false;
          jjtreeCloseNodeScope(jjtn001);
                if (parser_pass == 5) {
                        if (value != Integer.MIN_VALUE) {
                                b2 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b2.setBound_value(null, value);
                        } else if (!numeric_expression_calculated) {
                                b2 = (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CPopulation_dependent_bound.class);
                                jjtn001.pdb = (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2;
                                ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setSchema_name(null, sd.getName(null));
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope).getName(null));
                                        jjtn001.entity = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
                                } else
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EFunction_definition)active_scope).getName(null));
                                        jjtn001.function = (jsdai.SExtended_dictionary_schema.EFunction_definition)active_scope;
                                } else
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EProcedure_definition) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EProcedure_definition)active_scope).getName(null));
                                        jjtn001.procedure = (jsdai.SExtended_dictionary_schema.EProcedure_definition)active_scope;
                                } else
                                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                                        ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setEntity_name(null, ((jsdai.SExtended_dictionary_schema.EGlobal_rule)active_scope).getName(null));
                                        jjtn001.rule = (jsdai.SExtended_dictionary_schema.EGlobal_rule)active_scope;
                                }
                                ((jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)b2).setMethod_name(null, getPDBname());
                                createExpressEntity(b2, bound_description, start_token, end_token);
//				createExpressEntity(b2, bound_description);
                        }
                }
                {if (true) return b2;}
    } catch (Throwable jjte001) {
          if (jjtc001) {
            jjtree.clearNodeScope(jjtn001);
            jjtc001 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte001 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte001;}
          }
          if (jjte001 instanceof ParseException) {
            {if (true) throw (ParseException)jjte001;}
          }
          if (jjte001 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte001;}
          }
          {if (true) throw (Error)jjte001;}
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001,  ( ! numeric_expression_calculated ) && make_pdb);
            jjtreeCloseNodeScope(jjtn001);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.176------------ */

// jsdai.SExtended_dictionary_schema.EInteger_bound [] BoundSpec5() throws jsdai.lang.SdaiException :
  static final public jsdai.SExtended_dictionary_schema.EBound [] BoundSpec5() throws ParseException, jsdai.lang.SdaiException {
        // jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EBound[2];
        // jsdai.SExtended_dictionary_schema.EInteger_bound b1 = null;
        // jsdai.SExtended_dictionary_schema.EInteger_bound b2 = null;
        jsdai.SExtended_dictionary_schema.EBound b1 = null;
        jsdai.SExtended_dictionary_schema.EBound b2 = null;
    jj_consume_token(LBRACKET);
    b1 = Bound15(true);
    jj_consume_token(COLON);
                if (parser_pass == 5) {
                        bounds[0] = b1;
                }
    b2 = Bound25(true);
    jj_consume_token(RBRACKET);
                if (parser_pass == 5) {
                        bounds[1] = b2;
                }
                {if (true) return bounds;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.177------------ */
  static final public Object BuiltInConstant5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) BuiltInConstant */
        X_BuiltInConstant jjtn000 = new X_BuiltInConstant(JJTBUILTINCONSTANT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object result = null;
        Integer l;
        Double d;
        Token t;
    try {
      switch (jj_nt.kind) {
      case CONST_E:
        jj_consume_token(CONST_E);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        // maybe I should store in dictionary extension, etc, the fact about E constant, not the value
                        d = new Double(2.718281828459); // whatever number, check
                        result = d;
                        argument_stack.push(d);
                        if (flag_type_tracking)
                                type_stack.push(jsdai.lang.ExpressTypes.REAL_TYPE);
                        printStack("PUSH - BuiltInConstant5: E");
                        if (expression_instances) {
                                 jjtn000.type = 1;
                                // expression_stack.push(null);
                        }
                }
                {if (true) return result;}
        break;
      case PI:
        jj_consume_token(PI);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        // maybe I should store in dictionary extension, etc, the fact about PI constant, not the value
                        d = new Double(3.1415926);
                        result = d;
                        argument_stack.push(d);
                        if (flag_type_tracking)
                                type_stack.push(jsdai.lang.ExpressTypes.REAL_TYPE);
                        printStack("PUSH - BuiltInConstant5: PI");
                        if (expression_instances) {
                                 jjtn000.type = 2;
                                // expression_stack.push(null);
                        }
                }
                {if (true) return result;}
        break;
      case SELF:
        t = jj_consume_token(SELF);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
          // using Token for SELF for now, later will see.
                if (parser_pass == 5) {
                        argument_stack.push(t);
                        if (flag_type_tracking)
                                type_stack.push(jsdai.lang.ExpressTypes.GENERIC_TYPE); // we really need Named Type here 
                        result = t;
                        printStack("PUSH - BuiltInConstant5: <SELF>");
                        if (expression_instances) {
                                 jjtn000.type = 3;
                                // expression_stack.push(null);
                        }
                }
                {if (true) return result;}
        break;
      case HOOK:
        jj_consume_token(HOOK);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        l = new Integer(Integer.MIN_VALUE);
                        result = l;
                        argument_stack.push(l);
                        if (flag_type_tracking)
                                type_stack.push(jsdai.lang.ExpressTypes.INTEGER_TYPE); // not really right
                        printStack("PUSH - BuiltInConstant5: ?");
                        if (expression_instances) {
                                 jjtn000.type = 4;
                                // expression_stack.push(null);
                        }
                }
                {if (true) return result;}
        break;
      default:
        jj_la1[268] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.178------------ */
  static final public int BuiltInFunction5() throws ParseException {
        int id = 0;
    switch (jj_nt.kind) {
    case ABS:
      jj_consume_token(ABS);
                id = 1;
      break;
    case ACOS:
      jj_consume_token(ACOS);
                id = 2;
      break;
    case ASIN:
      jj_consume_token(ASIN);
                id = 3;
      break;
    case ATAN:
      jj_consume_token(ATAN);
                id = 4;
      break;
    case BLENGTH:
      jj_consume_token(BLENGTH);
                   id = 5;
      break;
    case COS:
      jj_consume_token(COS);
               id = 6;
      break;
    case EXISTS:
      jj_consume_token(EXISTS);
                  id = 7;
      break;
    case EXTENT:
      jj_consume_token(EXTENT);
                  id = 30;
      break;
    case EXP:
      jj_consume_token(EXP);
               id = 8;
      break;
    case FORMAT:
      jj_consume_token(FORMAT);
                  id = 9;
      break;
    case HIBOUND:
      jj_consume_token(HIBOUND);
                   id = 10;
      break;
    case HIINDEX:
      jj_consume_token(HIINDEX);
                   id = 11;
      break;
    case LENGTH:
      jj_consume_token(LENGTH);
                  id = 12;
      break;
    case LOBOUND:
      jj_consume_token(LOBOUND);
                   id = 13;
      break;
    case LOINDEX:
      jj_consume_token(LOINDEX);
                   id = 14;
      break;
    case LOG:
      jj_consume_token(LOG);
               id = 15;
      break;
    case LOG2:
      jj_consume_token(LOG2);
                id = 16;
      break;
    case LOG10:
      jj_consume_token(LOG10);
                 id = 17;
      break;
    case NVL:
      jj_consume_token(NVL);
               id = 18;
      break;
    case ODD:
      jj_consume_token(ODD);
               id = 19;
      break;
    case ROLESOF:
      jj_consume_token(ROLESOF);
                   id = 20;
      break;
    case SIN:
      jj_consume_token(SIN);
               id = 21;
      break;
    case SIZEOF:
      jj_consume_token(SIZEOF);
                  id = 22;
      break;
    case SQRT:
      jj_consume_token(SQRT);
                id = 23;
      break;
    case TAN:
      jj_consume_token(TAN);
               id = 24;
      break;
    case TYPEOF:
      jj_consume_token(TYPEOF);
                  id = 25;
      break;
    case USEDIN:
      jj_consume_token(USEDIN);
                  id = 26;
      break;
    case VALUE:
      jj_consume_token(VALUE);
                 id = 27;
      break;
    case VALUE_IN:
      jj_consume_token(VALUE_IN);
                    id = 28;
      break;
    case VALUE_UNIQUE:
      jj_consume_token(VALUE_UNIQUE);
                        id = 29;
      break;
    default:
      jj_la1[269] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In BuiltInFunction5, function: " + id);
                {if (true) return id;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.179------------ */
  static final public int BuiltInProcedure5() throws ParseException, jsdai.lang.SdaiException {
        int id = 0;
    switch (jj_nt.kind) {
    case INSERT:
      jj_consume_token(INSERT);
                  id = 1;
      break;
    case REMOVE:
      jj_consume_token(REMOVE);
                                       id = 2;
      break;
    default:
      jj_la1[270] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return id;}
    throw new Error("Missing return statement in function");
  }

/* -+----------------------------------------------------------------------------------- ISO 10303-11:A.2.180------------ */
  static final public void CaseAction5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) CaseAction */
  X_CaseAction jjtn000 = new X_CaseAction(JJTCASEACTION);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      CaseLabel5();
      label_88:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[271] = jj_gen;
          break label_88;
        }
        jj_consume_token(COMMA);
        CaseLabel5();
      }
      jj_consume_token(COLON);
      Stmt5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-+-------- ISO 10303-14:B2.53 ---------*/
  static final public void CaseExpr5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) CaseExpr */
        X_CaseExpr jjtn000 = new X_CaseExpr(JJTCASEEXPR);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);int case_count = 0;
        boolean otherwise_present = false;
    try {
      jj_consume_token(CASE);
      Selector5();
      jj_consume_token(OF);
      label_89:
      while (true) {
        if (jj_2_46(1)) {
          ;
        } else {
          break label_89;
        }
        CaseExprAction5();
                                                     case_count++;
      }
      switch (jj_nt.kind) {
      case OTHERWISE:
        jj_consume_token(OTHERWISE);
        jj_consume_token(COLON);
        Expression5();
                                                                                                        otherwise_present = true;
        break;
      default:
        jj_la1[272] = jj_gen;
        ;
      }
      jj_consume_token(END_CASE);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (expression_instances) {
                        jjtn000.case_count = case_count;
                        jjtn000.otherwise_present = otherwise_present;
                }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-+-------- ISO 10303-14:B2.54 ---------*/
  static final public void CaseExprAction5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) CaseExprAction */
  X_CaseExprAction jjtn000 = new X_CaseExprAction(JJTCASEEXPRACTION);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      CaseLabel5();
      label_90:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[273] = jj_gen;
          break label_90;
        }
        jj_consume_token(COMMA);
        CaseLabel5();
      }
      jj_consume_token(COLON);
      Expression5();
      jj_consume_token(SEMICOLON);
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.181------------ */
  static final public void CaseLabel5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) CaseLabel */
        X_CaseLabel jjtn000 = new X_CaseLabel(JJTCASELABEL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object op_case_label = null;
        Object op_case_label_type = null;
        Object pop_inst = null;
    try {
                printDebug("In CaseLabel5, starting, pass " + parser_pass);
      Expression5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        op_case_label = argument_stack.pop();
                        if (flag_type_tracking)
                                op_case_label_type = type_stack.pop();
                        printStack("POP: CaseStmt5 - CaseAction5 - CaseLabel5: " + op_case_label);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
                printDebug("In CaseLabel5, ending, pass " + parser_pass);
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.182------------ */
  static final public void CaseStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) CaseStmt */
        X_CaseStmt jjtn000 = new X_CaseStmt(JJTCASESTMT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object op_selector = null;
        Object op_selector_type = null;
        Object pop_inst = null;
        boolean otherwise_present = false;
    try {
                printDebug("In CaseStmt5, starting");
      jj_consume_token(CASE);
                 X_CaseSelector jjtn001 = new X_CaseSelector(JJTCASESELECTOR);
                 boolean jjtc001 = true;
                 jjtree.openNodeScope(jjtn001);
                 jjtreeOpenNodeScope(jjtn001);
      try {
        Selector5();
      } catch (Throwable jjte001) {
                 if (jjtc001) {
                   jjtree.clearNodeScope(jjtn001);
                   jjtc001 = false;
                 } else {
                   jjtree.popNode();
                 }
                 if (jjte001 instanceof RuntimeException) {
                   {if (true) throw (RuntimeException)jjte001;}
                 }
                 if (jjte001 instanceof ParseException) {
                   {if (true) throw (ParseException)jjte001;}
                 }
                 if (jjte001 instanceof jsdai.lang.SdaiException) {
                   {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                 }
                 {if (true) throw (Error)jjte001;}
      } finally {
                 if (jjtc001) {
                   jjtree.closeNodeScope(jjtn001, true);
                   jjtreeCloseNodeScope(jjtn001);
                 }
      }
                if (parser_pass == 5) {
                        jjtn000.otherwise_present = otherwise_present;
                        op_selector = argument_stack.pop();
                        if (flag_type_tracking)
                                op_selector_type = type_stack.pop();
                        printStack("POP: CaseStmt5, Selector5: " + op_selector);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
      jj_consume_token(OF);
      label_91:
      while (true) {
        if (jj_2_47(1)) {
          ;
        } else {
          break label_91;
        }
        CaseAction5();
      }
      switch (jj_nt.kind) {
      case OTHERWISE:
        jj_consume_token(OTHERWISE);
                                             otherwise_present = true;
        jj_consume_token(COLON);
                                                                             X_CaseOtherwise jjtn002 = new X_CaseOtherwise(JJTCASEOTHERWISE);
                                                                             boolean jjtc002 = true;
                                                                             jjtree.openNodeScope(jjtn002);
                                                                             jjtreeOpenNodeScope(jjtn002);
        try {
          Stmt5();
        } catch (Throwable jjte002) {
                                                                             if (jjtc002) {
                                                                               jjtree.clearNodeScope(jjtn002);
                                                                               jjtc002 = false;
                                                                             } else {
                                                                               jjtree.popNode();
                                                                             }
                                                                             if (jjte002 instanceof RuntimeException) {
                                                                               {if (true) throw (RuntimeException)jjte002;}
                                                                             }
                                                                             if (jjte002 instanceof ParseException) {
                                                                               {if (true) throw (ParseException)jjte002;}
                                                                             }
                                                                             if (jjte002 instanceof jsdai.lang.SdaiException) {
                                                                               {if (true) throw (jsdai.lang.SdaiException)jjte002;}
                                                                             }
                                                                             {if (true) throw (Error)jjte002;}
        } finally {
                                                                             if (jjtc002) {
                                                                               jjtree.closeNodeScope(jjtn002, true);
                                                                               jjtreeCloseNodeScope(jjtn002);
                                                                             }
        }
        break;
      default:
        jj_la1[274] = jj_gen;
        ;
      }
      jj_consume_token(END_CASE);
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In CaseStmt5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.183------------ */
  static final public void CompoundStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) CompoundStmt */
        X_CompoundStmt jjtn000 = new X_CompoundStmt(JJTCOMPOUNDSTMT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand = null;
    try {
                printDebug("In CompoundStmt5, starting");
      jj_consume_token(BEGIN);
      label_92:
      while (true) {
        Stmt5();
        switch (jj_nt.kind) {
        case SEMICOLON:
        case ALIAS:
        case BEGIN:
        case CASE:
        case ESCAPE:
        case IF:
        case INSERT:
        case REMOVE:
        case REPEAT:
        case RETURN:
        case KW_SKIP:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[275] = jj_gen;
          break label_92;
        }
      }
      jj_consume_token(END);
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
//                      operand = argument_stack.pop();
///             printStack("POP: CompoundStmt5, return value: " + operand);
                }
                printDebug("In CompoundStmt5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.184------------ */
  static final public void ConstantBody5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ConstantBody */
        X_ConstantBody jjtn000 = new X_ConstantBody(JJTCONSTANTBODY);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EConstant_definition cd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration cond;
        int Index5 = 1;
        String name;
  Object operand = null;
  Object operand_type = null;
        Object pop_inst = null;
  jsdai.lang.EEntity bt = null;
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
        jsdai.lang.EEntity active_scope_backup = null;
    try {
                active_scope_backup = active_scope;
      name = ConstantId5();
                if (parser_pass == 1) {
                        printVerbose("Constant: " + name);
                        //cd = findConstant_definition(name);
                        // why it was still old without X?
                        cd = findConstant_definitionX(name);
                        if (cd != null) {
                                                error_count++;
                                                printErrorMsg5("" + name + " - duplicate constant name", null, true);
                                                printDebug("duplicate constant name \"" + name + "\"");
                        } else {
                                String wrong_name = findAnyName(name);
                                if (wrong_name != null) {
                                                error_count++;
                                                printErrorMsg5("" + name + " - duplicate name, used for a constant and for something else", null, true);
                                                printDebug("duplicate name \"" + name + "\". The same name used for a constant and for " + wrong_name);
                                }
                        }
                        printDebug("In ConstantBody5, before 1st create");
                        cd = (jsdai.SExtended_dictionary_schema.EConstant_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CConstant_definition.class);
                        printDebug("In ConstantBody5, after 1st create");
                        active_scope = cd;
                  cond = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CConstant_declaration$local_declaration.class);
                        printDebug("In ConstantBody5, after 2nd create");
                        cond.setParent(null, sd);
                        // parent_schema is now derived instead of explicit 
                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                // cond.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);	
                        // }
                        cond.setDefinition(null, cd);
                        if (flag_oc) {
                                cd.setName(null, name);
                        } else {
                                cd.setName(null, name.toLowerCase());
                        }
                } else {
//			cd = findConstant_definition(name);
                        cd = findConstant_definitionX(name);
                  active_scope_extension = new ECtScope(active_scope, cd, active_scope_extension, active_scope_string, name, constructConstantKey(name));
                active_scope_string = "";
                        active_scope = cd;
                        if (cd == null) {
                                error_count++;
                                printErrorMsg5("" + name + " - constant not found", null, true);
                                printDebug("ConstantBody5- constant not found: " + name);
                        }
                }
      jj_consume_token(COLON);
      bt = BaseType5(cd);
                        if (bt != null) {
                                // possible additional check because of the changes for amendment and because of the way paramater_type is implemented.
                                cd.setDomain(null, bt);
                        } else {
                                printDebug("In ConstantBody5, after BaseType5, base type is NULL in pass: " + parser_pass + ", constantn_definition: " + cd);
                        }
      jj_consume_token(ASSIGN);
                if (parser_pass == 5) {
//			String constant_expression_description = "";
                        String constant_expression_description = " ";
                        for (int i = 1; ; i++) {
                                Token t = getToken(i);
                                if (t.kind == SEMICOLON) {
                                        break;
                                }
                                // is it needed?
                                if (flag_oc) {
                                        constant_expression_description += t.image + " ";
                                } else {
                                        constant_expression_description += t.image.toLowerCase() + " ";
                                }
                                if (first_token) {
                                        start_token = t;
                                        end_token = t;
                                        first_token = false;
                                } else {
                                        end_token = t;
                                }
//				constant_expression_description += t.image;
                        }
                        createExpressEntity(cd, constant_expression_description, start_token, end_token);
//			createExpressEntity(cd, constant_expression_description);
                }
      Expression5();
                if (parser_pass == 5) {

                        operand = argument_stack.pop();
                        if (flag_type_tracking)
                                operand_type = type_stack.pop();
                        printStack("POP: ConstantDecl5 - ConstantBody5: " + operand);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                                jjtn000.cd = cd;
                                if (cd != null) {
                                        jjtn000.name = cd.getName(null);
                                } else {
//System.out.println("<EC> constant null: " + name);	
printErrorMsgX("reference to unknown constant: " + name, null, true);
                                        jjtn000.name = name;
                                }
                        }
                }
                active_scope = active_scope_backup;
    // moved from ConstantDecl5
                active_scope_string = active_scope_extension.getParent_scope_string();
                active_scope_extension = active_scope_extension.getParent();
      jj_consume_token(SEMICOLON);
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

  static final public void ConstantDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ConstantDecl */
        X_ConstantDecl jjtn000 = new X_ConstantDecl(JJTCONSTANTDECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.lang.EEntity active_scope_backup = null;
    try {
      try {
                printDebug("In ConstantDecl5, starting");
                active_scope_backup = active_scope;
        jj_consume_token(CONSTANT);
        label_93:
        while (true) {
          ConstantBody5();
          switch (jj_nt.kind) {
          case SIMPLE_ID:
            ;
            break;
          default:
            jj_la1[276] = jj_gen;
            break label_93;
          }
        }
        jj_consume_token(END_CONSTANT);
        jj_consume_token(SEMICOLON);
                active_scope = active_scope_backup;
// in ConstBody5
// 		active_scope_string = active_scope_extension.getParent_scope_string();
//	  active_scope_extension = active_scope_extension.getParent();


                if ((active_scope instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) || (active_scope instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule)) {
                        jjtn000.inner_constant = true;
                } else {
                        jjtn000.inner_constant = false;
                }
                printDebug("In ConstantDecl5, ending");
      } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
         printErrorMsg5(e.getMessage(), null, true);
        // System.out.println("ERROR RECOVERY: skipping to END_CONSTANT");
                error_count++;
        recoverFromParseException(END_CONSTANT, e);
      }
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.186------------ */
  static final public void ConstantFactor5() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case HOOK:
    case CONST_E:
    case PI:
    case SELF:
      BuiltInConstant5();
      break;
    case SIMPLE_ID:
      InterpretedRef5(PI_CONSTANT);
      break;
    default:
      jj_la1[277] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.187------------ */
  static final public String ConstantId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ---------------------------------------------------------- ISO 10303-11:A.2.188------------ */
  static final public void ConstructedTypes5(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
    if (jj_2_48(2)) {
      EnumerationType5(dt);
    } else {
      switch (jj_nt.kind) {
      case EXTENSIBLE:
      case GENERIC_ENTITY:
      case SELECT:
        SelectType5(dt);
        break;
      default:
        jj_la1[278] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

// -- removed in DIS version
/*--------- ISO 10303-14:B.2.62 ---*/
/*
void CreateMapDecl() throws jsdai.lang.SdaiException :
{}
{
	<CREATE> InstanceId() ":" TargetEntityReference5() ";" [ <WHERE> LogicalExpression5() ";" ] (MapAttributeDeclaration5())+  <END_CREATE> ";"
}
*/

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.189 ------------ */
  static final public void Declaration5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) Declaration */
  X_Declaration jjtn000 = new X_Declaration(JJTDECLARATION);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
                printDebug("In Declaration5, starting");
      switch (jj_nt.kind) {
      case ENTITY:
        EntityDecl5();
        break;
      case SUBTYPE_CONSTRAINT:
        SubtypeConstraintDecl5();
        break;
      case FUNCTION:
        FunctionDecl5();
        break;
      case PROCEDURE:
        ProcedureDecl5();
        break;
      case TYPE:
        TypeDecl5();
        break;
      default:
        jj_la1[279] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In Declaration5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.411 ------------ */
  static final public void SubtypeConstraintBody5(jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc0) throws ParseException, jsdai.lang.SdaiException {
        boolean is_abstract = false;
        jsdai.lang.EEntity ee = null;
        jsdai.SExtended_dictionary_schema.ESubtype_expression constraint = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc;
        jsdai.lang.EEntity se;
        Object se_type = null;
        Object pop_inst = null;
        jsdai.SExtended_dictionary_schema.EAndor_subtype_expression andor;
        // pre-X	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands;
                printDebug("In SubtypeConstraintBody5, starting");
    switch (jj_nt.kind) {
    case ABSTRACT:
      AbstractSupertype5();
                               is_abstract = true;
      break;
    default:
      jj_la1[280] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case TOTAL_OVER:
      TotalOver5(sc0);
      break;
    default:
      jj_la1[281] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case LPAREN:
    case ONEOF:
    case SIMPLE_ID:
      SupertypeExpression5();
                if (parser_pass == 5) {


                        se = (jsdai.lang.EEntity)argument_stack.pop();
                        if (flag_type_tracking)
                                se_type = type_stack.pop();
                        printStack("POP: SubtypeConstraint5: " + se);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }

      ed = sc0.getSuper_type(null);
                        if (se instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) {
//1				sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
//2				sc.setGeneric_supertype(null, ed);
                                // super_type is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // sc.setSuper_type(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)ed);
                                // }
//3
                                sc0.setConstraint(null, (jsdai.SExtended_dictionary_schema.ESubtype_expression)se);
// System.out.println("<SC-B-1> not created: " + sc0);

                        } else
                        if (se instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) // SUPERTYPE OF (single_entity)
            {
//4				sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
//5			sc.setGeneric_supertype(null, ed);
                                // super_type is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // sc.setSuper_type(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)ed);
                                // }
                                andor = (jsdai.SExtended_dictionary_schema.EAndor_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAndor_subtype_expression.class);
                                generic_operands = andor.createGeneric_operands(null);
                                // operands is now derived instead of explicit 
                                // operands = andor.createOperands(null);
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) se);
                                // operands is now derived instead of explicit 
                                // if (!(se instanceof jsdai.SExtended_dictionary_schema.EView_definition)) {
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) se);
                                // }
//6
                                sc0.setConstraint(null, (jsdai.SExtended_dictionary_schema.ESubtype_expression)andor);
// System.out.println("<SC-B-2> not-created: " + sc0);
                        }
                        else { //
                                error_count++;
                                printErrorMsg5(" name not available - internal error in SubtypeConstraint5", null, true);
                                printEDebug("Internal error in SubtypeConstraint5");
                        }
                }
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[282] = jj_gen;
      ;
    }
                if (is_abstract) {
                        if (sc0 != null) {
                                sc0.setAbstract_supertype(null, true);
//				if (sc0.testSuper_type(null)) {
//					ed = sc0.getSuper_type(null);
//					ed.setInstantiable(null, false);
//				}

//				if (sc0.testGeneric_supertype(null)) {
//					ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)sc0.getGeneric_supertype(null);
//					ed.setInstantiable(null, false);
//				}
                        } else {
                         printErrorMsg5("supertype_constraint is null", null, true);
                        }
                }
                printDebug("In SubtypeConstraintBody5, ending");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.412 ------------ */
  static final public void SubtypeConstraintDecl5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc = null;
                printDebug("In SubtypeConstraintDecl5, starting");
    sc = SubtypeConstraintHead5();
    SubtypeConstraintBody5(sc);
    jj_consume_token(END_SUBTYPE_CONSTRAINT);
    jj_consume_token(SEMICOLON);
                printDebug("In SubtypeConstraintDecl5, ending");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.413 ------------ */
  static final public jsdai.SExtended_dictionary_schema.ESub_supertype_constraint SubtypeConstraintHead5() throws ParseException, jsdai.lang.SdaiException {
        String constraint_id = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc = null;
        jsdai.SExtended_dictionary_schema.ESubtype_constraint_declaration scd = null;
                printDebug("In SubtypeConstraintHead5, starting");
    jj_consume_token(SUBTYPE_CONSTRAINT);
    constraint_id = SubtypeConstraintId5();
    jj_consume_token(FOR);
    ed = EntityRef5(null);
    jj_consume_token(SEMICOLON);
                printDebug("In SubtypeConstraintHead5, ending");

                if (parser_pass == 1) {
                        sc = findSubtype_constraint(constraint_id);
                        if (sc != null) {
                                        error_count++;
                                        printErrorMsg5("" + constraint_id + " - duplicate subtype_constraint name", null, true);
                                        printDebug("duplicate subtype_constraint name \"" + constraint_id + "\"");
                        } else {
                                String wrong_name = findAnyName(constraint_id);
                                if (wrong_name != null) {
                                        error_count++;
                                        printErrorMsg5("" + constraint_id + " - duplicate name, the same name used for a subtype_constraint and for something else", null, true);
                                        printDebug("duplicate name \"" + constraint_id + "\". The same name used for a subtype_constraint and for " + wrong_name);
                                }
                                sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
                                scd = (jsdai.SExtended_dictionary_schema.ESubtype_constraint_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$subtype_constraint_declaration.class);
                                scd.setDefinition(null, sc);
                                // parent_schema is now derived instead of explicit 
                                // scd.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                scd.setParent(null, sd);
                                sc.setName(null, constraint_id);
                                sc.setAbstract_supertype(null, false);
                                if (ed != null) {
                                        // super_type is now derived instead of explicit 
                                        // sc.setSuper_type(null, ed);
                                        sc.setGeneric_supertype(null, ed);
                                }
// System.out.println("<SC-1> created constraint: " + sc);
                        }
                } else { // parser_pass > 1 
                        sc = findSubtype_constraint(constraint_id);
                        if (sc == null) {
                                error_count++;
                                printErrorMsg5("" + constraint_id + " - subtype_constraint not found", null, true);
                                printDebug("subtype_constraint not found:  \"" + constraint_id + "\"");
                        } else {
                                if (ed != null) {
                                        // super_type is now derived instead of explicit 
                                        // sc.setSuper_type(null, ed);
                                        sc.setGeneric_supertype(null, ed);
                                }
                        }
// System.out.println("<SC-2> found constraint: " + sc + ", pass: " + parser_pass);
                }

                {if (true) return sc;}
    throw new Error("Missing return statement in function");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.414 ------------ */
  static final public String SubtypeConstraintId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
                printDebug("In SubtypeConstraintId5, starting");
    t = jj_consume_token(SIMPLE_ID);
                printDebug("In SubtypeConstraintId5, ending");
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.415 ------------ */
  static final public void TotalOver5(jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.AEntity_definition total_cover = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition sub_ed = null;;
        int Index5 = 1;
                printDebug("In TotalOver5, starting");
    jj_consume_token(TOTAL_OVER);
    jj_consume_token(LPAREN);

    sub_ed = EntityRef5(null);

    label_94:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[283] = jj_gen;
        break label_94;
      }
      jj_consume_token(COMMA);
      sub_ed = EntityRef5(null);

    }
    jj_consume_token(RPAREN);
    jj_consume_token(SEMICOLON);
                printDebug("In TotalOver5, ending");
  }

/* --------------------------------------------------------------Amendment--------------- ISO 10303-11:A.2.400 ------------ */
  static final public void AbstractSupertype5() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In AbstractSupertype5, starting");
    jj_consume_token(ABSTRACT);
    jj_consume_token(SUPERTYPE);
    jj_consume_token(SEMICOLON);
                printDebug("In AbstractSupertype5, ending");
  }

/*-+-------- ISO 10303-14:B.2.64 ---*/
  static final public void DependentMapDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) DependentMapDecl */
        X_DependentMapDecl jjtn000 = new X_DependentMapDecl(JJTDEPENDENTMAPDECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);//	jsdai.SExtended_dictionary_schema.EDependent_map_declaration dmdc = null;
        jsdai.SExtended_dictionary_schema.EMap_declaration dmdc = null;
        jsdai.SExtended_dictionary_schema.EDependent_map_definition dmd = null;
        String map_name = null;
    try {
                target_parameter_order_count = 0;
      jj_consume_token(DEPENDENT_MAP);
      map_name = MapId5();
      jj_consume_token(AS);
                printDebug("In DependentMapDecl5, starting: " + map_name);
                if (parser_pass == 1) {
                        // check if a dependent_map with this name already exists in the extent.
                        dmd = findDependent_map_definition(map_name, null);
                        if (dmd != null) {
                                error_count++;
//				printError("duplicate dependent_map name \"" + map_name + "\"");
                        } else {
                                String wrong_name = findAnyName(map_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + map_name + "\". The same name used for a dependent_map and for " + wrong_name);
                                }
                                dmd = (jsdai.SExtended_dictionary_schema.EDependent_map_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_map_definition.class);
                                active_scope = dmd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
//no				dmdc = (jsdai.SExtended_dictionary_schema.EDependent_map_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$dependent_map_declaration.class);
                                dmdc = (jsdai.SExtended_dictionary_schema.EMap_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$map_declaration.class);


//no				dmdc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                dmdc.setParent(null, sd);
                                dmdc.setDefinition(null, dmd);

                                dmd.setName(null, map_name);
                                // supertypes - added this attribute
//				dmd.createSupertypes(null);
//				dmd.createSuper_type(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper5()
                        dmd = findDependent_map_definition(map_name, null);
                        active_scope = dmd;
                        if (dmd == null) {
                                error_count++;
//				printError("DependentMapDecl5 - the dependent_map not found: " + map_name);
                                printErrorMsg("" + map_name + " - dependent map not found", null, true);
                        }

                        if (parser_pass == 5) {
                                        if (expression_instances) {
                                                        jjtn000.definition = dmd;
                                        }
                        }


                }
                // createDocumentationEntity2(md, a_token);

                target_parameter_order_count = 0;
      label_95:
      while (true) {
        TargetParameter5(dmd);
        switch (jj_nt.kind) {
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[284] = jj_gen;
          break label_95;
        }
      }
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case SUBTYPE:
        MapSubtypeOfClause5(dmd);
        break;
      default:
        jj_la1[285] = jj_gen;
        ;
      }
      label_96:
      while (true) {
        DepMapPartition5(dmd);
        switch (jj_nt.kind) {
        case FROM:
        case PARTITION:
          ;
          break;
        default:
          jj_la1[286] = jj_gen;
          break label_96;
        }
      }
      jj_consume_token(END_DEPENDENT_MAP);
      jj_consume_token(SEMICOLON);
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-+-------- ISO 10303-14:B.2.65 ---*/
  static final public void DepBindingDecl5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
    DepFromClause5(parent);
    switch (jj_nt.kind) {
    case WHERE:
      WhereClause5(null);
      break;
    default:
      jj_la1[287] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case ORDERED_BY:
      OrderedByClause5();
      break;
    default:
      jj_la1[288] = jj_gen;
      ;
    }
  }

/*-+-------- ISO 10303-14:B.2.66 ---*/
  static final public void DepFromClause5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(FROM);
    label_97:
    while (true) {
      DepSourceParameter5(parent);
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[289] = jj_gen;
        break label_97;
      }
    }
  }

/*--------- ISO 10303-14:B.2.67 ---*/
  static final public void DepMapDeclBody5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
    DepBindingDecl5(parent);
    MapProjectClause5(parent);
  }

/*--------- ISO 10303-14:B.2.68 ---*/
  static final public void DepMapPartition5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) DepMapPartition */
        X_DepMapPartition jjtn000 = new X_DepMapPartition(JJTDEPMAPPARTITION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String partition_name = "_implicit_partition_";
        jsdai.lang.EEntity partition = null;
        jsdai.SExtended_dictionary_schema.EDependent_map_partition mp = null;
    try {
      switch (jj_nt.kind) {
      case PARTITION:
        jj_consume_token(PARTITION);
        partition_name = PartitionId5();
        jj_consume_token(COLON);
        break;
      default:
        jj_la1[290] = jj_gen;
        ;
      }
                                mp = (jsdai.SExtended_dictionary_schema.EDependent_map_partition)findDependent_map_partition(partition_name, (jsdai.SExtended_dictionary_schema.EDependent_map_definition)parent);
                                partition = (jsdai.lang.EEntity)mp;

                                if (expression_instances) {
                                                jjtn000.partition = mp;
                                                jjtn000.definition = (jsdai.SExtended_dictionary_schema.EDependent_map_definition)parent;
                                }
      DepMapDeclBody5(mp);
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-+-------- ISO 10303-14:B.2.69 ---*/
  static final public void DepSourceParameter5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String source_parameter_name;
        jsdai.SExtended_dictionary_schema.ESource_parameter sp0 = null;
        jsdai.SExtended_dictionary_schema.EDependent_source_parameter sp = null;
        jsdai.SExtended_dictionary_schema.EData_type er = null; // fix dictionary - need defined_type or simple type
        jsdai.SExtended_dictionary_schema.ESimple_type st = null;
        jsdai.SExtended_dictionary_schema.EDefined_type  dt = null;
    source_parameter_name = SourceParameterId5();
    label_98:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[291] = jj_gen;
        break label_98;
      }
      jj_consume_token(COMMA);
      SourceParameterId5();
    }
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case BINARY:
    case BOOLEAN:
    case INTEGER:
    case LOGICAL:
    case NUMBER:
    case REAL:
    case STRING:
      st = SimpleTypes5(null);
      break;
    case SIMPLE_ID:
      dt = TypeReference5();
      break;
    default:
      jj_la1[292] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                        sp0 = findSource_parameter(source_parameter_name);
                        if (sp0 == null) {
                                // error - should have been found
                        }
                        if (parser_pass == 4) {
                                        if ((st != null) && (dt == null)) {
                                                sp0.setExtent(null, st);
                                        } else
                                        if ((st == null) && (dt != null)) {
                                                sp0.setExtent(null, dt);
                                        } else {
                                        }
                                sp.setOrder(null, from_order_count++);
                        }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.190------------ */
  static final public void DerivedAttr5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) DerivedAttr */
        X_DerivedAttr jjtn000 = new X_DerivedAttr(JJTDERIVEDATTR);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EAttribute da;
        jsdai.lang.EEntity bt = null;
        Object exp = null;
        Object exp_type = null;
        Object pop_inst = null;
        //3.0 jsdai.SExtended_dictionary_schema.EJava_code je = null;
        String error_attr_name = "";
        String error_current_name = "";
        String error_supertype_name = "";
        String x_operand = "";
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
    try {
                printDebug("In derived attribute of entity: " + ed.getName(null));
                active_scope = ed; // of course
                flag_derived_expression = false;
      da = AttributeDecl5(ed, 1);
      jj_consume_token(COLON);
      bt = BaseType5(da);
      jj_consume_token(ASSIGN);
//System.out.println(">DerivedAttr5<  BaseType: " + bt);

                if (parser_pass == 5) {

                        if (da == null) {
                                // attribute not found, probably redeclaring problem
                                error_attr_name = global_attribute_name;
                                error_current_name = ed.getName(null);
                                if (global_entity2 != null) {
                                        error_supertype_name = global_entity2.getName(null);
                                }
// this error already reported elsewhere (?)


//				error_count++;
                 // printError("redeclaring attribute \"" + error_attr_name + "\" in entity \"" + error_current_name + "\": the attribute not found in supertype entity \"" + error_supertype_name + "\" entity_name + "\"");

//				printError("redeclaring attribute \"" + error_attr_name + "\" in entity  \"" + error_current_name + "\": the attribute not found in the supertype entity \"" + error_supertype_name + "\"");

//RR

                                // TO_FIX: may not be redeclaring only, if it is not redeclaring, then an internal error
//				printErrorMsg("" + error_attr_name + " - redeclaring attribute in entity  \"" + error_current_name + "\": the attribute not found in the supertype entity \"" + error_supertype_name + "\"", null, true);

                        } else {
                                if (!(da instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute)) {
                                        printErrorMsg("" + error_attr_name + " - expected derived attribute is not derived: " + da, null, true);
                                        error_count++;

                                }
                        }


                        if (da != null) {


//			String derived_description = "";
                        String derived_description = " ";
                        for (int i = 1; ; i++) {
                                Token t = getToken(i);
                                if (t.kind == SEMICOLON) {
                                        break;
                                }
                                if (first_token) {
                                        start_token = t;
                                        end_token = t;
                                        first_token = false;
                                } else {
                                        end_token = t;
                                }
                                // is it needed?
                                if (flag_oc) {
                                        derived_description += t.image + " ";
                                } else {
                                        derived_description += t.image.toLowerCase() + " ";
                                }
//				derived_description += t.image; 
                }
                        // printDDebug("Derived attribute " + da.getName(null) + " is : " + derived_description);
                        createExpressEntity(da, derived_description, start_token, end_token);
//			createExpressEntity(da, derived_description);
                        if (expression_instances) {
//				je = createJavaEntity(da, null);
//				expression_stack.push(x_operand);
                        }

                        } // da != null
                } // pass == 5 ?
                flag_derived_expression = true;
      Expression5();
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                flag_derived_expression = false;

                if (da != null) {

                if (parser_pass > 3) {
                        if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) {
                                if (!((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).testDomain(null)) {
                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
                                }
                        } else
                        if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                if (!((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).testDomain(null)) {
                                        ((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
                                }
                        } else
                        if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                if (da != null) {
                                        if (!((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).testDomain(null)) {
// not derived attribute here in the next line !!!!!
                                                ((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);
                                        }
                                } else {
                                        printVerbose("ERROR, derived attribute da is NULL");
                                }
                        } else
                        if (bt instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                // generalized, the entity should be abstract, perhaps it could be checked.
                                if (!((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).testDomain(null)) {
                                ((jsdai.SExtended_dictionary_schema.EDerived_attribute)da).setDomain(null, (jsdai.SExtended_dictionary_schema.EParameter)bt);
                                }

                        }
                        if (parser_pass == 5) {
                                        if (expression_instances) {
                                                        jjtn000.owner_entity = ed;
                                                        jjtn000.attribute = da;
                                        } // maybe include the next line or two
                                        exp = argument_stack.pop();
                                        if (flag_type_tracking)
                                                exp_type = type_stack.pop();
                                        printStack("POP: DerivedAttr5: Expression5: " + exp);
                                        if (expression_instances) {
                                                        // x_operand = (String)expression_stack.pop(); // could be je;
                                                        // printXStack("POP: DerivedAttr5: Expression5: " + x_operand);
                                                        //RR-Tue				je = createJavaEntity(da, x_operand);
                                                        //				jsdai.lang.A_string values = je.getValues(null);
                                                        //				String vvv = (String)expression_stack.pop();
                                                        //				values.addByIndex(2, vvv);
                                        }

                                // let's add the type compatibility check here
                                if (flag_in_redeclaring) {
//					if (!(isRedeclared_attrCompatible(global_redeclaring, global_redeclared))) {
                                        if (false) {
                                                error_count++;
//					printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared derived attribute in entity " + attr.getParent(null).getName(null), null, true);
                                        }
                                        global_redeclaring = null;
                                        global_redeclared = null;
                                        flag_in_redeclaring = false;
                                }
                        }
                }
                } // da != null
// System.out.println(">DerivedAttr5<  after expression: " + da + ", base type: " + bt);

    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.191------------ */
  static final public void DeriveClause5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(DERIVE);
    label_99:
    while (true) {
      DerivedAttr5(ed);
      switch (jj_nt.kind) {
      case SELF:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[293] = jj_gen;
        break label_99;
      }
    }
  }

/* - LOOKAHEAD 2 or > - (Column 3) ---------------------------------------------------- ISO 10303-11:A.2.192------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict in [] construct (column 3).
		 Expansion nested within construct and expansion following construct have common prefixes,
		 one of which is <SIMPLE_ID>. Lookahead of 2 or more should be used for the nested expansion.
*/
  static final public jsdai.SExtended_dictionary_schema.EWhere_rule DomainRule5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) DomainRule */
        X_DomainRule jjtn000 = new X_DomainRule(JJTDOMAINRULE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EWhere_rule wr = null;
        Object exp = null;
        Object exp_type = null;
        Object pop_inst = null;
  String name = null;
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
        boolean is_outer_sizeof = false;
        boolean is_negative_number = false;
  boolean       is_spec_warning_sizeof = false;
  boolean is_spec_error_sizeof = false;
        int sizeof_restriction_value = -1;
    try {
                        printDebug("In DomainRule5, parent: " + parent);
//			sizeof_depth = 0;
//			parenthesis_depth = 0;

      if (jj_2_49(2)) {
        name = Label5();
                                               printDebug("Domain rule name: " + name);
        jj_consume_token(COLON);
      } else {
        ;
      }
                        if (parser_pass == 5) {

                        if (name == null) {
                                // optional label missing
                                no_label_nr++;
                                name = "no_label_" + no_label_nr;
                        }


//				if (!(parent instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule)) {
//				String where_description = "";
                                String where_description = " ";
                        is_outer_sizeof = false;
                        is_negative_number = false;
                        is_spec_warning_sizeof = false;
                        is_spec_error_sizeof = false;
              sizeof_restriction_value = -1;
                        for (int i = 1; ; i++) {
                                        Token t = getToken(i);
// System.out.println("token " + i + ": " + t.image + ", kind: " + t.kind);
                                        if ((i == 1) &&(t.kind == SIZEOF)) {
                                                is_outer_sizeof = true;
                                        }
                                        if (t.kind == SEMICOLON) {
                                                if (is_outer_sizeof) {
                                                 Token tv = getToken(i-1);
                                                 if (tv.kind == INTEGER_LITERAL) {
                                                        Token ts;
                                                        ts = getToken(i-2);
                                                        if (ts.kind == MINUS) {
                                                                is_negative_number = true;
                                                                ts = getToken(i-3);
                                                        }
                                                        if (ts.kind == EQ) {  // =
                                                                if (!is_negative_number) {
                                                                        if (tv.image.equals("0")) {
                                                                                is_spec_error_sizeof = true;
                                                                        } else {
                                                                                is_spec_warning_sizeof = true;
                                                                                // we might want this value to pass as a parameter of the sizeof, perhaps
                                                                                String s = tv.image;
                                                                                Integer l = new Integer(s);
                                                                                sizeof_restriction_value = l.intValue();

                                                                        }
                                                                } else {
                                                                        // makes no sense, should not occur, but if occured, ignore, default sizeof
                                                                        // but perhaps we could allow = -0
                                                                        if (tv.image.equals("0")) {
                                                                                is_spec_error_sizeof = true;
                                                                        } else {
                                                                                // just ignore
                                                                        }
                                                                }
                                                        } else
                                                        if (ts.kind == GT) {  // >
                                                                // no error or warning, just ignore
                                                        } else
                                                        if (ts.kind == LT) { // <
                                                                if (!is_negative_number) {
                                                                        if (tv.image.equals("0")) {
                        //  < 0 makes no sense, ignore
                  } else {
                                                                                is_spec_warning_sizeof = true;
                                                                                // we might want this value to pass as a parameter of the sizeof, perhaps
                                                                                String s = tv.image;
                                                                                Integer l = new Integer(s);
                                                                                sizeof_restriction_value = l.intValue();
                                                                        }
                                                                } else {
                                                                        // ignore, should not occur and makes no sense
                                                                }
                                                        } else
                                                        if (ts.kind == LE) { // <=
                                                                if (!is_negative_number) {
                                                                        if (tv.image.equals("0")) {
                                                                                // <= 0 - the = 0 part can be considered here, so error
                                                                                is_spec_error_sizeof = true;
                                                                        } else {
                                                                                is_spec_warning_sizeof = true;
                                                                                // we might want this value to pass as a parameter of the sizeof, perhaps
                                                                                String s = tv.image;
                                                                                Integer l = new Integer(s);
                                                                                sizeof_restriction_value = l.intValue();
                                                                        }
                                                                } else {
                                                                         // perhaps makes sense  <= -0
                                                                         // because -0 = 0, the same as <= 0, and then = 0 part is ok, or = -0, if you wish
                                                                        if (tv.image.equals("0")) {
                                                                                is_spec_error_sizeof = true;
                                                                        } else {
                                                                                // makes no sense, ignore
                                                                        }
                                                                }
                                                        } else
                                                        if (ts.kind == GE) { // >=
                                                                // everything here is not an error or warning, ignore
                                                        } else
                                                        if (ts.kind == NE) { // <>
                                                                // interesting case here, perhaps with the second parameter
                                                                if (!is_negative_number) {
                                                                        if (tv.image.equals("0")) {
                                                                                //  <> 0 - no violation, ignore, the same as > 0
                                                                        } else {
                                                                                // <> 5 , for example, perhaps we could pass as a parameter, if exactly 5, then print them? not sure
                                                                                String s = tv.image;
                                                                                Integer l = new Integer(s);
                                                                                sizeof_restriction_value = l.intValue();
                                                                        }
                                                                } else {
                                                                        // either not a violation ( <> -0 - can be the same as > 0), or makes no sense, so - ignore
                                                                }
                                                        }
                                                 } // integer literal - else - not supported so far

                                                } // outer_sizeof
                                                break;
                                        }
                                        if (first_token) {
                                                start_token = t;
                                                end_token = t;
                                                first_token = false;
                                        } else {
                                                end_token = t;
                                        }
                                        // is it needed?
                                        if (flag_oc) {
                                                where_description += t.image + " ";
                                        } else {
                                                where_description += t.image.toLowerCase() + " ";
                                        }
//					where_description += t.image;
                        }
                                        // printDDebug("Where rule " + name + " is : " + where_description);
//				} // if not global_rule
                                wr = (jsdai.SExtended_dictionary_schema.EWhere_rule)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CWhere_rule.class);
                                if (name != null) {
                                        wr.setLabel(null, name);
                                } else {
//					wr.setLabel(null, "_no_label_" + no_label_nr);
                                        // perhaps it is safe to assume, that if no label, then only one domain rule? I'm making this assupmtion for now.
                                        // I am also assuming, that there are no mixed cases label-no label
                                        // it is not easy to implement unique labels, because in the case of incremental, only a fraction may have to be parsed,
                                  // and the unique number would be different.
                                        wr.setLabel(null, "WR1");
                                        no_label_nr++;
                                }
                                wr.setOrder(null, where_rule_order_count++);
//				createExpressEntity(wr, where_description);
                                createExpressEntity(wr, where_description, start_token, end_token);
                        } // pass 5
                        global_sizeof_restriction_value = sizeof_restriction_value;
                        global_is_spec_error_sizeof = is_spec_error_sizeof;
                        global_is_spec_warning_sizeof = is_spec_warning_sizeof;
                        global_is_outer_sizeof = is_outer_sizeof;
                  X_DomainRuleLogicalExpression jjtn001 = new X_DomainRuleLogicalExpression(JJTDOMAINRULELOGICALEXPRESSION);
                  boolean jjtc001 = true;
                  jjtree.openNodeScope(jjtn001);
                  jjtreeOpenNodeScope(jjtn001);
      try {
        LogicalExpression5();
      } catch (Throwable jjte001) {
                  if (jjtc001) {
                    jjtree.clearNodeScope(jjtn001);
                    jjtc001 = false;
                  } else {
                    jjtree.popNode();
                  }
                  if (jjte001 instanceof RuntimeException) {
                    {if (true) throw (RuntimeException)jjte001;}
                  }
                  if (jjte001 instanceof ParseException) {
                    {if (true) throw (ParseException)jjte001;}
                  }
                  if (jjte001 instanceof jsdai.lang.SdaiException) {
                    {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                  }
                  {if (true) throw (Error)jjte001;}
      } finally {
                  if (jjtc001) {
                    jjtree.closeNodeScope(jjtn001, true);
                    jjtreeCloseNodeScope(jjtn001);
                  }
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        exp = argument_stack.pop();
                        if (flag_type_tracking)
                                exp_type = type_stack.pop();
                        printStack("POP: DomainRule5: LogicalExpression5: " + exp);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                        if (expression_instances) {
// System.out.println("outer sizeof: " + is_outer_sizeof + ", erorr: " + is_spec_error_sizeof + ", warning: " + is_spec_warning_sizeof);
                                jjtn000.where_rule = wr;
                                if ((parent instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule)) {
                                        jjtn000.global_rule = true;
                                        jjtn000.map_definition = false;
                                }else   if ((parent instanceof jsdai.SExtended_dictionary_schema.EMap_definition)) {
                                        jjtn000.map_definition = true;
                                        jjtn000.global_rule = false;
                                }else {
                                        jjtn000.global_rule = false;
                                        jjtn000.map_definition = false;
                                }

                        }
                }
                {if (true) return wr;}
    } catch (Throwable jjte000) {
                  if (jjtc000) {
                    jjtree.clearNodeScope(jjtn000);
                    jjtc000 = false;
                  } else {
                    jjtree.popNode();
                  }
                  if (jjte000 instanceof RuntimeException) {
                    {if (true) throw (RuntimeException)jjte000;}
                  }
                  if (jjte000 instanceof ParseException) {
                    {if (true) throw (ParseException)jjte000;}
                  }
                  if (jjte000 instanceof jsdai.lang.SdaiException) {
                    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
                  }
                  {if (true) throw (Error)jjte000;}
    } finally {
                  if (jjtc000) {
                    jjtree.closeNodeScope(jjtn000, true);
                    jjtreeCloseNodeScope(jjtn000);
                  }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.193------------ */
  static final public void Element5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) Element */
        X_Element jjtn000 = new X_Element(JJTELEMENT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);int rep = 1;
    try {
                printDebug("In Element5, starting");
      Expression5();
      switch (jj_nt.kind) {
      case COLON:
        jj_consume_token(COLON);
        rep = Repetition5();
        break;
      default:
        jj_la1[294] = jj_gen;
        ;
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.repetition = rep;
//				if (rep > 1) {
//					jjtThis.repetition = rep;
//				} else {
//					jjtThis.repetition = 1;
//				}
                        }
                }
                printDebug("In Element5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.194 ------------ */
  static final public void EntityBody5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        {
                attribute_order_count = 0;
                explicit_attribute_order_count = 0;
                derived_attribute_order_count = 0;
                inverse_attribute_order_count = 0;
                where_rule_order_count = 0;
                hs_redeclared_attribute_originals = new HashSet();

        }
    label_100:
    while (true) {
      switch (jj_nt.kind) {
      case SELF:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[295] = jj_gen;
        break label_100;
      }
      ExplicitAttr5(ed);
    }
    switch (jj_nt.kind) {
    case DERIVE:
      DeriveClause5(ed);
      break;
    default:
      jj_la1[296] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case INVERSE:
      InverseClause5(ed);
      break;
    default:
      jj_la1[297] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case UNIQUE:
      UniqueClause5(ed);
      break;
    default:
      jj_la1[298] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case WHERE:
                printDebug("before where clause, entity: " + ed.getName(null));
      WhereClause5(ed);
      break;
    default:
      jj_la1[299] = jj_gen;
      ;
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.195------------ */
  static final public void EntityConstructor5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) EntityConstructor */
        X_EntityConstructor jjtn000 = new X_EntityConstructor(JJTENTITYCONSTRUCTOR);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        int parameter_counter = 0;
    try {
      ed = EntityRef5(null);
      jj_consume_token(LPAREN);
      if (jj_2_50(1)) {
        EntityConstructorParameter5();
                                                                 parameter_counter++;
        label_101:
        while (true) {
          switch (jj_nt.kind) {
          case COMMA:
            ;
            break;
          default:
            jj_la1[300] = jj_gen;
            break label_101;
          }
          jj_consume_token(COMMA);
          EntityConstructorParameter5();
                                                                                                                          parameter_counter++;
        }
      } else {
        ;
      }
      jj_consume_token(RPAREN);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        jjtn000.ed = ed;
                        argument_stack.push(ed);
                        if (flag_type_tracking)
                                type_stack.push(ed); // perhaps we could push GENERIC_ENTITY here, but better be as precise as possible
                        printStack("PUSH: EntityConstructor5: " + ed);
                }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

  static final public void EntityConstructorParameter5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) EntityConstructorParameter */
  X_EntityConstructorParameter jjtn000 = new X_EntityConstructorParameter(JJTENTITYCONSTRUCTORPARAMETER);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      Expression5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.196 ------------ */
  static final public void EntityDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) EntityDecl */
        X_EntityDecl jjtn000 = new X_EntityDecl(JJTENTITYDECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);{
                scope_stack.push(current_scope);
                current_scope = new Vector();
        }
        jsdai.SExtended_dictionary_schema.EEntity_definition ed;
    try {
      try {
        ed = EntityHead5();
        EntityBody5(ed);
        jj_consume_token(END_ENTITY);
                active_scope = null;
                active_scope_string =  active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();
        jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.entity_definition = ed;
                        }
                }
      } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
         printErrorMsg5(e.getMessage(), null, true);
        // System.out.println("ERROR RECOVERY: skipping to END_ENTITY");
                error_count++;
        recoverFromParseException(END_ENTITY, e);
      }
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.197 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition EntityHead5() throws ParseException, jsdai.lang.SdaiException {
        String entity_name;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        // have to change complex interface either to the corresponding complex class, or into EDeclaration - more general interface.
//      jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration eld;
        jsdai.SExtended_dictionary_schema.EDeclaration eld;
  Token a_token;
        boolean is_abstract_entity = false;
    /* <ENTITY> EntityId5() [SubSuper5()] ";" - In ISO, but [] expands to [[] []], so the outer [] not needed? (javaCC ERROR) */
            a_token = jj_consume_token(ENTITY);
    entity_name = EntityId5();
                global_entity_name = entity_name.toLowerCase();
                printDebug("Current entity: " + entity_name);
                if (parser_pass == 1) {
                        // check if an entity with this name already exists in the extent.
                        ed = findEntity_definition(entity_name, null);
                        if (ed != null) {
                                        error_count++;
                                        printDebug("duplicate entity name \"" + entity_name + "\"");
                        }       else {
                                String wrong_name = findAnyName(entity_name);
                                if (wrong_name != null) {
                                        error_count++;
                                        printDebug("duplicate name \"" + entity_name + "\". The same name used for an entity and for " + wrong_name);
                                }
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_definition.class);
                                active_scope = ed;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                eld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);

        if (sd == null) {
//              printDDebug("SD NULL, entity_name: " + entity_name + ", complex: " + is_complex_schema + ", pass: " + parser_pass);
        } else {
        }

                                eld.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // eld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                eld.setDefinition(null, ed);
                                hm_current_entity_declarations.put(entity_name.toLowerCase(), eld);

                                if (flag_oc) {
                                        ed.setName(null, entity_name);
                                } else {
                ed.setName(null, entity_name.toLowerCase());
                                }
//                              ed.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                ed.setInstantiable(null, true); // later must be repalaced to true, must be true for all entities except ABSTRACT
        if (is_complex_schema)
                                        ed.setComplex(null, true); // unnecessary, 0 by default
                                else
                                        ed.setComplex(null, false); // unnecessary, 0 by default
                                ed.setAbstract_entity(null, false);
                                ed.createGeneric_supertypes(null);
                                // supertypes is now derived instead of explicit 
                                // ed.createSupertypes(null);
                                // now it is inverse.
                                // ed.createWhere_rules(null);
                                // no longer
                                // ed.createExplicit_attributes(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper5()
                        ed = findEntity_definition(entity_name, null);
                  active_scope_extension = new ECtScope(active_scope, ed, active_scope_extension, active_scope_string, entity_name, entity_name.toLowerCase());
                active_scope_string = "";
                        active_scope = ed;
                        if (ed == null) {
                                error_count++;
                                printErrorMsg5("" + entity_name + " - entity not found", null, true);
                                printDebug("EntityHead5 - the entity not found: " + entity_name);
                        }
                }
                createDocumentationEntity2(ed, a_token);
    SubSuper5(ed);
    jj_consume_token(SEMICOLON);
//	  if (parser_pass == 1) {
//	  	if (is_abstract_entity) {
//	  		ed.setInstantiable(null, false);
//			}
//	  }
                {if (true) return ed;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.198 ------------ */
  static final public String EntityId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image.replace('$', '+'));}
                } else {
                        {if (true) return (t.image.toLowerCase().replace('$', '+'));}
                }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.74 ---*/
  static final public void EntityInstantiationLoop5(jsdai.lang.EEntity partition) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) EntityInstantiationLoop */
        X_EntityInstantiationLoop jjtn000 = new X_EntityInstantiationLoop(JJTENTITYINSTANTIATIONLOOP);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);boolean increment_like_present = false;
        String var_id = "";
    try {
                printDebug("In EntityInstantiationLoop5, starting");

                //  it has its own scope which extends through the MapProjectClause
                // the openiing of the scope will be handled inside InstantiationLoopControl,
                // closing - here


                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
                variable_id_stack.push(var_id);
                scope_stack.push(current_scope);
                current_scope = new Vector();
      jj_consume_token(FOR);
      increment_like_present = InstantiationLoopControl5();
      jj_consume_token(SEMICOLON);
      MapProjectClause5(partition);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                jjtn000.variable_uid = variable_uid;
                jjtn000.variable_id = var_id;
                jjtn000.partition = (jsdai.SExtended_dictionary_schema.EMap_or_view_partition)partition;
                jjtn000.map_definition = (jsdai.SExtended_dictionary_schema.EMap_definition)active_scope;

                current_scope = (Vector)scope_stack.pop();
                variable_id_stack.pop();

                if (increment_like_present) {
                        active_scope_string = active_scope_extension.getParent_scope_string();
                        active_scope_extension = active_scope_extension.getParent();
                }

                printDebug("In EntityInstantiationLoop5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-+-------- ISO 10303-14:B.2.75 ---*/
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition EntityRef5erence5() throws ParseException, jsdai.lang.SdaiException {
        String schema_name = null;
        String entity_name = null;
                printDebug("In EntityRef5erence5, starting");
    if (jj_2_51(2)) {
      schema_name = InterpretedId5();
      jj_consume_token(DOT);
    } else {
      ;
    }
    entity_name = InterpretedId5();
                printDebug("In EntityRef5erence5, ending,but before find method");
                {if (true) return findEntityReference(entity_name, schema_name);}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.199------------ */
  static final public String EnumerationId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 or > - (Column 3) ---------------------------------------------------- ISO 10303-11:A.2.200------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict in [] construct (column 3).
		 Expansion nested within construct and expansion following construct have common prefixes,
		 one of which is <SIMPLE_ID>. Lookahead of 2 or more should be used for the nested expansion.
*/

// grammar change is needed here
  static final public void EnumerationReference5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
                printDebug("In EnumerationReference5");
    if (jj_2_52(2)) {
      dt = TypeRef5(0);
      jj_consume_token(DOT);
    } else {
      ;
    }
    EnumerationRef5(dt);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.201------------ */


// new 
  static final public void EnumerationType5(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEnumeration_type et = null;
        // String Element5;
        jsdai.lang.A_string elements = null;
        // int Index5 = 1;
        boolean is_extensible = false;
        boolean is_extension = false;
        Vector elementz = new Vector();
        jsdai.SExtended_dictionary_schema.EDefined_type enum_super = null;
    switch (jj_nt.kind) {
    case EXTENSIBLE:
      jj_consume_token(EXTENSIBLE);
                       is_extensible = true;
      break;
    default:
      jj_la1[301] = jj_gen;
      ;
    }
    jj_consume_token(ENUMERATION);

    switch (jj_nt.kind) {
    case BASED_ON:
    case OF:
      switch (jj_nt.kind) {
      case OF:
        jj_consume_token(OF);
        elementz = EnumerationItems5(elementz);
        break;
      case BASED_ON:
        enum_super = EnumerationExtension5(elementz);
                                                                                                           is_extension = true;
        break;
      default:
        jj_la1[302] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[303] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (is_extensible) {
                                if (is_extension) {
                                        // extended_enumeration_type+extensible_enumeration_type
                                                et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtended_enumeration_type$extensible_enumeration_type.class);
                                } else {
                                        // extensible_enumeration_type
                                        et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtensible_enumeration_type.class);
                                }
                        } else {
                                if (is_extension) {
                                        // extended_enumeration_type
                                                et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtended_enumeration_type.class);
                                } else {
                                        // enumeration_type - rather weird, perhaps we needed non-extensible enumeration type in dictionary too.
                                        et = (jsdai.SExtended_dictionary_schema.EEnumeration_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEnumeration_type.class);
                                }
                        }
                        et.setName(null, "_ENUMERATION_" + dt.getName(null));
//		elements = et.createElements(null);
                        elements = et.createLocal_elements(null);
                        dt.setDomain(null, et);

                        for (int i = 0; i < elementz.size(); i++) {
                                elements.addUnordered((String)elementz.elementAt(i));
                        }
                        dt.setDomain(null, et);
                        if (is_extension) {
                                if (et instanceof jsdai.SExtended_dictionary_schema.EExtended_enumeration_type) {
                                        if (enum_super != null) {
                                                if (enum_super.testDomain(null)) {
//							((jsdai.SExtended_dictionary_schema.EExtended_enumeration_type)et).setIs_based_on(null, (jsdai.SExtended_dictionary_schema.EExtensible_enumeration_type)enum_super.getDomain(null));
                                                        ((jsdai.SExtended_dictionary_schema.EExtended_enumeration_type)et).setIs_based_on(null, enum_super);
                                                } else {
                                                }
                                        } else {

                                        }
                                } else {
                                        // something wrong here - internal error
                                }
                        }
                }
  }

// in this version, return  is no longer really needed
  static final public Vector EnumerationItems5(Vector elementz) throws ParseException, jsdai.lang.SdaiException {
        String Element5;
        int Index5 = 1;
    jj_consume_token(LPAREN);
    Element5 = EnumerationId5();
                if (parser_pass == 3) {
                        elementz.addElement(Element5);
                }
    label_102:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[304] = jj_gen;
        break label_102;
      }
      jj_consume_token(COMMA);
      Element5 = EnumerationId5();
                if (parser_pass == 3) {
                        // duplicate Element5 names are now allowed but evaluate to the same value
//			if (isEnumerationElementNotUnique(elements, Element5)) {
//				error_count++;
//				printError("duplicate enumeration Element5 name \"" + Element5 + "\" in enumeration: " + dt.getName(null));
//			}
                        elementz.addElement(Element5);
                }
    }
    jj_consume_token(RPAREN);
                {if (true) return elementz;}
    throw new Error("Missing return statement in function");
  }

// jsdai.lang.A_string EnumerationExtension5(jsdai.SExtended_dictionary_schema.EDefined_type dt, jsdai.SExtended_dictionary_schema.EEnumeration_type et, jsdai.lang.A_string elements) throws jsdai.lang.SdaiException :
  static final public jsdai.SExtended_dictionary_schema.EDefined_type EnumerationExtension5(Vector elementz) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EDefined_type enum_super = null;
    jj_consume_token(BASED_ON);
    enum_super = TypeRef5(0);
    switch (jj_nt.kind) {
    case WITH:
      jj_consume_token(WITH);
      EnumerationItems5(elementz);
      break;
    default:
      jj_la1[305] = jj_gen;
      ;
    }
        // further implementation depends on the approach	
                {if (true) return enum_super;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.202------------ */
  static final public void EscapeStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) EscapeStmt */
  X_EscapeStmt jjtn000 = new X_EscapeStmt(JJTESCAPESTMT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
                printDebug("In EscapeStmt5 starting");
      jj_consume_token(ESCAPE);
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In EscapeStmt5 ending");
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.203------------ */
  static final public void ExplicitAttr5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute a;
        jsdai.SExtended_dictionary_schema.EExplicit_attribute ea = null;
        jsdai.SExtended_dictionary_schema.AExplicit_attribute aa = null;
        jsdai.lang.EEntity bt = null;
        int i = 1;
        boolean optional_flag = false;
        String error_attr_name = "";
        String error_current_name = "";
        String error_supertype_name = "";
        printDebug("In ExplicitAttribute5, starting");
    a = AttributeDecl5(ed, 0);
// System.out.println("XXX: attribute: " + a + ", entity: " + ed + ", pass: " + parser_pass);
                if (parser_pass > 3) {

                        if (a == null) {
                                // attribute not found, probably redeclaring problem
                                error_attr_name = global_attribute_name;
                                error_current_name = ed.getName(null);
                                if (global_entity2 != null) {
                                        error_supertype_name = global_entity2.getName(null);
                                }
//				error_count++;

                // printError("redeclaring attribute \"" + error_attr_name + "\" in entity \"" + error_current_name + "\": the attribute not found in supertype entity \"" + error_supertype_name + "\" entity_name + "\"");

                //				printError("redeclaring attribute \"" + error_attr_name + "\" in entity  \"" + error_current_name + "\": the attribute not found in the supertype entity \"" + error_supertype_name + "\"");

//				printErrorMsg("" + error_attr_name + " - redeclaring attribute in entity  \"" + error_current_name + "\": the attribute not found in the supertype entity \"" + error_supertype_name + "\"", null, true);
                                printDebug("the result from AttributeDecl5 is NULL");
System.out.println("Attribute-NULL, error_attr_name: " + error_attr_name + ", error_current_name " +  error_current_name + ", error_supertype_name " + error_supertype_name + ", entity: " + ed);

                        } else {
                                if (!(a instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute)) {
                                        printWarningMsg("" + a.getName(null) + " - not explicit in pass 5 - STRONG WARNING -, in entity: " + ed.getName(null), null, true);
                                }
                        }




                        if (a != null) {


                        ea = (jsdai.SExtended_dictionary_schema.EExplicit_attribute)a;
                        i = 1;
                        aa = new jsdai.SExtended_dictionary_schema.AExplicit_attribute();
                        if (ea != null) {
//System.out.println("<1> index i: " + i + ", ea: " + ea + ", parent entity: " + ea.getParent(null));
                                aa.addByIndex(i++, ea);
                        } else {
//System.out.println("<1-2> ea is null");
                                printVerbose("ERROR: explicit attribute ea is NULL");
                        }
                }
                else {
                // a == null
                                printDebug("Yes, the result from AttributeDecl5 is NULL");
                                // creating just to avoid null pointer exception later on
                                        aa = new jsdai.SExtended_dictionary_schema.AExplicit_attribute();
                        }

                }
    label_103:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[306] = jj_gen;
        break label_103;
      }
      jj_consume_token(COMMA);
      a = AttributeDecl5(ed, 0);
                if (parser_pass > 3) {
                  ea = null;
                  if (a != null) {
                                printDebug("the result from AttributeDecl5 - a = " + a);
                                ea = (jsdai.SExtended_dictionary_schema.EExplicit_attribute)a;
                        } else {
                                printDebug("a is NULL (the result from AttributeDecl5");
                        }
                        if (ea != null) {
//System.out.println("<2> index i: " + i + ", ea: " + ea + ", parent entity: " + ea.getParent(null));
                                aa.addByIndex(i++, ea);
                        } else {
                                printVerbose("ERROR: explicit attribute ea is NULL");
                        }
                }
    }
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
                             optional_flag = true;
      break;
    default:
      jj_la1[307] = jj_gen;
      ;
    }
    bt = BaseType5(a);
    jj_consume_token(SEMICOLON);
                if (parser_pass > 3) {
        printDebug("XXX: base type: " + bt);


                        // if it is redeclaration of an attribute, check if the type of the redeclaring attribute is compatible with the type of the redeclared one

//			good_type = isExplicitAttributeTypeCompatible(ed, ea, aa, bt);
//			if (!good_type) {
                                // perhaps the printing of the error and the increasing of the number will be done in the function inside
//			}




                        jsdai.lang.SdaiIterator attr_iter = aa.createIterator();

printDDebug("<XXX>");
                        while (attr_iter.next()) {
                                ea = aa.getCurrentMember(attr_iter);
//System.out.println("OO attribute: " + ea   + ", bt: " + bt);
                                if (bt == null) {
printDDebug("XP: ERROR - explicit atttribute daclaration, base type - null: " + ea.getName(null) + ", t: " + bt);
                                } else
                                if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) {
// in earlier passes standard string_type is returned instead of the custom one, here - ok, so take this
//					if (!ea.testDomain(null)) {
                                                ea.setDomain(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//					}
                                } else
                                if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
printDDebug("XP: explicit atttribute daclaration, base type - aggregate: " + ea.getName(null) + ", t: " + bt);
                                        if (!ea.testDomain(null)) {
                                                ea.setDomain(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
                                        }
                                } else
                                if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
printDDebug("XP: explicit atttribute daclaration, base type - named type: " + ea.getName(null) + ", t: " + bt);
                                        if (!ea.testDomain(null)) {
                                                ea.setDomain(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);
                                        }
                                } else
                                if (bt instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                        // express amendment generalized base type issue
                                        if (!ea.testDomain(null)) {
                                                ea.setDomain(null, (jsdai.SExtended_dictionary_schema.EParameter)bt);
                                        }
                                } else {
printDDebug("XP: ERROR - explicit atttribute daclaration, base type - unknown type: " + ea.getName(null) + ", t: " + bt);
                                }
                                ea.setOptional_flag(null, optional_flag);
//System.out.println("SET OPTIONAL 09, attribute: " + ea);
// System.out.println("@X15 attr: " + ea);
                        }
                        // let's add the type compatibility check here
                        if (flag_in_redeclaring) {
//				if (!(isRedeclared_attrCompatible(global_redeclaring, global_redeclared))) {
                                if (false) {
                                        error_count++;
//					printErrorMsg("" + attr.getName(null) + " - incompatible type of redeclared explicit attribute in entity " + attr.getParent(null).getName(null), null, true);
                                }
                                global_redeclaring = null;
                                global_redeclared = null;
                                flag_in_redeclaring = false;
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.204------------ */
  static final public X_Expression Expression5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) Expression */
        X_Expression jjtn000 = new X_Expression(JJTEXPRESSION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand1 = null;
        Object operand1_type = null;
        Object operand2 = null;
        Object operand2_type = null;
        Object result = "";
        String x_operand1 = "";
        String x_operand2 = "";
        double op1double;
        double op2double;
        int op1int;
        int op2int;
        int operation = 0;
        String x_result = "";
        int op_nr = 0;
        int nr_of_operands = 0;
    try {
                printDebug("In Expression5 before SimpleExpression5");
                  X_RelOpExtended jjtn001 = new X_RelOpExtended(JJTRELOPEXTENDED);
                  boolean jjtc001 = true;
                  jjtree.openNodeScope(jjtn001);
                  jjtreeOpenNodeScope(jjtn001);
      try {
        SimpleExpression5();
                printDebug("In Expression5 after SimpleExpression5");
                if (parser_pass == 5) {
                        nr_of_operands++;
                        operand1 = argument_stack.pop();
                        if (flag_type_tracking)
                                operand1_type = type_stack.pop();
                        printStack("POP: Expression5, operand1: " + operand1);
                        if (expression_instances) {
                                // x_operand1 = (String)expression_stack.pop();
                                //printXStack("POP: Expression5, operand1: " + x_operand1);
                                // x_result = x_operand1;
                        }
                        result = operand1;
                }
        if (jj_2_53(2)) {
          operation = RelOpExtended5();
          SimpleExpression5();
                printDebug("In Expression5 after the second SimpleExpression5");

                if (parser_pass == 5) {
                        nr_of_operands++;
                        if (expression_instances) {
//				jjtThis.operations[op_nr++] = operation;
                                jjtn001.operations.add(new Integer(operation));
                                op_nr++;
                        }
                        operand2 = argument_stack.pop();
                        if (flag_type_tracking)
                                operand2_type = type_stack.pop();
                        printStack("POP: Expression5, operand2: " + operand2);
                        if (expression_instances) {
                                // x_operand2 = (String)expression_stack.pop();
                                // printXStack("POP: Expression5, operand2: " + x_operand2);
                        }
                }
        } else {
          ;
        }
      } catch (Throwable jjte001) {
                  if (jjtc001) {
                    jjtree.clearNodeScope(jjtn001);
                    jjtc001 = false;
                  } else {
                    jjtree.popNode();
                  }
                  if (jjte001 instanceof RuntimeException) {
                    {if (true) throw (RuntimeException)jjte001;}
                  }
                  if (jjte001 instanceof ParseException) {
                    {if (true) throw (ParseException)jjte001;}
                  }
                  if (jjte001 instanceof jsdai.lang.SdaiException) {
                    {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                  }
                  {if (true) throw (Error)jjte001;}
      } finally {
                  if (jjtc001) {
                    jjtree.closeNodeScope(jjtn001,  nr_of_operands > 1);
                    jjtreeCloseNodeScope(jjtn001);
                  }
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        switch (operation) {
                                case 1: // <
                                        if (expression_instances) {
                                                // result = "(" + x_operand1 + " < " + x_operand2 + ")";
                                        }
                                        break;
                                case 2: // >
                                        if (expression_instances) {
                                                // result = "(" + x_operand1 + " > " + x_operand2 + ")";
                                        }
                                        break;
                                case 3: // <=
                                        if (expression_instances) {
                                                // result = "(" + x_operand1 + " <= " + x_operand2 + ")";
                                        }
                                        break;
                                case 4: // >=
                                        if (expression_instances) {
                                                // result = "(" + x_operand1 + " >= " + x_operand2 + ")";
                                        }
                                        break;
                                case 5: // <>
                                        if (expression_instances) {
                                                // result = "(" + x_operand1 + " != " + x_operand2 + ")";
                                        }
                                        break;
                                case 6: // =
                                        if (expression_instances) {
                                                // result = "(" + x_operand1 + " == " + x_operand2 + ")";
                                        }
                                        break;
                                case 7: // :<>:
                                        break;
                                case 8: // :=:
                                        break;
                                case 9: // <IN>
                                        break;
                                case 10: // <LIKE>
                                        break;
                                case  0:
                                default:
        //                              printError ("unknown RelOperation"); - or rather no second operand - perfectly ok.
                                        break;
                        }
                        argument_stack.push(result);
                        printStack("PUSH: Expression5, result: " + result);
                        if (expression_instances) {
                                // expression_stack.push(x_result);
                          //    printXStack("PUSH: Expression5, result: " + x_result);
                        }
                }
                {if (true) return jjtn000;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.79 ---*/
  static final public void ExpressionOrWild5() throws ParseException, jsdai.lang.SdaiException {
    if (jj_2_54(1)) {
      Expression5();
    } else {
      switch (jj_nt.kind) {
      case OP_UNDERSCORE:
        jj_consume_token(OP_UNDERSCORE);
        break;
      default:
        jj_la1[308] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

/*--------- ISO 10303-14:B.2.80 ---*/
  static final public jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ExtentReference5() throws ParseException, jsdai.lang.SdaiException {
        String schema_name = null;
        String object_name = null;
    if (jj_2_55(2)) {
      schema_name = InterpretedId5();
      jj_consume_token(DOT);
    } else {
      ;
    }
    object_name = InterpretedId5();
                {if (true) return findEntity_or_view_definition(object_name, schema_name);}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.205------------ */
  static final public void Factor5() throws ParseException, jsdai.lang.SdaiException {
        Object operand1 = null;
        Object operand2 = null;
        String x_operand1 = "";
        String x_operand2 = "";
        String x_result = "";
        boolean power_present = false;
                printDebug("In Factor5 before SimpleFactor5");
          X_PowerOp jjtn001 = new X_PowerOp(JJTPOWEROP);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
          jjtreeOpenNodeScope(jjtn001);
    try {
      SimpleFactor5();
                printDebug("In Factor5 after SimpleFactor5");
                if (parser_pass == 5) {
                        operand1 = argument_stack.pop();
                        printStack("POP: Factor5, operand1: " + operand1);
                        if (expression_instances) {
                // x_operand1 = (String)expression_stack.pop();
                                // x_result = x_operand1;
                                // printXStack("POP: Factor5, operand1: " + x_operand1);
                        }
                }
      if (jj_2_56(2)) {
        jj_consume_token(STARS);
        SimpleFactor5();
                power_present = true;
                printDebug("In Factor5 after second SimpleFactor5");
                if (parser_pass == 5) {
                        operand2 = argument_stack.pop();
                        printStack("POP: Factor5, operand 2: " + operand2);
                        if (expression_instances) {
                                // x_operand2 = (String)expression_stack.pop();
                                // printXStack("POP: Factor5, operand2: " + x_operand2);
                                // modify x_result here
                        }
                }
      } else {
        ;
      }
    } catch (Throwable jjte001) {
          if (jjtc001) {
            jjtree.clearNodeScope(jjtn001);
            jjtc001 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte001 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte001;}
          }
          if (jjte001 instanceof ParseException) {
            {if (true) throw (ParseException)jjte001;}
          }
          if (jjte001 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte001;}
          }
          {if (true) throw (Error)jjte001;}
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001,  power_present);
            jjtreeCloseNodeScope(jjtn001);
          }
    }
                if (parser_pass == 5) {
                        // implement ** operation here operand1 = operand1 ** operand2
                        argument_stack.push(operand1);
                        printStack("PUSH: Factor5: " + operand1);
                        if (expression_instances) {
                                // expression_stack.push(x_result);
                                // printXStack("PUSH: Factor5, result: " + x_result);
                        }
                }
  }

/*--------- ISO 10303-14:B.2.82 ---*/
  static final public void ForeachExpr5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ForeachExpr */
        X_ForeachExpr jjtn000 = new X_ForeachExpr(JJTFOREACHEXPR);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object in_exp = null;
        Object return_exp = null;
        ECtVariable var = null;
        String variable_id = null;
        jsdai.lang.EEntity variable_parameter_type = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type = null;
        String var_id = "";
        String variable_key = "";
    try {
                printDebug("In ForEachExpr5, starting");
                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
                variable_id_stack.push(var_id);
                scope_stack.push(current_scope);
                current_scope = new Vector();
      jj_consume_token(EACH);
      variable_id = VariableId5();
                global_flag_for_expression_inside = false;
                if (expression_instances) {
                                jjtn000.foreach_variable_id = variable_id;
                                jjtn000.foreach_variable_uid = (String)variable_id_stack.peek() + variable_id;
                                jjtn000.foreach_variable_scope_id = (String)variable_id_stack.peek();
                }

                // do we need to create it anew?
          active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension, active_scope_string, "" + variable_uid, variable_id);
                active_scope_string = "";

                var = findVariableX(variable_id);
                var.scope_id = (String)variable_id_stack.peek();
                current_scope.addElement(var);
      jj_consume_token(IN);
      Expression5();

      switch (jj_nt.kind) {
      case WHERE:
        WhereClause5(active_scope);
        break;
      default:
        jj_la1[309] = jj_gen;
        ;
      }
      jj_consume_token(RETURN);
      Expression5();
  jjtree.closeNodeScope(jjtn000, true);
  jjtc000 = false;
  jjtreeCloseNodeScope(jjtn000);
                // TOCHECK - if pop is needed
                return_exp = argument_stack.pop();
                printStack("POP: For EACH RETURN Expression5 in Query: " + return_exp);

                if (expression_instances) {
// System.out.println("ForEach - setting outer: " + 	global_flag_for_expression_inside);	
                        jjtn000.outer = global_flag_for_expression_inside;
                }

                global_flag_for_expression_inside = true;
// System.out.println("ForEach - before returning: " + 	global_flag_for_expression_inside);	




                current_scope = (Vector)scope_stack.pop();
                variable_id_stack.pop();
                active_scope_string = active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();
                printDebug("In ForEachExpr5, ending");
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
  }

/*--------- ISO 10303-14:B.2.83 ---*/
  static final public void ForloopExpr5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ForloopExpr */
        X_ForloopExpr jjtn000 = new X_ForloopExpr(JJTFORLOOPEXPR);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand = null;
        String var_id = "";
        boolean increment_present = false;
    try {
                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
//		var_id += "_implicit_" + variable_uid + "_" + "_e_";
                variable_id_stack.push(var_id);
                printDebug("In ForLoopExpr5, starting");
                scope_stack.push(current_scope);
                current_scope = new Vector();
                global_flag_for_expression_inside = false;
      // RepeatControl5() <RETURN> MapAttrAssgnmtExpr()
              increment_present = RepeatControl5();
      jj_consume_token(RETURN);
      Expression5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
//			operand = argument_stack.pop();
//			printStack("POP: RepeatStmt5, return value: " + operand);


                }

                if (expression_instances) {
                        jjtn000.outer = global_flag_for_expression_inside;
                }
                global_flag_for_expression_inside = true;

                current_scope = (Vector)scope_stack.pop();
                variable_id_stack.pop();
                printDebug("In ForLoopExpr5, ending");
                if (increment_present) {
                active_scope_string = active_scope_extension.getParent_scope_string();
                        active_scope_extension = active_scope_extension.getParent();
                }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.206------------ */
  static final public jsdai.lang.EEntity FormalParameter5(jsdai.SExtended_dictionary_schema.AParameter parameters, boolean var_present, /* jsdai.SSdai_expressions_schema.AVariable fp_parameters,*/ jsdai.lang.EEntity owner) throws ParseException, jsdai.lang.SdaiException {
        String par_name;
        Vector par_names = new Vector();
        jsdai.lang.EEntity pt = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        // jsdai.SSdai_expressions_schema.EEntity_variable ev = null;
        int parameter_counter = 0;
        jsdai.SExtended_dictionary_schema.EParameter par2 = null;
                printDebug("In FormalParameter5, starting");
    par_name = ParameterId5();
                parameter_counter++;
                par_names.addElement(par_name);
    label_104:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[310] = jj_gen;
        break label_104;
      }
      jj_consume_token(COMMA);
      par_name = ParameterId5();
                        parameter_counter++;
                        par_names.addElement(par_name);
    }
    jj_consume_token(COLON);
    par = ParameterType5();
                if (parser_pass == 5) {
                        if (parameters != null) {
// printDDebug("Last Parameter5 name: " + par_name);
if (par == null) {
;//     printDDebug("par is NUL");
} else {
;//     printDDebug("par is NOT null");
}
if (par_names == null) {
;//     printDDebug("par_names is NUL");
} else {
;//     printDDebug("par_names is NOT null, number: " + par_names.size());
}

                                if (par != null) {
                                        par.setName(null, (String)par_names.elementAt(0));
                                        if (var_present) {
                                                par.setVar_type(null, true);
                                        }
                                        current_scope.addElement(par);
                                        parameters.addByIndex(parameters.getMemberCount()+1,par);
                                        for (int i = 1; i < parameter_counter; i++) {
                                                par2 = (jsdai.SExtended_dictionary_schema.EParameter)par.copyApplicationInstance(model);
                                                par2.setName(null, (String)par_names.elementAt(i));
                                                if (var_present) {
                                                        par2.setVar_type(null, true);
                                                }
                                                current_scope.addElement(par2);
                                                parameters.addByIndex(parameters.getMemberCount()+1, par2);
                                        }
                                } else {
                                        printVerbose("ERROR: formal parameter par NULL");
                                }
                        }
                        if (expression_instances) {
                                if (pt != null) {
                                        if (pt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                                for (int i = 0; i < par_names.size(); i++) {
                                                        String par_name1 = (String)par_names.elementAt(i);
                                                  // ev = (jsdai.SSdai_expressions_schema.EEntity_variable)expression_model.createEntityInstance(jsdai.SSdai_expressions_schema.CEntity_variable.class);
                                                        // ev.setOwner(null, owner);
                                                        // ev.setVariable_name(null, par_name1);
                                                        // ev.setDefinition(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)pt);
                // fp_parameters.addByIndex(fp_parameters.getMemberCount()+i+1, ev);
                                                        // current_scope.addElement(ev);
            }
                                        } else {
                                                printDebug("In Formal Parameter5 - not entity");
                                        }
                                }
                        }
                }

                printDebug("In FormalParameter5, ending");
                {if (true) return pt;} // really needed at all?

    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.85 ---*/
  static final public void ForwardPathQualifier5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ForwardPathQualifier */
  X_ForwardPathQualifier jjtn000 = new X_ForwardPathQualifier(JJTFORWARDPATHQUALIFIER);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      jj_consume_token(FPATH);
      AttributeRef5(null, null, -1, null);
      if (jj_2_57(2147483647)) {
        PathCondition5();
      } else {
        ;
      }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-+-------- ISO 10303-14:B.2.86 ---*/
// void ForExpr5() throws jsdai.lang.SdaiException #ForExpr :
  static final public void ForExpr5() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(FOR);
    switch (jj_nt.kind) {
    case EACH:
      ForeachExpr5();
      break;
    case RETURN:
    case UNTIL:
    case WHILE:
    case SIMPLE_ID:
      ForloopExpr5();
      break;
    default:
      jj_la1[311] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*-+-------- ISO 10303-14:B.2.87 ---*/
  static final public void FromClause5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
                printDebug("In FromClause5, starting, parent: " + parent);
                from_order_count = 0;
    jj_consume_token(FROM);
    label_105:
    while (true) {
      SourceParameter5(parent);
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[312] = jj_gen;
        break label_105;
      }
    }
printDebug("In FromClause5, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.207------------ */
  static final public Object FunctionCall5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) FunctionCall */
        X_FunctionCall jjtn000 = new X_FunctionCall(JJTFUNCTIONCALL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);int built_in_id = -1;
        Vector arguments = new Vector();
        Vector expressions = new Vector();
        int arg_count = -1;
        Object result = null;
        Object function_instance = null;
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
        int sizeof_restriction_value;
        boolean is_spec_error_sizeof;
        boolean is_spec_warning_sizeof;
        boolean is_outer_sizeof;
    try {
                printDebug("Starting FunctionCall5");
                sizeof_restriction_value = global_sizeof_restriction_value;
                is_spec_error_sizeof = global_is_spec_error_sizeof;
                is_spec_warning_sizeof = global_is_spec_warning_sizeof;
                is_outer_sizeof = global_is_outer_sizeof;

                global_sizeof_restriction_value = -1;
                global_is_spec_error_sizeof = false;
                global_is_spec_warning_sizeof = false;
                global_is_outer_sizeof = false;
      switch (jj_nt.kind) {
      case ABS:
      case ACOS:
      case ASIN:
      case ATAN:
      case BLENGTH:
      case COS:
      case EXISTS:
      case EXP:
      case EXTENT:
      case FORMAT:
      case HIBOUND:
      case HIINDEX:
      case LENGTH:
      case LOBOUND:
      case LOG:
      case LOG10:
      case LOG2:
      case LOINDEX:
      case NVL:
      case ODD:
      case ROLESOF:
      case SIN:
      case SIZEOF:
      case SQRT:
      case TAN:
      case TYPEOF:
      case USEDIN:
      case VALUE:
      case VALUE_IN:
      case VALUE_UNIQUE:
        built_in_id = BuiltInFunction5();
        break;
      case SIMPLE_ID:
        fd = FunctionRef5();
        break;
      default:
        jj_la1[313] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      switch (jj_nt.kind) {
      case LPAREN:
        arg_count = ActualParameterList5(arguments, expressions);
        break;
      default:
        jj_la1[314] = jj_gen;
        ;
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        if (built_in_id > 0) {
                                result = new Integer(built_in_id);
                        } else {
                                result = fd;
                                if (fd.getName(null).equalsIgnoreCase("bag_to_set")) {
                                        // treat this function as a  built-in one, the optimized version is implemented in lang
                                        built_in_id = 31;
                                }
                        }
                        if (built_in_id == 22) {
//				++sizeof_depth;
                        if (is_outer_sizeof) {
                                jjtn000.outer_sizeof = true;
                                jjtn000.sizeof_is_warning = is_spec_warning_sizeof;
                                jjtn000.sizeof_is_error = is_spec_error_sizeof;
                                jjtn000.sizeof_value = sizeof_restriction_value;
                        } else {
                                jjtn000.outer_sizeof = false;
                                jjtn000.sizeof_is_warning = false;
                                jjtn000.sizeof_is_error = false;
                                jjtn000.sizeof_value = -1;
                        }

                        } else {
                        }
                        jjtn000.built_in_id = built_in_id;
                        jjtn000.fd = fd;
                        jjtn000.scope = active_scope;
                        jjtn000.arguments = arguments;
                        jjtn000.argument_count = arg_count;
                        switch (built_in_id) {
                                case -1: // not a built in function
                                        break;
                                case  0: // unknown built in function, internal error
                                        break;
                                case  1: // ABS - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ABS", null, true);

                                        }
                                        // create instance of abs_function, assign it to function_instance variable.
                                        // set the operand attribute with the value from expressions (Parameter5 from ActualParameterList5() - extract the first Element5 of Vector)
                                        if (expression_instances) {
// printDebug("before creating abs_function instance");
                                                // abs_f = (jsdai.SIso13584_expressions_schema.EAbs_function)expression_model.createEntityInstance(jsdai.SIso13584_expressions_schema.CAbs_function.class);
// printDebug("after creating abs_function instance");
                                                // Object arg_inst = expressions.elementAt(0);
                                                // if (arg_inst instanceof jsdai.SIso13584_expressions_schema.ENumeric_expression) {
                                                        // abs_f.setOperand(null, (jsdai.SIso13584_expressions_schema.ENumeric_expression)arg_inst);
                                                // } else {
                                                        // printError("INSTANTIATING EXPRESSIONS: ABS built-in function argument is not a numeric_expression");
                                                // }
                                                // function_instance = abs_f;
                                        }
                                        break;
                                case  2: // ACOS - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ACOS", null, true);

                                        }
                                        // acos_function
                                        break;
                                case  3: // ASIN - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ASIN", null, true);

                                        }
                                        // asin_function
                                        break;
                                case  4: // ATAN - 2
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ATAN", null, true);

                                        }
                                        break;
                                case  5: // BLENGTH - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function BLENGTH", null, true);

                                        }
                                        break;
                                case  6: // COS  - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function COS", null, true);

                                        }
                                        // cos_function
                                        break;
                                case  7: // EXISTS  - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function EXISTS", null, true);

                                        }
                                        break;
                                case  8: // EXP - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function EXP", null, true);

                                        }
                                        // exp_function
                                        break;
                                case  9: // FORMAT - 2
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function FORMAT", null, true);

                                        }
                                        break;
                                case 10: // HIBOUND - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function HIBOUND", null, true);

                                        }
                                        break;
                                case 11: // HIINDEX - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function HIINDEX", null, true);

                                        }
                                        break;
                                case 12: // LENGTH - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LENGTH", null, true);

                                        }
                                        break;
                                case 13: // LOBOUND  - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOBOUND", null, true);

                                        }
                                        break;
                                case 14: // LOINDEX - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOINDEX", null, true);

                                        }
                                        break;
                                case 15: // LOG - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOG", null, true);

                                        }
                                        // log_function
                                        break;
                                case 16: // LOG2 - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOG2", null, true);

                                        }
                                        // log2_function
                                        break;
                                case 17: // LOG10 - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function LOG10", null, true);

                                        }
                                        // log10_function
                                        break;
                                case 18: // NVL - 2
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function NVL", null, true);

                                        }
                                        break;
                                case 19: // ODD - 1 
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ODD", null, true);

                                        }
                                        break;
                                case 20: // ROLESOF - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function ROLESOF", null, true);

                                        }
                                        break;
                                case 21: // SIN - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function SIN", null, true);

                                        }
                                        break;
                                case 22: // SIZEOF - 1
//					arg_count = 1; // temporary fix
                                        if (arg_count != 1) {
                                                error_count++;
//						printErrorMsg5("function call has wrong number of arguments for built-in function SIZEOF", null, true);

System.out.println("5th pass");
                                                printErrorMsg5("function call has wrong number of arguments for built-in function SIZEOF: " + arg_count, null, true);

                                        }
                                        break;
                                case 23: // SQRT - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function SQRT", null, true);

                                        }
                                        // square_root_function
                                        break;
                                case 24: // TAN - 1
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function TAN", null, true);

                                        }
                                        // tan_function
                                        break;
                                case 25: // TYPEOF - 1 parameter
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function TYPEOF", null, true);

                                        }
                                        break;
                                case 26: // USEDIN  - 2 parameters
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function USEDIN", null, true);

                                        }
                                        break;
                                case 27: // VALUE - 1 parameter
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function VALUE", null, true);

                                        }
                                        break;
                                case 28: // VALUE_IN - 2  parameters
                                        if (arg_count != 2) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function VALUE_IN", null, true);

                                        }
                                        break;
                                case 29: // VALUE_UNIQUE - 1 parameter
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has wrong number of arguments for built-in function VALUE_UNIQUE", null, true);

                                        }
                                        break;
                                case 30: // EXTENT - ?  - this is Express X, look up the number of parameters
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has a wrong number of arguments for built-in function EXTENT", null, true);
                                        }
                                        break;
                                case 31: // bag_to_set - ?  - this is a pseudo-built-in function
                                        if (arg_count != 1) {
                                                error_count++;
                                                printErrorMsg5("function call has a wrong number of arguments for function bag_to_set", null, true);
                                        }
                                        break;
                                default: // must be an internal error.
                                        break;
                        }
                        argument_stack.push(result);
                        printStack("PUSH: FunctionCall5: " + result);
                        if (expression_instances) {
                                // expression_stack.push(function_instance);
                        }
                        printDebug("Ending FunctionCall5: " + built_in_id);
                }
                {if (true) return result;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.208------------ */
  static final public void FunctionDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) FunctionDecl */
        X_FunctionDecl jjtn000 = new X_FunctionDecl(JJTFUNCTIONDECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
    try {
      try {
                printDebug("In FunctionDecl5, starting");
                scope_stack.push(current_scope);
                current_scope = new Vector();
        fd = FunctionHead5();
        AlgorithmHead5();
                                                    X_ListOfStmt jjtn001 = new X_ListOfStmt(JJTLISTOFSTMT);
                                                    boolean jjtc001 = true;
                                                    jjtree.openNodeScope(jjtn001);
                                                    jjtreeOpenNodeScope(jjtn001);
        try {
          label_106:
          while (true) {
            Stmt5();
            switch (jj_nt.kind) {
            case SEMICOLON:
            case ALIAS:
            case BEGIN:
            case CASE:
            case ESCAPE:
            case IF:
            case INSERT:
            case REMOVE:
            case REPEAT:
            case RETURN:
            case KW_SKIP:
            case SIMPLE_ID:
              ;
              break;
            default:
              jj_la1[315] = jj_gen;
              break label_106;
            }
          }
        } catch (Throwable jjte001) {
                                                    if (jjtc001) {
                                                      jjtree.clearNodeScope(jjtn001);
                                                      jjtc001 = false;
                                                    } else {
                                                      jjtree.popNode();
                                                    }
                                                    if (jjte001 instanceof RuntimeException) {
                                                      {if (true) throw (RuntimeException)jjte001;}
                                                    }
                                                    if (jjte001 instanceof ParseException) {
                                                      {if (true) throw (ParseException)jjte001;}
                                                    }
                                                    if (jjte001 instanceof jsdai.lang.SdaiException) {
                                                      {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                                                    }
                                                    {if (true) throw (Error)jjte001;}
        } finally {
                                                    if (jjtc001) {
                                                      jjtree.closeNodeScope(jjtn001, true);
                                                      jjtreeCloseNodeScope(jjtn001);
                                                    }
        }
        jj_consume_token(END_FUNCTION);
                function_depth--;
                if (function_depth > 0) {
                        active_scope = getParentFunctionProcedureRuleDefinition(fd);
                active_scope_string =  active_scope_extension.getParent_scope_string();
                  active_scope_extension = active_scope_extension.getParent();
                } else {
// System.out.println("function ending in pass 5 - active_scope BEFORE: " + active_scope);	
// System.out.println("function ending in pass 5 - active_scope_extension BEFORE: " + active_scope_extension);	
                        active_scope = null;
                active_scope_string =  active_scope_extension.getParent_scope_string();
                  active_scope_extension = active_scope_extension.getParent();
// System.out.println("function ending in pass 5 - AFTER: " + fd.getName(null) + ", active_scope_extension: " + active_scope_extension);	
                }
        jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                printDebug("In FunctionDecl5, ending");
                if (parser_pass == 5) {
                        {
// System.out.println("YHAA-01: " + rtp); 
                                jjtn000.fd = fd;
//				jjtThis.return_type_parameter = rtp;
                        }
                }
      } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
         printErrorMsg5(e.getMessage(), null, true);
        // System.out.println("ERROR RECOVERY: skipping to END_FUNCTION");
                error_count++;
        recoverFromParseException(END_FUNCTION, e);
      }
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.209------------ */
  static final public jsdai.SExtended_dictionary_schema.EFunction_definition FunctionHead5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) FunctionHead */
        X_FunctionHead jjtn000 = new X_FunctionHead(JJTFUNCTIONHEAD);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String name = null;
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration fund;
        // jsdai.SSdai_expressions_schema.EExpress_function ef = null;
        // jsdai.SSdai_expressions_schema.AVariable ef_parameters = null;
        jsdai.SExtended_dictionary_schema.EParameter rpt = null;
//      jsdai.lang.EEntity rt = null;
        jsdai.SExtended_dictionary_schema.EData_type rt = null;
        jsdai.SExtended_dictionary_schema.AParameter parameters = null;
        String return_type_label = null;
        jsdai.lang.A_string return_type_labels = null;
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
    try {
                printDebug("In FunctionHead5, starting");
      jj_consume_token(FUNCTION);
                    function_depth++;
      name = FunctionId5();
                if ((expression_instances) && (parser_pass == 5) && (function_depth > 1)){
                        if (active_scope instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
//				printWarning("nested functions not yet supported. Inner function: " + name + " in " + ((jsdai.SExtended_dictionary_schema.EFunction_definition)active_scope).getName(null));

//				printWarningMsg("" + name + " - inner function, nested functions not yet supported, in " + ((jsdai.SExtended_dictionary_schema.EFunction_definition)active_scope).getName(null), null, true);
                        } else {
//				printWarning("nested functions not yet supported. Inner function: " + name);
//				printWarningMsg("" + name + " - inner function, nested functions not yet supported", null, true);
                        }
                }
                if (parser_pass == 1) {
                        printVerbose("Function: " + name);
//			fd = findFunction_definition(name);
                        fd = findFunction_definitionX(name);
                        if (fd != null) {
                                                error_count++;
                                                printDebug("duplicate function name \"" + name + "\"");
                        } else {
                                String wrong_name = findAnyName(name);
                                if (wrong_name != null) {
                                                error_count++;
                                                printDebug("duplicate name \"" + name + "\". The same name used for a function and for " + wrong_name);
                                }
                        }
                  if (function_depth == 1) {
                                fd = (jsdai.SExtended_dictionary_schema.EFunction_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_definition.class);
                                active_scope = fd;
                                fund = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_declaration$local_declaration.class);
                                fund.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                // fund.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                fund.setDefinition(null, fd);
                                if (flag_oc) {
                                        fd.setName(null, name);
                                } else {
                                        fd.setName(null, name.toLowerCase());
                                }
                                parameters = fd.createParameters(null);
                                hm_current_function_declarations.put(name.toLowerCase(), fund);
                        } else {


                                fd = (jsdai.SExtended_dictionary_schema.EFunction_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_definition.class);
                                fund = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_declaration$inner_declaration.class);
                                fund.setParent(null, sd);
                                ((jsdai.SExtended_dictionary_schema.EInner_declaration)fund).setScope(null,active_scope);
                                active_scope = fd;
                                                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // fund.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                fund.setDefinition(null, fd);
                                hm_current_function_declarations.put(name.toLowerCase(), fund);
                                if (flag_oc) {
                                        fd.setName(null, name);
                                } else {
                                        fd.setName(null, name.toLowerCase());
                                }
                                parameters = fd.createParameters(null);



                        }
                } else {
                        if (function_depth == 1) {
//				fd = findFunction_definition(name);
                                fd = findFunction_definitionX(name);
                          active_scope_extension = new ECtScope(active_scope, fd, active_scope_extension, active_scope_string, name, name.toLowerCase());
                        active_scope_string = "";
                                active_scope = fd;
                                if (fd == null) {
                                        error_count++;
                                        printErrorMsg5("" + name + " - function not found", null, true);
                                        printDebug("FunctionHead5 - function not found: " + name);
                                } else {
                                        parameters = fd.getParameters(null);
                                }
                        } else {

//				fd = findFunction_definition(name);
                                fd = findFunction_definitionX(name);
                          active_scope_extension = new ECtScope(active_scope, fd, active_scope_extension, active_scope_string, name, constructFunctionKey(name));
                        active_scope_string = "";
                                active_scope = fd;
                                if (fd == null) {
                                        error_count++;
                                        printErrorMsg5("" + name + " - function not found", null, true);
                                        printDebug("FunctionHead5 - function not found: " + name);
                                } else {
                                        parameters = fd.getParameters(null);
                                }

                        }
                        if (parser_pass == 5) {
                                if (expression_instances) {
                                  // ef = (jsdai.SSdai_expressions_schema.EExpress_function)expression_model.createEntityInstance(jsdai.SSdai_expressions_schema.CExpress_function.class);
                                        // ef.setDefinition(null, fd);
                                        // ef_parameters = ef.createParameters(null);
                                }
                        }
                }
      switch (jj_nt.kind) {
      case LPAREN:
        jj_consume_token(LPAREN);
        FormalParameter5(parameters, false, /* ef_parameters, ef*/ null);
        label_107:
        while (true) {
          switch (jj_nt.kind) {
          case SEMICOLON:
            ;
            break;
          default:
            jj_la1[316] = jj_gen;
            break label_107;
          }
          jj_consume_token(SEMICOLON);
          FormalParameter5(parameters, false, /* ef_parameters, ef */ null);
        }
        jj_consume_token(RPAREN);
        break;
      default:
        jj_la1[317] = jj_gen;
        ;
      }
      jj_consume_token(COLON);
      rpt = ParameterType5();
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
//                      jjtThis.name = name;
                        if (rpt != null) {
//  System.out.println("YHAA-02: " + rpt); 
                         jjtn000.return_type_parameter = rpt;

//				rtp = rpt;
                                if (rpt.testParameter_type(null)) {
                                        rt = rpt.getParameter_type(null);
                                        if (rpt.testType_labels(null)) {
                                                jsdai.lang.A_string type_labels = rpt.getType_labels(null);
                                                if (type_labels.getMemberCount() > 0) {
                jsdai.lang.A_string return_labels = fd.createReturn_type_labels(null);
                jsdai.lang.SdaiIterator iter_labels = type_labels.createIterator();
              int label_count = 1;
              boolean already_done = false; // deprecated
              while (iter_labels.next()) {
              String label = type_labels.getCurrentMember(iter_labels);
                return_labels.addByIndex(label_count++, label);
                // the whole "if" stuff is depricated, attribute return_type_label is depricated
                if (!label.equals("") && !already_done) {
                        return_type_label = label;
                        already_done = true;
                }
              } // while
                                                }
                                        }
                         } else {
                                        printDDebug("Oo> parameter_type unset in function_head: " + name);
                                }
                        }
//                      jjtThis.return_type = rt;
                        if (fd != null) {
                                if (rt != null) {
                                        fd.setReturn_type(null, rt);
                                } else {
                                        printDDebug("In FunctionHead5, rt is NULL, function: " + name);
                                }
                                if (return_type_label != null) {
                                        fd.setReturn_type_label(null, return_type_label);
                                }
                        }
                        printVerbose("Function: " + name);
                        if (expression_instances) {
                                // if (rt != null) {
                                        // if (rt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) {
                                                // ef.setReturn_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)rt);
                                        // } else
                                        // if (rt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                                // ef.setReturn_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)rt);
                                        // }
                                // }
                        }
                        if (function_depth == 1) {
//				String function_description = "";
                                String function_description = " ";
                                int local_function_depth = 1;
                        for (int i = 1; ; i++) {
                                        Token t = getToken(i);
                                        if (t.kind == FUNCTION) {
                                                local_function_depth++;
                                        }
                                        if (t.kind == END_FUNCTION) {
                                                local_function_depth--;
                                                if (local_function_depth == 0) {
                                                 // printDDebug("Break, function depth: " + local_function_depth);
                                                 break;
                                                } else {
                                                 ; // printDDebug("Continue, function depth: " + local_function_depth);
                                                }

                                        }
                                        if (first_token) {
                                                start_token = t;
                                                end_token = t;
                                                first_token = false;
                                        } else {
                                                end_token = t;
                                        }
                                        // is it needed?
                                        if (flag_oc) {
                                                function_description += t.image + " ";
                                        } else {
                                                function_description += t.image.toLowerCase() + " ";
                                        }
//					function_description += t.image;
                        }
                                // printDDebug("Function: " + function_description);
                                createExpressEntity(fd, function_description, start_token, end_token);
//				createExpressEntity(fd, function_description);
                        }
                }

                printDebug("In FunctionHead5, ending: " + name);
                // return ef;
                {if (true) return fd;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.210------------ */
  static final public String FunctionId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
// printDDebug("## FUNCTION: " + t.image.toLowerCase());
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.211------------ */
// extended - GenericEntityType5 ----
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralizedTypes5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        // jsdai.lang.EEntity gt = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.lang.EEntity ae = null;
                printDebug("In GeneralizedTypes5, starting");
    switch (jj_nt.kind) {
    case GENERIC_ENTITY:
      par = GenericEntityType5();
      break;
    case AGGREGATE:
      par = AggregateType5();
      break;
    case ARRAY:
    case BAG:
    case LIST:
    case SET:
      par = GeneralAggregationTypes5();
      break;
    case GENERIC:
      par = GenericType5();
      break;
    default:
      jj_la1[318] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In GeneralizedTypes5, ending: " + par);
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.212------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralAggregationTypes5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter par = null;
                printDebug("In GeneralAggregationTypes5, starting");
    switch (jj_nt.kind) {
    case ARRAY:
      par = GeneralArrayType5();
      break;
    case BAG:
      par = GeneralBagType5();
      break;
    case LIST:
      par = GeneralListType5();
      break;
    case SET:
      par = GeneralSetType5();
      break;
    default:
      jj_la1[319] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In GeneralAggregationTypes5, ending");
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.213------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralArrayType5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.EArray_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        String bound_name;
        jsdai.lang.EEntity bt;
        boolean optional = false;
        boolean unique = false;
                printDebug("In GeneralArrayType5, starting");
    jj_consume_token(ARRAY);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec5();
      break;
    default:
      jj_la1[320] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    switch (jj_nt.kind) {
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
                                                          optional = true;
      break;
    default:
      jj_la1[321] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case UNIQUE:
      jj_consume_token(UNIQUE);
                                                                                        unique = true;
      break;
    default:
      jj_la1[322] = jj_gen;
      ;
    }
    par = ParameterType5();
                if (parser_pass == 5) {
                        at = (jsdai.SExtended_dictionary_schema.EArray_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CArray_type.class);
                        bound_name = getBoundString(1, bounds, optional, unique);
                        at.setName(null, "_GENERALARRAY" + bound_name + _data_type_name);
                        _data_type_name = "_GENERALARRAY"  + bound_name + _data_type_name;
                        // better check these bounds for array
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_index(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_index(null, bounds[1]);
                        }       else {
                                printDebug("Undefined upper Index5 of an array");
//      at.unsetUpper_index(null);  // no need for that it is unset after creating
                        }
                        // set element_type
                        at.setUnique_flag(null, unique);
                        at.setOptional_flag(null, optional);
// System.out.println("SET OPTIONAL 10, attribute: " + at);
                        if (par.testParameter_type(null)) {
                                at.setElement_type(null, par.getParameter_type(null));
                        } else {
                                printDDebug("Oo> parameter_type unset in general_array_type: ARRAY OF " + par);
                        }
//                      bt = par.getParameter_type(null);
//                      if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type)
//                              at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//                      else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type)
//                              at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//                      else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//                              at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_general_array_type_");
                        if (par.testType_labels(null)) {
                                // need to add those labels to this one
                                jsdai.lang.A_string new_labels = result.createType_labels(null);
        jsdai.lang.A_string labels = par.getType_labels(null);
        jsdai.lang.SdaiIterator iter_labels = labels.createIterator();
        String label = "";
        int label_index = 1;
                                new_labels.addByIndex(label_index++, label);
        while (iter_labels.next()) {
                label  = labels.getCurrentMember(iter_labels);
                                        new_labels.addByIndex(label_index++, label);
        }


                        }



                }
                printDebug("In GeneralArrayType5, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.95 ---*/
  static final public void GeneralAttributeQualifier5() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(DOT);
    AttributeRef5(null, null, -1, null);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.214------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralBagType5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.EBag_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        String bound_name;
        int bound_value;
        jsdai.lang.EEntity bt;
                printDebug("In GeneralBagType5, starting");
    jj_consume_token(BAG);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec5();
      break;
    default:
      jj_la1[323] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    par = ParameterType5();
//System.out.println("<RR><PASS 5> generalbag element type: " + par + ", pass: " + parser_pass);
                if (parser_pass == 5) {

                        boolean must_create = false;
                        if (bounds[1] != null) {
                                if (bounds[1] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[1]).getBound_value(null);
                                        if (bound_value != Integer.MIN_VALUE) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }
                        if (bounds[0] != null) {
                                if (bounds[0] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[0]).getBound_value(null);
                                        if (bound_value != 0) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }

                        if (par != null) {
                                if (par.testParameter_type(null)) {
                                        if (par.getParameter_type(null) != _st_generic) {
                                                must_create = true;
                                        } else {
                                                if (par.testType_labels(null)) {
                                                        must_create = true;
                                                }
                                        }
                        } else {
                                // why unset?
                                must_create = true;
                        }
                  } else {
                    // not standart type, but, on the other hand, something wrong here
                        must_create = true;
                  }

                        if (must_create) {


                        at = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
                        bound_name = getBoundString(0, bounds, false, false);
                        at.setName(null, "_GENERALBAG" + bound_name + _data_type_name);
                        _data_type_name = "_GENERALBAG" + bound_name + _data_type_name;
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        }       else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                        // set element_type
                        if (par.testParameter_type(null)) {
                                at.setElement_type(null, par.getParameter_type(null));
                                // at.setElement_type(null, par); // impossible
                        } else {
                                printDDebug("Oo> parameter_type unset in general_bag_type: BAG OF " + par);
                        }

                  } else {
                        at = _st_bag_generic;
//				_data_type_name = "_BAG_GENERIC";
                                _data_type_name = "_GENERALBAG_0_GENERIC";
                  }

// System.out.println("<RR><PASS 5> generalbag type: " + at + ", pass: " + parser_pass);

//      bt = par.getParameter_type(null);
//	    if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type)
//  	    at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//      else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type)
//  	    at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//      else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//    	  at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_general_bag_type_");
                        if (par.testType_labels(null)) {
                                // need to add those labels to this one
                                jsdai.lang.A_string new_labels = result.createType_labels(null);
        jsdai.lang.A_string labels = par.getType_labels(null);
        jsdai.lang.SdaiIterator iter_labels = labels.createIterator();
        String label = "";
        int label_index = 1;
                                new_labels.addByIndex(label_index++, label);
        while (iter_labels.next()) {
                label  = labels.getCurrentMember(iter_labels);
                                        new_labels.addByIndex(label_index++, label);
        }


                        }
                }


                printDebug("In GeneralBagType5, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.215------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralListType5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.EList_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        String bound_name;
        int bound_value;
        jsdai.lang.EEntity bt;
        boolean unique = false;
                printDebug("In GeneralListType5, starting");
    jj_consume_token(LIST);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec5();
      break;
    default:
      jj_la1[324] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    switch (jj_nt.kind) {
    case UNIQUE:
      jj_consume_token(UNIQUE);
                                                       unique = true;
      break;
    default:
      jj_la1[325] = jj_gen;
      ;
    }
    par = ParameterType5();
                if (parser_pass == 5) {

                        boolean must_create = false;
                        if (unique) {
                                must_create = true;
                        }
                        if (bounds[1] != null) {
                                if (bounds[1] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[1]).getBound_value(null);
                                        if (bound_value != Integer.MIN_VALUE) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }
                        if (bounds[0] != null) {
                                if (bounds[0] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[0]).getBound_value(null);
                                        if (bound_value != 0) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }

                        if (par != null) {
                                if (par.testParameter_type(null)) {
                                        if (par.getParameter_type(null) != _st_generic) {
                                                must_create = true;
                                        }
                        } else {
                                // why unset?
                                must_create = true;
                        }
                  } else {
                    // not standart type, but, on the other hand, something wrong here
                        must_create = true;
                  }

                        if (must_create) {


                        at = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
printDDebug(".oO0Oo. LIST TYPE CREATED - GeneralListType5 pass 4");
                        bound_name = getBoundString(2, bounds, false, unique);
                        at.setName(null, "_GENERALLIST" + bound_name + _data_type_name);
                        _data_type_name = "_GENERALLIST"  + bound_name + _data_type_name;
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        } else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                        // set element_type
                        at.setUnique_flag(null, unique);
                        if (par.testParameter_type(null)) {
                                at.setElement_type(null, par.getParameter_type(null));
                        } else {
//		  		printDDebug("Oo> parameter_type unset i_type: LIST OF " + par);
                        }


                  } else {
                        at = _st_list_generic;
//				_data_type_name = "_LIST_GENERIC";
                                _data_type_name = "_GENERALLIST_0_GENERIC";
                  }

//    bt = par.getParameter_type(null);
//    if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type)
//	    at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//    else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type)
//  	  at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//    else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//    	at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_general_list_type_");
                        if (par.testType_labels(null)) {
                                // need to add those labels to this one
                                jsdai.lang.A_string new_labels = result.createType_labels(null);
        jsdai.lang.A_string labels = par.getType_labels(null);
        jsdai.lang.SdaiIterator iter_labels = labels.createIterator();
        String label = "";
        int label_index = 1;
                                new_labels.addByIndex(label_index++, label);
        while (iter_labels.next()) {
                label  = labels.getCurrentMember(iter_labels);
                                        new_labels.addByIndex(label_index++, label);
        }


                        }


                }


                printDebug("In GeneralListType5, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

// 135 map_call = [ target_parameter_ref '@' ] map_reference [ partition_qualification ] '(' expression_or_wild { ',' expression_or_wild } ')'


/* - LOOKAHEAD 2 - (Columns 3 & 20) --------------------------------------------------- ISO 10303-11:A.2.216------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at columns 3 and 20.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/
  static final public Object GeneralRef5() throws ParseException, jsdai.lang.SdaiException {
        Object return_value = null;
        String name;
                printDebug("In GeneralRef5, starting");
    // making changes in the grammar:
            // (LOOKAHEAD(2) return_value = ParameterRef5() | return_value = VariableRef5() )
                    name = InterpretedId5();
//			if (parser_pass == 5) {

//				return_value = findInterpretedId(name);
                                return_value = findInterpretedIdX(name);
//			}

                printDebug("In GeneralRef5, ending, name: " + name + ", result: " + return_value + ", parser pass: " + parser_pass);
                {if (true) return return_value;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.100 ---*/
  static final public void GeneralSchemaAliasId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    // SchemaId5() | SchemaMapId5() | SchemaViewId5()
            t = jj_consume_token(SIMPLE_ID);
  }

/*--------- ISO 10303-14:B.2.101 ---*/
  static final public jsdai.SExtended_dictionary_schema.EGeneric_schema_definition GeneralSchemaRef5() throws ParseException, jsdai.lang.SdaiException {
  // jsdai.SExtended_dictionary_schema.EGeneric_schema_definition result = null;
  Object result = null;
    //      SchemaRef5() | SchemaMapRef5() | SchemaViewRef55()
    //      SchemaRef5()
            result = InterpretedRef5(PI_SCHEMA_OR_SCHEMA_MAP_OR_SCHEMA_VIEW);
                {if (true) return (jsdai.SExtended_dictionary_schema.EGeneric_schema_definition)result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.217------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GeneralSetType5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter result = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.ESet_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        int bound_value;
        jsdai.lang.EEntity bt;
        String bound_name;
                printDebug("In GeneralSetType5, starting");
    jj_consume_token(SET);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec5();
      break;
    default:
      jj_la1[326] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    par = ParameterType5();
                if (parser_pass == 5) {
                        // see perhaps general set of generic
                        // both bounds must be missing or bound 1 must be 0 and bound 2 must be ?
                        // and the par paramete_type must be standart express type generic
                        // if not - create

                        boolean must_create = false;
                        boolean is_generic = false;
                        if (bounds[1] != null) {
                                if (bounds[1] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[1]).getBound_value(null);
                                        if (bound_value != Integer.MIN_VALUE) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }
                        if (bounds[0] != null) {
                                if (bounds[0] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                        bound_value = ((jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[0]).getBound_value(null);
                                        if (bound_value != 0) {
                                                must_create = true;
                                        }
                                } else {
                                        must_create = true;
                                }
                        }

                        if (par != null) {
                                if (par.testParameter_type(null)) {
                                        if ((par.getParameter_type(null) != _st_generic) && (par.getParameter_type(null) != _st_string)) {
                                                must_create = true;
                                        } else {
                                                if (par.getParameter_type(null) == _st_generic) {
                                                        is_generic = true;
                                                }
                                                if (par.testType_labels(null)) {
                                                        must_create = true;
                                                }

                                        }
                        } else {
                                // why unset?
                                must_create = true;
                        }
                  } else {
                    // not standart type, but, on the other hand, something wrong here
                        must_create = true;
                  }

                        if (must_create) {
                                at = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
                                bound_name = getBoundString(2, bounds, false, false);
                                at.setName(null, "_GENERALSET" + bound_name + _data_type_name);
                                _data_type_name = "_GENERALSET"  + bound_name + _data_type_name;
                                if (bounds[0] == null) {
                                        b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, 0);
                                        bounds[0] = b1;
                                }
                                at.setLower_bound(null, bounds[0]);
                                if (bounds[1] != null) {
                                        at.setUpper_bound(null, bounds[1]);
                                }       else {
                                        at.unsetUpper_bound(null);  // no need for that it is unset after creating
                                }
                                // set element_type
                                if (par != null) {
                                        if (par.testParameter_type(null)) {
                                                at.setElement_type(null, par.getParameter_type(null));
                                        } else {
                                                printDDebug("Oo> parameter_type unset in general_set_type: SET OF " + par);
                                        }
                                }
                  } else {
                    // again, do we need separate types for generic set and for set?
                    // currently, the same one in dictionary for standard set/generalset type
                    if (is_generic) {
                                at = _st_set_generic;
//					_data_type_name = "_SET_GENERIC";
                                        _data_type_name = "_GENERALSET_0_GENERIC";
                        } else {
                                at = _st_set_string;
//					_data_type_name = "_SET_STRING";
                                        _data_type_name = "_GENERALSET_0_STRING";
                        }
                  }
//    bt = par.getParameter_type(null);
//    if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type)
//	    at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//    else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type)
//  	  at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//    else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//     at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        result = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        result.setParameter_type(null, at);
                        result.setName(null, "_general_set_type_");
                        if (par.testType_labels(null)) {
                                // need to add those labels to this one
                                jsdai.lang.A_string new_labels = result.createType_labels(null);
        jsdai.lang.A_string labels = par.getType_labels(null);
        jsdai.lang.SdaiIterator iter_labels = labels.createIterator();
        String label = "";
        int label_index = 1;
                                new_labels.addByIndex(label_index++, label);
        while (iter_labels.next()) {
                label  = labels.getCurrentMember(iter_labels);
                                        new_labels.addByIndex(label_index++, label);
        }


                        }


                }
                printDebug("In GeneralSetType5, ending");
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ Extension to EXPRESS, E2?------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GenericEntityType5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter par = null;
//	jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EData_type ed = null;
        jsdai.SExtended_dictionary_schema.EEntity_declaration edc = null;
        String Label5 = null;
        jsdai.SExtended_dictionary_schema.EDeclaration eld = null;
        jsdai.lang.A_string labels = null;
                printDebug("In GenericEntityType5, starting");
    jj_consume_token(GENERIC_ENTITY);
    switch (jj_nt.kind) {
    case COLON:
      jj_consume_token(COLON);
      Label5 = TypeLabel5();
      break;
    default:
      jj_la1[327] = jj_gen;
      ;
    }
                _data_type_name = "_ENTITY";
                if (parser_pass == 5) {
                        par = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        par.setName(null, "_generic_entity_");
                        // ed = findEntity_definition("Entity");
                        // changed generic entity from entity_definition to data_type because of bootstrapping problems in lang
//			ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)_st_entity;
                        ed = _st_entity;
//                      if (ed == null) {
//                              ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_definition.class);
//                              eld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
//                              eld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//                              eld.setDefinition(null, ed);
//                              ed.setName(null, "Entity");
//                              ed.setInstantiable(null, false); // guessing
//                              ed.setComplex(null, false);
//                              ed.createSupertypes(null);
                                // now it is inverse
                                // ed.createWhere_rules(null);
                                // no longer
                                // ed.createExplicit_attributes(null);
//                      }
                        par.setParameter_type(null, ed);
                        if (Label5 != null) {
                                labels = par.createType_labels(null);
                                labels.addByIndex(1, Label5);
                                // par.setType_label(null, Label5);
                        }
                }
                printDebug("In GenericEntityType5, ending");
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.218------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter GenericType5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        jsdai.SExtended_dictionary_schema.EData_type gt = null;
        String Label5 = null;
        jsdai.lang.A_string labels = null;
                printDebug("In GenericType5, starting");
    jj_consume_token(GENERIC);
    switch (jj_nt.kind) {
    case COLON:
      jj_consume_token(COLON);
      Label5 = TypeLabel5();
      break;
    default:
      jj_la1[328] = jj_gen;
      ;
    }
                _data_type_name = "_GENERIC";
                if (parser_pass == 5) {
                        par = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                        par.setName(null, "_generic_");
                        gt = _st_generic;
                        // gt = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                        par.setParameter_type(null, gt);
                        if (Label5 != null) {
                                labels = par.createType_labels(null);
                                labels.addByIndex(1, Label5);
//                              par.setType_label(null, Label5);
                        }
                }
                printDebug("In GenericType5, ending: " + par);
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.219------------ */
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition GroupQualifier5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) GroupQualifier */
        X_GroupQualifier jjtn000 = new X_GroupQualifier(JJTGROUPQUALIFIER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EEntity_definition ed0 = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed;
    try {
                printDebug("In GroupQualifier5, starting");
      jj_consume_token(BACKSLASH);
      ed = EntityRef5(null);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (ed == null) {
                        printDebug("In GroupQualifier5, Entity Reference is null");
                } else {
                        if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ed0 = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
                if (ed == ed0) {
                                        // perhaps it is a warning only? The requirement is that the entity reference should be of a type in the same sub-supertype graf as the instance
                                        // but the issue with the looping should be fixed
//					printWarningMsg("" + ed.getName(null) + " - in group qualifier, own entity type", null, true);
//					error_count++;
                }

                                // actually, if the group qualifier is a part of an attribute redeclaration, the requirement must be that ed is supertype of ed0,
                                // if not redeclaration of an attribute - perhaps  that ed and ed0 are in the same sub-supertype graph
                                if (flag_in_redeclaring) {
                                        // check that ed is supertype of ed0

                                        if (!flag_derived_expression) {
                                                // if in derived expression on the right side of := then this check reports non-existing errors
                                                if (!isSpecifiedEntityOfRedeclaredAttributeIsSupertype(ed0, ed)) {
                                                        // error
                                                        printErrorMsg("" + ed.getName(null) + " - is not supertype of entity " + ed0.getName(null) + " as it should be when redeclaring an attribute", null, true);
                                                        error_count++;
                                                }
                                        }

                                } else {
                                        // check that ed and ed0 are in the same sub-supertype graph
                                }

        }
                }

                if (parser_pass == 5) {
                        argument_stack.push(ed);
                        if (ed != null) {
                                printStack("PUSH: GroupQualifier5, entity reference: " + ed.getName(null));
                        } else {
                                printStack("PUSH: GroupQualifier5, entity reference: NULL");
                        }
                        if (expression_instances) {
                                        jjtn000.ed = ed;
                        }
                }
                printDebug("In GroupQualifier5, ending");
                {if (true) return ed;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.105 ---*/
  static final public void IdentifiedByClause5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IdentifiedByClause */
  X_IdentifiedByClause jjtn000 = new X_IdentifiedByClause(JJTIDENTIFIEDBYCLAUSE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      jj_consume_token(IDENTIFIED_BY);
      label_108:
      while (true) {
        IdParameter5();
        jj_consume_token(SEMICOLON);
        if (jj_2_58(2147483647)) {
          ;
        } else {
          break label_108;
        }
      }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-+-------- ISO 10303-14:B.2.106  ---*/
  static final public void IdParameter5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IdParameter */
  X_IdParameter jjtn000 = new X_IdParameter(JJTIDPARAMETER);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      if (jj_2_59(2)) {
        IdParameterId5();
        jj_consume_token(COLON);
      } else {
        ;
      }
      Expression5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*--------- ISO 10303-14:B.2.107  ---*/
  static final public void IdParameterId5() throws ParseException, jsdai.lang.SdaiException {
    ParameterId5();
  }

/*-+-------- ISO 10303-14:B.2.108  ---*/
  static final public void IfExpr5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IfExpr */
        X_IfExpr jjtn000 = new X_IfExpr(JJTIFEXPR);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);int elsif_count = 0;
        boolean else_present = false;
    try {
      jj_consume_token(IF);
      LogicalExpression5();
      jj_consume_token(THEN);
      Expression5();
      label_109:
      while (true) {
        switch (jj_nt.kind) {
        case ELSIF:
          ;
          break;
        default:
          jj_la1[329] = jj_gen;
          break label_109;
        }
        jj_consume_token(ELSIF);
        LogicalExpression5();
        Expression5();
                                                                                                     elsif_count++;
      }
      switch (jj_nt.kind) {
      case ELSE:
        jj_consume_token(ELSE);
        Expression5();
                                                                                                                                               else_present = true;
        break;
      default:
        jj_la1[330] = jj_gen;
        ;
      }
      jj_consume_token(END_IF);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (expression_instances) {
                        jjtn000.elsif_count = elsif_count;
                        jjtn000.else_present = else_present;
                }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.220------------ */
  static final public void IfStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IfStmt */
        X_IfStmt jjtn000 = new X_IfStmt(JJTIFSTMT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand = null;
        Object pop_inst = null;
        int if_count = 0;
        int else_count = 0;
    try {
                printDebug("In IfStmt5, starting");
//              system.out.println("<><> if count: " + if_count + ", else count: " + else_count);

      jj_consume_token(IF);
               X_IfCondition jjtn001 = new X_IfCondition(JJTIFCONDITION);
               boolean jjtc001 = true;
               jjtree.openNodeScope(jjtn001);
               jjtreeOpenNodeScope(jjtn001);
      try {
        LogicalExpression5();
      } catch (Throwable jjte001) {
               if (jjtc001) {
                 jjtree.clearNodeScope(jjtn001);
                 jjtc001 = false;
               } else {
                 jjtree.popNode();
               }
               if (jjte001 instanceof RuntimeException) {
                 {if (true) throw (RuntimeException)jjte001;}
               }
               if (jjte001 instanceof ParseException) {
                 {if (true) throw (ParseException)jjte001;}
               }
               if (jjte001 instanceof jsdai.lang.SdaiException) {
                 {if (true) throw (jsdai.lang.SdaiException)jjte001;}
               }
               {if (true) throw (Error)jjte001;}
      } finally {
               if (jjtc001) {
                 jjtree.closeNodeScope(jjtn001, true);
                 jjtreeCloseNodeScope(jjtn001);
               }
      }
                if (parser_pass == 5) {
                        operand = argument_stack.pop();
                        printStack("POP: IfStmt5, logical Expression5: " + operand);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
      jj_consume_token(THEN);
      label_110:
      while (true) {
        Stmt5();
                          if_count++;
        switch (jj_nt.kind) {
        case SEMICOLON:
        case ALIAS:
        case BEGIN:
        case CASE:
        case ESCAPE:
        case IF:
        case INSERT:
        case REMOVE:
        case REPEAT:
        case RETURN:
        case KW_SKIP:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[331] = jj_gen;
          break label_110;
        }
      }
      switch (jj_nt.kind) {
      case ELSE:
        jj_consume_token(ELSE);
        label_111:
        while (true) {
          Stmt5();
                                                          else_count++;
          switch (jj_nt.kind) {
          case SEMICOLON:
          case ALIAS:
          case BEGIN:
          case CASE:
          case ESCAPE:
          case IF:
          case INSERT:
          case REMOVE:
          case REPEAT:
          case RETURN:
          case KW_SKIP:
          case SIMPLE_ID:
            ;
            break;
          default:
            jj_la1[332] = jj_gen;
            break label_111;
          }
        }
        break;
      default:
        jj_la1[333] = jj_gen;
        ;
      }
      jj_consume_token(END_IF);
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.if_count = if_count;
                                jjtn000.else_count = else_count;
                        }
//                      operand = argument_stack.pop();
//      printStack("POP: IfStmt5, return value: " + operand);
                }
                printDebug("In IfStmt5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.221------------ */
  static final public int Increment5() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression5();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.222------------ */
  static final public void IncrementControl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IncrementControl */
        X_IncrementControl jjtn000 = new X_IncrementControl(JJTINCREMENTCONTROL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);ECtVariable var = null;
        String variable_id = null;
        jsdai.lang.EEntity variable_parameter_type = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type = null;
        boolean increment_present = false;
        String variable_key = "";
    try {
      variable_id = VariableId5();

      jj_consume_token(ASSIGN);
      Bound15(false);
      jj_consume_token(TO);
      Bound25(false);
      switch (jj_nt.kind) {
      case BY:
        jj_consume_token(BY);
        Increment5();
                                                                                                  increment_present = true;
        break;
      default:
        jj_la1[334] = jj_gen;
        ;
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.variable_id = variable_id;
                                jjtn000.variable_uid = (String)variable_id_stack.peek() + variable_id;
                                jjtn000.variable_scope_id = (String)variable_id_stack.peek();
                                jjtn000.increment_present = increment_present;
                        }
//			variable_type = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
//			variable_type.setName(null, "_implicit_variable_");
                        // variable_type.setParameter_type(null, variable_parameter_type);



                  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension, active_scope_string, "" + variable_uid, variable_id);
                        active_scope_string = "";
//			active_scope = null;  // not using on schema level (yet)

/*

			variable_key = constructImplicitVariableKey(variable_id, variable_uid);

			var = new ECtVariable(variable_id, variable_type, function_depth, variable_key, active_scope, true, 1, (String)variable_id_stack.peek());
//			var = new ECtVariable(variable_id, variable_type, (String)variable_id_stack.peek());

			if (variable_key != null) {
				if (!(hm_current_variables.containsKey(variable_key))) {
					hm_current_variables.put(variable_key, var);
				} else {
					// error - perhaps more than one variable with the same name in a function
				}
			} else {
				System.out.println("INTERNAL ERROR - ImplicitVariable in IncrementControl: " + variable_id + "  - wrong active scope: " + active_scope);
			}

*/
//System.out.println("about to find variable X, IncrementControl5 : " + variable_id); 		
                        var = findVariableX(variable_id);
//System.out.println("IncrementControl5, did we find var " + variable_id + ", see: " + var + ", scope : " + active_scope);

// protection against null pointer exception
if (var == null ) {
        System.out.println("INTERNAL ERROR in IncrementControl5, variable not found: " + variable_id);
} else {
      var.scope_id = (String)variable_id_stack.peek();
}

//			var = new ECtVariable(variable_id, variable_type, (String)variable_id_stack.peek());
                        current_scope.addElement(var);

                } else { // other passes - added to handle interpreted IDs
                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);
                }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.223------------ */
  static final public int Index5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) Index */
        X_Index jjtn000 = new X_Index(JJTINDEX);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);int value;
    try {
      value = NumericExpression5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                {if (true) return value;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.224------------ */
  static final public int Index15() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = Index5();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.225------------ */
  static final public int Index25() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = Index5();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.226------------ */
  static final public Object IndexQualifier5(Object general_reference) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IndexQualifier */
        X_IndexQualifier jjtn000 = new X_IndexQualifier(JJTINDEXQUALIFIER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);int ind1 = Integer.MIN_VALUE;
        int ind2 = Integer.MIN_VALUE;
//	jsdai.lang.EEntity reference = null;
        Object reference = null;
//	jsdai.SExtended_dictionary_schema.EData_type gen_data = null;
        Object gen_data = null;
    try {
                printDebug("In IndexQualifier5, starting");
      jj_consume_token(LBRACKET);
      ind1 = Index15();
      switch (jj_nt.kind) {
      case COLON:
        jj_consume_token(COLON);
        ind2 = Index25();
        break;
      default:
        jj_la1[335] = jj_gen;
        ;
      }
      jj_consume_token(RBRACKET);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {


                        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                // jsdai.lang.EEntity ref_type;
                                if (((jsdai.SExtended_dictionary_schema.EParameter)general_reference).testParameter_type(null)) {
                                        reference = ((jsdai.SExtended_dictionary_schema.EParameter)general_reference).getParameter_type(null);
                                } else {
                                        printDDebug("Oo> parameter_type unset in Index5 Qualifier5: reference = Parameter5: " + general_reference);
                                }
                        } else
                        if (general_reference instanceof ECtVariable) {
                                jsdai.SExtended_dictionary_schema.EParameter par_type;
                                par_type = ((ECtVariable)general_reference).getType();
                                if (par_type.testParameter_type(null)) {
                                        reference = par_type.getParameter_type(null);
                                } else {
                                        printDDebug("Oo> parameter_type unset in Index5 Qualifier5: reference = variable: " + general_reference);
                                }
                        } else {
                                reference = general_reference;
                        }

                        while (reference instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                if ( ((jsdai.SExtended_dictionary_schema.EDefined_type)reference).testDomain(null) ) {
                                        reference = ((jsdai.SExtended_dictionary_schema.EDefined_type)reference).getDomain(null);
                                }
                        }

                        if (reference instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                if (((jsdai.SExtended_dictionary_schema.EAggregation_type)reference).testElement_type(null)) {
                                        gen_data = ((jsdai.SExtended_dictionary_schema.EAggregation_type)reference).getElement_type(null);
                                } else {
                                        printDebug("Index5 Qualifier5: aggregate Element5 not set");
                                }
                        } else
                        if (reference instanceof jsdai.SExtended_dictionary_schema.EString_type) {
                                gen_data = reference;
                        } else
                        if (reference instanceof jsdai.SExtended_dictionary_schema.EBinary_type) {
                                gen_data = reference;
       } else
                        if (reference instanceof jsdai.SExtended_dictionary_schema.ETarget_parameter) {
                                jsdai.SExtended_dictionary_schema.ETarget_parameter tp = (jsdai.SExtended_dictionary_schema.ETarget_parameter)reference;
                                if (tp.testExtent(null)) {
                                        gen_data  = tp.getExtent(null);

                                }

                        } else {
                                printDebug("Index5 Qualifier5: reference of incompatible type:" + reference);
                        }


                        if (expression_instances) {
                                jjtn000.index1 = ind1;
                                jjtn000.index2 = ind2;
                        }
                }
                printDebug("In IndexQualifier5, ending");
                {if (true) return gen_data;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

// REMOVED IN DIS
/*--------- ISO 10303-14:B.2.116  ---*/
/*
String InstanceId() throws jsdai.lang.SdaiException :
{
	Token t;
}
{
	t = <SIMPLE_ID>
	{
		return (t.image.toLowerCase());
		}
}
*/

/*--------- ISO 10303-14:B.2.117  ---*/
  static final public int InstantiationForeachControl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) InstantiationForeachControl */
        X_InstantiationForeachControl jjtn000 = new X_InstantiationForeachControl(JJTINSTANTIATIONFOREACHCONTROL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);ECtVariable var1 = null;
        ECtVariable var2 = null;
        String iterator_name;
        String index_name;
        String var_id = "";
        jsdai.SExtended_dictionary_schema.EParameter variable_type1 = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type2 = null;
        String variable_key1 = "";
        String variable_key2 = "";

        ECtScope active_scope_extension_prev = null;
        int implicit_present = 0;
    try {
                printDebug("In InstantiationForeachControl5, starting");
//		variable_uid++;
//		var_id += "_implicit_" + variable_uid + "_";
//		variable_id_stack.push(var_id);
//		scope_stack.push(current_scope);
//		current_scope = new Vector();
                implicit_present = 2;  // asume for now that INDEXING is always present, this grammar does not even make it optional

      jj_consume_token(EACH);
      iterator_name = VariableId5();
      jj_consume_token(IN);
      SourceAttributeReference5();
      jj_consume_token(INDEXING);
      index_name = VariableId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (expression_instances) {
                                jjtn000.iterator_name = iterator_name;
                                jjtn000.iterator_uid = (String)variable_id_stack.peek() + iterator_name;
                                jjtn000.index_name = index_name;
                                jjtn000.index_uid = (String)variable_id_stack.peek() + index_name;
                                jjtn000.variable_scope_id = (String)variable_id_stack.peek();
                }


                active_scope_extension_prev = active_scope_extension;

          active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension, active_scope_string, "" + variable_uid, iterator_name);
                active_scope_string = "";

                var1 = findVariableX(iterator_name);
                var1.scope_id = (String)variable_id_stack.peek();
                current_scope.addElement(var1);

//	  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension_prev, active_scope_string, "" + variable_uid, index_name);
//		active_scope_string = "";

                active_scope_extension.set2ndId("" + variable_uid);
                active_scope_extension.set2ndKey(index_name);

                var2 = findVariableX(index_name);
                var2.scope_id = (String)variable_id_stack.peek();
                current_scope.addElement(var2);

                // this part perhaps needs to be after attribute mappings 
//		current_scope = (Vector)scope_stack.pop();
//		variable_id_stack.pop();
//		active_scope_string = active_scope_extension.getParent_scope_string();
//	  active_scope_extension = active_scope_extension.getParent();

                printDebug("In InstantiationForeachControl, ending");
                {if (true) return (2);}
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.118  ---*/
  static final public boolean InstantiationLoopControl5() throws ParseException, jsdai.lang.SdaiException {
        boolean increment_present = false;
        int increments_present = 0;
                printDebug("In InstantiationLoopControl5, starting");
//		variable_uid++;
//		scope_stack.push(current_scope);
//		current_scope = new Vector();

//		variable_uid++;
//		var_id += "_implicit_" + variable_uid + "_";
//		variable_id_stack.push(var_id);
//		scope_stack.push(current_scope);
//		current_scope = new Vector();

    switch (jj_nt.kind) {
    case EACH:
      increments_present = InstantiationForeachControl5();
      break;
    default:
      jj_la1[336] = jj_gen;
      increment_present = RepeatControl5();
    }
                if (increments_present > 0) increment_present = true;
                // current_scope = (Vector)scope_stack.pop();


//		current_scope = (Vector)scope_stack.pop();
//		variable_id_stack.pop();
//		if (increment_present) {
//	  	active_scope_string = active_scope_extension.getParent_scope_string();
//			active_scope_extension = active_scope_extension.getParent();
//		}	else
//		if (increments_present > 0) {
                        // do we need anything special for the difference between only iterator and both iterator and index?
//	  	active_scope_string = active_scope_extension.getParent_scope_string();
//			active_scope_extension = active_scope_extension.getParent();
//		}		


                printDebug("In InstantiationLoopControl5, ending");
                {if (true) return increment_present;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.227------------ */
  static final public jsdai.SExtended_dictionary_schema.EInteger_type IntegerType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EInteger_type it = null;
    jj_consume_token(INTEGER);
                if (parser_pass == 3) {
                        // it = (jsdai.SExtended_dictionary_schema.EInteger_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_type.class);
                        it = _st_integer;
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                it = (jsdai.SExtended_dictionary_schema.EInteger_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (it == null) {
                                // it = (jsdai.SExtended_dictionary_schema.EInteger_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_type.class);
                                it = _st_integer;
                printDDebug("In integer_type, pass > 3, dd = null: " + it);
                        }
                }
                printDDebug("In integer_type, ending: " + it);
                {if (true) return it;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.228 ------------ */
  static final public void InterfaceSpecification5(Vector used_vector, Vector referenced_vector) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case REFERENCE2:
      Reference2Clause5(referenced_vector);
      break;
    case REFERENCE:
      ReferenceClause5(referenced_vector);
      break;
    case USE:
      UseClause5(used_vector);
      break;
    default:
      jj_la1[337] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.229------------ */
  static final public void Interval5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) Interval */
        X_Interval jjtn000 = new X_Interval(JJTINTERVAL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object low = null;
        Object item = null;
        Object high = null;
        Object result = null;
        Object pop_inst_low = null;
        Object pop_inst_item = null;
        Object pop_inst_high = null;
        Object exp_inst_result = null;
    try {
                printDebug("In Interval5, starting");
      jj_consume_token(LBRACE);
      IntervalLow5();
                if (parser_pass == 5) {
                        low = argument_stack.pop();
                        printStack("POP: Interval5, IntervalLow5: " + low);
                        if (expression_instances) {
                                // pop_inst_low = expression_stack.pop();
                        }
                }
      IntervalOp5();
      IntervalItem5();
                if (parser_pass == 5) {
                        item = argument_stack.pop();
                        printStack("POP: Interval5, IntervalItem5: " + item);
                        if (expression_instances) {
                                // pop_inst_item = expression_stack.pop();
                        }
                }
      IntervalOp5();
      IntervalHigh5();
                if (parser_pass == 5) {
                        high = argument_stack.pop();
                        printStack("POP: Interval5, IntervalHigh5: " + high);
                        if (expression_instances) {
                                // pop_inst_high = expression_stack.pop();
                        }
                }
      jj_consume_token(RBRACE);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        argument_stack.push(result);
                        printStack("PUSH: Interval5: " + result);
                        if (expression_instances) {
                                // expression_stack.push(exp_inst_result);
                        }
                }
                printDebug("In Interval5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.230------------ */
  static final public void IntervalHigh5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IntervalHigh */
  X_IntervalHigh jjtn000 = new X_IntervalHigh(JJTINTERVALHIGH);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      SimpleExpression5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.231------------ */
  static final public void IntervalItem5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IntervalItem */
  X_IntervalItem jjtn000 = new X_IntervalItem(JJTINTERVALITEM);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      SimpleExpression5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.232------------ */
  static final public void IntervalLow5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IntervalLow */
  X_IntervalLow jjtn000 = new X_IntervalLow(JJTINTERVALLOW);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      SimpleExpression5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.233------------ */
  static final public void IntervalOp5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) IntervalOp */
        X_IntervalOp jjtn000 = new X_IntervalOp(JJTINTERVALOP);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);int op = -1;
    try {
      switch (jj_nt.kind) {
      case LT:
        jj_consume_token(LT);
              op = 1;
        break;
      case LE:
        jj_consume_token(LE);
                               op = 2;
        break;
      default:
        jj_la1[338] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (expression_instances) {
                        jjtn000.operator = op;
                }
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.234------------ */
  static final public void InverseAttr5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute a;
        jsdai.SExtended_dictionary_schema.EAttribute a2;
        jsdai.SExtended_dictionary_schema.EInverse_attribute ia;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed2;
        jsdai.SExtended_dictionary_schema.EExplicit_attribute ar;
//  jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        boolean duplicates = false;
        int bag_set = -1;

        jsdai.SExtended_dictionary_schema.ESet_type at = null;
        jsdai.SExtended_dictionary_schema.EBag_type bt = null;
        String _aggr_name = null;
        String bound_name = null;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
    a = AttributeDecl5(ed, 2);
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case BAG:
    case SET:
      switch (jj_nt.kind) {
      case SET:
        jj_consume_token(SET);
                 duplicates = false; bag_set = 0;
        break;
      case BAG:
        jj_consume_token(BAG);
                                                          duplicates = true; bag_set = 1;
        break;
      default:
        jj_la1[339] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      switch (jj_nt.kind) {
      case LBRACKET:
        bounds = BoundSpec5();
        break;
      default:
        jj_la1[340] = jj_gen;
        ;
      }
      jj_consume_token(OF);
      break;
    default:
      jj_la1[341] = jj_gen;
      ;
    }
    ed2 = EntityRef5(null);
    jj_consume_token(FOR);
    a2 = AttributeRef5(ed, ed2, 3, null);
    jj_consume_token(SEMICOLON);
                if (parser_pass > 3)
                {
                        ia = null;
                        if (a != null) {
                                ia = (jsdai.SExtended_dictionary_schema.EInverse_attribute)a;
                        }
                        ar = null;
                        if (a2 != null) {
                                ar = (jsdai.SExtended_dictionary_schema.EExplicit_attribute)a2;
                        }
                        if (ia != null) {
                                if (ed2 != null) {
                                        ia.setDomain(null, ed2);
                                } else {
                                        printVerbose("ERROR - inverse attribute domain ed2 is null");
                                }
                                if (!(isInverted_attrCompatible(ed, ar))) {
//				if (!ia.testInverted_attr(null)) {
//					printError("inverse attribute has incompatible inverted attribute. Entity: " + ed.getName(null).toLowerCase() + ", attribute: " + ia.getName(null).toLowerCase());
                                        printErrorMsg("" + ia.getName(null) + " - inverse attribute has incompatible inverted attribute, entity: " + ed.getName(null), null, true);
//				}
                                        error_count++;
                                }
                                if (ar != null) {
                                        ia.setInverted_attr(null, ar);
                                } else {
                                        printVerbose("ERROR - inverse attribute inverted_attr ar is null");
                                }
                                if (bag_set < 0) { // single entity, no set or bag
                                        duplicates = false;
                                        ia.unsetMin_cardinality(null);  // not really needed.
                                        ia.unsetMax_cardinality(null);  // not really needed.
                                }
                                else {

                                        if (bounds[0] == null) {
                                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                                b1.setBound_value(null, 0);
                                                bounds[0] = b1;
                                        }
                                        ia.setMin_cardinality(null,bounds[0]);
                                        if (bounds[1] != null) {
                                                ia.setMax_cardinality(null,bounds[1]);
                                        }

                                        if (parser_pass == 5) {
                                                // create aggregate in the dictionary
                                                if (duplicates) {

                                                        bt = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
                                                        if (bounds[0] == null) {
                                                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                                                b1.setBound_value(null, 0);
                                                                bounds[0] = b1;
                                                        }
                                                        bt.setLower_bound(null, bounds[0]);
                                                        if (bounds[1] != null) {
                                                                bt.setUpper_bound(null, bounds[1]);
                                                        }       else {
                                                                bt.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                        }
                                                        if(ed2 != null) {
                                                                bt.setElement_type(null, ed2);
                                                        }
                                                        bound_name = getBoundString(0, bounds, false, false);
                                                        _aggr_name = "_BAG"  + bound_name + "_" + ed2.getName(null);
                                                        bt.setName(null, _aggr_name);

                                                } else {

                                                        at = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
                                                        if (bounds[0] == null) {
                                                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                                                b1.setBound_value(null, 0);
                                                                bounds[0] = b1;
                                                        }
                                                        at.setLower_bound(null, bounds[0]);
                                                        if (bounds[1] != null) {
                                                                at.setUpper_bound(null, bounds[1]);
                                                        }       else {
                                                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                        }
                                                        if(ed2 != null) {
                                                                at.setElement_type(null, ed2);
                                                        }
                                                        bound_name = getBoundString(0, bounds, false, false);
                                                        _aggr_name = "_SET"  + bound_name + "_" + ed2.getName(null);
                                                        at.setName(null, _aggr_name);


                                                } // no duplicates - set
                                        }
                                }
                                ia.setDuplicates(null, duplicates);
                        } else {
                                printVerbose("ignoring previous errors, ERROR: inverse attribute ia is NULL");
                        }

                        // let's add the type compatibility check here

                        if (flag_in_redeclaring) {
//				if (!(isRedeclared_attrCompatible(global_redeclaring, global_redeclared))) {
                                if (false) {
                                        error_count++;
//					printErrorMsg("" + attr.getName(null) + " - incompatible type of inverse attribute in entity " + attr.getParent(null).getName(null), null, true);
                                }
                                global_redeclaring = null;
                                global_redeclared = null;
                                flag_in_redeclaring = false;
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.235------------ */
  static final public void InverseClause5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(INVERSE);
    label_112:
    while (true) {
      InverseAttr5(ed);
      switch (jj_nt.kind) {
      case SELF:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[342] = jj_gen;
        break label_112;
      }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.236------------ */
  static final public String Label5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.237------------ */
  static final public jsdai.SExtended_dictionary_schema.EList_type ListType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EList_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        jsdai.lang.EEntity bt;
        String bound_name;
        boolean unique = false;
    jj_consume_token(LIST);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec5();
      break;
    default:
      jj_la1[343] = jj_gen;
      ;
    }
    jj_consume_token(OF);
    switch (jj_nt.kind) {
    case UNIQUE:
      jj_consume_token(UNIQUE);
                                                      unique = true;
      break;
    default:
      jj_la1[344] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (whose != null) {
                                at = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//				bound_name = getBoundString(0, bounds, false, unique);
//				at.setName(null, "_LIST" + bound_name + _data_type_name);
//				_data_type_name = "_LIST"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                        }
                } else
                if (parser_pass == 4) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//				bound_name = getBoundString(0, bounds, false, unique);
//				at.setName(null, "_LIST" + bound_name + _data_type_name);
//				_data_type_name = "_LIST"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                        }
                } else
                if (parser_pass == 5) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.EList_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//				bound_name = getBoundString(0, bounds, false, unique);
//				at.setName(null, "_LIST" + bound_name + _data_type_name);
//				_data_type_name = "_LIST"  + bound_name + _data_type_name;
                                at.setUnique_flag(null, unique);
                        }
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        } else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                }
                if ((parser_pass == 5) && (at == null)) {
                        printDDebug("XP ########### ListType5 is NULL: " + _data_type_name);
                }
    bt = BaseType5(at);
                if (parser_pass > 3) {
                        // set element_type
//			if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);

                        if (!(at.testElement_type(null))) {
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EData_type) {
                                        at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EData_type)bt);
                                } else
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                        if (((jsdai.SExtended_dictionary_schema.EParameter)bt).testParameter_type(null)) {
                                                at.setElement_type(null, ((jsdai.SExtended_dictionary_schema.EParameter)bt).getParameter_type(null));
                                        } else {
                                        }
                                } else {
                                  // express amendment issue
                                        printDDebug("in ListType5, error while setting Element_type, base type: " + bt + "list type: " +at);
                                }
                        }
                }
                bound_name = getBoundString(0, bounds, false, unique);
                _data_type_name = "_LIST"  + bound_name + _data_type_name;
                if (at != null) {
                        at.setName(null, _data_type_name);
                }
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.238------------ */
  static final public void Literal5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) Literal */
        X_Literal jjtn000 = new X_Literal(JJTLITERAL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Token t = null;
        String s;
        Integer l;
        int logical_value;
        Double d;
        BitSet b;
        String str_value;
        String x_operand = "";
        jsdai.lang.Binary blt = null;
    try {
                printDebug("In Literal5, starting");
      switch (jj_nt.kind) {
      case BINARY_LITERAL:
        t = jj_consume_token(BINARY_LITERAL);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In Binary Literal5: " + t.image);

                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.type = 1;
                        }
                        s = t.image;
                        /* should contain % and 1s and 0s.
				1. Drop the initial %
				2. create BitSet with initial size of the length of the remaining string.
				3. Make a loop through all the characters in the string and set or clear the bits in the bitset
			*/
                        String bits = s.substring(1);
//                      printDDebug("Initial: " + s + ", after: " + bits + ", length: " + bits.length());

//          bl = (jsdai.lang.Binary)model.createEntityInstance(jsdai.lang.Binary.class);

                        blt = new jsdai.lang.Binary(bits);
                        if (expression_instances) {
                                jjtn000.binary_value = blt;
                        }

                        b = new BitSet(bits.length());
                        for (int i = 0; i < bits.length(); i++) {
                                char c = bits.charAt(i);
                                if (c == '1') {
                                        b.set(i);
                                } else
                                if (c == '0') {
                                        b.clear(i); // probably unnecessary
                                } else {
                                        System.out.println("Error in binary Literal5 - illegal character: " + c);
                                }
                        }
                        argument_stack.push(b);
                        printStack("PUSH: Literal5: <BINARY_LITERAL>: " + b.toString());
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
        break;
      case INTEGER_LITERAL:
        t = jj_consume_token(INTEGER_LITERAL);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In Integer Literal5: " + t.image);
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.type = 2;
                        }
                        s = t.image;
                        l = new Integer(s);
                        if (expression_instances) {
                                jjtn000.int_value = l.intValue();
                        }
                        argument_stack.push(l);
                        printStack("PUSH: Literal5: <INTEGER_LITERAL>: " + s);
                        if (expression_instances) {
// printDDebug("#2# Literal5: " + s);
//                              x_operand = (String)expression_stack.pop();
                                // x_operand = s;
                                // expression_stack.push(x_operand);
                                // printXStack("PUSH: Literal5: <INTEGER_LITERAL>: " + x_operand);
                        }
                }
        break;
      case FALSE:
      case TRUE:
      case UNKNOWN:
        logical_value = LogicalLiteral5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.type = 3;
                                jjtn000.logical_value = logical_value;
                        }
                }
        break;
      case REAL_LITERAL:
        t = jj_consume_token(REAL_LITERAL);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In Real Literal5: " + t.image);
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.type = 4;
                        }
                        s = t.image;
                        d = new Double(s);
                        if (expression_instances) {
                                jjtn000.double_value = d.doubleValue();
                        }
                        argument_stack.push(d);
                        printStack("PUSH: Literal5: <REAL_LITERAL>: " + s);
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
        break;
      case ENCODED_STRING_LITERAL:
      case SIMPLE_STRING_LITERAL:
        str_value = StringLiteral5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        if (expression_instances) {
                                String str_value_mod = replace_schema_name(str_value);
                                String str_original_schema_name = get_original_schema_name(str_value);
                                jjtn000.type = 5;
                                jjtn000.string_value = str_value_mod;
                                jjtn000.original_schema_name = str_original_schema_name;
                        }
                }
        break;
      default:
        jj_la1[345] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.239------------ */
  static final public void LocalDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) LocalDecl */
  X_LocalDecl jjtn000 = new X_LocalDecl(JJTLOCALDECL);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
                printDebug("In LocalDecl5, starting");
      jj_consume_token(LOCAL);
      label_113:
      while (true) {
        LocalVariable5();
        switch (jj_nt.kind) {
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[346] = jj_gen;
          break label_113;
        }
      }
      jj_consume_token(END_LOCAL);
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In LocalDecl5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.240------------ */
  static final public void LocalVariable5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) LocalVariable */
        X_LocalVariable jjtn000 = new X_LocalVariable(JJTLOCALVARIABLE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand = null;
        Object pop_inst = null;
        Vector variable_ids = new Vector();
        Vector node_variable_ids = new Vector();
        String str = null;
        jsdai.SExtended_dictionary_schema.EParameter par_type = null;
        ECtVariable var = null;
    try {
                printDebug("In LocalVariable5, starting");
      str = VariableId5();
                             variable_ids.addElement(str); node_variable_ids.addElement("_e_" + str);
      label_114:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[347] = jj_gen;
          break label_114;
        }
        jj_consume_token(COMMA);
        str = VariableId5();
                                                                                                                               variable_ids.addElement(str);node_variable_ids.addElement("_e_" + str);
      }
      jj_consume_token(COLON);
      par_type = ParameterType5();
      switch (jj_nt.kind) {
      case ASSIGN:
        jj_consume_token(ASSIGN);
        Expression5();
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.expression_present = true;
                        }
                        operand = argument_stack.pop();
        printStack("POP: LocalVariable5 Expression5: " + operand);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
        break;
      default:
        jj_la1[348] = jj_gen;
        ;
      }
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
if (par_type == null) {
         printDDebug("#123: Parameter5 type = NULL");
         System.out.println("#123: Parameter5 type = NULL");
} else {
        ; // printDDebug("#123: Parameter5 type NOT NULL");
}
                        if (expression_instances) {
                                jjtn000.variable_ids = node_variable_ids;
                                jjtn000.parameter_type = par_type;
                        }
                        // make ECtVariable instances and add them to the current_scope

                        for (int i = 0; i < variable_ids.size(); i++) {
                                String id = (String)variable_ids.elementAt(i);
//				var = new ECtVariable(id, par_type);

//System.out.println("<about to find var, 04, name: " + id); 
                                var = findVariableX(id);
                                // temporary solution, perhaps better to move creation of parameters to pass 1 as well, we'll see
//	 printDDebug("#123-2: setting parameter type, variable: " + var + ", parameter: " + par_type );

//	 System.out.println("#123-2: setting parameter type, variable: " + var + ", parameter: " + par_type );


//if (id.equalsIgnoreCase("ct")) {
//System.out.println(">>>>>>>>>>>>>>>> var: " + id + ", par_type: " + par_type + ", variable: " + var + ", scope: " + active_scope);
//}


                                var.setType(par_type);
                                current_scope.addElement(var);
                        }

                } else { // other passes - added to handle interpreted IDs
/*
			for (int i = 0; i < variable_ids.size(); i++) {
				String id = (String)variable_ids.elementAt(i);
				var = new ECtVariable(id, par_type);
				current_scope.addElement(var);
			}
*/
                }
                printDebug("In LocalVariable5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.241------------ */
  static final public void LogicalExpression5() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In LogicalExpression5, starting");
    Expression5();
                printDebug("In LogicalExpression5, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.242------------ */
  static final public int LogicalLiteral5() throws ParseException {
        int return_value = -1;
                printDebug("In Logical Literal5");
    switch (jj_nt.kind) {
    case FALSE:
      jj_consume_token(FALSE);
                return_value = 1;
                if (parser_pass == 5) {
                        argument_stack.push(new Integer(0));
                        printStack("PUSH: Literal5: <LOGICAL_LITERAL>: FALSE");
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
      break;
    case TRUE:
      jj_consume_token(TRUE);
                return_value = 2;
                if (parser_pass == 5) {
                        argument_stack.push(new Integer(1));
                        printStack("PUSH: Literal5: <LOGICAL_LITERAL>: TRUE");
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
      break;
    case UNKNOWN:
      jj_consume_token(UNKNOWN);
                return_value = 3;
                if (parser_pass == 5) {
                        argument_stack.push(new Integer(2));
                        printStack("PUSH: Literal5: <LOGICAL_LITERAL>: UNKNOWN");
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
      break;
    default:
      jj_la1[349] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return return_value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.243------------ */
  static final public jsdai.SExtended_dictionary_schema.ELogical_type LogicalType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ELogical_type lt = null;
    jj_consume_token(LOGICAL);
                if (parser_pass == 3) {
                        // lt = (jsdai.SExtended_dictionary_schema.ELogical_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLogical_type.class);
                        lt = _st_logical;
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                lt = (jsdai.SExtended_dictionary_schema.ELogical_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (lt == null) {
                                // lt = (jsdai.SExtended_dictionary_schema.ELogical_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLogical_type.class);
                                lt = _st_logical;
                        }
                }
                {if (true) return lt;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.133  ---*/
  static final public void MapAttributeDeclaration5(jsdai.lang.EEntity partition) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) MapAttributeDeclaration */
        X_MapAttributeDeclaration jjtn000 = new X_MapAttributeDeclaration(JJTMAPATTRIBUTEDECLARATION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object general_reference = null;
        Object qualified_reference = null;
        Object operand = null;
    try {
                printDebug("In MapAttributeDeclaration5, starting");
      //	[ TargetParameterRef5() [ IndexQualifier5() ] [ GroupQualifier5() ] "." ] AttributeRef5(null, null, -1, null) [ IndexQualifier5() ] ":=" MapAttrAssgnmtExpr() ";"
              // <SIMPLE_ID> choice conflict, better to reach "." here, but Expression5 in Index5 Qualifier5, number unknown
              // have to fix IndexQualifier5() argument
      
      
      
      // Antano	[  LOOKAHEAD(TargetParameterRef5() [ IndexQualifier5(null) ] [ GroupQualifier5() ] "." ) TargetParameterRef5() [ IndexQualifier5(null) ] [ GroupQualifier5() ] "." ] AttributeRef5(null, null, -1, null) [ IndexQualifier5(null) ] ":=" Expression5() ";"
      
      
      //previous	[  LOOKAHEAD(TargetParameterRef5() [ IndexQualifier5(null) ] [ GroupQualifier5() ] "." ) TargetParameterRef5() [ IndexQualifier5(null) ] [ GroupQualifier5() ] "." ] AttributeRef5(null, null, -1, null) [ IndexQualifier5(null) ] ":=" Expression5() ";"
      
      //	[  LOOKAHEAD(TargetParameterRef5() [ IndexQualifier5(null) ] [ GroupQualifier5() ] "." ) TargetParameterRef5() [ IndexQualifier5(null) ] [ GroupQualifier5() ] "." ] AttributeRef5(null, null, -1, null) [ IndexQualifier5(null) ] ":=" Expression5() ";"
      
      
      //	[  LOOKAHEAD(TargetParameterRef5() [ IndexQualifier5(null) ] [ GroupQualifier5() ] "." ) general_reference = TargetParameterRef5() 
      
      
      //	general_reference = TargetParameterRef5() 
              general_reference = TargetParameterRefStrict5();
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.target_parameter = (jsdai.SExtended_dictionary_schema.ETarget_parameter)general_reference;

//				jjtThis.partition = (jsdai.SExtended_dictionary_schema.EMap_partition)partition;
                                jjtn000.partition = (jsdai.SExtended_dictionary_schema.EMap_or_view_partition)partition;
                        }
                }
      label_115:
      while (true) {
        switch (jj_nt.kind) {
        case LBRACKET:
        case DOT:
        case BPATH:
        case FPATH:
        case BACKSLASH:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[350] = jj_gen;
          break label_115;
        }
        qualified_reference = Qualifier5(general_reference);
                general_reference = qualified_reference;
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.qualifiers.addElement(qualified_reference);
                        }
                }
      }
      jj_consume_token(ASSIGN);
      Expression5();
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        operand = argument_stack.pop();
                        printStack("POP: MapAttributeDeclarationStmt: " + operand);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
                printDebug("In MapAttributeDeclaration5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*--------- ISO 10303-14:B.2.134  ---*/
// eliminated
/*
void MapAttrAssgnmtExpr() throws jsdai.lang.SdaiException :
{}
{
	Expression5() | IfExpr5() | CaseExpr5() | ForExpr5()
}
*/

/*-+-------- ISO 10303-14:B.2.135  ---*/
// Object MapCall5(jsdai.SExtended_dictionary_schema.ETarget_parameter tp) throws jsdai.lang.SdaiException :
// 135map_call = [ target_parameter_ref '@' ] map_reference [ partition_qualification ] '(' expression_or_wild { ',' expression_or_wild } ')'

// Object MapCall5(String target_parameter_name) throws jsdai.lang.SdaiException :
  static final public Object MapCall5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) MapCall */
        X_MapCall jjtn000 = new X_MapCall(JJTMAPCALL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Token t = null;
        String name = null;
        Object reference = null;
        jsdai.SExtended_dictionary_schema.EMap_definition md = null;
        jsdai.SExtended_dictionary_schema.EMap_or_view_partition partition = null;
  // here target_parameter can be found from its name and map definition md
        jsdai.SExtended_dictionary_schema.ETarget_parameter tp = null;
        int arg_count = 0;
    try {
//		printDebug("In MapCall5, starting, target Parameter5 name: " + target_parameter_name);
                printDebug("In MapCall5, starting");
      if (jj_2_60(2147483647)) {
        tp = TargetParameterRef5();
        jj_consume_token(OP_AT);
      } else {
        ;
      }
      md = MapRef5();
      switch (jj_nt.kind) {
      case BACKSLASH:
        partition = PartitionQualification5(md);
        break;
      default:
        jj_la1[351] = jj_gen;
        ;
      }
      jj_consume_token(LPAREN);
      ExpressionOrWild5();
                                                                                                                                                                  arg_count++;
      label_116:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[352] = jj_gen;
          break label_116;
        }
        jj_consume_token(COMMA);
        ExpressionOrWild5();
                                                                                                                                                                                                          arg_count++;
      }
      jj_consume_token(RPAREN);
    jjtree.closeNodeScope(jjtn000, true);
    jjtc000 = false;
    jjtreeCloseNodeScope(jjtn000);
                if (expression_instances) {
                        jjtn000.map_definition = md;
                        if (tp == null) {
                                jjtn000.target_parameter_present = false;
                        } else {
                                jjtn000.target_parameter_present = true;
                        }
                        jjtn000.target_parameter = tp;
                        if (partition == null) {
                                jjtn000.partition_present = false;
                        } else {
                                jjtn000.partition_present = true;
                        }
                        jjtn000.partition = partition;
                        jjtn000.scope = active_scope;
                        jjtn000.argument_count = arg_count;

                }

                printDebug("In MapCall5, ending");
        {if (true) return md;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

////////////// not needed

/*-+-------- ISO 10303-14:B.2.98 ---*/
  static final public Object GeneralOrMapCall5() throws ParseException, jsdai.lang.SdaiException {
        Token t = null;
        jsdai.SExtended_dictionary_schema.ETarget_parameter tp = null;
        Object reference = null;
        String name = null;
                printDebug("In GeneralOrMapCall5, starting");
    if (jj_2_61(2147483647)) {
      t = jj_consume_token(SIMPLE_ID);
      jj_consume_token(OP_AT);
                if (t != null) {
                        name = t.image;
                }
    } else {
      ;
    }
    reference = MapCall5();
                printDebug("In GeneralOrMapCall5, ending");
                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

/////////////////// not needed end



/*-+-------- ISO 10303-14:B.2.136  ---*/
  static final public void MapDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) MapDecl */
        X_MapDecl jjtn000 = new X_MapDecl(JJTMAPDECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EMap_definition md = null;
        jsdai.SExtended_dictionary_schema.EMap_declaration mdc = null;
        String map_name;
        jsdai.lang.EEntity partition = null;
    try {
                target_parameter_order_count = 0;
                scope_stack.push(current_scope);
                current_scope = new Vector();
      jj_consume_token(MAP);
      map_name = MapId5();
      jj_consume_token(AS);
                printDebug("In MapDecl5, starting: " + map_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        md = findMap_definition(map_name, null);
                        if (md != null) {
                                error_count++;
//				printError("duplicate map name \"" + map_name + "\"");
                        } else {
                                String wrong_name = findAnyName(map_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + map_name + "\". The same name used for a map and for " + wrong_name);
                                }
                                md = (jsdai.SExtended_dictionary_schema.EMap_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CMap_definition.class);
                                active_scope = md;
printDDebug("active_scope in map 1: " + active_scope);
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                mdc = (jsdai.SExtended_dictionary_schema.EMap_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$map_declaration.class);


//				mdc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                mdc.setParent(null, sd);
                                mdc.setDefinition(null, md);

                                md.setName(null, map_name);
                                // supertypes - added this attribute
//				md.createSupertypes(null);
//				md.createSuper_type(null);
                        }
                } else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper5()
                        md = findMap_definition(map_name, null);

                  active_scope_extension = new ECtScope(active_scope, md, active_scope_extension, active_scope_string, map_name, map_name.toLowerCase());
                active_scope_string = "";
                        active_scope = md;



                        if (parser_pass == 5) {
                                        if (expression_instances) {
                                                        jjtn000.map_definition = md;
                                        }
                        }

printDDebug("active_scope in map 2: " + active_scope);
                        if (md == null) {
                                error_count++;
//				printError("MapDecl5 - the map not found: " + map_name);
                                printErrorMsg("" + map_name + " - map not found", null, true);
                        }
                }
                // createDocumentationEntity2(md, a_token);

                target_parameter_order_count = 0;
      label_117:
      while (true) {
        TargetParameter5(md);
        jj_consume_token(SEMICOLON);
        switch (jj_nt.kind) {
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[353] = jj_gen;
          break label_117;
        }
      }
      switch (jj_nt.kind) {
      case FOR:
      case FROM:
      case IDENTIFIED_BY:
      case LOCAL:
      case ORDERED_BY:
      case PARTITION:
      case RETURN:
      case SELECT:
      case WHERE:
        partition = BindingHeader5(md);
        MapDeclBody5(partition);
        label_118:
        while (true) {
          switch (jj_nt.kind) {
          case FOR:
          case FROM:
          case IDENTIFIED_BY:
          case LOCAL:
          case ORDERED_BY:
          case PARTITION:
          case RETURN:
          case SELECT:
          case WHERE:
            ;
            break;
          default:
            jj_la1[354] = jj_gen;
            break label_118;
          }
          partition = BindingHeader5(md);
          MapDeclBody5(partition);
        }
        break;
      case SUBTYPE:
        MapSubtypeOfClause5(md);
        partition = SubtypeBindingHeader5(md);
        MapDeclBody5(partition);
        label_119:
        while (true) {
          switch (jj_nt.kind) {
          case PARTITION:
          case WHERE:
            ;
            break;
          default:
            jj_la1[355] = jj_gen;
            break label_119;
          }
          //            LOOKAHEAD(SubtypeBindingHeader5(md) MapDeclBody5()) SubtypeBindingHeader5(md) MapDeclBody5() 
                        partition = SubtypeBindingHeader5(md);
          MapDeclBody5(partition);
        }
        break;
      default:
        jj_la1[356] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      jj_consume_token(END_MAP);
                active_scope = null;
                active_scope_string =  active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                current_scope = (Vector)scope_stack.pop();
                printDebug("In MapDecl5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-+-------- ISO 10303-14:B.2.137  ---*/
  static final public void MapDeclBody5(jsdai.lang.EEntity partition) throws ParseException, jsdai.lang.SdaiException {
                printDebug("In MapDeclBody5, starting");
    switch (jj_nt.kind) {
    case FOR:
      label_120:
      while (true) {
        EntityInstantiationLoop5(partition);
        if (jj_2_62(2147483647)) {
          ;
        } else {
          break label_120;
        }
      }
      break;
    case SELECT:
      MapProjectClause5(partition);
      break;
    case RETURN:
      jj_consume_token(RETURN);
      Expression5();
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[357] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In MapDeclBody5, ending");
  }

/*--------- ISO 10303-14:B.2.138  ---*/
  static final public String MapId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.139  ---*/
  static final public void MapProjectClause5(jsdai.lang.EEntity partition) throws ParseException, jsdai.lang.SdaiException {
                printDebug("In MapProjectClause5, starting");
    jj_consume_token(SELECT);
    label_121:
    while (true) {
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[358] = jj_gen;
        break label_121;
      }
      MapAttributeDeclaration5(partition);
    }
                printDebug("In MapProjectClause5, ending");
  }

/*--------- ISO 10303-14:B.2.140  ---*/
  static final public jsdai.SExtended_dictionary_schema.EMap_definition MapRef5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EMap_definition result = null;
        String name;
    name = MapId5();
                result = findMap_definition(name, null);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.141  ---*/
  static final public jsdai.SExtended_dictionary_schema.EMap_definition MapReference5() throws ParseException, jsdai.lang.SdaiException {
        Object map_reference = null;
    if (jj_2_63(2)) {
      InterpretedRef5(PI_SCHEMA_MAP);
      jj_consume_token(DOT);
    } else {
      ;
    }
    map_reference = InterpretedRef5(PI_MAP);
                {if (true) return (jsdai.SExtended_dictionary_schema.EMap_definition)map_reference;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.142  ---*/
  static final public void MapSubtypeOfClause5(jsdai.SExtended_dictionary_schema.EMap_definition md) throws ParseException, jsdai.lang.SdaiException {
        // Object supertype_obj = null;
        jsdai.SExtended_dictionary_schema.EMap_definition supertype = null;
        jsdai.SExtended_dictionary_schema.AMap_definition supertypes = null;
                printDebug("In MapSubtypeOfClause5, starting");
    jj_consume_token(SUBTYPE);
    jj_consume_token(OF);
    jj_consume_token(LPAREN);
    supertype = MapReference5();
    jj_consume_token(RPAREN);
    jj_consume_token(SEMICOLON);
                if (parser_pass == 2) {
//			supertypes = md.createSupertypes(null);
//			supertypes = md.createSuper_type(null);
//			supertypes.addByIndex(1, supertype);		
//				supertype = (jsdai.SExtended_dictionary_schema.EMap_definition)supertype_obj;
                                md.setSuper_type(null, supertype);
                }
                printDebug("In MapSubtypeOfClause5, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.244------------ */
  static final public int MultiplicationLikeOp5() throws ParseException, jsdai.lang.SdaiException {
        int operation = 0;
    switch (jj_nt.kind) {
    case STAR:
      jj_consume_token(STAR);
              operation = 1;
      break;
    case SLASH:
      jj_consume_token(SLASH);
                                       operation = 2;
      break;
    case DIV:
      jj_consume_token(DIV);
                                         operation = 3;
      break;
    case MOD:
      jj_consume_token(MOD);
                                         operation = 4;
      break;
    case AND:
      jj_consume_token(AND);
                                         operation = 5;
      break;
    case 213:
      jj_consume_token(213);
                                        operation = 6;
      break;
    default:
      jj_la1[359] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                                        {if (true) return operation;}
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 17) --------------------------------------------------- ISO 10303-11:A.2.245------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at columns 3 and 17.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/
//  (LOOKAHEAD(2) a_type = EntityRef5() | a_type = TypeRef5(0))
//  TypeRef5()

// new interpreted identifier NamedTypeRef55() introduced into the grammar instead of EntityRef5() | TypeRef5)
// must also cover ViewRef5() now for ExpressX
  static final public jsdai.SExtended_dictionary_schema.ENamed_type NamedTypes5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ENamed_type nt = null;
                        printDebug("In NamedTypes5, starting is pass " + parser_pass + ", from: " + whose);
    nt = NamedTypeRef55();
                        if (nt != null) {
                                if (nt.testName(null)) {
                                        _data_type_name = "_" + nt.getName(null);
                                }
                                printDebug("In NamedTypes5, ending in pass: " + parser_pass + ": " + nt.getName(null));
                        } else {
                                printDebug("In NamedTypes5, ending - null ");
                        }

                        {if (true) return nt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ introduced by eRRe ------------ */
  static final public String NamedTypeId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 23 & 36) ------------------------------------------------ ISO 10303-11:A.2.246------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at columns 23 and 36.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/
  static final public jsdai.SExtended_dictionary_schema.EDeclaration NamedTypeOrRename5(jsdai.lang.SdaiModel interfaced_model) throws ParseException, jsdai.lang.SdaiException {
        String named_type_name;
  String alias_name = null;
        jsdai.SExtended_dictionary_schema.ENamed_type nt = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
    named_type_name = NamedTypeId5();
                if (parser_pass == 2) {
                        ed = findInterfacedEntity_definition(interfaced_model, named_type_name);
                        if (ed == null) {
                                dt = findInterfacedDefined_type(interfaced_model, named_type_name);
                                if (dt == null) {
                                        error_count++;
//					printError("USE FROM: interfaced named type \"" + named_type_name + "\" not found in model: " + interfaced_model.getName());
                                        if (interfaced_model != null ) {
                                                printDebug("USE FROM: interfaced named type \"" + named_type_name + "\" not found in model: " + interfaced_model.getName());
                                        } else {
                                                printDebug("USE FROM: interfaced named type \"" + named_type_name + "\" not found in model: NULL");
                                        }
                                } else {
//                                      tdc = checkTypeUsedDeclaration(dt);
//                                      if (tdc == null ) {
                                        if (neededTypeUsedDeclaration(dt)) {
                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CType_declaration$used_declaration.class);
                                                dc.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                // }
                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)dt);
                                                hm_current_type_declarations.put(named_type_name.toLowerCase(), dc);
                                                dt.setTemp(FLAG_USED);
                                        }
                                }
                        } else { // entity_definition
//                                      edc = checkEntityUsedDeclaration(ed);
//                                      if (edc == null ) {
                                        if (neededEntityUsedDeclaration(ed)) {
                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$used_declaration.class);
                                                dc.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                // }
                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)ed);
                                                hm_current_entity_declarations.put(named_type_name.toLowerCase(), dc);
                                                // at this stage, perhaps ECtRenamed object could be already removed and converted back to Integer where needed
                                                // it could be done at the end of the resolve() stage of ECtRenamed between the parser passes
                                                // still, just in case, we may have this protection here at least for now
                                                Object t_object = ed.getTemp();
                                                if (t_object == null) {
                                                        ed.setTemp(FLAG_USED);
                                                } else {
                                                        if (t_object instanceof ECtRenamed) {
                                                                ((ECtRenamed)t_object).interfaced_flag = FLAG_USED;
                                                        } else {
                                                                System.out.println("<ExpressCompiler> INTERNAL ERROR - NamedTypeOrRename 5 - temp_object: " + t_object + ", entity: " + ed);
                                                        }
                                                }
                                        }
                        }
                } else
                if (parser_pass == 3) {
                } else
                if (parser_pass == 4) {
                } else
                if (parser_pass == 5) {
                }
    switch (jj_nt.kind) {
    case AS:
      jj_consume_token(AS);
      if (jj_2_64(2)) {
        alias_name = EntityId5();
      } else {
        switch (jj_nt.kind) {
        case SIMPLE_ID:
          alias_name = TypeId5();
          break;
        default:
          jj_la1[360] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
      break;
    default:
      jj_la1[361] = jj_gen;
      ;
    }
                if (parser_pass == 2) {
                        if ((alias_name != null) && (dc != null)) {
                                ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dc).setAlias_name(null, alias_name);
                        }

//                      if (dc instanceof jsdai.SExtended_dictionary_schema.EEntity_declaration$used_declaration) {
//                              dc.set
//                      } else
//                      if (dc instanceof jsdai.SExtended_dictionary_schema.EType_declaration$used_declaration) (
//                      }
                }
                {if (true) return dc;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.247------------ */
  static final public void NullStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) NullStmt */
  X_NullStmt jjtn000 = new X_NullStmt(JJTNULLSTMT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
                printDebug("In NullStmt5 starting");
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In NullStmt5 ending");
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.248------------ */
  static final public jsdai.SExtended_dictionary_schema.ENumber_type NumberType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ENumber_type nt = null;
    jj_consume_token(NUMBER);
                if (parser_pass == 3) {
                        // nt = (jsdai.SExtended_dictionary_schema.ENumber_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNumber_type.class);
                        nt = _st_number;
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                nt = (jsdai.SExtended_dictionary_schema.ENumber_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (nt == null) {
                                // nt = (jsdai.SExtended_dictionary_schema.ENumber_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNumber_type.class);
                                nt = _st_number;
                        }
                }
                {if (true) return nt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.249------------ */
  static final public int NumericExpression5() throws ParseException, jsdai.lang.SdaiException {
        int value = Integer.MIN_VALUE;
        Object argument;
        Object x_argument = null;
    SimpleExpression5();
                if (parser_pass == 5) {
                        argument = argument_stack.pop();
                        printStack("POP: NumericExpression5: " + argument);
                        if (expression_instances) {
                                // x_argument = expression_stack.pop();
                        }
                        if (argument instanceof Integer) {
                                value = ((Integer)argument).intValue();
                                numeric_expression_calculated = true;
                        } else
                        if (argument instanceof Number) {
                                value = ((Number)argument).intValue();
                                // not sure if ever happens
                                numeric_expression_calculated = false;
                        }
                        else {
                                value = Integer.MIN_VALUE;
                                numeric_expression_calculated = false;
                        }
                }
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.250------------ */
  static final public void OneOf5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EOneof_subtype_expression one_of = null;;
// pre-X	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.lang.EEntity ee;
        Object pop_inst = null;
    jj_consume_token(ONEOF);
    jj_consume_token(LPAREN);
    SupertypeExpression5();
                if (parser_pass == 5) {
                        one_of = (jsdai.SExtended_dictionary_schema.EOneof_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.COneof_subtype_expression.class);
                        generic_operands = one_of.createGeneric_operands(null);
                        // operands is now derived instead of explicit 
                        // operands = one_of.createOperands(null);
                        ee = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: OneOf: " + ee);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                        if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression)  { // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                // operands is now derived instead of explicit 
                                // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                        } else
                        if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                // operands is now derived instead of explicit 
                                // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                        } else
                        if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                        } else  {
                        error_count++;
                                printErrorMsg5(" name not available  - internal error in OneOf 1", null, true);
                                printEDebug("Internal error in OneOf 1");
                        }
                }
    label_122:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[362] = jj_gen;
        break label_122;
      }
      jj_consume_token(COMMA);
      SupertypeExpression5();
                if (parser_pass == 5) {
                        ee = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: OneOf: " + ee);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                        if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression)  { // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                // operands is now derived instead of explicit 
                                // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                        } else
                        if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {  // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                // operands is now derived instead of explicit 
                                // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                        } else
                        if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) {  // better with C?
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                        } else {
                                error_count++;
                                printErrorMsg5(" name not available - internal error in OneOf 2", null, true);
                                printEDebug("Internal error in OneOf 2");
                        }
                }
    }
    jj_consume_token(RPAREN);
                if (parser_pass == 5) {
                        argument_stack.push(one_of);
                        printStack("PUSH: OneOf: " + one_of);
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
  }

/*-+-------- ISO 10303-14:B.2.149  ---*/
  static final public void OrderedByClause5() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(ORDERED_BY);
    Expression5();
    label_123:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[363] = jj_gen;
        break label_123;
      }
      jj_consume_token(COMMA);
      Expression5();
    }
    jj_consume_token(SEMICOLON);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.251------------ */
  static final public Object [] Parameter5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) Parameter */
        X_Parameter jjtn000 = new X_Parameter(JJTPARAMETER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object [] results = new Object[2];
        results[0] = null;
        results[1] = null;
    try {
                printDebug("Starting Parameter5");
      Expression5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        results[0] = argument_stack.pop();
                        printStack("POP: Parameter5: " + results[0]);
                        if (expression_instances) {
                                // results[1] = expression_stack.pop();
                        }
                }
                printDebug("Ending Parameter5");
                {if (true) return results;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.252------------ */
  static final public String ParameterId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
                printDebug("In ParameterId5, starting");
    t = jj_consume_token(SIMPLE_ID);
                printDebug("In ParameterId5, ending: " + t.image);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.253------------ */
  static final public jsdai.SExtended_dictionary_schema.EParameter ParameterType5() throws ParseException, jsdai.lang.SdaiException {
//      jsdai.lang.EEntity pt = null;
        jsdai.SExtended_dictionary_schema.EData_type pt = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
                printDebug("In ParameterType5, starting");
    switch (jj_nt.kind) {
    case AGGREGATE:
    case ARRAY:
    case BAG:
    case GENERIC_ENTITY:
    case GENERIC:
    case LIST:
    case SET:
      par = GeneralizedTypes5(null);
      break;
    case SIMPLE_ID:
      pt = NamedTypes5(null);
      break;
    case BINARY:
    case BOOLEAN:
    case INTEGER:
    case LOGICAL:
    case NUMBER:
    case REAL:
    case STRING:
      pt = SimpleTypes5(null);
      break;
    default:
      jj_la1[364] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                if (parser_pass == 5) {
                        if (pt !=null) {
                                // par must be null, of course, NamedTypes5() or SimpleTypes5() was chosen. Parameter5 instance must be created now.
//                              if (create_instances) {
                                        par = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);
                                        par.setParameter_type(null, pt);
                                        par.setName(null, "_named_or_simple_");
//                              }
                        } else {
//				System.out.println("@#PT Parameter5 type null ERROR or generalized type");
                        }
                }
                if (par == null) {
                        printDebug("In ParameterType5, ending - null");
                } else {
                        printDebug("In ParameterType5, ending - OK");
                }
                {if (true) return par;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.153  ---*/
  static final public String PartitionId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.154  ---*/
  static final public jsdai.SExtended_dictionary_schema.EMap_or_view_partition PartitionQualification5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EMap_or_view_partition result = null;
    jj_consume_token(BACKSLASH);
    result = PartitionRef5(parent);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.155  ---*/
  static final public void PathCondition5() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(LBRACE);
    ExtentReference5();
    switch (jj_nt.kind) {
    case BIT_OR:
      jj_consume_token(BIT_OR);
      LogicalExpression5();
      break;
    default:
      jj_la1[365] = jj_gen;
      ;
    }
    jj_consume_token(RBRACE);
  }

/*-+-------- ISO 10303-14:B.2.156  ---*/
  static final public void PathQualifier5() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case FPATH:
      ForwardPathQualifier5();
      break;
    case BPATH:
      BackwardPathQualifier5();
      break;
    default:
      jj_la1[366] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.254------------ */
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition Population5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) Population */
        X_Population jjtn000 = new X_Population(JJTPOPULATION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
    try {
                printDebug("In Population5, starting");
      ed = EntityRef5(null);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        // argument_stack.push(ed); - doing it in qualifiable factor already
                        printStack("PUSH: Population5, entity reference: " + ed.getName(null));
                        if (expression_instances) {
                                jjtn000.ed = ed;
                                // expression_stack.push(null);
                        }
                        // creating set type in dictionary
                        if (ed != null) {
                                // String set_name = "_SET_0_" + _data_type_name;
                                // static fields are not generated for each possible no-name aggregate, but on demand only
                                // demand, such as attribute type, Parameter5 type or local variable type
                                // for Population5, it is not possible to determine by demand, let's distinguish by name.
                                String set_name = "_POPULATION_" + _data_type_name;
                                printDebug("SET_NAME: " +set_name);
                                if (!(isDataTypePresent(set_name))) {
                                        jsdai.SExtended_dictionary_schema.ESet_type st = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
                                        st.setName(null, set_name);
                                        st.setElement_type(null, ed);
                                        jsdai.SExtended_dictionary_schema.EInteger_bound b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, 0);
                                        st.setLower_bound(null, b1);
                                        st.unsetUpper_bound(null);  // no need for that - it is unset after creating
                                }
                        }
                }
                printDebug("In Population5, ending");
                {if (true) return ed;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.255------------ */
  static final public int PrecisionSpec5() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression5();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.256------------ */
  static final public void Primary5() throws ParseException, jsdai.lang.SdaiException {
        Object reference = null;
                printDebug("In Primary5");
    switch (jj_nt.kind) {
    case FALSE:
    case TRUE:
    case UNKNOWN:
    case BINARY_LITERAL:
    case ENCODED_STRING_LITERAL:
    case INTEGER_LITERAL:
    case REAL_LITERAL:
    case SIMPLE_STRING_LITERAL:
      Literal5();
      break;
    default:
      jj_la1[367] = jj_gen;
      if (jj_2_66(1)) {
        reference = QualifiableFactor5();
        label_124:
        while (true) {
          if (jj_2_65(2)) {
            ;
          } else {
            break label_124;
          }
          reference = Qualifier5(reference);
        }
      } else {
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.257------------ */
  static final public void ProcedureCallStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ProcedureCallStmt */
        X_ProcedureCallStmt jjtn000 = new X_ProcedureCallStmt(JJTPROCEDURECALLSTMT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);int builtin_proc_id = -1;
        Vector arguments = new Vector();
        Vector expressions = new Vector();
        int argument_count = -1;
        Object operand = null;
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
    try {
                printDebug("In ProcedureCallStmt5, starting");
      switch (jj_nt.kind) {
      case INSERT:
      case REMOVE:
        builtin_proc_id = BuiltInProcedure5();
        break;
      case SIMPLE_ID:
        pd = ProcedureRef5();
        break;
      default:
        jj_la1[368] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      switch (jj_nt.kind) {
      case LPAREN:
        argument_count = ActualParameterList5(arguments, expressions);
        break;
      default:
        jj_la1[369] = jj_gen;
        ;
      }
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        jjtn000.built_in_id = builtin_proc_id;
// System.out.println("OOOO pd = " + pd);
                        jjtn000.pd = pd;
                        jjtn000.arguments = arguments;
                        jjtn000.scope = active_scope;
                        jjtn000.argument_count = argument_count;
//                      operand = argument_stack.pop();
//                      printStack("POP: ProcedureCallStmt5, return value: " + operand);
                }
                printDebug("Ending ProcedureCallStmt5: " + builtin_proc_id);
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.258------------ */
  static final public void ProcedureDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ProcedureDecl */
        X_ProcedureDecl jjtn000 = new X_ProcedureDecl(JJTPROCEDUREDECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
    try {
      try {
                scope_stack.push(current_scope);
                current_scope = new Vector();
        pd = ProcedureHead5();
        AlgorithmHead5();
                                                 X_ListOfStmt jjtn001 = new X_ListOfStmt(JJTLISTOFSTMT);
                                                 boolean jjtc001 = true;
                                                 jjtree.openNodeScope(jjtn001);
                                                 jjtreeOpenNodeScope(jjtn001);
        try {
          label_125:
          while (true) {
            switch (jj_nt.kind) {
            case SEMICOLON:
            case ALIAS:
            case BEGIN:
            case CASE:
            case ESCAPE:
            case IF:
            case INSERT:
            case REMOVE:
            case REPEAT:
            case RETURN:
            case KW_SKIP:
            case SIMPLE_ID:
              ;
              break;
            default:
              jj_la1[370] = jj_gen;
              break label_125;
            }
            Stmt5();
          }
        } catch (Throwable jjte001) {
                                                 if (jjtc001) {
                                                   jjtree.clearNodeScope(jjtn001);
                                                   jjtc001 = false;
                                                 } else {
                                                   jjtree.popNode();
                                                 }
                                                 if (jjte001 instanceof RuntimeException) {
                                                   {if (true) throw (RuntimeException)jjte001;}
                                                 }
                                                 if (jjte001 instanceof ParseException) {
                                                   {if (true) throw (ParseException)jjte001;}
                                                 }
                                                 if (jjte001 instanceof jsdai.lang.SdaiException) {
                                                   {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                                                 }
                                                 {if (true) throw (Error)jjte001;}
        } finally {
                                                 if (jjtc001) {
                                                   jjtree.closeNodeScope(jjtn001, true);
                                                   jjtreeCloseNodeScope(jjtn001);
                                                 }
        }
        jj_consume_token(END_PROCEDURE);
//	active_scope = null;
                function_depth--;
                if (function_depth > 0) {
                        active_scope = getParentFunctionProcedureRuleDefinition(pd);
                        active_scope_string =  active_scope_extension.getParent_scope_string();
                  active_scope_extension = active_scope_extension.getParent();
                } else {
                        active_scope = null;
                        active_scope_string =  active_scope_extension.getParent_scope_string();
                  active_scope_extension = active_scope_extension.getParent();
                }
        jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.pd = pd;
                        }
                }
      } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
        printErrorMsg5(e.getMessage(), null, true);
        // System.out.println("ERROR RECOVERY: skipping to END_PROCEDURE");
                error_count++;
        recoverFromParseException(END_PROCEDURE, e);
      }
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.259------------ */
  static final public jsdai.SExtended_dictionary_schema.EProcedure_definition ProcedureHead5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ProcedureHead */
        X_ProcedureHead jjtn000 = new X_ProcedureHead(JJTPROCEDUREHEAD);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String name;
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration prod;
        String key = "";




        jsdai.SExtended_dictionary_schema.AParameter parameters = null;
        boolean var_present = false;
        boolean first_token = true;
        Token start_token = null;
        Token end_token = null;
    try {
      jj_consume_token(PROCEDURE);
                     function_depth++;
      name = ProcedureId5();
                if (parser_pass == 1) {
                        printVerbose("Procedure: " + name);
//			pd = findProcedure(name);
//			pd = findProcedure_definition(name);
                        pd = findProcedure_definitionX(name);
                        if (pd != null) {
                                                error_count++;
                                                printDebug("duplicate procedure name \"" + name + "\"");
                        } else {
                                String wrong_name = findAnyName(name);
                                if (wrong_name != null) {
                                                error_count++;
                                                printDebug("duplicate name \"" + name + "\". The same name used for a procedure and for " + wrong_name);
                                }
                        }
                  if (function_depth == 1) {
                                pd = (jsdai.SExtended_dictionary_schema.EProcedure_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CProcedure_definition.class);
                                active_scope = pd;
                          prod = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$procedure_declaration.class);
                                prod.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // prod.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                prod.setDefinition(null, pd);
                                if (flag_oc) {
                                        pd.setName(null, name);
                                } else {
                                        pd.setName(null, name.toLowerCase());
                                }
                                parameters = pd.createParameters(null);
                          // is it really needed here in the 5-th pass?
                                hm_current_procedure_declarations.put(name.toLowerCase(), prod);
                        }
                } else {
                        if (function_depth == 1) {
//			pd = findProcedure(name);
//				pd = findProcedure_definition(name);
                                pd = findProcedure_definitionX(name);
                          active_scope_extension = new ECtScope(active_scope, pd, active_scope_extension, active_scope_string, name, name.toLowerCase());
                        active_scope_string = "";
                                active_scope = pd;
                                if (pd == null) {
                                        error_count++;
                                        printErrorMsg5("" + name + " - procedure not found", null, true);
                                        printDebug("ProcedureHead5 - procedure not found: " + name);
                                } else {
                                        parameters = pd.getParameters(null);
                                }
                        } else {
//				pd = findProcedure_definition(name);
                                pd = findProcedure_definitionX(name);
                          active_scope_extension = new ECtScope(active_scope, pd, active_scope_extension, active_scope_string, name, constructProcedureKey(name));
                        active_scope_string = "";
                                active_scope = pd;
                                if (pd == null) {
                                        error_count++;
                                        printErrorMsg5("" + name + " - procedure not found", null, true);
                                        printDebug("ProcedureHead5 - procedure not found: " + name);
                                } else {
                                        parameters = pd.getParameters(null);
                                }
                        }
                }
      switch (jj_nt.kind) {
      case LPAREN:
        jj_consume_token(LPAREN);
               var_present = false;
        switch (jj_nt.kind) {
        case VAR:
          jj_consume_token(VAR);
                                            var_present = true;
          break;
        default:
          jj_la1[371] = jj_gen;
          ;
        }
        FormalParameter5(parameters, var_present, /* null,*/ null);
        label_126:
        while (true) {
          switch (jj_nt.kind) {
          case SEMICOLON:
            ;
            break;
          default:
            jj_la1[372] = jj_gen;
            break label_126;
          }
          jj_consume_token(SEMICOLON);
                                                                                                                                   var_present = false;
          switch (jj_nt.kind) {
          case VAR:
            jj_consume_token(VAR);
                                                                                                                                                               var_present = true;
            break;
          default:
            jj_la1[373] = jj_gen;
            ;
          }
          FormalParameter5(parameters, var_present, /* null,*/ null);
        }
        jj_consume_token(RPAREN);
        break;
      default:
        jj_la1[374] = jj_gen;
        ;
      }
      jj_consume_token(SEMICOLON);
           jjtree.closeNodeScope(jjtn000, true);
           jjtc000 = false;
           jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        if (function_depth == 1) {
//				String procedure_description = "";
                                String procedure_description = " ";
                                int local_function_depth = 1;
                        for (int i = 1; ; i++) {
                                        Token t = getToken(i);
                                        if (t.kind == PROCEDURE) {
                                                local_function_depth++;
                                        }
                                        if (t.kind == END_PROCEDURE) {
                                                local_function_depth--;
                                                if (local_function_depth == 0) {
                                                 // printDDebug("Break, function depth: " + local_function_depth);
                                                 break;
                                                } else {
                                                 ; // printDDebug("Continue, function depth: " + local_function_depth);
                                                }

                                        }
                                        if (first_token) {
                                                start_token = t;
                                                end_token = t;
                                                first_token = false;
                                        } else {
                                                end_token = t;
                                        }
                                        // is it needed?
                                        if (flag_oc) {
                                                procedure_description += t.image + " ";
                                        } else {
                                                procedure_description += t.image.toLowerCase() + " ";
                                        }
//					procedure_description += t.image;
                        }
                                // printDDebug("Procedure: " + procedure_description);
                                createExpressEntity(pd, procedure_description, start_token, end_token);
//				createExpressEntity(pd, procedure_description);
                        }
        }
        {if (true) return pd;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.260------------ */
  static final public String ProcedureId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 20, 20 & 39, 39 & 56, 56 & 71) ------------------------ ISO 10303-11:A.2.261------------ */
// here, the bnf must be modified to handle interpreted identifiers.
  static final public Object QualifiableFactor_old5() throws ParseException, jsdai.lang.SdaiException {
                Object reference = null;
                Object function_call = null;
                printDebug("In QualifiableFactor5");
                int which_selected = 0;
                Token t = null;
                String name = null;
                global_name = null;
                Object constant = null;
                jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                if (flag_oc) {
                  name = getToken(1).image;
                } else {
                  name = getToken(1).image.toLowerCase();
                }
                printDebug("In QualifiableFactor5 - token: " + name);
    if (jj_2_67(2147483647)) {
      function_call = FunctionCall5();
                                                                                               which_selected = 1;
    } else if (getToken(1).kind == Compiler2Constants.SIMPLE_ID) {
      reference = QFInterpretedId5(name);
                                                                                                                  which_selected = 3;
    } else {
      switch (jj_nt.kind) {
      case HOOK:
      case CONST_E:
      case PI:
      case SELF:
        //	    BuiltInConstant5(){which_selected = 2;})
                constant = BuiltInConstant5();
                                      which_selected = 2;
        break;
      default:
        jj_la1[375] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                switch (which_selected) {
                        case 0:
                                printDebug("In QualifiableFactor5 nothing selected: " + name);
                                break;
                        case 1:
                                printDebug("In QualifiableFactor5 selected FunctionCall5: " + name);
                                if (parser_pass == 5) {
                                        // stack is pushed in FunctionCall5
                                        reference = function_call;
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        case 2:
                                printDebug("In QualifiableFactor5 selected BuiltInConstant5: " + name);
                                if (parser_pass == 5) {
                                        // stack is pushed in BuiltInConstant5
                                        reference = constant;
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        case 3:
                                printDebug("In QualifiableFactor5 selected InterpretedId5: " + name);
                                break;
                        default:
                                printDebug("In QualifiableFactor5 - error: " + name);
                                break;
                }


                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

///// ----------------- S
  static final public Object QualifiableFactor5() throws ParseException, jsdai.lang.SdaiException {
                Object reference = null;
                printDebug("In QualifiableFactor5");
                int which_selected = 0;
                Token t = null;
                String name = null;
                global_name = null;
                Object constant = null;
                jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                jsdai.SExtended_dictionary_schema.EEntity_definition pop_ed = null;
                jsdai.SExtended_dictionary_schema.EParameter par = null;
                jsdai.SExtended_dictionary_schema.EAttribute attr = null;
                ECtVariable var = null;
                if (flag_oc) {
                  name = getToken(1).image;
                } else {
                  name = getToken(1).image.toLowerCase();
                }
                printDebug("In QualifiableFactor5 - token: " + name);
// System.out.println("@#Q in QualifiableFactor5 - active scope: " + active_scope);		
                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
    }
//    ahead = whatsAhead(this);

    if (jj_2_68(2147483647)) {
      reference = BuiltInConstant5();
                        printDebug("In QualifiableFactor5 selected BuiltInConstant5: " + name);
                        if (parser_pass == 5) {
                                // stack is pushed in BuiltInConstant5
                                // reference = constant;
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isAttributeRef()) {
      attr = AttributeRef5(null, ed, 4, null);
// System.out.println("@#A AttributeRef5 in QualifiableFactor5, ed: " + ed);
                        printDebug("In QualifiableFactor5 selected Attribute: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(attr);
                                reference = attr;
                                if (attr != null) {
                                        printStack("PUSH: QF attribute: " + attr.getName(null));
                                        if (expression_instances) {
                                                String x_operand = attr.getName(null);
                                        }
                                } else {
                                                printVerbose("ERROR: QF attribute is NULL");
                                }
//				printStack("PUSH: QF attribute: " + attr.getName(null));
                        }
    } else if (isConstantRef()) {
      reference = ConstantRef5();
                        printDebug("In QualifiableFactor5 selected Constant: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(reference);
                                // reference = constant;
                                printStack("PUSH: QF constant: " + reference);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isFunctionCall()) {
      reference = FunctionCall5();
                        printDebug("In QualifiableFactor5 selected FunctionCall5: " + name);
                        if (parser_pass == 5) {
                                // stack is pushed in FunctionCall5
                                // reference = function_call;
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isViewAttributeRef()) {
      reference = ViewAttributeRef5();
                        printDebug("In QualifiableFactor5 selected ViewAttributeRef5: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(reference);
                                printStack("PUSH: QF view_attribute_ref: " + reference);
                        }
    } else if (isSourceParameterRef()) {
      reference = SourceParameterRef5();
                        printDebug("In QualifiableFactor5 selected SourceParameterRef5: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(reference);
                                printStack("PUSH: QF source_parameter_ref: " + reference);
                        }
    } else if (isTargetParameterRef()) {
      reference = TargetParameterRef5();
                        printDebug("In QualifiableFactor5 selected TargetParameterRef5: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(reference);
                                printStack("PUSH: QF target_parameter_ref: " + reference);
                        }
    } else if (isViewCall()) {
      reference = ViewCall5();
                        printDebug("In QualifiableFactor5 selected ViewCall5: " + name);
                        if (parser_pass == 5) {
                                // is stack pushed in ViewCall5? to see how to implement
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isParameterRef()) {
      par = ParameterRef5();
                        printDebug("In QualifiableFactor5 selected Parameter5: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(par);
                                reference = par;
                                printStack("PUSH: QF Parameter5: " + par);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isVariableRefX()) {
      var = VariableRef5();
                        printDebug("In QualifiableFactor5 selected Variable: " + name);
                        if (parser_pass == 5) {
                                argument_stack.push(var);
                                reference = var;
                                printStack("PUSH: QF variable: " + var);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else if (isPopulation()) {
      pop_ed = Population5();
                        printDebug("In QualifiableFactor5 selected Population5: " + name);
                        if (parser_pass == 5) {
                                // CHECK: are we pushing it the second time here? also in Population5()
                                argument_stack.push(pop_ed);
                                reference = pop_ed;
                                printStack("PUSH: QF Population5: " + pop_ed.getName(null));
                        }
    } else if (isMapCall()) {
      reference = MapCall5();
                        printDebug("In QualifiableFactor5 selected MapCall5: " + name);
                        if (parser_pass == 5) {
                                // is pushed in MapCall5 - to be implemented
                                // reference = view_call;
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
    } else {
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        // hopefully it will not happen in pass 5
                        reference = UnrecognizedReference5();
                        printDebug("In QualifiableFactor5 nothing selected: " + name);
                        if (parser_pass == 5) {
                                // is pushed in MapCall5 - to be implemented
                                // reference = view_call;

                                // experimental stuff, but perhaps push is always needed even for push(null)
                                argument_stack.push(reference);
//				reference = unknown;
                                printStack("PUSH: QF Unrecognized Object: " + reference);


                                if (expression_instances) {
//					printErrorMsg("reference to unknown object in qualifiable_factor: " + name, null, true);
                                        printErrorMsg("" + name + " - reference to unknown object in an expression", null, true);
                                error_count++;
                                        // expression_stack.push(null);
                                }
                        }
        break;
      default:
        jj_la1[376] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

  static final public UnknownObject UnrecognizedReference5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) UnrecognizedReference */
        X_UnrecognizedReference jjtn000 = new X_UnrecognizedReference(JJTUNRECOGNIZEDREFERENCE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Token t;
        String name;
        UnknownObject unknown;
    try {
                        printDebug("In UnrecognizedReference5, starting in pass: " + parser_pass);
      //    <SIMPLE_ID> [ "(" Expression5() ")" [";"] ]
          t = jj_consume_token(SIMPLE_ID);
      switch (jj_nt.kind) {
      case LPAREN:
        jj_consume_token(LPAREN);
        if (jj_2_69(1)) {
          Expression5();
        } else {
          ;
        }
        label_127:
        while (true) {
          switch (jj_nt.kind) {
          case COMMA:
            ;
            break;
          default:
            jj_la1[377] = jj_gen;
            break label_127;
          }
          jj_consume_token(COMMA);
          Expression5();
        }
        jj_consume_token(RPAREN);
        break;
      default:
        jj_la1[378] = jj_gen;
        ;
      }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (flag_oc) {
                        name = t.image;
                } else {
                        name = t.image.toLowerCase();
                }
                unknown = new UnknownObject(name, active_scope, sd, express_file);

        // if goes here in pass 5, empty stack exeption may occur.
                if (parser_pass == 5) {
//			argument_stack.push(null);
                                if (expression_instances) {
                                        jjtn000.unknown = unknown;
                                }
                }
                printDebug("In UnrecognizedReference5, ending: " + t.image);
                {if (true) return unknown;}
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
    throw new Error("Missing return statement in function");
  }

  static final public Object QualifiableFactor_new_abandoned5() throws ParseException, jsdai.lang.SdaiException {
                Object reference = null;
                Object function_call = null;
                printDebug("In QualifiableFactor5");
                int which_selected = 0;
                Token t = null;
                String name = null;
                global_name = null;
                Object constant = null;
                jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
                if (flag_oc) {
                  name = getToken(1).image;
                } else {
                  name = getToken(1).image.toLowerCase();
                }
                printDebug("In QualifiableFactor5 - token: " + name);
                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
    }
    ahead = whatsAhead();
    if (ahead == WA_ATTRIBUTE_REF) {
      reference = AttributeRef5(null, ed, 4, null);

    } else if (ahead == WA_BUILTIN_CONSTANT) {
      reference = BuiltInConstant5();

    } else if (ahead == WA_CONSTANT_REF) {
      reference = ConstantRef5();

    } else if (ahead == WA_FUNCTION_CALL) {
      reference = FunctionCall5();

    } else if (ahead == WA_POPULATION) {
      reference = Population5();

    } else if (ahead == WA_VIEW_ATTRIBUTE_REF) {
      reference = ViewAttributeRef5();

    } else if (ahead == WA_VIEW_CALL) {
      reference = ViewCall5();

    } else if (ahead == WA_PARAMETER_REF) {
      reference = ParameterRef5();

    } else if (ahead == WA_VARIABLE_REF) {
      reference = VariableRef5();

    } else if (ahead == WA_MAP_CALL) {
      reference = GeneralOrMapCall5();

    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
/*
		switch (which_selected) {
			case 0:
				printDebug("In QualifiableFactor5 nothing selected: " + name);
				break;
			case 1:
				printDebug("In QualifiableFactor5 selected FunctionCall5: " + name);
				if (parser_pass == 5) {
					// stack is pushed in FunctionCall5
					reference = function_call;
					if (expression_instances) {
						// expression_stack.push(null);
					}
				}
				break;
			case 2:
				printDebug("In QualifiableFactor5 selected BuiltInConstant5: " + name);
				if (parser_pass == 5) {
					// stack is pushed in BuiltInConstant5
					reference = constant;
					if (expression_instances) {
						// expression_stack.push(null);
					}
				}
				break;
			case 3:
				printDebug("In QualifiableFactor5 selected InterpretedId5: " + name);
				break;
			default:
				printDebug("In QualifiableFactor5 - error: " + name);
				break;
		}

*/
                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

///////////// E
  static final public Object QFInterpretedId5(String name) throws ParseException, jsdai.lang.SdaiException {
        Object reference = null;
        choice = 0;
        int chosen = 0;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EConstant_definition con = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        ECtVariable var = null;
        Object constant = null;
        jsdai.SExtended_dictionary_schema.EParameter par = null;
        Object varpar = null;
        String attr_key = null;
//              printDDebug("interpreted ID name in QF: " + name);
                if (parser_pass == 1) {
                } else
                if (parser_pass == 2) {
                } else
                if ((parser_pass == 3) || (parser_pass == 4)) {
                        ed = findEntity_definition(name, null);
                        if (ed != null) { // interpreted ID is entity ID
                                choice = 1;
                        } else {
                                // not an entity
                                // con = findConstant(name);
                                // ?
                                con = findConstant_definitionX(name);
                                if (con != null) { // interpreted ID is constant ID
                                        choice = 3;
                                } else {
                                // attribute - not in pass 3, Parameter5, variable - not yet applicable, by default - variable (?)
                                        choice = 5;
                                }
                        }
                }       else
                if (parser_pass == 5) {
                        ed = findEntity_definition(name, null);
                        if (ed != null) { // interpreted ID is entity ID
                                choice = 1;
                        } else {
                                // not an entity
//				con = findConstant_definition(name);
                                con = findConstant_definitionX(name);
                                if (con != null) { // interpreted ID is constant ID
                                        choice = 3;
                                } else {

                                        if (active_scope instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)active_scope;
printDDebug("QF entity-attribute: " + ed.getName(null));
// System.out.println("@X 11 name: " + name + ", ed: " + ed);
                                                attr = findAttribute(name, ed, -1, null, attr_key); // currently, 0, 1, or 2 is ignored, any attribute is returned.
                                                if (attr != null) { // interpreted ID is an attribute
                                                        choice = 2;
                                                }
                                        } else {


                                                // varpar = findInNestedScope(name);
//						varpar = findInterpretedId(name);
                                                varpar = findInterpretedIdX(name);
                                                if (varpar == null) {
                                                        // seems like an error.
                                                } else {
                                                        if (varpar instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                                                par = (jsdai.SExtended_dictionary_schema.EParameter)varpar;
                                                                choice = 4;
                                                        } else
                                                        if (varpar instanceof ECtVariable) {
                                                                var = (ECtVariable)varpar;
                                                                choice = 5;
                                                        } else {
                                                                // seems like an error as well. Although I may need to modify the part about constants in QFInterpretedId5.
                                                  }

                                                }
                                                // Parameter5 or variable - not yet applicable, default - variable
                                                // choice = 5;
                                        }
                                }
                        }
                }
//              printDDebug("QF choice nr: " + choice);

    if (choice == 1) {
      ed = Population5();
                                                      chosen = 1;
    } else if (choice == 2) {
      attr = AttributeRef5(null, ed, 4, null);
                                                                                  chosen = 2;
    } else if (choice == 3) {
      constant = ConstantRef5();
                                                                    chosen = 3;
    } else if (choice == 4) {
      par = ParameterRef5();
                                                                chosen = 4;
    } else {
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        var = VariableRef5();
                                      chosen = 5;
        break;
      default:
        jj_la1[379] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                switch (chosen) {
                        case 0:
                                printDebug("In QF nothing selected");
                                break;
                        case 1:
                                printDebug("In QF selected Population5");
                                if (parser_pass == 5) {
                                        argument_stack.push(ed);
                                        reference = ed;
                                        printStack("PUSH: QF Population5: " + ed.getName(null));
                                }
                                break;
                        case 2:
                                printDebug("In QF selected Attribute");
                                if (parser_pass == 5) {
                                        argument_stack.push(attr);
                                        reference = attr;
                                        if (attr != null) {
                                                printStack("PUSH: QF attribute: " + attr.getName(null));
                                                if (expression_instances) {
                                                        //String x_operand = (String)expression_stack.pop();
                                                        String x_operand = attr.getName(null);
//            x_operand = "this.get" + x_operand.substring(0,1).toUpperCase() + x_operand.substring(1).toLowerCase() + "(null)";
            // x_operand = "get" + x_operand.substring(0,1).toUpperCase() + x_operand.substring(1).toLowerCase() + "(null)";
                                                // expression_stack.push(x_operand);
                                                // printXStack("PUSH: QF attribute: " + x_operand);
                                                }
                                        } else {
                                                printVerbose("ERROR: QF attribute is NULL");
                                        }
                                        // printStack("PUSH: QF attribute: " + attr.getName(null));
                                }
                                break;
                        case 3:
                                printDebug("In QF selected Constant");
                                if (parser_pass == 5) {
                                        argument_stack.push(constant);
                                        reference = constant;
                                        printStack("PUSH: QF constant: " + constant);
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        case 4:
                                printDebug("In QF selected Parameter5");
                                if (parser_pass == 5) {
                                        argument_stack.push(par);
                                        reference = par;
                                        printStack("PUSH: QF Parameter5: " + par);
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        case 5:
                                printDebug("In QF selected Variable");
                                if (parser_pass == 5) {
                                        argument_stack.push(var);
                                        reference = var;
                                        printStack("PUSH: QF variable: " + var);
                                        if (expression_instances) {
                                                // expression_stack.push(null);
                                        }
                                }
                                break;
                        default:
                                printDebug("In QF - error");
                                break;
                }
                {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.262------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute QualifiedAttribute5(jsdai.SExtended_dictionary_schema.EEntity_definition ed, int attr_type) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr2 = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed2 = null;
        Token a_token;
        int attr_type_original;
        boolean to_debug = false;
//	 System.out.println("@X 5-1 - going to GroupQualifier + AttributeQualifier - ed: " + ed);
        printDebug("In QualifiedAttribute5, starting");

                attr_type_original = attr_type;
                if (attr_type == -40) {
                        attr_type = 0;
                        to_debug = true;
                        System.out.println("to debug QualifiedAttribute5: " + ed);
                }
    a_token = jj_consume_token(SELF);
    ed2 = GroupQualifier5();

    //	attr2 = AttributeQualifier5(ed, ed2, attr_type, null)
            attr2 = AttributeQualifier5(ed, ed2, attr_type_original, null);
//		 System.out.println("@X 5-3 - AttributeQualifier returns  - attr2: " + attr2);
                 if (parser_pass == 1) {
                 }
                 else { // pass 2
                        if (to_debug) {
                                System.out.println("attr2 returned by AttributeQualifier5: " + attr2);
                        }
                 }
                 createDocumentationEntity3(attr2, a_token);
// if (attr2 == null)
// printDDebug("After createDocumentation in QualifiedAttribute5 - null");
// else
// printDDebug("After createDocumentation in QualifiedAttribute5: " + attr2.getName(null));
        printDebug("In QualifiedAttribute5, ending");
                 {if (true) return attr2;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.263------------ */
  static final public Object Qualifier5(Object general_reference) throws ParseException, jsdai.lang.SdaiException {
        Object reference = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.EData_type gen_data = null;

        printDebug("In Qualifier5, starting, general_reference: " + general_reference);


        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)general_reference;
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                jsdai.lang.EEntity ref_type = null;
                if (((jsdai.SExtended_dictionary_schema.EParameter)general_reference).testParameter_type(null)) {
                        ref_type = ((jsdai.SExtended_dictionary_schema.EParameter)general_reference).getParameter_type(null);
// System.out.println("@#Q: Parameter5 type: " + ref_type);
                } else {
                        printDDebug("Oo> parameter_type unset in Qualifier5: Qualifier5 = Parameter5: " + general_reference);
                }
                if (ref_type instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)ref_type;
                } else {
                        if (ref_type instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                if (((jsdai.SExtended_dictionary_schema.EAggregation_type)ref_type).testElement_type(null)) {
                                        gen_data = ((jsdai.SExtended_dictionary_schema.EAggregation_type)ref_type).getElement_type(null);
                                        if (gen_data instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
printDDebug("OoO Parameter5, Entity in aggregate: " + gen_data.getName(null));
                                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)gen_data;
                                        } else {
                                                printDDebug("OoO Parameter5, NOT entity in aggregate: " + gen_data.getName(null));
                                        }
                                } else {
                                        printDDebug("OoO Parameter5, In aggregate Element5 type not set");
                                }
                        } {
                                printDDebug("OoO Parameter5, NOT entity, not aggregate");
                        }

                }
        } else
        if (general_reference instanceof ECtVariable) {
                jsdai.SExtended_dictionary_schema.EParameter par_type;
                jsdai.lang.EEntity ref_type = null;
                par_type = ((ECtVariable)general_reference).getType();

    if (par_type == null) {
        printDDebug("HiHa variable Parameter5 type NULL: " + general_reference);
    } else
                if (par_type.testParameter_type(null)) {
                        ref_type = par_type.getParameter_type(null);
                } else {
                        printDDebug("Oo> parameter_type unset in Qualifier5: Qualifier5 = variable: " + general_reference);
                }
                if (ref_type == null) {
                        printDDebug("OoO variable type is NULL, possibly implicit: " + general_reference);
                } else
                if (ref_type instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                        ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)ref_type;
                } else {
                        if (ref_type instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                if (((jsdai.SExtended_dictionary_schema.EAggregation_type)ref_type).testElement_type(null)) {
                                        gen_data = ((jsdai.SExtended_dictionary_schema.EAggregation_type)ref_type).getElement_type(null);
                                        if (gen_data instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
printDDebug("OoO variable, Entity in aggregate: " + gen_data.getName(null));
                                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)gen_data;
                                        } else {
                                                printDDebug("OoO variable, NOT entity in aggregate: " + gen_data.getName(null));
                                        }
                                } else {
                                        printDDebug("OoO variable, In aggregate Element5 type not set");
                                }
                        } else {
                                printDDebug("OoO variable, NOT entity, not aggregate");
                        }

                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                if (((jsdai.SExtended_dictionary_schema.EAggregation_type)general_reference).testElement_type(null)) {
                        gen_data = ((jsdai.SExtended_dictionary_schema.EAggregation_type)general_reference).getElement_type(null);
                        if (gen_data instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
printDDebug("OoO aggregate, Entity in aggregate: " + gen_data.getName(null));
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)gen_data;
                        } else {
                                printDDebug("OoO aggregate, NOT entity in aggregate: " + gen_data.getName(null));
                        }
                } else {
                                printDDebug("OoO aggregate, Element5 not set");
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)general_reference).testDomain(null)) {
                        jsdai.lang.EEntity domain =  ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)general_reference).getDomain(null);
                        general_reference = domain;
                        if (domain instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)domain;
                        }
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)general_reference).testDomain(null)) {
                        jsdai.lang.EEntity domain =  ((jsdai.SExtended_dictionary_schema.EDerived_attribute)general_reference).getDomain(null);
                        general_reference = domain;
                        if (domain instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)domain;
                        }
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)general_reference).testDomain(null)) {
                        jsdai.lang.EEntity domain =  ((jsdai.SExtended_dictionary_schema.EInverse_attribute)general_reference).getDomain(null);
                        general_reference = domain;
                        if (domain instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)domain;
                        }
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.ESource_parameter) {
                jsdai.SExtended_dictionary_schema.ESource_parameter sp = (jsdai.SExtended_dictionary_schema.ESource_parameter)general_reference;
                if (sp.testExtent(null)) {
                                jsdai.lang.EEntity domain =  ((jsdai.SExtended_dictionary_schema.ESource_parameter)general_reference).getExtent(null);
                                general_reference = domain;
                                //			ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)sp.getExtent(null); 
                                ed = (jsdai.SExtended_dictionary_schema.EEntity_definition)domain;
                }
        } else
        if (general_reference instanceof jsdai.SExtended_dictionary_schema.ETarget_parameter) {
                jsdai.SExtended_dictionary_schema.ETarget_parameter tp = (jsdai.SExtended_dictionary_schema.ETarget_parameter)general_reference;
                if (tp.testExtent(null)) {
                                ed =  tp.getExtent(null);

// System.out.println("<UUU> ed: " + ed);

                }
        } else
        if (general_reference == null) {
                printDDebug("OoO General reference is NULL");
        } else {
                printDDebug("OoO NOT variable, NOT Parameter5, NOT entity, NOT aggregate: " + general_reference);
        }
    switch (jj_nt.kind) {
    case DOT:
      reference = AttributeQualifier5(ed, ed, 5, general_reference);
      break;
    case BACKSLASH:
      reference = GroupQualifier5();
      break;
    case LBRACKET:
      reference = IndexQualifier5(general_reference);
      break;
    case BPATH:
    case FPATH:
      PathQualifier5();
      break;
    case SIMPLE_ID:
      ViewAttributeRef5();
      break;
    default:
      jj_la1[380] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
// System.out.println("<UOU> reference: " + reference);


                if (reference == null) {
                        printDebug("In Qualifier5, ending with reference = null");
                } else {
                        printDebug("In Qualifier5, ending with OK reference");
                }
        // if (reference == null) {
        //      reference = general_reference;
        // }	

//if (reference == null) {
//	Token t = Compiler2.getToken(0);
//	int line = t.beginLine;
//	int column = t.beginColumn;

//	System.out.println("Qualifier is null, line: " + line + ", column: " + column);
//}	
        {if (true) return reference;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.264------------ */
  static final public void QueryExpression5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) QueryExpression */
        X_QueryExpression jjtn000 = new X_QueryExpression(JJTQUERYEXPRESSION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object aggregate_source = null; // should be entity_definition
        Object log_exp = null;
        Object query_result = null;
        Object pop_inst_aggr_src = null;
        Object pop_inst_log_exp = null;
        ECtVariable var = null;
        String variable_id = null;
        jsdai.lang.EEntity variable_parameter_type = null;
        jsdai.SExtended_dictionary_schema.EParameter variable_type = null;
        String var_id = "";
        String variable_key = "";
    try {
                printDebug("In QueryExpression5, starting");
                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
//		var_id += "_implicit_" + variable_uid + "_" + "_e_";
                variable_id_stack.push(var_id);
                scope_stack.push(current_scope);
                current_scope = new Vector();
// System.out.println("Q - new scope: " + current_scope + ", previous: " + scope_stack.elementAt(0));

      jj_consume_token(QUERY);
      jj_consume_token(LPAREN);
      variable_id = VariableId5();
      jj_consume_token(214);
      AggregateSource5();
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.query_variable_id = variable_id;
                                jjtn000.query_variable_uid = (String)variable_id_stack.peek() + variable_id;
                                jjtn000.query_variable_scope_id = (String)variable_id_stack.peek();

// System.out.println("Q - jjtThis.query_variable_id: " + variable_id);
// System.out.println("Q - jjtThis.query_variable_uid: " + (String)variable_id_stack.peek() + variable_id);
// System.out.println("Q - jjtThis.query_variable_scope_id: " + (String)variable_id_stack.peek());

                        }

 /*
  		variable_type = (jsdai.SExtended_dictionary_schema.EParameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CParameter.class);

			variable_type.setName(null, "_implicit_variable_");

			if (argument_stack.empty()) {
				printVerbose("ERROR: stack empty - QueryExpression");
			} else {
				aggregate_source = argument_stack.pop();
// System.out.println("Q - aggregate_source: " + aggregate_source);
			}	
				
			printStack("POP: AggregateSource5 in Query: " + aggregate_source);
			printDDebug("aggregate_source : " + aggregate_source);
			
			if (aggregate_source instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute){
					printDDebug("getDomain: attr domain: " + ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)aggregate_source).getDomain(null));
					variable_type.setParameter_type(null, (jsdai.SExtended_dictionary_schema.EData_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)aggregate_source).getDomain(null));
			}else
			if (aggregate_source instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute){
					printDDebug("getDomain: attr domain: " + ((jsdai.SExtended_dictionary_schema.EDerived_attribute)aggregate_source).getDomain(null));
					variable_type.setParameter_type(null, (jsdai.SExtended_dictionary_schema.EData_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)aggregate_source).getDomain(null));
			}else
			if (aggregate_source instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute){
					printDDebug("getDomain: attr domain: " + ((jsdai.SExtended_dictionary_schema.EInverse_attribute)aggregate_source).getDomain(null));
					variable_type.setParameter_type(null, (jsdai.SExtended_dictionary_schema.EData_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)aggregate_source).getDomain(null));
			}
			if (aggregate_source instanceof ECtVariable){
// System.out.println("Q - aggregate_source - variable");
//				printDDebug("getDomain: attr domain: " + ((ECtVariable)aggregate_source).getType());
//				variable_type.setParameter_type(null, ((ECtVariable)aggregate_source).getType().getParameter_type(null));
				jsdai.SExtended_dictionary_schema.EParameter tmp = ((ECtVariable)aggregate_source).getType();
				if (tmp.testParameter_type(null)) {
			  		variable_type.setParameter_type(null, tmp.getParameter_type(null));
// System.out.println("Q - parameter_type SET: " + tmp.getParameter_type(null));
				} else {
		  			printDDebug("Oo> parameter_type unset in query_expression, aggregate_source is variable: " + aggregate_source);
// System.out.println("Q - parameter_type UNSET in aggregate_source");
		  	}
			}

*/

                  active_scope_extension = new ECtScope(active_scope, (jsdai.lang.EEntity)null, active_scope_extension, active_scope_string, "" + variable_uid, variable_id);
                        active_scope_string = "";
//			active_scope = null;  // not using on schema level (yet)

/*

			variable_key = constructImplicitVariableKey(variable_id, variable_uid);

			var = new ECtVariable(variable_id, variable_type, function_depth, variable_key, active_scope, true, 1, (String)variable_id_stack.peek());
//			var = new ECtVariable(variable_id, variable_type, (String)variable_id_stack.peek());

			if (variable_key != null) {
				if (!(hm_current_variables.containsKey(variable_key))) {
					hm_current_variables.put(variable_key, var);
				} else {
					// error - perhaps more than one variable with the same name in a function
				}
			} else {
				System.out.println("INTERNAL ERROR - ImplicitVariable in QueryExpression: " + variable_id + "  - wrong active scope: " + active_scope);
			}

*/
//System.out.println("about to find variable X, QueryExpression5 : " + variable_id); 		
                        var = findVariableX(variable_id);

// protection against null pointer exception
if (var == null) {
        System.out.println("INTERNAL ERROR, variable not found in QueryExpression5: " + variable_id);

}  else {

                        var.scope_id = (String)variable_id_stack.peek();

}

//			var = new ECtVariable(variable_id, variable_type, (String)variable_id_stack.peek());

// System.out.println("Q - currrent scope size before: " + current_scope.size());
                        current_scope.addElement(var);
// System.out.println("Q - query variable: " + var);
// System.out.println("Q - currrent scope size after: " + current_scope.size() + ", current scope instance: " + current_scope);

                        printStack("POP: AggregateSource5 in Query: " + aggregate_source);
                        if (expression_instances) {
                                // pop_inst_aggr_src = expression_stack.pop();
                        }
                } else { // other passes - added to handle interpreted IDs
                        var = new ECtVariable(variable_id, variable_type);
                        current_scope.addElement(var);
                }
           X_QueryLogicalExpression jjtn001 = new X_QueryLogicalExpression(JJTQUERYLOGICALEXPRESSION);
           boolean jjtc001 = true;
           jjtree.openNodeScope(jjtn001);
           jjtreeOpenNodeScope(jjtn001);
      try {
        jj_consume_token(BIT_OR);
        LogicalExpression5();
      } catch (Throwable jjte001) {
           if (jjtc001) {
             jjtree.clearNodeScope(jjtn001);
             jjtc001 = false;
           } else {
             jjtree.popNode();
           }
           if (jjte001 instanceof RuntimeException) {
             {if (true) throw (RuntimeException)jjte001;}
           }
           if (jjte001 instanceof ParseException) {
             {if (true) throw (ParseException)jjte001;}
           }
           if (jjte001 instanceof jsdai.lang.SdaiException) {
             {if (true) throw (jsdai.lang.SdaiException)jjte001;}
           }
           {if (true) throw (Error)jjte001;}
      } finally {
           if (jjtc001) {
             jjtree.closeNodeScope(jjtn001, true);
             jjtreeCloseNodeScope(jjtn001);
           }
      }
                if (parser_pass == 5) {
                        log_exp = argument_stack.pop();
                        printStack("POP: Logical Expression5 in Query: " + log_exp);
                        if (expression_instances) {
                                // pop_inst_log_exp = expression_stack.pop();
                        }
                }
      jj_consume_token(RPAREN);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
                        argument_stack.push(query_result);
                        printStack("PUSH: Query result: " + query_result);
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
                current_scope = (Vector)scope_stack.pop();
                variable_id_stack.pop();
                active_scope_string = active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();
                printDebug("In QueryExpression5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.265------------ */
  static final public jsdai.SExtended_dictionary_schema.EReal_type RealType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EReal_type rt = null;
        int precision = 0;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        boolean precision_present = false;
    jj_consume_token(REAL);
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      precision = PrecisionSpec5();
                                                 precision_present = true;
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[381] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if ((!precision_present) || (precision == Integer.MIN_VALUE)) {
                                rt = _st_real;
                        } else {
                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                _data_type_name = "_REAL_" + precision;
                                rt.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, precision);
                                rt.setPrecision(null, b1);
                        }
                }
                else if (parser_pass > 3) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        if (rt == null) {
                                if ((!precision_present) || (precision == Integer.MIN_VALUE)) {
                                        rt = _st_real;
                                } else {
                                        rt = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                        _data_type_name = "_REAL_" + precision;
                                        rt.setName(null, _data_type_name);
                                        b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, precision);
                                        rt.setPrecision(null, b1);
                                }
                        }
                }
                if ((parser_pass == 5) && (precision_present) && (precision != Integer.MIN_VALUE)) {
                                rt = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                _data_type_name = "_REAL_" + precision;
                                rt.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, precision);
                                rt.setPrecision(null, b1);
                }
                {if (true) return rt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.266------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute ReferencedAttribute5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAttribute a;
        printDebug("In ReferencedAttribute5, starting");
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      a = AttributeRef5(null, ed, 4, null);
      break;
    case SELF:
      a = QualifiedAttribute5(ed, 4);
      break;
    default:
      jj_la1[382] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
// System.out.println("AttributeRef5,4, ed: " + ed + ", a: " + a);
        printDebug("In ReferencedAttribute5, ending");
                {if (true) return a;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.267------------ */
/*  ISO 10303-14.B.2.168 */
  static final public void ReferenceClause5(Vector referenced_vector) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EGeneric_schema_definition reference_schema = null;
        String reference_schema_str;
        jsdai.lang.SdaiModel interfaced_model = null;
        boolean items_listed = false;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
        Vector items_vector;
        jsdai.SExtended_dictionary_schema.EReference_from_specification rfs = null;
//	jsdai.SExtended_dictionary_schema.AReferenced_declaration items = null;
        jsdai.SExtended_dictionary_schema.AInterfaced_declaration items = null;
    jj_consume_token(REFERENCE);
    jj_consume_token(FROM);
    reference_schema = SchemaRef5OrRename5();
                items_vector = new Vector();
// what is that? next line, as found:
//		interfaced_model = reference_schema.findEntityInstanceSdaiModel();
                interfaced_model = findReferencedModel(reference_schema);
                if ((interfaced_model == null) && (parser_pass != 1)) {
                        error_count++;
                        printErrorMsg5("" + reference_schema + " - schema not found", null, true);
                        printDebug("schema not found: " + reference_schema);
                }

// 		if ((parser_pass == 2) && (interfaced_model != null)) {
                if (interfaced_model != null) {
                        if (interfaced_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                                interfaced_model.startReadOnlyAccess();
                        }
                }
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      dc = ResourceOrRename5(interfaced_model);
                                                       items_listed = true; items_vector.addElement(dc);
      label_128:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[383] = jj_gen;
          break label_128;
        }
        jj_consume_token(COMMA);
        dc = ResourceOrRename5(interfaced_model);
                                                                                                                                                          items_vector.addElement(dc);
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[384] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case AS:
      jj_consume_token(AS);
      switch (jj_nt.kind) {
      case SOURCE:
        jj_consume_token(SOURCE);
        break;
      case TARGET:
        jj_consume_token(TARGET);
        break;
      default:
        jj_la1[385] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[386] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 2) {
                        rfs = (jsdai.SExtended_dictionary_schema.EReference_from_specification)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReference_from_specification.class);
                        jsdai.SExtended_dictionary_schema.ESchema_definition asd = getSchema_definitionFromModel(interfaced_model);
                        if (asd != null) {
                                rfs.setForeign_schema(null, asd);  // generic_schema_definition;
                        }

                        rfs.setCurrent_schema(null, sd); // generic_schema_definition;
                        if (!items_listed) {
                                if (interfaced_model != null) {
                                        createAllReferencedDeclarations(interfaced_model);
                                        referenced_vector.addElement(interfaced_model);
                                }
                        } else {
                                items = rfs.createItems(null);
//System.out.println("XXXOOOO: " + items);
                                for (int i = 0; i < items_vector.size(); i++) {
//System.out.println("XXXOO: " + items_vector.elementAt(i));
//					 items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));
//					items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EInterfaced_declaration)items_vector.elementAt(i));
//					((jsdai.SExtended_dictionary_schema.AReferenced_declaration)items).addByIndex(i, (jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));

                                         items.addUnordered((jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));
                                }
                        }
                }
  }

/* Reference-Use */
  static final public void Reference2Clause5(Vector referenced_vector) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EGeneric_schema_definition reference_schema = null;
        String reference_schema_str;
        jsdai.lang.SdaiModel interfaced_model = null;
        boolean items_listed = false;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
        Vector items_vector;
        jsdai.SExtended_dictionary_schema.EReference_from_specification rfs = null;
//	jsdai.SExtended_dictionary_schema.AReferenced_declaration items = null;
        jsdai.SExtended_dictionary_schema.AInterfaced_declaration items = null;
    jj_consume_token(REFERENCE2);
    jj_consume_token(FROM);
    reference_schema = SchemaRef5OrRename5();
                items_vector = new Vector();
// what is that? next line, as found:
//		interfaced_model = reference_schema.findEntityInstanceSdaiModel();
                interfaced_model = findReferencedModel(reference_schema);
                if ((interfaced_model == null) && (parser_pass != 1)) {
                        error_count++;
                        printErrorMsg5("" + reference_schema + " - schema not found", null, true);
                        printDebug("schema not found: " + reference_schema);
                }

// 		if ((parser_pass == 2) && (interfaced_model != null)) {
                if (interfaced_model != null) {
                        if (interfaced_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                                interfaced_model.startReadOnlyAccess();
                        }
                }
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      dc = ResourceOrRename5(interfaced_model);
                                                       items_listed = true; items_vector.addElement(dc);
      label_129:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[387] = jj_gen;
          break label_129;
        }
        jj_consume_token(COMMA);
        dc = ResourceOrRename5(interfaced_model);
                                                                                                                                                          items_vector.addElement(dc);
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[388] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case AS:
      jj_consume_token(AS);
      switch (jj_nt.kind) {
      case SOURCE:
        jj_consume_token(SOURCE);
        break;
      case TARGET:
        jj_consume_token(TARGET);
        break;
      default:
        jj_la1[389] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[390] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 2) {
                        rfs = (jsdai.SExtended_dictionary_schema.EReference_from_specification)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReference_from_specification.class);
                        jsdai.SExtended_dictionary_schema.ESchema_definition asd = getSchema_definitionFromModel(interfaced_model);
                        if (asd != null) {
                                rfs.setForeign_schema(null, asd);  // generic_schema_definition;
                        }

                        rfs.setCurrent_schema(null, sd); // generic_schema_definition;
                        if (!items_listed) {
                                if (interfaced_model != null) {
                                        createAllReferencedDeclarations(interfaced_model);
                                        referenced_vector.addElement(interfaced_model);
                                }
                        } else {
                                items = rfs.createItems(null);
//System.out.println("XXXOOOO: " + items);
                                for (int i = 0; i < items_vector.size(); i++) {
//System.out.println("XXXOO: " + items_vector.elementAt(i));
//					 items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));
//					items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EInterfaced_declaration)items_vector.elementAt(i));
//					((jsdai.SExtended_dictionary_schema.AReferenced_declaration)items).addByIndex(i, (jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));

                                         items.addUnordered((jsdai.SExtended_dictionary_schema.EReferenced_declaration)items_vector.elementAt(i));
                                }
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.268------------ */
  static final public int RelOp5() throws ParseException, jsdai.lang.SdaiException {
        int op = 0;
    switch (jj_nt.kind) {
    case LT:
      jj_consume_token(LT);
              op = 1;
      break;
    case GT:
      jj_consume_token(GT);
                              op = 2;
      break;
    case LE:
      jj_consume_token(LE);
                                                op = 3;
      break;
    case GE:
      jj_consume_token(GE);
                                                                 op = 4;
      break;
    case NE:
      jj_consume_token(NE);
                                                                                  op = 5;
      break;
    case EQ:
      jj_consume_token(EQ);
                                                                                                  op = 6;
      break;
    case 215:
      jj_consume_token(215);
                                                                                                                     op = 7;
      break;
    case 216:
      jj_consume_token(216);
                                                                                                                                       op = 8;
      break;
    default:
      jj_la1[391] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return op;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.269------------ */
  static final public int RelOpExtended5() throws ParseException, jsdai.lang.SdaiException {
        int op = 0;
    switch (jj_nt.kind) {
    case EQ:
    case GT:
    case LT:
    case LE:
    case GE:
    case NE:
    case 215:
    case 216:
      op = RelOp5();
      break;
    case IN:
      jj_consume_token(IN);
                               op = 9;
      break;
    case LIKE:
      jj_consume_token(LIKE);
                                                 op = 10;
      break;
    default:
      jj_la1[392] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return op;}
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 18, 18 & 31, 31 & 46, 46 & 62) ------------------------ ISO 10303-11:A.2.270------------ */
/*
void RenameId5() :
{}
{
	LOOKAHEAD(2) ConstantId5() | LOOKAHEAD(2) EntityId5() | LOOKAHEAD(2) FunctionId5() | LOOKAHEAD(2) ProcedureId5() | TypeId5()
}
*/
  static final public String RenameId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.271------------ */
  static final public boolean RepeatControl5() throws ParseException, jsdai.lang.SdaiException {
        Object while_op = null;
        Object until_op = null;
        Object pop_inst_while = null;
        Object pop_inst_until = null;
        boolean increment_present = false;
                printDebug("In RepeatControl5, starting");
                increment_present = false;
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      IncrementControl5();
                              increment_present = true;
      break;
    default:
      jj_la1[393] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case WHILE:
      WhileControl5();
                if (parser_pass == 5) {
                        while_op = argument_stack.pop();
                        printStack("POP: RepeatControl5, while: " + while_op);
                        if (expression_instances) {
                                // pop_inst_while = expression_stack.pop();
                        }
                }
      break;
    default:
      jj_la1[394] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case UNTIL:
      UntilControl5();
                if (parser_pass == 5) {
                        until_op = argument_stack.pop();
                        printStack("POP: RepeatControl5, until: " + until_op);
                        if (expression_instances) {
                                // pop_inst_until = expression_stack.pop();
                        }
                }
      break;
    default:
      jj_la1[395] = jj_gen;
      ;
    }
                printDebug("In RepeatControl5, ending");
                {if (true) return increment_present;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.272------------ */
  static final public void RepeatStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) RepeatStmt */
        X_RepeatStmt jjtn000 = new X_RepeatStmt(JJTREPEATSTMT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand = null;
        String var_id = "";
        boolean increment_present = false;
    try {
                variable_uid++;
                var_id += "_implicit_" + variable_uid + "_";
//		var_id += "_implicit_" + variable_uid + "_" + "_e_";
                variable_id_stack.push(var_id);
                printDebug("In RepeatStmt5, starting");
                scope_stack.push(current_scope);
                current_scope = new Vector();
      jj_consume_token(REPEAT);
      increment_present = RepeatControl5();
      jj_consume_token(SEMICOLON);
      label_130:
      while (true) {
        Stmt5();
        switch (jj_nt.kind) {
        case SEMICOLON:
        case ALIAS:
        case BEGIN:
        case CASE:
        case ESCAPE:
        case IF:
        case INSERT:
        case REMOVE:
        case REPEAT:
        case RETURN:
        case KW_SKIP:
        case SIMPLE_ID:
          ;
          break;
        default:
          jj_la1[396] = jj_gen;
          break label_130;
        }
      }
      jj_consume_token(END_REPEAT);
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                if (parser_pass == 5) {
//			operand = argument_stack.pop();
//			printStack("POP: RepeatStmt5, return value: " + operand);
                }
                current_scope = (Vector)scope_stack.pop();
                variable_id_stack.pop();
                printDebug("In RepeatStmt5, ending");
                if (increment_present) {
                active_scope_string = active_scope_extension.getParent_scope_string();
                        active_scope_extension = active_scope_extension.getParent();
                }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.273------------ */
  static final public int Repetition5() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression5();
                /*
			 this is repetition, therefore only positive numbers make sense
			 so we can use a small negative number for non-computable during parsing
			 and MIN_VALUE still may remain for indeterminate, when it is calculated during parsing to be ? constant
		
			BTW, if indeterminate results in 0 (zero) repetitions, we can use 0 as indeterminate value as well. 
		
			So: 
				MIN_VALUE + flag numeric_expression_calculated = true  - means built-in constant ?
		    for this we may generate repetition value 0
		
				flag numeric_expression_calculated = false - 
					means to calculate during run-time, also different java code needs
		      to be generated
		    for this we may generate repetition value -1  
		*/
                if (!numeric_expression_calculated) {
                        value = -1;
                } else {
                        if (value == Integer.MIN_VALUE) {
                                value = 0;
                        }
                }
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.274------------ */
  static final public jsdai.SExtended_dictionary_schema.EDeclaration ResourceOrRename5(jsdai.lang.SdaiModel interfaced_model) throws ParseException, jsdai.lang.SdaiException {
  String alias_name = null;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
    dc = ResourceRef5(interfaced_model);
    switch (jj_nt.kind) {
    case AS:
      jj_consume_token(AS);
      alias_name = RenameId5();
      break;
    default:
      jj_la1[397] = jj_gen;
      ;
    }
                if (parser_pass == 2) {
                        if ((alias_name != null) && (dc != null)) ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dc).setAlias_name(null, alias_name);

//                      if (dc instanceof jsdai.SExtended_dictionary_schema.EEntity_declaration$used_declaration) {
//                              dc.set
//                      } else
//                      if (dc instanceof jsdai.SExtended_dictionary_schema.EType_declaration$used_declaration) (
//                      }
                }
                {if (true) return dc;}
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 19, 19 & 33, 33 & 49, 49 & 66) ------------------------ ISO 10303-11:A.2.275------------ */
/*  ISO 10303-14.B.2.176 */
// also must handle ViewRef5 and MapRef5 for Express X
  static final public jsdai.SExtended_dictionary_schema.EDeclaration ResourceRef5(jsdai.lang.SdaiModel interfaced_model) throws ParseException, jsdai.lang.SdaiException {
  String referenced_type_name = null;
        jsdai.SExtended_dictionary_schema.ENamed_type nt = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
        jsdai.SExtended_dictionary_schema.EConstant_definition cd = null;
        jsdai.SExtended_dictionary_schema.EFunction_definition fd = null;
        jsdai.SExtended_dictionary_schema.EProcedure_definition pd = null;
        jsdai.SExtended_dictionary_schema.EGlobal_rule gr = null;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
    // this is stupid as only ConstantRef5() is actually always chosen, no matter how many lookahead symbols.
            // better to write and use only one not confusing non-terminal symbol instead
    
    //  ConstantRef5() | EntityRef5() | FunctionRef5() | ProcedureRef5() | TypeRef5(3)
    
                    referenced_type_name = InterpretedId5();
                if (parser_pass == 2) {
                        ed = findInterfacedEntity_definition(interfaced_model, referenced_type_name);
printDDebug("#@# ResourceRef5: ed: " + ed);
                        if (ed == null) {
                                dt = findInterfacedDefined_type(interfaced_model, referenced_type_name);
                                if (dt == null) {
                                        cd = findInterfacedConstant(interfaced_model, referenced_type_name);
                                        if (cd == null) {
                                                fd = findInterfacedFunction(interfaced_model, referenced_type_name);
                                                if (fd == null) {
                                                        pd = findInterfacedProcedure(interfaced_model, referenced_type_name);
                                                        if (pd == null) {
                                                                gr = findInterfacedRule(interfaced_model, referenced_type_name);
                                                                if (gr == null) {
                                                                        error_count++;
                                                                        printDebug("REFERENCE FROM: interfaced express type \"" + referenced_type_name + "\" not found in model: " + interfaced_model.getName());
                                                                } else {
                                                                printDebug("interfaced rule: " + referenced_type_name);
                                                                /*
									if (neededRuleReferencedDeclaration(gr)) {
										dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReferenced_declaration$rule_declaration.class);
										dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
										dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EGlobal_rule)gr);
										gr.setTemp(FLAG_REFERENCED);
									}
								*/
                                                                }
                                                        } else {
                                                                if (neededProcedureReferencedDeclaration(pd)) {
                                                                        dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CProcedure_declaration$referenced_declaration.class);
                                                                        dc.setParent(null, sd);
                                                                        // parent_schema is now derived instead of explicit 
                                                                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                                                // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                                        // }
                                                                        dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EProcedure_definition)pd);
                                                                        pd.setTemp(FLAG_REFERENCED);
                                                                }
                                                        }
                                                } else {
                                                        if (neededFunctionReferencedDeclaration(fd)) {
                                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_declaration$referenced_declaration.class);
                                                                dc.setParent(null, sd);
                                                                // parent_schema is now derived instead of explicit 
                                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                                // }
                                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EFunction_definition)fd);
                                                                hm_current_function_declarations.put(referenced_type_name.toLowerCase(), dc);
                                                                fd.setTemp(FLAG_REFERENCED);
                                                        }
                                                }
                                        } else {
                                                if (neededConstantReferencedDeclaration(cd)) {
                                                        dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CConstant_declaration$referenced_declaration.class);
                                                        dc.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                                // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        // }
                                                        dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EConstant_definition)cd);
                                                        cd.setTemp(FLAG_REFERENCED);
                                                }
                                        }
                                } else {
//                                      tdc = checkTypeRef5erencedDeclaration(dt);
//                                      if (tdc == null ) {
                                        if (neededTypeReferencedDeclaration(dt)) {
                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReferenced_declaration$type_declaration.class);
                                                dc.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                // }
                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)dt);
                                                hm_current_type_declarations.put(referenced_type_name.toLowerCase(), dc);
                                                dt.setTemp(FLAG_REFERENCED);
                                        }
                                }
                        } else { // entity_definition
//                                      edc = checkEntityRef5erencedDeclaration(ed);
//                                      if (edc == null ) {
                                        if (neededEntityReferencedDeclaration(ed)) {
                                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$referenced_declaration.class);
                                                dc.setParent(null, sd);
                                                // parent_schema is now derived instead of explicit 
                                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                // }
                                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)ed);
                                                hm_current_entity_declarations.put(referenced_type_name.toLowerCase(), dc);
                                                ed.setTemp(FLAG_REFERENCED);
                                                // at this stage, perhaps ECtRenamed object could be already removed and converted back to Integer where needed
                                                // it could be done at the end of the resolve() stage of ECtRenamed between the parser passes
                                                // still, just in case, we may have this protection here at least for now
                                                Object t_object = ed.getTemp();
                                                if (t_object == null) {
                                                        ed.setTemp(FLAG_REFERENCED);
                                                } else {
                                                        if (t_object instanceof ECtRenamed) {
                                                                ((ECtRenamed)t_object).interfaced_flag = FLAG_REFERENCED;
                                                        } else {
                                                                System.out.println("<ExpressCompiler> INTERNAL ERROR - ResourceRef 5 - temp_object: " + t_object + ", entity: " + ed);
                                                        }
                                                }
                                        }
                        }
                } else
                if (parser_pass == 3) {
                } else
                if (parser_pass == 4) {
                } else
                if (parser_pass == 5) {
                }
                {if (true) return dc;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.276------------ */
  static final public void ReturnStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) ReturnStmt */
        X_ReturnStmt jjtn000 = new X_ReturnStmt(JJTRETURNSTMT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);Object operand = null;
        Object pop_inst = null;
    try {
                printDebug("In ReturnStmt5, starting");
      jj_consume_token(RETURN);
      switch (jj_nt.kind) {
      case LPAREN:
        jj_consume_token(LPAREN);
        Expression5();
                if (parser_pass == 5) {
                        operand = argument_stack.pop();
                        printStack("POP: ReturnStmt5: " + operand);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
        jj_consume_token(RPAREN);
        break;
      default:
        jj_la1[398] = jj_gen;
        ;
      }
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In ReturnStmt5, ending");
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.277 ------------ */
  static final public void RuleDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) RuleDecl */
        X_RuleDecl jjtn000 = new X_RuleDecl(JJTRULEDECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EGlobal_rule gr;
    try {
      try {
                scope_stack.push(current_scope);
                current_scope = new Vector();
        gr = RuleHead5();
        AlgorithmHead5();
        label_131:
        while (true) {
          switch (jj_nt.kind) {
          case SEMICOLON:
          case ALIAS:
          case BEGIN:
          case CASE:
          case ESCAPE:
          case IF:
          case INSERT:
          case REMOVE:
          case REPEAT:
          case RETURN:
          case KW_SKIP:
          case SIMPLE_ID:
            ;
            break;
          default:
            jj_la1[399] = jj_gen;
            break label_131;
          }
          Stmt5();
        }
        WhereClause5(gr);
        jj_consume_token(END_RULE);
                active_scope = null;
                active_scope_string =  active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();
                function_depth = 0;
        jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                if (parser_pass == 5) {
                        if (expression_instances) {
                                jjtn000.global_rule = gr;
                        }
                }
      } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
        printErrorMsg5(e.getMessage(), null, true);
        // System.out.println("ERROR RECOVERY: skipping to END_RULE");
                error_count++;
        recoverFromParseException(END_RULE, e);
      }
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.278------------ */
  static final public jsdai.SExtended_dictionary_schema.EGlobal_rule RuleHead5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EGlobal_rule gr = null;
        jsdai.SExtended_dictionary_schema.AEntity_definition aed = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed;
//      jsdai.SExtended_dictionary_schema.ELocal_declaration$rule_declaration lrd;
        jsdai.SExtended_dictionary_schema.EDeclaration lrd;
        int Index5 = 1;
        String name;
        Token start_token = null;
        Token end_token = null;
        boolean first_token = true;
    jj_consume_token(RULE);
                 function_depth++;
    name = RuleId5();
    jj_consume_token(FOR);
    jj_consume_token(LPAREN);
    ed = EntityRef5(null);
                if (parser_pass != 5) { // throw out
printVerbose("Global Rule: " + name);

                        if (model != null ) {

                        gr = (jsdai.SExtended_dictionary_schema.EGlobal_rule)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CGlobal_rule.class);
                        active_scope = gr;
                  lrd = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$rule_declaration.class);
                        lrd.setParent(null, sd);
                        // parent_schema is now derived instead of explicit 
                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                // lrd.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                        // }
                        if (!(hm_current_rule_declarations.containsKey(name.toLowerCase()))) {
                                hm_current_rule_declarations.put(name.toLowerCase(), lrd);
                        }
                        lrd.setDefinition(null, gr);
                        if (flag_oc) {
                                gr.setName(null, name);
                        } else {
                                gr.setName(null, name.toLowerCase());
                        }
//                      gr.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                        // now it is inverse
                        // gr.createWhere_rules(null);
      aed = gr.createEntities(null);
      if (ed != null) {
        aed.addByIndex(Index5++, ed);
                        }
                } //  model not null
                } else {
                        gr = findGlobal_rule(name);
                        aed = gr.getEntities(null);
                  active_scope_extension = new ECtScope(active_scope, gr, active_scope_extension, active_scope_string, name, name.toLowerCase());
                        active_scope_string = "";
                        active_scope = gr;

                }
    label_132:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[400] = jj_gen;
        break label_132;
      }
      jj_consume_token(COMMA);
      ed = EntityRef5(null);
                if (parser_pass == 5) {
    // if (aed != null) {
    //  if (ed != null) {
    //  	aed.addByIndex(Index5++, ed);
                //	}
                // }	
                }
    }
    jj_consume_token(RPAREN);
    jj_consume_token(SEMICOLON);
                if (parser_pass == 5) {
//			String rule_description = "";
                        String rule_description = " ";
                        for (int i = 1; ; i++) {
                                Token t = getToken(i);
                                if (t.kind == WHERE) {
                                        break;
                                }
                                if (first_token) {
                                        start_token = t;
                                        end_token = t;
                                        first_token = false;
                                } else {
                                        end_token = t;
                                }
                                // is it needed?
                                if (flag_oc) {
                                        rule_description += t.image + " ";
                                } else {
                                        rule_description += t.image.toLowerCase() + " ";
                                }
//				rule_description += t.image;
                        }



                                // printDDebug("Global rule: " + rule_description);
                        createExpressEntity(gr, rule_description, start_token, end_token);
//			createExpressEntity(gr, rule_description);
    }
                {if (true) return gr;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.279------------ */
  static final public String RuleId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.280 ------------ */
  static final public void SchemaBody5(Vector used_vector, Vector referenced_vector) throws ParseException, jsdai.lang.SdaiException {
    label_133:
    while (true) {
      switch (jj_nt.kind) {
      case REFERENCE2:
      case REFERENCE:
      case USE:
        ;
        break;
      default:
        jj_la1[401] = jj_gen;
        break label_133;
      }
      InterfaceSpecification5(used_vector, referenced_vector);
    }
    switch (jj_nt.kind) {
    case CONSTANT:
      ConstantDecl5();
      break;
    default:
      jj_la1[402] = jj_gen;
      ;
    }
    label_134:
    while (true) {
      switch (jj_nt.kind) {
      case ENTITY:
      case FUNCTION:
      case PROCEDURE:
      case RULE:
      case SUBTYPE_CONSTRAINT:
      case TYPE:
        ;
        break;
      default:
        jj_la1[403] = jj_gen;
        break label_134;
      }
      switch (jj_nt.kind) {
      case ENTITY:
      case FUNCTION:
      case PROCEDURE:
      case SUBTYPE_CONSTRAINT:
      case TYPE:
        Declaration5();
        break;
      case RULE:
        RuleDecl5();
        break;
      default:
        jj_la1[404] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

/* -------------------------------------------------------------------Amendment--------------10303-11:A.2.406 ------------ */
  static final public jsdai.SExtended_dictionary_schema.EAttribute RedeclaredAttribute5(jsdai.SExtended_dictionary_schema.EEntity_definition ed, int attr_type) throws ParseException, jsdai.lang.SdaiException {
        Token new_name = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr = null;
        jsdai.SExtended_dictionary_schema.EAttribute attr_current = null;
        jsdai.SExtended_dictionary_schema.EAttribute original_attr = null;
        int attr_type_original;
        boolean to_debug = false;
// System.out.println("@X 4-3 - going to RedeclaredAttribute - ed: " + ed);
        printDebug("In RedeclaredAttribute5, starting");

                attr_type_original = attr_type;
                if (attr_type == -40) {
                        attr_type = 0;
                        to_debug = true;
                        System.out.println("to debug RedeclaredAttribute5: " + ed);
                }
                flag_in_redeclaring = true;
    //	attr = QualifiedAttribute5(ed, attr_type)  [<RENAMED> new_name = AttributeId5() ]	
            attr = QualifiedAttribute5(ed, attr_type_original);
    switch (jj_nt.kind) {
    case RENAMED:
      jj_consume_token(RENAMED);
      new_name = AttributeId5();
      break;
    default:
      jj_la1[405] = jj_gen;
      ;
    }
// System.out.println("@X 4-4 - after QualifiedAttribute: new name: " + new_name + ", attr: " + attr);

                if (attr != null) { // what if it is null? an internal error probably, to report
//System.out.println("<1> attr: " + attr + ", hs: " + hs_redeclared_attribute_originals);
                        original_attr = getOriginalAttributeForRedeclaring(attr);
//System.out.println("<2> original_attr: " + original_attr);
                        if (original_attr != null) { // and what if null - internal error, to report
                                if (!(hs_redeclared_attribute_originals.add(original_attr))) {
                                        // multiple redeclaration of the same attribute, express error
                                        error_count++;
                                        printErrorMsg5("" + attr.getName(null) +  " - redeclaring the same attribute in entity " + ed.getName(null) + " more than once", null, true);
                                }
//System.out.println("<3> hs: " + hs_redeclared_attribute_originals);
                        } else {
//				 System.out.println("<D2008>ORIGINAL attribute NULL in pass 5< current attribute: " + attr + ", new name if RENAMED: " + new_name);
                        }

                }


                if (new_name != null) {
                        // alternative would be to use a separate attribute alias_name in attribute
                        // but it is not really necessary, because it is always possible to get the original name from the redeclared attribute
                        // however, the old name is also available in the same scope, therefore it is better to have an additional name.
                        // Question: which name should be returned by getName()? old or new? If new - better to change the name, if old - better
                        // to have an additional attribute alias_name. Perhaps.
// System.out.println("@X 12 name: " + new_name.image + ", ed: " + ed);
// System.out.println("@X5 11 attr: " + attr);
// System.out.println("@X5 12 new name: " + new_name.image + ", ed: " + ed);

//			attr_current = findAttribute(new_name.image, ed, attr_type, null);

// System.out.println("@X5 13 attr_current: " + attr_current);

//			if (attr_current != null) {
                                // already exists, do nothing
                                // attr_current.setName(null, new_name.image);
//			} else {
                                if (attr != null) {
//					String old_name = attr.getName(null);
// System.out.println("@X14 attr: " + attr);
                                        String old_name = null;
                                        if (attr.testName(null)) {
                                                old_name = attr.getName(null);
                                        }
                                        if (old_name == null) {
                                                System.out.println("<INTERNAL ERROR> attribute has no name in pass 5: \n\tattribute: " + attr + "\n\tnew name: " + new_name.image);
                                                attr.setName(null, new_name.image);
                                        } else {
                                                if (old_name.equalsIgnoreCase(new_name.image)) {
                                                        // already new name, nothing to do
                                                } else {
                                                        // still the old name, resolving between passes 3 and 4 did not work
                                                        // printWarningMsg("RENAMED attribute, renaming in pass 5 only: " + attr + ", new name: " + new_name.image, null, true);
                                                        attr.setName(null, new_name.image);
                                                }
                                        }
// System.out.println("@X15 attr: " + attr);
                                } else { // attr is NULL
//				 System.out.println("<D2008>CURRENT REDECLARED attribute NULL in pass 5< new name if RENAMED: " + new_name);
                                }
//			}
                }
//		flag_in_redeclaring = false;
        printDebug("In RedeclaredAttribute5, ending");
                {if (true) return attr;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ Amendment ------------ */
  static final public void LanguageVersionId5() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(LBRACE);
    label_135:
    while (true) {
      switch (jj_nt.kind) {
      case LPAREN:
      case RPAREN:
      case INTEGER_LITERAL:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[406] = jj_gen;
        break label_135;
      }
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        jj_consume_token(SIMPLE_ID);
        break;
      case INTEGER_LITERAL:
        jj_consume_token(INTEGER_LITERAL);
        break;
      case LPAREN:
        jj_consume_token(LPAREN);
        break;
      case RPAREN:
        jj_consume_token(RPAREN);
        break;
      default:
        jj_la1[407] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    jj_consume_token(RBRACE);
  }

  static final public void AllSchemasInLoop5() throws ParseException, jsdai.lang.SdaiException {
    try {
      switch (jj_nt.kind) {
      case LBRACE:
        LanguageVersionId5();
        break;
      default:
        jj_la1[408] = jj_gen;
        ;
      }
      switch (jj_nt.kind) {
      case SCHEMA:
        SchemaDecl5();
        jj_consume_token(SEMICOLON);
        break;
      case SCHEMA_MAP:
        SchemaMapDecl5();
        break;
      case SCHEMA_VIEW:
        SchemaViewDecl5();
        break;
      case TYPE:
        GarbageDeclaration5();
        break;
      default:
        jj_la1[409] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    } catch (ParseException e) {
        System.out.println("EXCEPTION: " + e);
                error_count++;
        System.out.println("ERROR RECOVERY: between schemas skipping to the next schema");
        recoverToNextSchema(e);
    }
  }

  static final public void GarbageDeclaration5() throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(TYPE);
//		System.out.println("ERROR: Garbage between schemas");
                if (recoverToTheNextSchema(null) < 0) {if (true) return;}
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.281 ------------ */
  static final public X_AllSchemas AllSchemas5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) AllSchemas */
  X_AllSchemas jjtn000 = new X_AllSchemas(JJTALLSCHEMAS);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
                printDebug("In AllSchemas5, starting, pass: " + parser_pass);
                current_scope = new Vector();
                schema_depth = 0;

                global_sizeof_restriction_value = -1;
        global_is_spec_error_sizeof = false;
                global_is_spec_warning_sizeof = false;
                global_is_outer_sizeof = false;

                // current_scope.addElement("Universal Scope");
                // scope_stack.push(current_scope);
                // printScopeStack();

      try {
        AllSchemasInLoop5();
        label_136:
        while (true) {
          switch (jj_nt.kind) {
          case LBRACE:
          case SCHEMA:
          case SCHEMA_MAP:
          case SCHEMA_VIEW:
          case TYPE:
            ;
            break;
          default:
            jj_la1[410] = jj_gen;
            break label_136;
          }
          AllSchemasInLoop5();
        }
                // current__scope = scope_stack.pop();
         printDebug("In AllSchemas5, ending, pass: " + parser_pass);
         if (_st_real == null) {
                 printDebug("In AllSchemas5, ending, pass: " + parser_pass + ", _st_real is NULL");
         } else {
                 printDebug("In AllSchemas5, ending, pass: " + parser_pass + ", _st_real is OK");
         }
        {if (true) return jjtn000;}
      } catch (TokenMgrError e) {
//System.out.println("<> 5 pass lexical caught: " + jjtThis);
        {if (true) return jjtn000;}
      }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

  static final public void SchemaDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) SchemaDecl */
        X_SchemaDecl jjtn000 = new X_SchemaDecl(JJTSCHEMADECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String schema_name = null;
        String version_name = null;
        Token a_token;
        Vector used_vector = null;
        Vector referenced_vector = null;
    try {
      try {
                Token t;
                express_x = false;
                scope_stack.push(current_scope);
                current_scope = new Vector();
                function_depth = 0;
        a_token = jj_consume_token(SCHEMA);
                              schema_depth++;
        schema_name = SchemaId5();
                global_schema_name = schema_name.toLowerCase();
//System.out.println("<()>schema: " + schema_name);		
                printVerbose0("Parsing schema: " + schema_name + " in pass " + parser_pass);
//		printVerbose("Starting parsing schema: " + schema_name + " in pass " + parser_pass);
                if ((parser_pass == 1) && (!is_complex_schema)) {
//                      if (model == null) {
                                model_name = schema_name.toUpperCase() + "_DICTIONARY_DATA";
// listModels();
// printDDebug("Creating model: : " + model_name);
                                // If model for the schema already exists we delete it V.N.
                                // FIXME related models that have imported declarations from this model
                                //       should also be deleted
                                model = repository.findSdaiModel(model_name);
                                if(model != null) {
                                        model.deleteSdaiModel();
                                        jsdai.lang.SdaiModel relatedModel =
                                                repository.findSdaiModel("_EXPRESS_" + schema_name.toUpperCase());
                                        if(relatedModel != null) {
                                                relatedModel.deleteSdaiModel();
                                        }
                                        relatedModel =
                                                repository.findSdaiModel("_DOCUMENTATION_" + schema_name.toUpperCase());
                                        if(relatedModel != null) {
                                                relatedModel.deleteSdaiModel();
                                        }
                                }
// 				model = findModel(schema_name);
// 				if (model != null) {
// 					error_count++;
// 					printError("Duplicate schema name: " + schema_name);
// 				}
                                model = repository.createSdaiModel(model_name, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                                model.startReadWriteAccess();
                                sd = (jsdai.SExtended_dictionary_schema.ESchema_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSchema_definition.class);
                                if (flag_oc) {
                                        sd.setName(null, schema_name);
                                } else {
                                        sd.setName(null, schema_name.toUpperCase());
                                }
                                // add simple types:
                                if (model_name.equalsIgnoreCase("SDAI_DICTIONARY_SCHEMA_DICTIONARY_DATA")) {
                                        if (flag_xt_sdai) {
                                                // create instances of each simple data type
                                                _st_integer = (jsdai.SExtended_dictionary_schema.EInteger_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_type.class);
                                                _st_integer.setName(null, "_INTEGER");
                                                _st_real = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                                _st_real.setName(null, "_REAL");
                                                _st_number = (jsdai.SExtended_dictionary_schema.ENumber_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNumber_type.class);
                                                _st_number.setName(null, "_NUMBER");
                                                _st_logical = (jsdai.SExtended_dictionary_schema.ELogical_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLogical_type.class);
                                                _st_logical.setName(null, "_LOGICAL");
                                                _st_boolean = (jsdai.SExtended_dictionary_schema.EBoolean_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBoolean_type.class);
                                                _st_boolean.setName(null, "_BOOLEAN");
                                                _st_string = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                                _st_string.setName(null, "_STRING");
                                                _st_string.setFixed_width(null, false);
                                                _st_binary = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                                _st_binary.setName(null, "_BINARY");
                                                _st_binary.setFixed_width(null, false);
                                                _st_generic = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                                                _st_generic.setName(null, "_GENERIC");
                                                // because entity_definition causes bootstrapping problems, here is a temp implementation:
                                                _st_entity = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                                                _st_entity.setName(null, "_ENTITY");
//                _st_entity = (jsdai.SExtended_dictionary_schema.EEntity_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_definition.class);
//                                              _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
//                                              _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//                                              _std_entity.setDefinition(null, _st_entity);
//                                              _st_entity.setName(null, "_ENTITY");
//                                              _st_entity.setInstantiable(null, false);
//                                              _st_entity.setComplex(null, false);
//                                              _st_entity.createSupertypes(null);

//                                  _st_list_string  = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//printDDebug(".oO0Oo. LIST TYPE CREATED - for standard pass 1");
//                                              _st_list_string.setName(null, "_LIST_STRING");

//                                              jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
//                                              jsdai.SExtended_dictionary_schema.EInteger_bound b1;
//                                              b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
//                                              b1.setBound_value(null, 0);
//                                              bounds[0] = b1;
//                                              _st_list_string.setLower_bound(null, bounds[0]);
//                                              _st_list_string.unsetUpper_bound(null);  // no need for that it is unset after creating
//                                              _st_list_string.setUnique_flag(null, false);
//                                              _st_list_string.setElement_type(null, _st_string);


                                    _st_list_generic  = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
// printDDebug(".oO0Oo. LIST TYPE CREATED - for standard pass 1");
//						_st_list_generic.setName(null, "_LIST_GENERIC");
                                                _st_list_generic.setName(null, "_GENERALLIST_0_GENERIC");

                                                jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
                                                jsdai.SExtended_dictionary_schema.EInteger_bound b1;
                                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                                b1.setBound_value(null, 0);
                                                bounds[0] = b1;
                                                _st_list_generic.setLower_bound(null, bounds[0]);
                                                _st_list_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_list_generic.setUnique_flag(null, false);
                                                _st_list_generic.setElement_type(null, _st_generic);

                                    _st_set_generic  = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//						_st_set_generic.setName(null, "_SET_GENERIC");
                                                _st_set_generic.setName(null, "_GENERALSET_0_GENERIC");

                                                _st_set_generic.setLower_bound(null, bounds[0]);
                                                _st_set_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_set_generic.setElement_type(null, _st_generic);

                                    _st_set_string  = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//						_st_set_string.setName(null, "_SET_STRING");
                                                _st_set_string.setName(null, "_GENERALSET_0_STRING");

                                                _st_set_string.setLower_bound(null, bounds[0]);
                                                _st_set_string.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_set_string.setElement_type(null, _st_string);

                                    _st_bag_generic  = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//						_st_bag_generic.setName(null, "_BAG_GENERIC");
                                                _st_bag_generic.setName(null, "_GENERALBAG_0_GENERIC");

                                                _st_bag_generic.setLower_bound(null, bounds[0]);
                                                _st_bag_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_bag_generic.setElement_type(null, _st_generic);

                                    _st_aggregate_generic  = (jsdai.SExtended_dictionary_schema.EAggregation_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregation_type.class);
                                                _st_aggregate_generic.setName(null, "_AGGREGATE_GENERIC");

                                                _st_aggregate_generic.setElement_type(null, _st_generic);

                                                _st_schema = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
                                                _st_model  = model;

                                                if (flag_xt_declarations) {
                                                        _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_integer.setDefinition(null, _st_integer);
                                                        _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_real.setParent(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_real.setDefinition(null, _st_real);
                                                        _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_number.setDefinition(null, _st_number);
                                                        _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_logical.setDefinition(null, _st_logical);
                                                        _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_boolean.setDefinition(null, _st_boolean);
                                                        _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_string.setDefinition(null, _st_string);
                                                        _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_binary.setDefinition(null, _st_binary);
                                                        _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_generic.setDefinition(null, _st_generic);
                                                        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_entity.setDefinition(null, _st_entity);
//            _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//            _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//            _std_list_string.setDefinition(null, _st_list_string);
                                                        _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_list_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_list_generic.setDefinition(null, _st_list_generic);

                                                _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_generic.setDefinition(null, _st_set_generic);
                                                _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_string.setDefinition(null, _st_set_string);
                                                _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_bag_generic.setDefinition(null, _st_bag_generic);
                                                _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                                }
                                        } else {
                                                if (flag_xt_declarations) {
                                                        _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_integer.setDefinition(null, _st_integer);
                                                        _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_real.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_real.setDefinition(null, _st_real);
                                                        _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_number.setDefinition(null, _st_number);
                                                        _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_logical.setDefinition(null, _st_logical);
                                                        _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_boolean.setDefinition(null, _st_boolean);
                                                        _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_string.setDefinition(null, _st_string);
                                                        _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_binary.setDefinition(null, _st_binary);
                                                        _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_generic.setDefinition(null, _st_generic);
                                                        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        //_std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_entity.setDefinition(null, _st_entity);
//            _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//    	      _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//	          _std_list_string.setDefinition(null, _st_list_string);
                                                        _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_list_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_list_generic.setDefinition(null, _st_list_generic);
                                                _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_generic.setDefinition(null, _st_set_generic);
                                                _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_string.setDefinition(null, _st_set_string);
                                                _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_bag_generic.setDefinition(null, _st_bag_generic);
                                                _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                                }
                                        }
                                } else
                                if (model_name.equalsIgnoreCase("EXTENDED_DICTIONARY_SCHEMA_DICTIONARY_DATA")) {
                                        if (!flag_xt_sdai) {
                                                // create instances of each simple data type
                                                _st_integer = (jsdai.SExtended_dictionary_schema.EInteger_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_type.class);
                                                _st_integer.setName(null, "_INTEGER");
                                                _st_real = (jsdai.SExtended_dictionary_schema.EReal_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReal_type.class);
                                                _st_real.setName(null, "_REAL");
                                                _st_number = (jsdai.SExtended_dictionary_schema.ENumber_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNumber_type.class);
                                                _st_number.setName(null, "_NUMBER");
                                                _st_logical = (jsdai.SExtended_dictionary_schema.ELogical_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLogical_type.class);
                                                _st_logical.setName(null, "_LOGICAL");
                                                _st_boolean = (jsdai.SExtended_dictionary_schema.EBoolean_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBoolean_type.class);
                                                _st_boolean.setName(null, "_BOOLEAN");
                                                _st_string = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                                _st_string.setName(null, "_STRING");
                                                _st_string.setFixed_width(null, false);
                                                _st_binary = (jsdai.SExtended_dictionary_schema.EBinary_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBinary_type.class);
                                                _st_binary.setName(null, "_BINARY");
                                                _st_binary.setFixed_width(null, false);
                                                _st_generic = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                                                _st_generic.setName(null, "_GENERIC");
                                                // because entity_definition causes bootstrapping problems, here is a temp implementation:
                                                _st_entity = (jsdai.SExtended_dictionary_schema.EData_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type.class);
                                                _st_entity.setName(null, "_ENTITY");
//          _st_entity = (jsdai.SExtended_dictionary_schema.EEntity_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_definition.class);
//	        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
//          _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//          _std_entity.setDefinition(null, _st_entity);
//	        _st_entity.setName(null, "_ENTITY");
//          _st_entity.setInstantiable(null, false);
//          _st_entity.setComplex(null, false);
//          _st_entity.createSupertypes(null);

// 		     _st_list_string  = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
//printDDebug(".oO0Oo. LIST TYPE CREATED - for standard pass 1");
//         _st_list_string.setName(null, "_LIST_STRING");

//         jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
//         jsdai.SExtended_dictionary_schema.EInteger_bound b1;
//         b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
//         b1.setBound_value(null, 0);
//         bounds[0] = b1;
//    	   _st_list_string.setLower_bound(null, bounds[0]);
//  	     _st_list_string.unsetUpper_bound(null);  // no need for that it is unset after creating
//         _st_list_string.setUnique_flag(null, false);
//    	   _st_list_string.setElement_type(null, _st_string);

                                    _st_list_generic  = (jsdai.SExtended_dictionary_schema.EList_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CList_type.class);
// printDDebug(".oO0Oo. LIST TYPE CREATED - for standard pass 1");
//						_st_list_generic.setName(null, "_LIST_GENERIC");
                                                _st_list_generic.setName(null, "_GENERALLIST_0_GENERIC");

                                                jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
                                                jsdai.SExtended_dictionary_schema.EInteger_bound b1;
                                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                                b1.setBound_value(null, 0);
                                                bounds[0] = b1;
                                                _st_list_generic.setLower_bound(null, bounds[0]);
                                                _st_list_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_list_generic.setUnique_flag(null, false);
                                                _st_list_generic.setElement_type(null, _st_generic);

                                    _st_set_generic  = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//						_st_set_generic.setName(null, "_SET_GENERIC");
                                                _st_set_generic.setName(null, "_GENERALSET_0_GENERIC");

                                                _st_set_generic.setLower_bound(null, bounds[0]);
                                                _st_set_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_set_generic.setElement_type(null, _st_generic);

                                    _st_set_string  = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//						_st_set_string.setName(null, "_SET_STRING");
                                                _st_set_string.setName(null, "_GENERALSET_0_STRING");

                                                _st_set_string.setLower_bound(null, bounds[0]);
                                                _st_set_string.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_set_string.setElement_type(null, _st_string);

                                    _st_bag_generic  = (jsdai.SExtended_dictionary_schema.EBag_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CBag_type.class);
//						_st_bag_generic.setName(null, "_BAG_GENERIC");
                                                _st_bag_generic.setName(null, "_GENERALBAG_0_GENERIC");

                                                _st_bag_generic.setLower_bound(null, bounds[0]);
                                                _st_bag_generic.unsetUpper_bound(null);  // no need for that it is unset after creating
                                                _st_bag_generic.setElement_type(null, _st_generic);

                                    _st_aggregate_generic  = (jsdai.SExtended_dictionary_schema.EAggregation_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregation_type.class);
                                                _st_aggregate_generic.setName(null, "_AGGREGATE_GENERIC");

                                                _st_aggregate_generic.setElement_type(null, _st_generic);

                                                _st_schema = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
                                                _st_model  = model;

                                                if (flag_xt_declarations) {
                                                        _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_integer.setDefinition(null, _st_integer);
                                                        _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_real.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_real.setDefinition(null, _st_real);
                                                        _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_number.setDefinition(null, _st_number);
                                                        _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_logical.setDefinition(null, _st_logical);
                                                        _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_boolean.setDefinition(null, _st_boolean);
                                                        _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_string.setDefinition(null, _st_string);
                                                        _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_binary.setDefinition(null, _st_binary);
                                                        _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_generic.setDefinition(null, _st_generic);
                                                        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_entity.setDefinition(null, _st_entity);
//            _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//            _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//  	        _std_list_string.setDefinition(null, _st_list_string);
                                                        _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_list_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_list_generic.setDefinition(null, _st_list_generic);
                                                _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_generic.setDefinition(null, _st_set_generic);
                                                _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_string.setDefinition(null, _st_set_string);
                                                _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_bag_generic.setDefinition(null, _st_bag_generic);
                                                _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                                } // declarations
                                        } else {
                                                if (flag_xt_declarations) {
                                                        _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_integer.setDefinition(null, _st_integer);
                                                        _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_real.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_real.setDefinition(null, _st_real);
                                                        _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_number.setDefinition(null, _st_number);
                                                        _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_logical.setDefinition(null, _st_logical);
                                                        _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_boolean.setDefinition(null, _st_boolean);
                                                        _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_string.setDefinition(null, _st_string);
                                                        _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_binary.setDefinition(null, _st_binary);
                                                        _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                        _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_generic.setDefinition(null, _st_generic);
                                                        _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_entity.setDefinition(null, _st_entity);
//            _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//            _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//            _std_list_string.setDefinition(null, _st_list_string);
                                                        _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_list_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                        _std_list_generic.setDefinition(null, _st_list_generic);
                                                _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_generic.setDefinition(null, _st_set_generic);
                                                _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_set_string.setDefinition(null, _st_set_string);
                                                _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_bag_generic.setDefinition(null, _st_bag_generic);
                                                _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                        _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                        // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                        _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                                }
                                        }
                                } else {
                                        if (flag_xt_declarations) {
                                                _std_integer = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_integer.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_integer.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_integer.setDefinition(null, _st_integer);
                                                _std_real = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_real.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_real.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_real.setDefinition(null, _st_real);
                                                _std_number = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_number.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_number.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_number.setDefinition(null, _st_number);
                                                _std_logical = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_logical.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_logical.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_logical.setDefinition(null, _st_logical);
                                                _std_boolean = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_boolean.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_boolean.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_boolean.setDefinition(null, _st_boolean);
                                                _std_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_string.setDefinition(null, _st_string);
                                                _std_binary = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_binary.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_binary.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_binary.setDefinition(null, _st_binary);
                                                _std_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$implicit_declaration.class);
                                                _std_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_generic.setDefinition(null, _st_generic);
                                                _std_entity = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_entity.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_entity.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_entity.setDefinition(null, _st_entity);
// 	        _std_list_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
//          _std_list_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
//  	      _std_list_string.setDefinition(null, _st_list_string);
                                                _std_list_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_list_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_list_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                                _std_list_generic.setDefinition(null, _st_list_generic);
                                        _std_set_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_set_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_set_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                _std_set_generic.setDefinition(null, _st_set_generic);
                                        _std_set_string = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_set_string.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_set_string.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                _std_set_string.setDefinition(null, _st_set_string);
                                        _std_bag_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_bag_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_bag_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                _std_bag_generic.setDefinition(null, _st_bag_generic);
                                        _std_aggregate_generic = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CData_type_declaration$local_declaration.class);
                                                _std_aggregate_generic.setParent(null, sd);
                                                        // parent_schema is now derived instead of explicit 
                                                // _std_aggregate_generic.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd); 
                                                _std_aggregate_generic.setDefinition(null, _st_aggregate_generic);
                                        }
                                }

//                      }
                } else {
                        if (is_complex_schema) {
                                schema_name = schema_name.substring(3);
// printDDebug("##RR COMPLEX SCHEMA: " + schema_name);
                        }
                        model = findModel(schema_name);
                        if (model == null) {
                                printDebug("schema not found: " + schema_name);
                        }

                        hm_current_entity_declarations = (HashMap)hm_entity_declarations.get(model);
                        hm_current_type_declarations = (HashMap)hm_type_declarations.get(model);
                        hm_current_function_declarations = (HashMap)hm_function_declarations.get(model);
                        hm_current_procedure_declarations = (HashMap)hm_procedure_declarations.get(model);
                        hm_current_rule_declarations = (HashMap)hm_rule_declarations.get(model);
                        hm_current_constant_declarations = (HashMap)hm_constant_declarations.get(model);
                        hm_current_subtype_constraint_declarations = (HashMap)hm_subtype_constraint_declarations.get(model);
                        hm_current_parameters = (HashMap)hm_parameters.get(model);
                        hm_current_variables = (HashMap)hm_variables.get(model);

                        sd = getSchema_definitionFromModel(model);

                  active_scope_extension = new ECtScope(active_scope, sd, active_scope_extension, active_scope_string, schema_name, schema_name.toLowerCase());
                        active_scope_string = "";
                        active_scope = null;  // not using on schema level (yet)


                        if (expression_instances) {
                                jjtn000.model = model;
                                jjtn000.schema_name = schema_name;
// if (model == null) printDDebug("model = NULL, schema: " + schema_name + ", pass: " + parser_pass + ", complex: " + is_complex_schema);
// else printDDebug("model = OK, schema: " + schema_name + ", pass: " + parser_pass + ", complex: " + is_complex_schema);

//System.out.println("<()>  node: " +	sd.getName(null));	
                                jjtn000.schema_definition = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
//System.out.println("KUKU>> name: " + jjtThis.schema_name + ", sd: " + jjtThis.schema_definition);
                        }
// if (sd == null)
// printDDebug("##RR SCHEMA DEFINITION NOT FOUND");
//                      sd = (jsdai.SExtended_dictionary_schema.ESchema_definition)model.getDefined_schema();
                }
                createDocumentationEntity2(sd, a_token);
        switch (jj_nt.kind) {
        case SIMPLE_STRING_LITERAL:
          version_name = SchemaVersionId5();
          break;
        default:
          jj_la1[411] = jj_gen;
          ;
        }
// System.out.println("Schema version: " + version_name);
                if (parser_pass == 1) {
                        if (version_name != null) {
                                sd.setIdentification(null, version_name);
                        }
                }
        if ((parser_pass == 2) && (!is_complex_schema)) {
                used_vector = new Vector();
                referenced_vector = new Vector();
                used_vectors.addElement(used_vector);
                referenced_vectors.addElement(referenced_vector);
                model_vector.addElement(model); // probably not really necessary, the same order in the repository.
        }
         if (_st_real == null) {
                 printDebug("In SchemaDecl5 before body, pass: " + parser_pass + ", _st_real is NULL");
         } else {
                 printDebug("In SchemaDecl5 before body, pass: " + parser_pass + ", _st_real is OK");
         }
        jj_consume_token(SEMICOLON);
        SchemaBody5(used_vector, referenced_vector);
        jj_consume_token(END_SCHEMA);
                // this line in the alt version without ";" only
                schema_depth--;
                current_scope = (Vector)scope_stack.pop();
                active_scope = null;
                active_scope_string = active_scope_extension.getParent_scope_string();
                active_scope_extension = active_scope_extension.getParent();

         if (_st_real == null) {
                 printDebug("In SchemaDecl5, ending, pass: " + parser_pass + ", _st_real is NULL");
         } else {
                 printDebug("In SchemaDecl5, ending, pass: " + parser_pass + ", _st_real is OK");
         }
      } catch (ParseException e) {
//System.out.println("<(!)>: " + schema_name);
//	recoverFromParseException(END_SCHEMA, e);
//			System.out.println(e.getMessage());
        if (recoverToTheNextSchema(e) < 0) {if (true) return;}
      }
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.282 ------------ */
  static final public String SchemaId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.182  ---*/
  static final public void SchemaMapBodyElement5() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case FUNCTION:
      FunctionDecl5();
      break;
    case PROCEDURE:
      ProcedureDecl5();
      break;
    default:
      jj_la1[412] = jj_gen;
      if (jj_2_70(2147483647)) {
        ViewDecl5();
      } else {
        switch (jj_nt.kind) {
        case MAP:
          MapDecl5();
          break;
        case DEPENDENT_MAP:
          DependentMapDecl5();
          break;
        case RULE:
          RuleDecl5();
          break;
        default:
          jj_la1[413] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.183  ---*/
  static final public void SchemaMapBodyElementList5() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In SchemaMapBodyElementList5");
    label_137:
    while (true) {
      SchemaMapBodyElement5();
      switch (jj_nt.kind) {
      case DEPENDENT_MAP:
      case FUNCTION:
      case MAP:
      case PROCEDURE:
      case RULE:
      case VIEW:
        ;
        break;
      default:
        jj_la1[414] = jj_gen;
        break label_137;
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.184  ---*/
  static final public void SchemaMapDecl5() throws ParseException, jsdai.lang.SdaiException {
        String schema_map_name;
        String version_name = null;
        Token a_token;
        Vector used_vector = null;
        Vector referenced_vector = null;
                express_x = true;
                printDebug("In SchemaMapDecl5");
                scope_stack.push(current_scope);
                current_scope = new Vector();
                function_depth = 0;
    a_token = jj_consume_token(SCHEMA_MAP);
    schema_map_name = SchemaMapId5();
                printVerbose("Starting parsing schema_map: " + schema_map_name + " in pass " + parser_pass);
        if (parser_pass == 1) {
//                      if (model == null) {
                                model_name = schema_map_name.toUpperCase() + "_DICTIONARY_DATA";
// listModels();
// System.out.println("Creating model: : " + model_name);
                                model = repository.findSdaiModel(model_name);
                                if(model != null) {
                                        model.deleteSdaiModel();
                                        jsdai.lang.SdaiModel relatedModel =
                                                repository.findSdaiModel("_EXPRESS_" + schema_map_name.toUpperCase());
                                        if(relatedModel != null) {
                                                relatedModel.deleteSdaiModel();
                                        }
                                        relatedModel =
                                                repository.findSdaiModel("_DOCUMENTATION_" + schema_map_name.toUpperCase());
                                        if(relatedModel != null) {
                                                relatedModel.deleteSdaiModel();
                                        }
                                }
// 				model = findModel(schema_map_name);
// 				if (model != null) {
// 					error_count++;
// 					printError("Duplicate schema_map name: " + schema_map_name);
// 				}
                                model = repository.createSdaiModel(model_name, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                                model.startReadWriteAccess();
                                sd = (jsdai.SExtended_dictionary_schema.ESchema_map_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSchema_map_definition.class);
                                if (flag_oc) {
                                        sd.setName(null, schema_map_name);
                                } else {
                                        sd.setName(null, schema_map_name.toUpperCase());
                                }




//		createDocumentationEntity2(sd, a_token);

                } else {
                        if (is_complex_schema) {
                                schema_map_name = schema_map_name.substring(3);
                        }
                        model = findModel(schema_map_name);
                        if (model == null) {
//				printError("schema_view not found: " + schema_map_name);
                                printErrorMsg("" + schema_map_name + " - schema map not found", null, true);
                        }
                        sd = getGeneric_schema_definitionFromModel(model);

                  active_scope_extension = new ECtScope(active_scope, sd, active_scope_extension, active_scope_string, schema_map_name, schema_map_name.toLowerCase());
                        active_scope_string = "";
                        active_scope = null;  // not using on schema level (yet)


                        if (expression_instances) {
//				jjtThis.model = model;
//				jjtThis.schema_map_name = schema_map_name;
//				jjtThis.schema_definition = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
                        }
                }
                // createDocumentationEntity2(sd, a_token);
        if (parser_pass == 2) {

    // needed for chained use froms to work correctly
                used_vector = new Vector();
                used_vectors.addElement(used_vector);

                referenced_vector = new Vector();
                referenced_vectors.addElement(referenced_vector);
                model_vector.addElement(model); // probably not really necessary, the same order in the repository.
        }
    jj_consume_token(SEMICOLON);
    label_138:
    while (true) {
      ReferenceClause5(referenced_vector);
      switch (jj_nt.kind) {
      case REFERENCE:
        ;
        break;
      default:
        jj_la1[415] = jj_gen;
        break label_138;
      }
    }
    switch (jj_nt.kind) {
    case CONSTANT:
      ConstantDecl5();
      break;
    default:
      jj_la1[416] = jj_gen;
      ;
    }
    SchemaMapBodyElementList5();
    jj_consume_token(END_SCHEMA_MAP);
    jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
                active_scope = null;
                active_scope_string = active_scope_extension.getParent_scope_string();
                active_scope_extension = active_scope_extension.getParent();

                express_x = false;
  }

/*--------- ISO 10303-14:B.2.185  ---*/
  static final public String SchemaMapId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.186  ---*/
// String SchemaRef5OrRename5() throws jsdai.lang.SdaiException :
  static final public jsdai.SExtended_dictionary_schema.EGeneric_schema_definition SchemaRef5OrRename5() throws ParseException, jsdai.lang.SdaiException {
  // String schema_name = null;
  jsdai.SExtended_dictionary_schema.EGeneric_schema_definition gsd = null;
    if (jj_2_71(2)) {
      GeneralSchemaAliasId5();
      jj_consume_token(COLON);
    } else {
      ;
    }
    gsd = GeneralSchemaRef5();
            // if we operate not with name string here, we need to keep info about alias for further references to th schema by alias id.	
            if (gsd == null) {
                printDDebug("SchemaRef5OrRename5 - NULL in pass " + parser_pass);
            }
            {if (true) return gsd;}
            // return schema_name;

    throw new Error("Missing return statement in function");
  }

/*-+------- ISO 10303-14:B.2.187  ---*/
  static final public void SchemaViewBodyElement5() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case FUNCTION:
      FunctionDecl5();
      break;
    case PROCEDURE:
      ProcedureDecl5();
      break;
    case VIEW:
      ViewDecl5();
      break;
    case RULE:
      RuleDecl5();
      break;
    default:
      jj_la1[417] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*-+-------- ISO 10303-14:B.2.188  ---*/
  static final public void SchemaViewBodyElementList5() throws ParseException, jsdai.lang.SdaiException {
    label_139:
    while (true) {
      SchemaViewBodyElement5();
      switch (jj_nt.kind) {
      case FUNCTION:
      case PROCEDURE:
      case RULE:
      case VIEW:
        ;
        break;
      default:
        jj_la1[418] = jj_gen;
        break label_139;
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.189  ---*/
  static final public void SchemaViewDecl5() throws ParseException, jsdai.lang.SdaiException {
        String schema_view_name;
        String version_name = null;
        Token a_token;
        Vector used_vector = null;
        Vector referenced_vector = null;
                express_x = true;
                printDebug("In SchemaViewDecl5");
                scope_stack.push(current_scope);
                current_scope = new Vector();
                function_depth = 0;
    a_token = jj_consume_token(SCHEMA_VIEW);
    schema_view_name = SchemaViewId5();
                printVerbose("Starting parsing schema_view: " + schema_view_name + " in pass " + parser_pass);
                if (parser_pass == 1) {
//                      if (model == null) {
                                model_name = schema_view_name.toUpperCase() + "_DICTIONARY_DATA";
// listModels();
// System.out.println("Creating model: : " + model_name);
                                model = repository.findSdaiModel(model_name);
                                if(model != null) {
                                        model.deleteSdaiModel();
                                        jsdai.lang.SdaiModel relatedModel =
                                                repository.findSdaiModel("_EXPRESS_" + schema_view_name.toUpperCase());
                                        if(relatedModel != null) {
                                                relatedModel.deleteSdaiModel();
                                        }
                                        relatedModel =
                                                repository.findSdaiModel("_DOCUMENTATION_" + schema_view_name.toUpperCase());
                                        if(relatedModel != null) {
                                                relatedModel.deleteSdaiModel();
                                        }
                                }
// 				model = findModel(schema_view_name);
// 				if (model != null) {
// 					error_count++;
// 					printError("Duplicate schema_view name: " + schema_view_name);
// 				}
                                model = repository.createSdaiModel(model_name, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                                model.startReadWriteAccess();
                                sd = (jsdai.SExtended_dictionary_schema.ESchema_view_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSchema_view_definition.class);
                                if (flag_oc) {
                                        sd.setName(null, schema_view_name);
                                } else {
                                        sd.setName(null, schema_view_name.toUpperCase());
                                }
// System.out.println("#@# Model and schema_definition created for schema_view. model: " + model + ", schema: " + sd);




//		createDocumentationEntity2(sd, a_token);

                } else {
                        if (is_complex_schema) {
                                schema_view_name = schema_view_name.substring(3);
                        }
                        model = findModel(schema_view_name);
                        if (model == null) {
//				printError("schema_view not found: " + schema_view_name);
                                printErrorMsg("" + schema_view_name + " - schema view not found", null, true);
                        }
                        sd = getGeneric_schema_definitionFromModel(model);
                        if (expression_instances) {
//				jjtThis.model = model;
//				jjtThis.schema_view_name = schema_view_name;
//				jjtThis.schema_definition = (jsdai.SExtended_dictionary_schema.ESchema_definition)sd;
                        }
                }
                // createDocumentationEntity2(sd, a_token);



                if (parser_pass == 2) {

      // needed for chained use from to work correctly		
                        used_vector = new Vector();
                        used_vectors.addElement(used_vector);

                        referenced_vector = new Vector();
                        referenced_vectors.addElement(referenced_vector);
                        model_vector.addElement(model); // probably not really necessary, the same order in the repository.
                }

// System.out.println("#@# schema_view. Model: " + model + ", schema: " + sd + ", pass: " + parser_pass);	

    jj_consume_token(SEMICOLON);
    label_140:
    while (true) {
      switch (jj_nt.kind) {
      case REFERENCE:
        ;
        break;
      default:
        jj_la1[419] = jj_gen;
        break label_140;
      }
      ReferenceClause5(referenced_vector);
    }
    switch (jj_nt.kind) {
    case CONSTANT:
      ConstantDecl5();
      break;
    default:
      jj_la1[420] = jj_gen;
      ;
    }
    SchemaViewBodyElementList5();
    jj_consume_token(END_SCHEMA_VIEW);
    jj_consume_token(SEMICOLON);
                express_x = false;
  }

/*--------- ISO 10303-14:B.2.190  ---*/
  static final public String SchemaViewId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* ------ Our extension, in accordance with express 1.2 ------------------------------------*/
  static final public String SchemaVersionId5() throws ParseException {
        Token t;
        String image;
    t = jj_consume_token(SIMPLE_STRING_LITERAL);
                image = t.image;
                {if (true) return image.substring(1, image.length()-1);}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.283------------ */
  static final public void Selector5() throws ParseException, jsdai.lang.SdaiException {
    Expression5();
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.284------------ */
  static final public void SelectType5(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESelect_type st = null;
        jsdai.SExtended_dictionary_schema.ANamed_type selections = null;
        jsdai.SExtended_dictionary_schema.ENamed_type selection;
        boolean is_extensible = false;
        boolean is_entity = false;
        boolean is_extension = false;
        // selections - SET OF NAMED_TYPE
        Vector selectionz = new Vector();
        jsdai.SExtended_dictionary_schema.EDefined_type select_super = null;
                printVerbose("SelectType5 starting in pass " + parser_pass + ", defined type: " + dt);
    switch (jj_nt.kind) {
    case EXTENSIBLE:
      jj_consume_token(EXTENSIBLE);
                       is_extensible = true;
      break;
    default:
      jj_la1[421] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case GENERIC_ENTITY:
      jj_consume_token(GENERIC_ENTITY);
                                                                  is_entity = true;
      break;
    default:
      jj_la1[422] = jj_gen;
      ;
    }
    jj_consume_token(SELECT);
    switch (jj_nt.kind) {
    case LPAREN:
    case BASED_ON:
      switch (jj_nt.kind) {
      case LPAREN:
        selectionz = SelectList5(selectionz);
        break;
      case BASED_ON:
        select_super = SelectExtension5(dt, st, selectionz);
                                                                                                        is_extension = true;
        break;
      default:
        jj_la1[423] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[424] = jj_gen;
      ;
    }
                if (parser_pass == 3) {
                        if (is_extensible) {
                          if (is_entity) {
                                if (is_extension) {
                                                // entity_select_type+extended_select_type+extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_select_type$extended_select_type$extensible_select_type.class);
                                } else {
                                                // entity_select_type+extensible_select_type			  	}
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_select_type$extensible_select_type.class);
                                }
                          } else {
                                if (is_extension) {
                                                // extended_select_type+extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtended_select_type$extensible_select_type.class);
                                } else {
                                                // extensible_select_type			  	}
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtensible_select_type.class);
                                }
                          }
                        } else {
                          if (is_entity) {
                                if (is_extension) {
                                                // entity_select_type+extended_select_type+non_extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_select_type$extended_select_type$non_extensible_select_type.class);
                                } else {
                                                // entity_select_type+non_extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_select_type$non_extensible_select_type.class);
                                }
                          } else {
                                if (is_extension) {
                                                // extended_select_type+non_extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CExtended_select_type$non_extensible_select_type.class);



                                } else {
                                                // non_extensible_select_type
                                                st = (jsdai.SExtended_dictionary_schema.ESelect_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CNon_extensible_select_type.class);
                                }
                          }
                        }
                        st.setName(null, "_SELECT_" + dt.getName(null));
                        selections = st.createLocal_selections(null);
                        for (int i = 0; i < selectionz.size(); i++) {
                                selections.addUnordered((jsdai.SExtended_dictionary_schema.ENamed_type)selectionz.elementAt(i));
                        }
                        jsdai.SExtended_dictionary_schema.ANamed_type sel2 = st.getLocal_selections(null);
                        for (int k = 1; k < sel2.getMemberCount()+1; k++) {
                        }
// System.out.println("O-O-10: just before setting domain in select type - defined type: " + dt + ", domain: " + st);
                        dt.setDomain(null, st);
// System.out.println("O-O-11: domain set: " + dt);
                        if (is_extension) {
// System.out.println("O-O-01: is extension");
                                if (st instanceof jsdai.SExtended_dictionary_schema.EExtended_select_type) {
// System.out.println("O-O-03: is EExtended_select_type");
                                        if (select_super != null) {
// System.out.println("O-O-05: select_super NOT null");
                                                if (select_super.testDomain(null)) {
// System.out.println("O-O-07: select_super domain is set");
                                jsdai.SExtended_dictionary_schema.ESelect_type select_super_sel = (jsdai.SExtended_dictionary_schema.ESelect_type)select_super.getDomain(null);
                          if (select_super_sel instanceof jsdai.SExtended_dictionary_schema.EExtensible_select_type) {
// System.out.println("O-O-09: select_super domain IS of EExtensible_select_type");
//								((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).setIs_based_on(null, (jsdai.SExtended_dictionary_schema.EExtensible_select_type)select_super_sel);
                                                                ((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).setIs_based_on(null, select_super);
                                                        } else {
                                                                printDebug("The select type: " + select_super.getName(null) + " must be EXTENSIBLE: " + select_super_sel);
                                                        }
                                                } else {
// System.out.println("O-O-08: select_super domain IS unset: " + select_super);
                                                }
                                        } else {
// System.out.println("O-O-06: select_super IS null");

                                        }
                                } else {
// System.out.println("O-O-04: is NOT EExtended_select_type - something wrong: " + st);
                                        // something wrong here - internal error
                                }

                        //	jsdai.SExtended_dictionary_schema.ESelect_type prior = ((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).getIs_based_on(null);
                        //	jsdai.SExtended_dictionary_schema.ANamed_type lselections = prior.getLocal_selections(null);
                        //for (int l = 1; l < lselections.getMemberCount()+1; l++) {
                        //	System.out.println("extended Element5: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)lselections.getByIndex(l)).getName(null));
                        //}

                        } else {
// System.out.println("O-O-02: is NOT extension");
                        }
                } else
                if (parser_pass == 5) {
                        // st.setName(null, "_SELECT_" + dt.getName(null));
                        st = (jsdai.SExtended_dictionary_schema.ESelect_type)dt.getDomain(null);
                        if (is_extension) {

                        if (is_entity) {

                                if (!isEntitySelect(st)) {
                                        error_count++;
                                        printErrorMsg("" + dt.getName(null) + " - GENERIC_ENTITY select type contains non-entities", null, true);
                                }
                        }
/*
// System.out.println("O-O-01: is extension");
				if (st instanceof jsdai.SExtended_dictionary_schema.EExtended_select_type) {
// System.out.println("O-O-03: is EExtended_select_type");
					if (select_super != null) {
// System.out.println("O-O-05: select_super NOT null");
						if (select_super.testDomain(null)) {
// System.out.println("O-O-07: select_super domain is set");
		        	jsdai.SExtended_dictionary_schema.ESelect_type select_super_sel = (jsdai.SExtended_dictionary_schema.ESelect_type)select_super.getDomain(null);
		          if (select_super_sel instanceof jsdai.SExtended_dictionary_schema.EExtensible_select_type) {        				
// System.out.println("O-O-09: select_super domain IS of EExtensible_select_type");
								if (!(((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).testIs_based_on(null))) {
// System.out.println("O-O-13: was unset, setting now");
//									((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).setIs_based_on(null, (jsdai.SExtended_dictionary_schema.EExtensible_select_type)select_super_sel);
									((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).setIs_based_on(null, select_super);
								} else {
// System.out.println("O-O-14: was already set in pass 3: " + st);
								}
							} else {
								printDebug("The select type: " + select_super.getName(null) + " must be EXTENSIBLE: " + select_super_sel);
							}
						} else {
// System.out.println("O-O-08: select_super domain IS unset: " + select_super);
						}
					} else {
// System.out.println("O-O-06: select_super IS null");
						
					}
				} else {
// System.out.println("O-O-04: is NOT EExtended_select_type - something wrong: " + st);
					// something wrong here - internal error
				}
*/


                        //	jsdai.SExtended_dictionary_schema.ESelect_type prior = ((jsdai.SExtended_dictionary_schema.EExtended_select_type)st).getIs_based_on(null);
                        //	jsdai.SExtended_dictionary_schema.ANamed_type lselections = prior.getLocal_selections(null);
                        //for (int l = 1; l < lselections.getMemberCount()+1; l++) {
                        //	System.out.println("extended Element5: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)lselections.getByIndex(l)).getName(null));
                        //}

                        } else {
// System.out.println("O-O-02: is NOT extension");
                        }
                }
                printVerbose("SelectType5 ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.285------------ */

// in this version, return  is no longer really needed
  static final public Vector SelectList5(Vector selectionz) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESelect_type st = null;
        jsdai.SExtended_dictionary_schema.ENamed_type selection;
                printVerbose("SelectList5 starting in pass " + parser_pass + ", vector: " + selectionz);
    jj_consume_token(LPAREN);
    selection = NamedTypes5(null);
                if (parser_pass == 3) {
//			selections.addUnordered(selection);
                        selectionz.addElement(selection);
                }
    label_141:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[425] = jj_gen;
        break label_141;
      }
      jj_consume_token(COMMA);
      selection = NamedTypes5(null);
                if (parser_pass == 3) {
//			selections.addUnordered(selection);
                        selectionz.addElement(selection);
                }
    }
    jj_consume_token(RPAREN);
                printVerbose("SelectList5 ending in pass " + parser_pass);
                {if (true) return (selectionz);}
    throw new Error("Missing return statement in function");
  }

// Vector SelectExtension5(jsdai.SExtended_dictionary_schema.EDefined_type dt, jsdai.SExtended_dictionary_schema.ESelect_type st, Vector selectionz, jsdai.SExtended_dictionary_schema.EDefined_type select_super) throws jsdai.lang.SdaiException :
  static final public jsdai.SExtended_dictionary_schema.EDefined_type SelectExtension5(jsdai.SExtended_dictionary_schema.EDefined_type dt, jsdai.SExtended_dictionary_schema.ESelect_type st, Vector selectionz) throws ParseException, jsdai.lang.SdaiException {
         jsdai.SExtended_dictionary_schema.EDefined_type select_super = null;
                printVerbose("SelectExtension5 starting in pass " + parser_pass + ", defined type: " + dt);
    jj_consume_token(BASED_ON);
    select_super = TypeRef5(0);
    switch (jj_nt.kind) {
    case WITH:
      jj_consume_token(WITH);
      selectionz = SelectList5(selectionz);
      break;
    default:
      jj_la1[426] = jj_gen;
      ;
    }
                // not really needed, Vector is updated through the Parameter5 anyway
//		return selectionz;
                printVerbose("SelectExtension5 ending in pass " + parser_pass);
// System.out.println("select_super: " + select_super);
                {if (true) return select_super;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.285------------ */
  static final public jsdai.SExtended_dictionary_schema.ESet_type SetType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESet_type at = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        jsdai.lang.EEntity bt;
        String bound_name;
                printDebug("In SetType5, starting, whose: " + whose);
    jj_consume_token(SET);
    switch (jj_nt.kind) {
    case LBRACKET:
      bounds = BoundSpec5();
      break;
    default:
      jj_la1[427] = jj_gen;
      ;
    }
                if (parser_pass == 5) {
                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                at = (jsdai.SExtended_dictionary_schema.ESet_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }

//System.out.println(">< set type found in pass 5: " + at);

                        if (at == null) {
                                at = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);
//				bound_name = getBoundString(0, bounds, false, false);
//				at.setName(null, "_SET" + bound_name + _data_type_name);
//				_data_type_name = "_SET"  + bound_name + _data_type_name;
//				data_type_name = "_SET"  + bound_name;
                        }
                        if (bounds[0] == null) {
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, 0);
                                bounds[0] = b1;
                        }
                        at.setLower_bound(null, bounds[0]);
                        if (bounds[1] != null) {
                                at.setUpper_bound(null, bounds[1]);
                        }       else {
                                at.unsetUpper_bound(null);  // no need for that it is unset after creating
                        }
                } // pas 5

    jj_consume_token(OF);
    bt = BaseType5(at);
//System.out.println(">< base type found in pass 5: " + bt);
                if (parser_pass > 3) {
                        // set element_type
//			if (bt instanceof jsdai.SExtended_dictionary_schema.ESimple_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ESimple_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) 
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EAggregation_type)bt);
//			else if (bt instanceof jsdai.SExtended_dictionary_schema.ENamed_type)
//				at.setElement_type(null, (jsdai.SExtended_dictionary_schema.ENamed_type)bt);


                        if (!(at.testElement_type(null))) {
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EData_type) {
                                        at.setElement_type(null, (jsdai.SExtended_dictionary_schema.EData_type)bt);
                                } else
                                if(bt instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                        if (((jsdai.SExtended_dictionary_schema.EParameter)bt).testParameter_type(null)) {
                                                at.setElement_type(null, ((jsdai.SExtended_dictionary_schema.EParameter)bt).getParameter_type(null));
                                        } else {
                                        }
                                } else {
                                        // express amendment issue
                                }
                        } else {
                        }
                }
                bound_name = getBoundString(0, bounds, false, false);
                _data_type_name = "_SET"  + bound_name + _data_type_name;
                if (at != null) {
                        at.setName(null, _data_type_name);
                }
                printDebug("In SetType5, ending: " + at);
//System.out.println(">< returning set type in pass 5: " + at);
                {if (true) return at;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.286------------ */
  static final public void Sign5() throws ParseException {
    switch (jj_nt.kind) {
    case PLUS:
      jj_consume_token(PLUS);
      break;
    case MINUS:
      jj_consume_token(MINUS);
      break;
    default:
      jj_la1[428] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.287------------ */
  static final public void SimpleExpression5() throws ParseException, jsdai.lang.SdaiException {
        Object operand1 = null;
        Object operand2;
        String x_operand1 = "";
        String x_operand2 = "";
        double op1double;
        double op2double;
        int op1int;
        int op2int;
        int operation;
        Object exp_instance = null;
        String x_result = "";
        int op_nr = 0;
        int nr_of_operands = 0;
          X_AddLikeOp jjtn001 = new X_AddLikeOp(JJTADDLIKEOP);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
          jjtreeOpenNodeScope(jjtn001);
    try {
      Term5();
                if (parser_pass == 5) {
                        nr_of_operands++;
                        operand1 = argument_stack.pop();
                        printStack("POP: SimpleExpression5, operand1: " + operand1);
                        if (expression_instances) {
                                // x_operand1 = (String)expression_stack.pop();
                                // printXStack("POP: SimpleExpression5, operand1: " + x_operand1);
                                // x_result = x_operand1;
                        }
                }
      label_142:
      while (true) {
        if (jj_2_72(2)) {
          ;
        } else {
          break label_142;
        }
        operation = AddLikeOp5();
        Term5();
         if (parser_pass == 5) {
                nr_of_operands++;
                if (expression_instances) {
//			jjtThis.operations[op_nr++] = operation;
                        jjtn001.operations.add(new Integer(operation));
                        op_nr++;
                }
                operand2 = argument_stack.pop();
                printStack("POP: SimpleExpression5, operand2: " + operand2);
                if (expression_instances) {
                        // x_operand2 = (String)expression_stack.pop();
                        // printXStack("POP: SimpleExpression5, operand2: " + x_operand2);
                }
                if (operation == 1) {       // +
                        // create an instance of plus_expression
                        // create attribute operands - LIST, add members pop_inst1 and pop_inst2;
                        // push the plus_expression instance to expression_stack.
                        if (expression_instances) {
                                // x_result = "(" + x_operand1 + " + " + x_operand2 + ")";
                                // x_operand1 = x_result;
//printDebug("before creating plus_expression instance");
//                              jsdai.SIso13584_expressions_schema.EPlus_expression plus_e = (jsdai.SIso13584_expressions_schema.EPlus_expression)expression_model.createEntityInstance(jsdai.SIso13584_expressions_schema.CPlus_expression.class);
//printDebug("after creating plus_expression instance");
//                              jsdai.SIso13584_generic_expressions_schema.AGeneric_expression operands = plus_e.createOperands(null);
//                              if (pop_inst1 instanceof jsdai.SIso13584_generic_expressions_schema.EGeneric_expression) {
//                                      operands.addByIndex(1, (jsdai.SIso13584_generic_expressions_schema.EGeneric_expression)pop_inst1);
//                              } else {
//                                      printError("INSTANTIATING EXPRESSIONS: in plus_expression, simple Expression5 operand 1 is not a generic_expression:" + pop_inst1);
//                              }
//                              if (pop_inst2 instanceof jsdai.SIso13584_generic_expressions_schema.EGeneric_expression) {
//                                      operands.addByIndex(2, (jsdai.SIso13584_generic_expressions_schema.EGeneric_expression)pop_inst2);
//                              } else {
//                                      printError("INSTANTIATING EXPRESSIONS: in plus_expression, simple Expression5 operand 2 is not a generic_expression:" + pop_inst2);
//                              }
//                              exp_instance = plus_e;
                        }
                        if ((operand1 instanceof Integer) && (operand2 instanceof Integer)) {
                                op1int = ((Integer)operand1).intValue();
                                op2int = ((Integer)operand2).intValue();
                                op1int += op2int;
                                operand1 = new Integer(op1int);
                        }
                        else if ((operand1 instanceof Number) && (operand2 instanceof Number)) {
                                op1double = ((Number)operand1).doubleValue();
                                op2double = ((Number)operand2).doubleValue();
                                op1double += op2double;
                                operand1 = new Double(op1double);
                        }
                }
                else if (operation == 2) {  // -
                        // create an instance of minus_expression
                        // create attribute operands - LIST, add members pop_inst1 and pop_inst2;
                        // push the plus_expression instance to expression_stack.
                        if (expression_instances) {
                                // x_result = "(" + x_operand1 + " - " + x_operand2 + ")";
                                // x_operand1 = x_result;
//printDebug("before creating minus_expression instance");
//                              jsdai.SIso13584_expressions_schema.EMinus_expression minus_e = (jsdai.SIso13584_expressions_schema.EMinus_expression)expression_model.createEntityInstance(jsdai.SIso13584_expressions_schema.CMinus_expression.class);
//printDebug("after creating minus_expression instance");
//                              jsdai.SIso13584_generic_expressions_schema.AGeneric_expression operands = minus_e.createOperands(null);
//                              if (pop_inst1 instanceof jsdai.SIso13584_generic_expressions_schema.EGeneric_expression) {
//                                      operands.addByIndex(1, (jsdai.SIso13584_generic_expressions_schema.EGeneric_expression)pop_inst1);
//                              } else {
//                                      printError("INSTANTIATING EXPRESSIONS: in minus_expression, simple Expression5 operand 1 is not a generic_expression");
//                              }
//                              if (pop_inst2 instanceof jsdai.SIso13584_generic_expressions_schema.EGeneric_expression) {
//                                      operands.addByIndex(2, (jsdai.SIso13584_generic_expressions_schema.EGeneric_expression)pop_inst2);
//                      } else {
//                                      printError("INSTANTIATING EXPRESSIONS: in minus_expression, simple Expression5 operand 2 is not a generic_expression");
//                              }
//                              exp_instance = minus_e;
                        }
                        if ((operand1 instanceof Integer) && (operand2 instanceof Integer)) {
                                op1int = ((Integer)operand1).intValue();
                                op2int = ((Integer)operand2).intValue();
                                op1int -= op2int;
                                operand1 = new Integer(op1int);
                        }
                        else if ((operand1 instanceof Number) && (operand2 instanceof Number)) {
                                op1double = ((Number)operand1).doubleValue();
                                op2double = ((Number)operand2).doubleValue();
                                op1double -= op2double;
                                operand1 = new Double(op1double);
                        }
                }
                else if (operation == 3) {  // OR
                                x_result = "(" + x_operand1 + " | " + x_operand2 + ")";
                                x_operand1 = x_result;
                }
                else if (operation == 4) {  // XOR
                                x_result = "(" + x_operand1 + " ^ " + x_operand2 + ")";
                                x_operand1 = x_result;
                }
         }
      }
    } catch (Throwable jjte001) {
          if (jjtc001) {
            jjtree.clearNodeScope(jjtn001);
            jjtc001 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte001 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte001;}
          }
          if (jjte001 instanceof ParseException) {
            {if (true) throw (ParseException)jjte001;}
          }
          if (jjte001 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte001;}
          }
          {if (true) throw (Error)jjte001;}
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001,  nr_of_operands > 1);
            jjtreeCloseNodeScope(jjtn001);
          }
    }
                if (parser_pass == 5) {
                        argument_stack.push(operand1);
                        printStack("PUSH: SimpleExpression5: " + operand1);
                        if (expression_instances) {
                                // expression_stack.push(x_result);
                                // printXStack("PUSH: SimpleExpression5, result: " + x_result);
                        }
                }
  }

/* - LOOKAHEAD 4 or > - (Columns 1-28 & 2-3, 1-50 & 2-3) ------------------------------ ISO 10303-11:A.2.288------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at 1-28 and 2-3 respectively.
		 A common prefix is <SIMPLE_ID> "(" "["
		 Lookahead of 4 or more should be used for the earlier expansion.
*/
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at 1-50 and 2-3 respectively.
		 A common prefix is <SIMPLE_ID> "." <SIMPLE_ID>
		 Lookahead of 4 or more should be used for the earlier expansion.
*/

/* ISO 1030-14.B.2.194*/
// added CaseExpr5() and ForExpr5()
  static final public void SimpleFactor5() throws ParseException, jsdai.lang.SdaiException {
        int t = 0;
        Object operand1 = "";
        String x_operand1 = "";
        double op1double;
        int op1int;
        int chosen = 0;
        int kind = 0;
        String name = "";
                printDebug("In SimpleFactor5, starting");
                if (flag_oc) {
                  global_name1_global = getToken(1).image;
                  global_name2_global = getToken(2).image;
                  global_name3_global = getToken(3).image;
                } else {
                  global_name1_global = getToken(1).image.toLowerCase();
                  global_name2_global = getToken(2).image.toLowerCase();
                  global_name3_global = getToken(3).image.toLowerCase();
                }
                global_kind1_global = getToken(1).kind;
                global_kind2_global = getToken(2).kind;
                global_kind3_global = getToken(3).kind;
//System.out.println("in SimpleFactor5, starting: "  + global_name1_global + " " + global_name2_global + " " + global_name3_global);

    switch (jj_nt.kind) {
    case LBRACKET:
      AggregateInitializer5();
                                         chosen = 1;
      break;
    default:
      jj_la1[431] = jj_gen;
      if (isEntityConstructor()) {
        EntityConstructor5();
                                                                         chosen = 8;
      } else {
        switch (jj_nt.kind) {
        case LBRACE:
          Interval5();
                             chosen = 3;
          break;
        case QUERY:
          QueryExpression5();
                                    chosen = 4;
          break;
        case CASE:
          CaseExpr5();
                             chosen = 9;
          break;
        case FOR:
          ForExpr5();
                            chosen = 10;
          break;
        case IF:
          IfExpr5();
                           chosen = 11;
          break;
        default:
          jj_la1[432] = jj_gen;
          if (isEnumerationReference()) {
            EnumerationReference5();
                                                                               chosen = 2;
          } else if (jj_2_74(1)) {
                  X_UnaryOp jjtn001 = new X_UnaryOp(JJTUNARYOP);
                  boolean jjtc001 = true;
                  jjtree.openNodeScope(jjtn001);
                  jjtreeOpenNodeScope(jjtn001);
            try {
              switch (jj_nt.kind) {
              case PLUS:
              case MINUS:
              case NOT:
                t = UnaryOp5();
                                         chosen = 5;
                break;
              default:
                jj_la1[429] = jj_gen;
                ;
              }
              switch (jj_nt.kind) {
              case LPAREN:
                jj_consume_token(LPAREN);
                Expression5();
                                                   chosen = 6;
                jj_consume_token(RPAREN);
                break;
              default:
                jj_la1[430] = jj_gen;
                if (jj_2_73(1)) {
                  Primary5();
                                            chosen = 7;
                } else {
                  jj_consume_token(-1);
                  throw new ParseException();
                }
              }
                          jjtree.closeNodeScope(jjtn001,  t > 1);
                          jjtc001 = false;
                          jjtreeCloseNodeScope(jjtn001);
                                if (parser_pass == 5) {
                                        if (expression_instances) {
                                                jjtn001.operation = t;
                                        }
                                }
            } catch (Throwable jjte001) {
                  if (jjtc001) {
                    jjtree.clearNodeScope(jjtn001);
                    jjtc001 = false;
                  } else {
                    jjtree.popNode();
                  }
                  if (jjte001 instanceof RuntimeException) {
                    {if (true) throw (RuntimeException)jjte001;}
                  }
                  if (jjte001 instanceof ParseException) {
                    {if (true) throw (ParseException)jjte001;}
                  }
                  if (jjte001 instanceof jsdai.lang.SdaiException) {
                    {if (true) throw (jsdai.lang.SdaiException)jjte001;}
                  }
                  {if (true) throw (Error)jjte001;}
            } finally {
                  if (jjtc001) {
                    jjtree.closeNodeScope(jjtn001,  t > 1);
                    jjtreeCloseNodeScope(jjtn001);
                  }
            }
          } else {
            jj_consume_token(-1);
            throw new ParseException();
          }
        }
      }
    }
                // unary stuff goes here
                //System.out.println("XX--XX chosen: " + chosen);
         if (parser_pass == 5) {
                switch (chosen) {
                        case 0:
                                printDebug("In SimpleFactor5 - nothing was chosen");
                                break;
                        case 1:
                                printDebug("In SimpleFactor5 - AggregateInitializer5");
                                break;
                        case 2:
                                printDebug("In SimpleFactor5 - EnumeratiionReference");
                                break;
                        case 3:
                                printDebug("In SimpleFactor5 - Interval5");
                                break;
                        case 4:
                                printDebug("In SimpleFactor5 - QueryExpression5");
                                break;
                        case 5:
                                printDebug("In SimpleFactor5 - UnaryOp5");
                                break;
                        case 6:
                                printDebug("In SimpleFactor5 - Expression5");
                                break;
                        case 7:
                                printDebug("In SimpleFactor5 - Primary5");
                                break;
                        case 8:
                                printDebug("In SimpleFactor5 - EntityConstructor5");
                                break;
                        case 9:
                                printDebug("In SimpleFactor - CaseExpr");
                                break;
                        case 10:
                                printDebug("In SimpleFactor - ForExpr");
                                break;
                        case 11:
                                printDebug("In SimpleFactor - IfExpr");
                                break;
                        default:
                                printDebug("In SimpleFactor5 - error");
                                break;
                }
                if (t == 2) {
                        operand1 = argument_stack.pop();
                        printStack("POP: SimpleFactor5: " + operand1);
                        if (expression_instances) {
                                // x_operand1 = (String)expression_stack.pop();
                                // printXStack("POP: SimpleFactor5, operand1: " + x_operand1);
                        }
                        if (operand1 instanceof Integer) {
                                op1int = ((Integer)operand1).intValue();
                                op1int = -op1int;
                                operand1 = new Integer(op1int);
                        }
                        else if (operand1 instanceof Number) {
                                op1double = ((Number)operand1).doubleValue();
                                op1double = -op1double;
                                operand1 = new Double(op1double);
                        }
                        argument_stack.push(operand1);
                        printStack("PUSH: SimpleFactor5: " + operand1);
                        if (expression_instances) {
                                // expression_stack.push(x_operand1);
                                // printXStack("PUSH: SimpleFactor5, operand1: " + x_operand1);
                        }
                }
         }
// System.out.println("SimpleFactor5 - ending");	 

  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.289------------ */
  static final public jsdai.SExtended_dictionary_schema.ESimple_type SimpleTypes5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESimple_type st = null;
                printDebug("In simple type, starting, whose: " + whose);
    switch (jj_nt.kind) {
    case BINARY:
      st = BinaryType5(whose);
      break;
    case BOOLEAN:
      st = BooleanType5(whose);
      break;
    case INTEGER:
      st = IntegerType5(whose);
      break;
    case LOGICAL:
      st = LogicalType5(whose);
      break;
    case NUMBER:
      st = NumberType5(whose);
      break;
    case REAL:
      st = RealType5(whose);
      break;
    case STRING:
      st = StringType5(whose);
      break;
    default:
      jj_la1[433] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                printDebug("In simple type, ending, st: " + st);
                if (st != null) {
                        if (st.testName(null)) {
                                _data_type_name = st.getName(null);
                        }
                }
                {if (true) return st;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.290------------ */
  static final public void SkipStmt5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) SkipStmt */
  X_SkipStmt jjtn000 = new X_SkipStmt(JJTSKIPSTMT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
                printDebug("In SkipStmt5 starting");
      jj_consume_token(KW_SKIP);
      jj_consume_token(SEMICOLON);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In SkipStmt5 ending");
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* - LOOKAHEAD 2 - (Columns 1-17 & 2-16) ---------------------------------------------- ISO 10303-11:A.2.291------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at 1-17 and 2-16.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/


/*-+-------- ISO 10303-14:B.2.197  ---*/
  static final public void SourceAttributeReference5() throws ParseException, jsdai.lang.SdaiException {
        Object par_ref = null;
        Object attr_ref = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition par_extent = null;
    //      ParameterRef5() "." ( AttributeRef5(null, null, -1, null) | ViewAttributeRef5() )
    // perhaps Parameter5, and handles the same AttributeRef5
    
    //	 ParameterRef5() "." ( AttributeRef5(null, null, -1, null) )
             par_ref = SourceParameterRef5();
// 		System.out.println("<<++ par_ref :" + par_ref);
                par_extent = (jsdai.SExtended_dictionary_schema.EEntity_definition)((jsdai.SExtended_dictionary_schema.ESource_parameter)par_ref).getExtent(null);
    jj_consume_token(DOT);
    attr_ref = AttributeRef5(par_extent, par_extent, 3, par_extent);

  }

/*--------- ISO 10303-14:B.2.198  ---*/
  static final public void SourceEntityReference5() throws ParseException, jsdai.lang.SdaiException {
    EntityRef5erence5();
  }

/*-+-------- ISO 10303-14:B.2.199  ---*/
  static final public void SourceParameter5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
        String source_parameter_name;
        jsdai.SExtended_dictionary_schema.ESource_parameter sp = null;
        jsdai.SExtended_dictionary_schema.EEntity_or_view_definition evd = null;
    source_parameter_name = SourceParameterId5();
    jj_consume_token(COLON);
    evd = ExtentReference5();
                // which exactly pass needed here? to check. perhaps ExtentReference5 requires a pass after interfacing: 4?
                if (parser_pass == 1) {
// System.out.println("IN source_parameter 1");
                        sp = findSource_parameter(source_parameter_name);
                  if (sp != null) {
                                // error - should not be found
                        }
                        sp = (jsdai.SExtended_dictionary_schema.ESource_parameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSource_parameter.class);
                        sp.setName(null, source_parameter_name);
//		 	sp.setOrder(null, from_order_count++);
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EMap_partition) {
                                sp.setParent(null, (jsdai.SExtended_dictionary_schema.EMap_partition)parent);
                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_partition) {
                                sp.setParent(null, (jsdai.SExtended_dictionary_schema.EView_partition)parent);
                        } else {
                                // error
                        }
                } else {
// System.out.println("IN source_parameter 2");
                        sp = findSource_parameter(source_parameter_name);
// System.out.println("### SourceParameter5: " + source_parameter_name + " - is it found? : " + sp);

                        if (sp == null) {
                                // error - should have been found
                        }
                        if (parser_pass == 4) {
                                sp.setExtent(null, evd);
                                sp.setOrder(null, from_order_count++);
                        }
                }
  }

/*--------- ISO 10303-14:B.2.200  ---*/
  static final public String SourceParameterId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

  static final public void Stmt5() throws ParseException, jsdai.lang.SdaiException {
                printDebug("In Stmt5, starting");
    switch (jj_nt.kind) {
    case ALIAS:
      AliasStmt5();
      break;
    default:
      jj_la1[434] = jj_gen;
      if (jj_2_75(2147483647)) {
        AssignmentStmt5();
      } else {
        switch (jj_nt.kind) {
        case CASE:
          CaseStmt5();
          break;
        case BEGIN:
          CompoundStmt5();
          break;
        case ESCAPE:
          EscapeStmt5();
          break;
        case IF:
          IfStmt5();
          break;
        case SEMICOLON:
          NullStmt5();
          break;
        case REPEAT:
          RepeatStmt5();
          break;
        case RETURN:
          ReturnStmt5();
          break;
        case KW_SKIP:
          SkipStmt5();
          break;
        case INSERT:
        case REMOVE:
        case SIMPLE_ID:
          ProcedureCallStmt5();
          break;
        default:
          jj_la1[435] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
                printDebug("In Stmt5, ending");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.292------------ */
  static final public String StringLiteral5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
        String s = null;
                printDebug("In String Literal5");
    switch (jj_nt.kind) {
    case SIMPLE_STRING_LITERAL:
      t = jj_consume_token(SIMPLE_STRING_LITERAL);
                        if (parser_pass == 5) {
                                //				s = t.image;

// System.out.println("String Literal: " + t.image);
                                s = handleBackslash(t.image);
                                s = "\"" + s.substring(1,s.length()-1) + "\"";
                                argument_stack.push(s);
                                printStack("PUSH: Literal5: <SIMPLE_STRING_LITERAL>: " + s);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
      break;
    case ENCODED_STRING_LITERAL:
      t = jj_consume_token(ENCODED_STRING_LITERAL);
                        // just for now
                        if (parser_pass == 5) {
// System.out.println("Encoded String Literal: " + t.image);

//				s = t.image;
        s = "\"" + analyse_string(t) + "\"";

                                argument_stack.push(s);
                                printStack("PUSH: Literal5: <ENCODED_STRING_LITERAL>: " + s);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
      break;
    default:
      jj_la1[436] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
if (parser_pass == 5) {
// System.out.println("Processed String Literal: " + s);
}
                        {if (true) return s;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.293------------ */
  static final public jsdai.SExtended_dictionary_schema.EString_type StringType5(jsdai.lang.EEntity whose) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EString_type st = null;
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        int width_spec = 0;
        boolean is_fixed = false;
        String str_fixed;
    jj_consume_token(STRING);

    switch (jj_nt.kind) {
    case LPAREN:
      width_spec = WidthSpec5();
      break;
    default:
      jj_la1[437] = jj_gen;
      ;
    }
                if (width_spec == Integer.MIN_VALUE) {
                        width_spec = 0;
                }
                if (width_spec < 0) {
                        width_spec = -width_spec;
                        is_fixed = true;
                        str_fixed = "_FIXED";
                } else {
                        is_fixed = false;
                        str_fixed = "";
                }
                if (parser_pass == 3) {
                        if (width_spec == 0) {
                                st = _st_string;
                        } else {
                                st = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                _data_type_name = "_STRING_" + width_spec + str_fixed;
//				_data_type_name = "_STRING_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                st.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, width_spec);
                                st.setWidth(null, b1);
                                if (is_fixed) {
                                        st.setFixed_width(null, true);
                                } else {
                                        st.setFixed_width(null, false);
                                }
                        }
                } else
                if (parser_pass > 3) {

                        if (width_spec == 0) {
                                st = _st_string;
                        } else {


                        if (whose != null) {
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EDefined_type)whose).testDomain(null)) {
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EDefined_type)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).testDomain(null)) {
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EExplicit_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).testDomain(null)) {
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EDerived_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                        if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).testDomain(null)) {
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EInverse_attribute)whose).getDomain(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EAggregation_type) {
                                        if (((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).testElement_type(null)) {
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EAggregation_type)whose).getElement_type(null);
                                        }
                                } else
                                if (whose instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                        if (((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).testDomain(null)) {
                                                st = (jsdai.SExtended_dictionary_schema.EString_type)((jsdai.SExtended_dictionary_schema.EConstant_definition)whose).getDomain(null);
                                        }
                                }
                        }
                        } //  if width_spec present
                        if (st == null) {
                                if (width_spec == 0) { // no longer can occur
                                        st = _st_string;
                                } else {
                                        st = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                        _data_type_name = "_STRING_" + width_spec + str_fixed;
                                        // _data_type_name = "_STRING_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                        st.setName(null, _data_type_name);
                                        b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                        b1.setBound_value(null, width_spec);
                                        st.setWidth(null, b1);
                                        if (is_fixed) {
                                                st.setFixed_width(null, true);
                                        } else {
                                                st.setFixed_width(null, false);
                                        }
                                }
                        }
                }
                if ((parser_pass == 5) && (width_spec != 0)) {  // seem like may be creating a new instance again, better improve it
                                st = (jsdai.SExtended_dictionary_schema.EString_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CString_type.class);
                                _data_type_name = "_STRING_" + width_spec + str_fixed;
                                // _data_type_name = "_STRING_" + ((width_spec > 0) ?  (width_spec) : (-width_spec)) + ((width_spec < 0) ? "_FIXED" : "");
                                st.setName(null, _data_type_name);
                                b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
                                b1.setBound_value(null, width_spec);
                                st.setWidth(null, b1);
                                if (is_fixed) {
                                        st.setFixed_width(null, true);
                                } else {
                                        st.setFixed_width(null, false);
                                }
                }

                {if (true) return st;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.294 ------------ */
  static final public void SubSuper5(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case ABSTRACT:
    case SUPERTYPE:
      SupertypeConstraint5(ed);
      break;
    default:
      jj_la1[438] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case CONNOTATIONAL:
    case SUBTYPE:
      SubtypeDeclaration5(ed);
      break;
    default:
      jj_la1[439] = jj_gen;
      ;
    }
  }

  static final public void SubSuperNoAbstract5(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case SUPERTYPE:
      SupertypeConstraintNoAbstract5(ed);
      break;
    default:
      jj_la1[440] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case CONNOTATIONAL:
    case SUBTYPE:
      SubtypeDeclaration5(ed);
      break;
    default:
      jj_la1[441] = jj_gen;
      ;
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.295------------ */
  static final public void SubtypeConstraint5(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESub_supertype_constraint sc;
        jsdai.lang.EEntity se;
        Object pop_inst = null;

        jsdai.SExtended_dictionary_schema.EAndor_subtype_expression andor;
// pre-X	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands;
    jj_consume_token(OF);
    jj_consume_token(LPAREN);
    SupertypeExpression5();
    jj_consume_token(RPAREN);
                if (parser_pass == 5) {
                        se = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: SubtypeConstraint5: " + se);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }

                        if (se instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) {
                                sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
                                sc.setGeneric_supertype(null, ed);
                                // super_type is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // sc.setSuper_type(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)ed);
                                // }
                                sc.setConstraint(null, (jsdai.SExtended_dictionary_schema.ESubtype_expression)se);
                        } else if (se instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) // SUPERTYPE OF (single_entity)
                        {
                                sc = (jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSub_supertype_constraint.class);
                                sc.setGeneric_supertype(null, ed);
                                // super_type is now derived instead of explicit 
                                // if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        // sc.setSuper_type(null, (jsdai.SExtended_dictionary_schema.EEntity_definition)ed);
                                // }
                                andor = (jsdai.SExtended_dictionary_schema.EAndor_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAndor_subtype_expression.class);
                                generic_operands = andor.createGeneric_operands(null);
                                // operands is now derived instead of explicit 
                                // operands = andor.createOperands(null);
                                generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) se);
                                // operands is now derived instead of explicit 
                                // if (!(se instanceof jsdai.SExtended_dictionary_schema.EView_definition)) {
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) se);
                                // }
                                sc.setConstraint(null, (jsdai.SExtended_dictionary_schema.ESubtype_expression)andor);
                        }
                        else { //
                        error_count++;
                        printErrorMsg5(" name not available - internal error in SubtypeConstraint5", null, true);
                                printEDebug("Internal error in SubtypeConstraint5");
                        }
                }
  }

/*-+-------- ISO 10303-14:B.2.205  ---*/
// there is no supertype for map_definition and view_definition
  static final public jsdai.lang.EEntity SubtypeBindingHeader5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) SubtypeBindingHeader */
        X_SubtypeBindingHeader jjtn000 = new X_SubtypeBindingHeader(JJTSUBTYPEBINDINGHEADER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String partition_name = "_implicit_partition_"; // partition may be implicit, let's have name "" for it (so far)
        // I would like to have partition entity, supertype of map_partition and view_partition.
        jsdai.SExtended_dictionary_schema.EMap_partition mp = null;
        jsdai.SExtended_dictionary_schema.EView_partition vp = null;
        jsdai.lang.EEntity partition = null;
    try {
                printDebug("In SubtypeBindingHeader5, starting, parent: " + parent);
//		System.out.println("active_scope in map 10: " + active_scope);

      switch (jj_nt.kind) {
      case PARTITION:
        jj_consume_token(PARTITION);
        partition_name = PartitionId5();
        jj_consume_token(SEMICOLON);
        break;
      default:
        jj_la1[442] = jj_gen;
        ;
      }
                if (parser_pass == 1) {
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_definition) {
                                vp = (jsdai.SExtended_dictionary_schema.EView_partition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CView_partition.class);
                                vp.setParent(null, (jsdai.SExtended_dictionary_schema.EView_definition)parent);
                                vp.setName(null, partition_name);
                                partition = (jsdai.lang.EEntity)vp;

                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EMap_definition) {
                                mp = (jsdai.SExtended_dictionary_schema.EMap_partition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CMap_partition.class);
                                mp.setParent(null, (jsdai.SExtended_dictionary_schema.EMap_definition)parent);
                                mp.setName(null, partition_name);
                                partition = (jsdai.lang.EEntity)mp;
                        } else {
                                // error
                        }
                } else
                if (parser_pass == 5) {

                        if (parent instanceof jsdai.SExtended_dictionary_schema.EView_definition) {
                                vp = findView_partition(partition_name, (jsdai.SExtended_dictionary_schema.EView_definition)parent);
                                partition = (jsdai.lang.EEntity)vp;
                        } else
                        if (parent instanceof jsdai.SExtended_dictionary_schema.EMap_definition) {
                                mp = findMap_partition(partition_name, (jsdai.SExtended_dictionary_schema.EMap_definition)parent);
                                partition = (jsdai.lang.EEntity)mp;
                        } else {
                                // error
System.out.println("PARSER - SubtypeBindingHeader5 - parent type not expected: " + parent);
                        }
// we need a node just as for BindingHeader, to properly support multiple partitions 
                        if (expression_instances) {
                                jjtn000.partition = (jsdai.SExtended_dictionary_schema.EMap_or_view_partition)partition;
                        }


                }



//		System.out.println("active_scope in map 11: " + active_scope);

      WhereClause5(parent);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                printDebug("In SubtypeBindingHeader5, ending");
                {if (true) return partition;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.296 ------------ */
  static final public void SubtypeDeclaration5(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition super_ed;
// pre-X	jsdai.SExtended_dictionary_schema.AEntity_definition supertypes = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_definition generic_supertypes = null;
        jsdai.SExtended_dictionary_schema.AEntity_definition supertypes = null;
        int Index5 = 1;
        int index_g = 1;
        boolean is_connotational = false;
                if (parser_pass == 3) {
                        generic_supertypes = ed.getGeneric_supertypes(null);
                        if (ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                if (supertypes != null) {
                                        if (((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).testSupertypes(null)) {
                                                supertypes = ((jsdai.SExtended_dictionary_schema.EEntity_definition)ed).getSupertypes(null);
                                        }
                                }
                        }
                }
    switch (jj_nt.kind) {
    case CONNOTATIONAL:
      jj_consume_token(CONNOTATIONAL);
                          is_connotational = true;
      break;
    default:
      jj_la1[443] = jj_gen;
      ;
    }
    jj_consume_token(SUBTYPE);
    jj_consume_token(OF);
    jj_consume_token(LPAREN);
    super_ed = EntityRef5(null);
                if (parser_pass == 3) {
                        generic_supertypes.addByIndex(index_g++, super_ed);
                        if (supertypes != null) {
                                if (super_ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        supertypes.addByIndex(Index5++, super_ed);
                                }
                        }
                }
    label_143:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[444] = jj_gen;
        break label_143;
      }
      jj_consume_token(COMMA);
      super_ed = EntityRef5(null);
                if (parser_pass == 3)
                {
                        generic_supertypes.addByIndex(index_g++, super_ed);
                        if (supertypes != null) {
                                if (super_ed instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                        supertypes.addByIndex(Index5++, super_ed);
                                }
                        }
                }
    }
    jj_consume_token(RPAREN);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.297------------ */
  static final public void SupertypeConstraint5(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case ABSTRACT:
      AbstractSupertypEDeclaration5(ed);
      break;
    case SUPERTYPE:
      SupertypeRule5(ed);
      break;
    default:
      jj_la1[445] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  static final public void SupertypeConstraintNoAbstract5(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    SupertypeRule5(ed);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.298------------ */
  static final public void SupertypeExpression5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAndor_subtype_expression andor = null;
// pre-X	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.lang.EEntity ee = null;
        Object pop_inst = null;
        boolean andor_present = false;
    SupertypeFactor5();
                if (parser_pass == 5) {
                        ee = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: SupertypeExpression5: " + ee);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
    label_144:
    while (true) {
      switch (jj_nt.kind) {
      case ANDOR:
        ;
        break;
      default:
        jj_la1[446] = jj_gen;
        break label_144;
      }
      jj_consume_token(ANDOR);
      SupertypeFactor5();
                if (parser_pass == 5) {
                        if (!andor_present) {
                                andor = (jsdai.SExtended_dictionary_schema.EAndor_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAndor_subtype_expression.class);
                                generic_operands = andor.createGeneric_operands(null);
                                // operands is now derived instead of explicit 
                                // operands = andor.createOperands(null);
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                        error_count++;
                                        printErrorMsg5(" name not available - internal error in SupertypeExpression5 1", null, true);
                                        printEDebug("Internal error in SupertypeExpression5 1");
                                }
                                ee = (jsdai.lang.EEntity)argument_stack.pop();
                                printStack("POP: SupertypeExpression5: " + ee);
                                if (expression_instances) {
                                        // pop_inst = expression_stack.pop();
                                }
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                        error_count++;
                                        printErrorMsg5(" name not available - internal error in SupertypeExpression5 2", null, true);
                                        printEDebug("Internal error in SupertypeExpression5 2");
                                }
                                andor_present = true;
                        } else {
                                ee = (jsdai.lang.EEntity)argument_stack.pop();
                                printStack("POP: SupertypeExpression5: " + ee);
                                if (expression_instances) {
                                        // pop_inst = expression_stack.pop();
                                }
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                error_count++;
                                        printErrorMsg5(" name not available - internal error in SupertypeExpression5 3", null, true);
                                        printEDebug("Internal error in SupertypeExpression5 3");
                                }
                        }
                }
    }
                if (parser_pass == 5) {
                        if (andor_present) {
                                argument_stack.push(andor);
                                printStack("PUSH: SupertypeExpression5: " + andor);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        } else {
                                argument_stack.push(ee);
                                printStack("PUSH: SupertypeExpression5: " + ee);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.299------------ */
  static final public void SupertypeFactor5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAnd_subtype_expression and = null;
// pre-X 	jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_view_or_subtype_expression generic_operands = null;
        jsdai.SExtended_dictionary_schema.AEntity_or_subtype_expression operands = null;
        jsdai.lang.EEntity ee = null;
        Object pop_inst = null;
        boolean and_present = false;
    SupertypeTerm5();
                if (parser_pass == 5) {
                        ee = (jsdai.lang.EEntity)argument_stack.pop();
                        printStack("POP: SupertypeFactor5: " + ee);
                        if (expression_instances) {
                                // pop_inst = expression_stack.pop();
                        }
                }
    label_145:
    while (true) {
      switch (jj_nt.kind) {
      case AND:
        ;
        break;
      default:
        jj_la1[447] = jj_gen;
        break label_145;
      }
      jj_consume_token(AND);
      SupertypeTerm5();
                if (parser_pass == 5) {
                        if (!and_present) {
                                and = (jsdai.SExtended_dictionary_schema.EAnd_subtype_expression)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAnd_subtype_expression.class);
                                generic_operands = and.createGeneric_operands(null);
                                // operands is now derived instead of explicit 
                                // operands = and.createOperands(null);
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                error_count++;
                                        printErrorMsg5(" name not available - internal error in SupertypeFactor5 1", null, true);
                                        printEDebug("Internal error in SupertypeFactor5 1");
                                }
                                ee = (jsdai.lang.EEntity)argument_stack.pop();
                                printStack("POP: SupertypeFactor5: " + ee);
                                if (expression_instances) {
                                        // pop_inst = expression_stack.pop();
                                }
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                error_count++;
                                        printErrorMsg5(" name not available - internal error in SupertypeFactor5 2", null, true);
                                        printEDebug("Internal error in SupertypeFactor5 2");
                                }
                                and_present = true;
                        } else {
                                ee = (jsdai.lang.EEntity)argument_stack.pop();
                                printStack("POP: SupertypeFactor5: " + ee);
                                if (expression_instances) {
                                        // pop_inst = expression_stack.pop();
                                }
                                if (ee instanceof jsdai.SExtended_dictionary_schema.ESubtype_expression) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.ESubtype_expression) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                        // operands is now derived instead of explicit 
                                        // operands.addUnordered((jsdai.SExtended_dictionary_schema.EEntity_definition) ee);
                                } else
                                if (ee instanceof jsdai.SExtended_dictionary_schema.EView_definition) { // better with C?
                                        generic_operands.addUnordered((jsdai.SExtended_dictionary_schema.EView_definition) ee);
                                } else {
                                                error_count++;
                                          printErrorMsg5(" name not available - internal error in SupertypeFactor5 3", null, true);
                                                printEDebug("Internal error in SupertypeFactor5 3");
                                }
                        }
                }
    }
                if (parser_pass == 5) {
                        if (and_present) {
                                argument_stack.push(and);
                                printStack("PUSH: SupertypeFactor5: " + and);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        } else {
                                argument_stack.push(ee);
                                printStack("PUSH: SupertypeFactor5: " + ee);
                                if (expression_instances) {
                                        // expression_stack.push(null);
                                }
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.300------------ */
  static final public void SupertypeRule5(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition ed) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(SUPERTYPE);
    SubtypeConstraint5(ed);
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.301------------ */
  static final public void SupertypeTerm5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition ed;
    switch (jj_nt.kind) {
    case SIMPLE_ID:
      // Express X needs here ViewRef5() instead instead of EntityRef5(), so we need something entity_or_view_ref
      // because we now have in the dictionary entity_or_view_definition, so no problem.
       ed = EntityRef5(null);
                if (parser_pass == 5) {
                        argument_stack.push(ed);
                        if (ed != null) {
                                printStack("PUSH: SupertypeTerm5: entity " + ed.getName(null));
                        } else {
                                printStack("PUSH: SupertypeTerm5: entity_definition = null");
                        }
                        if (expression_instances) {
                                // expression_stack.push(null);
                        }
                }
      break;
    case ONEOF:
      OneOf5();
      break;
    case LPAREN:
      jj_consume_token(LPAREN);
      SupertypeExpression5();
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[448] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.302 ------------ */
  static final public void Syntax5() throws ParseException, jsdai.lang.SdaiException {
    label_146:
    while (true) {
      SchemaDecl5();
      switch (jj_nt.kind) {
      case SCHEMA:
        ;
        break;
      default:
        jj_la1[449] = jj_gen;
        break label_146;
      }
    }
    jj_consume_token(0);
  }

/*-+-------- ISO 10303-14:B.210  ---*/
  static final public void SyntaxX5() throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case SCHEMA_MAP:
      SchemaMapDecl5();
      break;
    case SCHEMA_VIEW:
      SchemaViewDecl5();
      break;
    default:
      jj_la1[450] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*-+-------- ISO 10303-14:B.2.211  ---*/
  static final public jsdai.SExtended_dictionary_schema.EEntity_definition TargetEntityReference5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed1 = null;
        // jsdai.SExtended_dictionary_schema.AEntity_definition aed = null;
        Vector entity_definitions = new Vector();
                printDebug("In TargetEntityReference5, starting");
    ed = EntityRef5erence5();
                                  entity_definitions.addElement(ed);
    label_147:
    while (true) {
      switch (jj_nt.kind) {
      case COMPLEX_AND:
        ;
        break;
      default:
        jj_la1[451] = jj_gen;
        break label_147;
      }
      jj_consume_token(COMPLEX_AND);
      ed1 = EntityRef5erence5();
                                                                                                                entity_definitions.addElement(ed1);
    }
                if (entity_definitions.size() > 1) {
                        ed = findComplexEntity(entity_definitions);
                }
                printDebug("In TargetEntityReference5, ending");
                {if (true) return ed;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.212  ---*/
  static final public void TargetParameter5(jsdai.SExtended_dictionary_schema.EMap_definition parent) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.ESet_type at = null;
        String name;
        jsdai.SExtended_dictionary_schema.EEntity_definition ed = null;
        jsdai.SExtended_dictionary_schema.ETarget_parameter tp = null;
        jsdai.SExtended_dictionary_schema.EAggregate_target_parameter atp = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = null;
//	jsdai.SExtended_dictionary_schema.EInteger_bound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EBound bounds [] = new jsdai.SExtended_dictionary_schema.EInteger_bound[2];
        jsdai.SExtended_dictionary_schema.EInteger_bound b1;
        boolean is_aggregate = false;
        Vector parameter_ids = new Vector();
        String id = null;
                printDebug("In TargetParameter5, starting, parent map definition: " + parent);
    name = TargetParameterId5();
                                     parameter_ids.addElement(name);
    label_148:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[452] = jj_gen;
        break label_148;
      }
      jj_consume_token(COMMA);
      name = TargetParameterId5();
                                                                                                         parameter_ids.addElement(name);
    }
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case AGGREGATE:
      jj_consume_token(AGGREGATE);
                                                                                                                                                                 is_aggregate = true;
      switch (jj_nt.kind) {
      case LBRACKET:
        bounds = BoundSpec5();
        break;
      default:
        jj_la1[453] = jj_gen;
        ;
      }
      jj_consume_token(OF);
      break;
    default:
      jj_la1[454] = jj_gen;
      ;
    }
    ed = TargetEntityReference5();
                // determine which min pass required
                if (parser_pass == 1) {

                        for (int i = 0; i < parameter_ids.size(); i++) {
                                id = (String)parameter_ids.elementAt(i);
                                tp = findTarget_parameter(id);
                                if (tp != null) {
                                        // error, the same name
                                }
                                if (is_aggregate) {
                                        atp = (jsdai.SExtended_dictionary_schema.EAggregate_target_parameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregate_target_parameter.class);
                                        tp = atp;
                                } else {
                                        tp = (jsdai.SExtended_dictionary_schema.ETarget_parameter)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CTarget_parameter.class);
                                }
                                tp.setName(null, id);
                                tp.setParent(null, parent);
//				tp.setOrder(null, target_parameter_order_count++);
                        }


                } else
                if (parser_pass == 4) {
                        if (is_aggregate) {

//				at = (jsdai.SExtended_dictionary_schema.ESet_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CSet_type.class);

                                // at = (jsdai.SExtended_dictionary_schema.EAggregation_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CAggregation_type.class);
                          // name may have to be corrected later
//		  	at.setName(null, "_TARGET_PARAMETER_SET");
//		  	_data_type_name = "_TARGET_PARAMETER_SET";
//		  	if (ed != null) {
//				at.setElement_type(null, ed);
//		  	} else {
//		  		System.out.println("target_parameter aggregate member entity is null");
//		  	}

//				if (bounds[0] == null) {
//					b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CInteger_bound.class);
//					b1.setBound_value(null, 0);
//					bounds[0] = b1;
//				} 

//				at.setLower_bound(null, bounds[0]); 
//				if (bounds[1] != null) {
//					at.setUpper_bound(null, bounds[1]); 
//				}	else {
//					at.unsetUpper_bound(null);  // no need for that it is unset after creating
//				}
                        }
                        for (int i = 0; i < parameter_ids.size(); i++) {
                                id = (String)parameter_ids.elementAt(i);
                                tp = findTarget_parameter(id);
                        // still need to create aggregate in the case of aggregate
                                // tp.setLower_bound(null,);
                                // tp.setUpper_bound(null,);

/*
				if (is_aggregate) {
					tp.setExtent(null, at);
				} else {
					tp.setExtent(null, ed);
				}
*/


                                tp.setExtent(null, ed);
                        } // for
                        tp.setOrder(null, target_parameter_order_count++);
                } else
                if (parser_pass == 5) {

                        for (int i = 0; i < parameter_ids.size(); i++) {
                                id = (String)parameter_ids.elementAt(i);
                                tp = findTarget_parameterStrict(id);


                                if (is_aggregate) {
                                        if (tp instanceof jsdai.SExtended_dictionary_schema.EAggregate_target_parameter) {
                                                atp = (jsdai.SExtended_dictionary_schema.EAggregate_target_parameter)tp;
                                                if (bounds[0] != null) {
                                                        atp.setLower_bound(null, bounds[0]);
                                                }
                                                if (bounds[1] != null) {
                                                        atp.setUpper_bound(null, bounds[1]);
                                                }
                                        } else {
                                                // internal error
                                        }

                                } // if aggregate
                        } // for
                }
                printDebug("In TargetParameter5, ending");
  }

/*--------- ISO 10303-14:B.2.213  ---*/
  static final public String TargetParameterId5() throws ParseException, jsdai.lang.SdaiException {
        String result = null;
                printDebug("In TargetParameterId5, starting");
    result = ParameterId5();
                printDebug("In TargetParameterId5, ending: " + result);
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.214  ---*/
  static final public jsdai.SExtended_dictionary_schema.ETarget_parameter TargetParameterRef5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) TargetParameterRef */
        X_TargetParameterRef jjtn000 = new X_TargetParameterRef(JJTTARGETPARAMETERREF);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String name;
        jsdai.SExtended_dictionary_schema.ETarget_parameter result = null;
    try {
      name = TargetParameterId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
          printDDebug("IN target_parameter_ref");
                result = findTarget_parameter(name);
//		jjtThis.name = name;
                jjtn000.name = result.getName(null);
                if (result.testOrder(null)) {
                        jjtn000.order = result.getOrder(null);
                }
                {if (true) return result;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

  static final public jsdai.SExtended_dictionary_schema.ETarget_parameter TargetParameterRefStrict5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) TargetParameterRef */
        X_TargetParameterRef jjtn000 = new X_TargetParameterRef(JJTTARGETPARAMETERREF);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String name;
        jsdai.SExtended_dictionary_schema.ETarget_parameter result = null;
    try {
      name = TargetParameterId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
          printDDebug("IN target_parameter_ref");
                result = findTarget_parameterStrict(name);
//		jjtThis.name = name;
                jjtn000.name = result.getName(null);
                if (result.testOrder(null)) {
                        jjtn000.order = result.getOrder(null);
                }
                {if (true) return result;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

// added by RR, not in part 14
  static final public jsdai.SExtended_dictionary_schema.ESource_parameter SourceParameterRef5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) SourceParameterRef */
        X_SourceParameterRef jjtn000 = new X_SourceParameterRef(JJTSOURCEPARAMETERREF);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String name;
        jsdai.SExtended_dictionary_schema.ESource_parameter result = null;
    try {
      name = SourceParameterId5();
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
          jjtreeCloseNodeScope(jjtn000);
                 printDDebug("IN source_parameter_ref");
     result = findSource_parameter(name);
//     jjtThis.name = name;
     jjtn000.source_parameter = result;
                 jjtn000.partition = result.getParent(null);
     jjtn000.name = result.getName(null);
     if (result.testOrder(null)) {
        jjtn000.order = result.getOrder(null);
                 }
                 {if (true) return result;}
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.303------------ */
  static final public void Term5() throws ParseException, jsdai.lang.SdaiException {
        Object operand1 = null;
        Object operand2;
        String x_operand1 = "";
        String x_operand2 = "";
        String x_result = "";
        double op1double;
        double op2double;
        int op1int;
        int op2int;
        int operation;
        int op_nr = 0;
        int nr_of_operands = 0;
          X_MultiplicationLikeOp jjtn001 = new X_MultiplicationLikeOp(JJTMULTIPLICATIONLIKEOP);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
          jjtreeOpenNodeScope(jjtn001);
    try {
      Factor5();
                if (parser_pass == 5) {
                        nr_of_operands++;
                        operand1 = argument_stack.pop();
                        printStack("POP: Term5, operand1: " + operand1);
                        if (expression_instances) {
                                // x_operand1 = (String)expression_stack.pop();
                                // printXStack("POP: Term5, operand1: " + x_operand1);
                                // x_result = x_operand1;
                        }
                }
      label_149:
      while (true) {
        if (jj_2_76(2)) {
          ;
        } else {
          break label_149;
        }
        operation = MultiplicationLikeOp5();
        Factor5();
         if (parser_pass == 5) {
                nr_of_operands++;
                if (expression_instances) {
//			jjtThis.operations[op_nr++] = operation;
                        jjtn001.operations.add(new Integer(operation));
                        op_nr++;
                }
                operand2 = argument_stack.pop();
                printStack("POP: Term5, operand2: " + operand2);
                if (expression_instances) {
                        // x_operand2 = (String)expression_stack.pop();
                        // printXStack("POP: Term5, operand2: " + x_operand2);
                }
                if (operation == 1) {       // *
                        if ((operand1 instanceof Integer) && (operand2 instanceof Integer)) {
                                op1int = ((Integer)operand1).intValue();
                                op2int = ((Integer)operand2).intValue();
                                op1int *= op2int;
                                operand1 = new Integer(op1int);
                        }       else
                        if ((operand1 instanceof Number) && (operand2 instanceof Number)) {
                                op1double = ((Number)operand1).doubleValue();
                                op2double = ((Number)operand2).doubleValue();
                                op1double *= op2double;
                                operand1 = new Double(op1double);

                        }
                        if (expression_instances) {
                                // x_result = x_operand1 + " * " + x_operand2;
//                              x_result = "(" + x_operand1 + " * " + x_operand2 + ")";
                                // x_operand1 = x_result;
                  }
                }       else
                if (operation == 2) {  // /
                        if ((operand1 instanceof Integer) && (operand2 instanceof Integer)) {
                                op1int = ((Integer)operand1).intValue();
                                op2int = ((Integer)operand2).intValue();
                                if (op2int != 0) {
                                        op1int /= op2int;
                                } else {
//					printError("devide by zero in expression");
                                        printErrorMsg("" + "" + " - devide by zero in expression", null, true);
                                        printDebug("Expression5 - devide by zero");
                                }
                                operand1 = new Integer(op1int);
                        } else
                        if ((operand1 instanceof Number) && (operand2 instanceof Number)) {
                                op1double = ((Number)operand1).doubleValue();
                                op2double = ((Number)operand2).doubleValue();
                                if (op2double != 0) {
                                        op1double /= op2double;
                                } else {
                                        printErrorMsg("" + "" + " - devide by zero in expression", null, true);
//					printError("devide by zero in expression");
                                        printDebug("Expression5 - devide by zero");
                                }
                                operand1 = new Double(op1double);
                        }
                        if (expression_instances) {
                                // x_result = x_operand1 + " / " + x_operand2;
//                              x_result = "(" + x_operand1 + " / " + x_operand2 + ")";
                                // x_operand1 = x_result;
                  }
                } else
                if (operation == 3) {  // DIV
                        if (expression_instances) {
//                              x_result = x_operand1 + " / " + x_operand2;
                                // x_result = "((int)" + x_operand1 + " / (int)" + x_operand2 + ")";
                                // x_operand1 = x_result;
                  }
                } else
                if (operation == 4) {  // MOD
                        if (expression_instances) {
//                              x_result = x_operand1 + " % " + x_operand2;
                                // x_result = "((int)" + x_operand1 + " % (int)" + x_operand2 + ")";
                                // x_operand1 = x_result;
                  }
                } else
                if (operation == 5) {  // AND
                        if (expression_instances) {
                                // x_result = x_operand1 + " & " + x_operand2;
//                              x_result = "(" + x_operand1 + " & " + x_operand2 + ")";
                                // x_operand1 = x_result;
                        }
                } else
                if (operation == 6) {  // ||
                }
        }
      }
    } catch (Throwable jjte001) {
          if (jjtc001) {
            jjtree.clearNodeScope(jjtn001);
            jjtc001 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte001 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte001;}
          }
          if (jjte001 instanceof ParseException) {
            {if (true) throw (ParseException)jjte001;}
          }
          if (jjte001 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte001;}
          }
          {if (true) throw (Error)jjte001;}
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001,  nr_of_operands > 1);
            jjtreeCloseNodeScope(jjtn001);
          }
    }
        if (parser_pass == 5) {
                argument_stack.push(operand1);
                printStack("PUSH: Term5 " + operand1);
                if (expression_instances) {
                        // expression_stack.push(x_result);
                        // printXStack("PUSH: Term5, result: " + x_result);
                }
        }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.304------------ */
  static final public void TypeDecl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) TypeDecl */
        X_TypeDecl jjtn000 = new X_TypeDecl(JJTTYPEDECL);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);String type_name;
        jsdai.SExtended_dictionary_schema.EDefined_type dt;
//      jsdai.SExtended_dictionary_schema.ELocal_declaration$type_declaration ltd;
        jsdai.SExtended_dictionary_schema.EDeclaration ltd;
        Token a_token;
    try {
      try {
                scope_stack.push(current_scope);
                current_scope = new Vector();
        a_token = jj_consume_token(TYPE);
        type_name = TypeId5();
                printDebug("In TypeDecl5, starting. Type: " + type_name);
                if (parser_pass == 1) {
                        dt = findDefined_type(type_name);
                        if (dt != null) {
                                                error_count++;
                                                printDebug("duplicate defined type name \"" + type_name + "\"");
                        } else
                        {
                                String wrong_name = findAnyName(type_name);
                                if (wrong_name != null) {
                                                error_count++;
                                                printDebug("duplicate name \"" + type_name + "\". The same name used for a defined type and for " + wrong_name);
                                }
                        }
                        dt = (jsdai.SExtended_dictionary_schema.EDefined_type)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDefined_type.class);
                        active_scope = dt;
                  ltd = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$type_declaration.class);
                        ltd.setParent(null, sd);
                        // parent_schema is now derived instead of explicit 
                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                // ltd.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                        // }
                        ltd.setDefinition(null, dt);
                        if (flag_oc) {
                                dt.setName(null, type_name);
                        } else {
                                dt.setName(null, type_name.toLowerCase());
                        }
                        hm_current_type_declarations.put(type_name.toLowerCase(), ltd);
//                      dt.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                        // now it is inverse
                        // dt.createWhere_rules(null);
                        createDocumentationEntity2(dt, a_token);
                } else
                {
                        dt = findDefined_type(type_name);
                  active_scope_extension = new ECtScope(active_scope, dt, active_scope_extension, active_scope_string, type_name, type_name.toLowerCase());
                        active_scope_string = "";
                        active_scope = dt;
                        if (dt == null) {
                                error_count++;
                                printErrorMsg5("" + type_name +  " - type not found", null, true);
                                printDebug("TypeDecl5 - defined type not found: " + type_name);
                        }
                        if (parser_pass == 5) {
                                if (expression_instances) {
                                        jjtn000.dt = dt;
                                        if (dt != null) {
                                                jjtn000.name = dt.getName(null);
                                        } else {
//System.out.println("<EC> type null: " + type_name);
printErrorMsgX("reference to unknown type: " + type_name, null, true);
                                                jjtn000.name = type_name;
                                        }
                                }
                        }

                }
        jj_consume_token(EQ);
        UnderlyingType5(dt);
        jj_consume_token(SEMICOLON);
        switch (jj_nt.kind) {
        case WHERE:
          WhereClause5(dt);
          break;
        default:
          jj_la1[455] = jj_gen;
          ;
        }
        jj_consume_token(END_TYPE);
                active_scope = null;
                active_scope_string =  active_scope_extension.getParent_scope_string();
          active_scope_extension = active_scope_extension.getParent();


                current_scope = (Vector)scope_stack.pop();
                printDebug("In TypeDecl5, ending. Type: " + type_name);
// System.out.println("O-O-12 - defined type: " + dt);

        jj_consume_token(SEMICOLON);
      } catch (ParseException e) {
//	System.out.println("EXCEPTION: " + e);
         printErrorMsg5(e.getMessage(), null, true);
        // System.out.println("ERROR RECOVERY: skipping to END_TYPE");
                error_count++;
        recoverFromParseException(END_TYPE, e);
      }
    } catch (Throwable jjte000) {
  if (jjtc000) {
    jjtree.clearNodeScope(jjtn000);
    jjtc000 = false;
  } else {
    jjtree.popNode();
  }
  if (jjte000 instanceof RuntimeException) {
    {if (true) throw (RuntimeException)jjte000;}
  }
  if (jjte000 instanceof ParseException) {
    {if (true) throw (ParseException)jjte000;}
  }
  if (jjte000 instanceof jsdai.lang.SdaiException) {
    {if (true) throw (jsdai.lang.SdaiException)jjte000;}
  }
  {if (true) throw (Error)jjte000;}
    } finally {
  if (jjtc000) {
    jjtree.closeNodeScope(jjtn000, true);
    jjtreeCloseNodeScope(jjtn000);
  }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.305------------ */
  static final public String TypeId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/* - LOOKAHEAD 2 - (Columns 3 & 19) --------------------------------------------------- ISO 10303-11:A.2.306------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict involving 2 expansions at 3 and 19.
		 Common prefix <SIMPLE_ID>
		 Lookahead of 2 should be used for the earlier expansion.
*/
  static final public String TypeLabel5() throws ParseException, jsdai.lang.SdaiException {
        String Label5 = null;
                printDebug("In TypeLabel5, starting");
    //      (Label5 = TypeLabelId5() | TypeLabelRef5())
            Label5 = TypeLabelId5();
                printDebug("In TypeLabel5, ending");
                {if (true) return Label5;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.307------------ */
  static final public String TypeLabelId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*--------- ISO 10303-14:B.2.219  ---*/
  static final public jsdai.SExtended_dictionary_schema.EDefined_type TypeReference5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
    if (jj_2_77(2147483647)) {
      SchemaRef5();
      jj_consume_token(DOT);
    } else {
      ;
    }
    dt = TypeRef5(0);
                {if (true) return dt;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.308------------ */
  static final public int UnaryOp5() throws ParseException, jsdai.lang.SdaiException {
        int t;
                printDebug("In UnaryOp5");
    switch (jj_nt.kind) {
    case PLUS:
      jj_consume_token(PLUS);
              t = 1;
      break;
    case MINUS:
      jj_consume_token(MINUS);
                            t = 2;
      break;
    case NOT:
      jj_consume_token(NOT);
                 t = 3;
      break;
    default:
      jj_la1[456] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                {if (true) return t;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.309------------ */
  static final public void UnderlyingType5(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EAggregation_type at = null;
        jsdai.SExtended_dictionary_schema.ESimple_type st = null;
        jsdai.SExtended_dictionary_schema.EDefined_type dt2 = null;
    switch (jj_nt.kind) {
    case ENUMERATION:
    case EXTENSIBLE:
    case GENERIC_ENTITY:
    case SELECT:
      ConstructedTypes5(dt);
      break;
    case ARRAY:
    case BAG:
    case LIST:
    case SET:
      at = AggregationTypes5(dt);
                // if (parser_pass > 3) {  // was == 2
                //	 dt.setDomain(null, at);
                // }
                if ((dt != null) && (at != null)) {
                if (!(dt.testDomain(null))) {
                                dt.setDomain(null, at);
                        }
                }
      break;
    case BINARY:
    case BOOLEAN:
    case INTEGER:
    case LOGICAL:
    case NUMBER:
    case REAL:
    case STRING:
      st = SimpleTypes5(dt);
                if (parser_pass > 3) {  // was == 3
                        if (st != null) {
                                dt.setDomain(null, st);
                        } else {
                                printVerbose("ERROR: domain st unset");
                        }
                }
      break;
    case SIMPLE_ID:
      dt2 = TypeRef5(0);
                if (parser_pass > 3) {  // was == 3
                        dt.setDomain(null, dt2);
                }
      break;
    default:
      jj_la1[457] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.310------------ */
  static final public void UniqueClause5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(UNIQUE);
    label_150:
    while (true) {
      UniqueRule5(ed);
      jj_consume_token(SEMICOLON);
      switch (jj_nt.kind) {
      case SELF:
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[458] = jj_gen;
        break label_150;
      }
    }
  }

/* - LOOKAHEAD 2 or > - (Column 3) ---------------------------------------------------- ISO 10303-11:A.2.311------------ */
/*
		 LOKAHEAD NEEDED! Choice conflict in [] construct (column 3).
		 Expansion nested within construct and expansion following construct have common prefixes,
		 one of which is <SIMPLE_ID>. Lookahead of 2 or more should be used for the nested expansion.
*/
  static final public void UniqueRule5(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
        String name = null;
        jsdai.SExtended_dictionary_schema.EUniqueness_rule ur;
        jsdai.SExtended_dictionary_schema.AAttribute aa = null;
        jsdai.SExtended_dictionary_schema.EAttribute a;
        int Index5 = 1;
    if (jj_2_78(2)) {
      name = Label5();
      jj_consume_token(COLON);
    } else {
      ;
    }
    a = ReferencedAttribute5(ed);
                if (parser_pass == 5) {
                        ur = (jsdai.SExtended_dictionary_schema.EUniqueness_rule)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CUniqueness_rule.class);
                        if (name != null)
                                ur.setLabel(null, name);
                        ur.setParent_entity(null, ed);
                        aa = ur.createAttributes(null);
                        if (a != null)
                                aa.addByIndex(Index5++, a);
                        else {
                                error_count++;
                                printErrorMsg5(" name not available - attribute not found in uniqueness rule", null, true);
                                printDebug("Uniqness rule - attribute not found");
                        }
                }
    label_151:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[459] = jj_gen;
        break label_151;
      }
      jj_consume_token(COMMA);
      a = ReferencedAttribute5(ed);
                if (parser_pass == 5) {
                        if (a != null)
                                aa.addByIndex(Index5++, a);
                        else {
                                error_count++;
                                printErrorMsg5(" name not available - attribute not found in uniqueness rule", null, true);
                                printDebug("Uniqness rule - attribute not found");
                        }
                }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.312------------ */
  static final public void UntilControl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) UntilControl */
  X_UntilControl jjtn000 = new X_UntilControl(JJTUNTILCONTROL);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      jj_consume_token(UNTIL);
      LogicalExpression5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.313------------ */
  static final public void UseClause5(Vector used_vector) throws ParseException, jsdai.lang.SdaiException {
  String used_schema;
        jsdai.lang.SdaiModel interfaced_model;
        boolean items_listed = false;
        jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
        Vector items_vector;
        jsdai.SExtended_dictionary_schema.EUse_from_specification ufs = null;
//	jsdai.SExtended_dictionary_schema.AUsed_declaration items = null;
        jsdai.SExtended_dictionary_schema.AInterfaced_declaration items = null;
    jj_consume_token(USE);
    jj_consume_token(FROM);
    used_schema = SchemaRef5();
                items_vector = new Vector();
                interfaced_model = findModel(used_schema);
//              if (interfaced_model == null) {
                if ((interfaced_model == null) && (parser_pass != 1)) {
                error_count++;
                        printErrorMsg5("" + used_schema + " - schema not found", null, true);
                        printDebug("schema not found: " + used_schema);
                }
// 		if ((parser_pass == 2) && (interfaced_model != null)) {
                if (interfaced_model != null) {
                        if (interfaced_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                                interfaced_model.startReadOnlyAccess();
                        }
                }
    switch (jj_nt.kind) {
    case LPAREN:
      jj_consume_token(LPAREN);
      dc = NamedTypeOrRename5(interfaced_model);
                                                        items_listed = true; items_vector.addElement(dc);
      label_152:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[460] = jj_gen;
          break label_152;
        }
        jj_consume_token(COMMA);
        dc = NamedTypeOrRename5(interfaced_model);
                                                                                                                                                           items_vector.addElement(dc);
      }
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[461] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
                if (parser_pass == 2) {
                        ufs = (jsdai.SExtended_dictionary_schema.EUse_from_specification)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CUse_from_specification.class);
                        jsdai.SExtended_dictionary_schema.ESchema_definition asd = getSchema_definitionFromModel(interfaced_model);
                        if (asd != null) {
                                ufs.setForeign_schema(null, asd);  // generic_schema_definition;
                        }

                        ufs.setCurrent_schema(null, sd); // generic_schema_definition;
                        if (!items_listed) {
                                if (interfaced_model != null) {
                                        createAllUsedDeclarations(interfaced_model);
                                        // here the interfaced_model is stored.
                                        used_vector.addElement(interfaced_model);
                                }
                        } else {
                                items = ufs.createItems(null);
                                for (int i = 0; i < items_vector.size(); i++) {
//					items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EUsed_declaration)items_vector.elementAt(i));
//					items.addByIndex(i, (jsdai.SExtended_dictionary_schema.EInterfaced_declaration)items_vector.elementAt(i));
                                        items.addUnordered((jsdai.SExtended_dictionary_schema.EUsed_declaration)items_vector.elementAt(i));
                                }
                        }
                }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.314------------ */
  static final public String VariableId5() throws ParseException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.223  ---*/
  static final public void ViewAttributeDecl5(jsdai.SExtended_dictionary_schema.EIndependent_view_definition vd, jsdai.SExtended_dictionary_schema.EView_partition partition, boolean first_partition) throws ParseException, jsdai.lang.SdaiException {
        String attr_name;
        boolean is_optional = false;
        jsdai.SExtended_dictionary_schema.ESchema_definition ssd = null;
        jsdai.lang.EEntity bt = null;
        jsdai.SExtended_dictionary_schema.EView_attribute va = null;
        jsdai.SExtended_dictionary_schema.EView_partition_attribute vpa = null;
    //      ViewAttributeId5() ":" [ <OPTIONAL> ] [ SourceSchemaRef55() "." ] BaseType5(null) ":=" Expression5() ";"
    //	attr_name = ViewAttributeId5() ":" [ <OPTIONAL> {is_optional = true;}] [  LOOKAHEAD(2) ssd = (jsdai.SExtended_dictionary_schema.ESchema_definition)InterpretedRef5(PI_SOURCE_SCHEMA) "." ] bt = BaseType5(ssd) ":=" Expression5() ";"
            // <SIMPLE_ID> choice conflict, "." allows to confirm the optional part, lookahead 2 is ok.
            attr_name = ViewAttributeId5();
    jj_consume_token(COLON);
    switch (jj_nt.kind) {
    case OPTIONAL:
      jj_consume_token(OPTIONAL);
                                                         is_optional = true;
      break;
    default:
      jj_la1[462] = jj_gen;
      ;
    }
    if (jj_2_79(2)) {
      ssd = SourceSchemaRef55();
      jj_consume_token(DOT);
    } else {
      ;
    }
    bt = BaseType5(ssd);
    jj_consume_token(ASSIGN);
    Expression5();
    jj_consume_token(SEMICOLON);
                // check which parser pass better to use.
                if (parser_pass == 1) {
                                va = findView_attribute(attr_name, vd);
                                if (va != null) {
                                        // error
                                }

                        if (first_partition) {
                                // if first partition, create both view_attribute and view_partition_attirbute
                                va =  (jsdai.SExtended_dictionary_schema.EView_attribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CView_attribute.class);
//				va.setParent_entity(null, vd);
                                va.setParent(null, vd);
                                va.setName(null, attr_name);
//				va.setOrder(null, view_attribute_order_count++);
                                va.setOptional_flag(null, is_optional);
// System.out.println("SET OPTIONAL 11, attribute: " + va);
                        } else {
                                // if subsequent partition, find view_attribute and create view_partition_attribute
                                va = findView_attribute(attr_name, vd);
                        }
                        vpa = (jsdai.SExtended_dictionary_schema.EView_partition_attribute)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CView_partition_attribute.class);
                        vpa.setParent_view_attribute(null, va);
                        vpa.setRelated_partition(null, partition);
                } else {
                        va = findView_attribute(attr_name, vd);
                        if (parser_pass == 4) {
                                va.setOrder(null, view_attribute_order_count++);
                        }
                }
  }

/*--------- ISO 10303-14:B.2.224  ---*/
  static final public String ViewAttributeId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.225  ---*/
  static final public void ViewAttrDeclStmtList5(jsdai.SExtended_dictionary_schema.EIndependent_view_definition vd, jsdai.SExtended_dictionary_schema.EView_partition partition, boolean first_partition) throws ParseException, jsdai.lang.SdaiException {
                view_attribute_order_count = 0;
    label_153:
    while (true) {
      ViewAttributeDecl5(vd, partition, first_partition);
      switch (jj_nt.kind) {
      case SIMPLE_ID:
        ;
        break;
      default:
        jj_la1[463] = jj_gen;
        break label_153;
      }
    }
  }

/*-+-------- ISO 10303-14:B.2.226  ---*/
  static final public Object ViewCall5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EView_partition vp = null;
        jsdai.SExtended_dictionary_schema.EMap_or_view_partition partition = null;
                printDebug("In ViewCall5, starting");
    vd = ViewReference5();
    switch (jj_nt.kind) {
    case BACKSLASH:
      partition = PartitionQualification5(vd);
      break;
    default:
      jj_la1[464] = jj_gen;
      ;
    }
    jj_consume_token(LPAREN);
    if (jj_2_80(1)) {
      ExpressionOrWild5();
      label_154:
      while (true) {
        switch (jj_nt.kind) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[465] = jj_gen;
          break label_154;
        }
        jj_consume_token(COMMA);
        ExpressionOrWild5();
      }
    } else {
      ;
    }
    jj_consume_token(RPAREN);
                printDebug("In ViewCall5, ending");
          {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.227  ---*/


//view_decl = VIEW view_id independent_view_decl | dependent_view_decl  END_VIEW ';'
  static final public void ViewDecl5() throws ParseException, jsdai.lang.SdaiException {
        String view_name;
        Token a_token;
                scope_stack.push(current_scope);
                current_scope = new Vector();
    a_token = jj_consume_token(VIEW);
    view_name = ViewId5();
    switch (jj_nt.kind) {
    case COLON:
      DependentViewDecl5(a_token, view_name);
      break;
    case SEMICOLON:
    case ABSTRACT:
    case CONNOTATIONAL:
    case SUBTYPE:
    case SUPERTYPE:
      IndependentViewDecl5(a_token, view_name);
      break;
    default:
      jj_la1[466] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    jj_consume_token(END_VIEW);
    jj_consume_token(SEMICOLON);
                current_scope = (Vector)scope_stack.pop();
  }

// independent_view_decl = root_view_decl | subtype_view_decl
  static final public void IndependentViewDecl5(Token a_token, String view_name) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration vld = null;
                printDebug("Current view: " + view_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        vd = findView_definition(view_name, null);
                        if (vd != null) {
                                error_count++;
//				printError("duplicate view name \"" + view_name + "\"");
                        } else {
                                String wrong_name = findAnyName(view_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + view_name + "\". The same name used for a view and for " + wrong_name);
                                }
                                vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CIndependent_view_definition.class);
                                active_scope = vd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                vld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$view_declaration.class);


//				vld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                vld.setParent(null, sd);
                                vld.setDefinition(null, vd);

                                vd.setName(null, view_name);
                                // supertypes is non-optional attribute, although there are no supertypes in dependent_views.
//				vd.createSupertypes(null);
                                vd.createGeneric_supertypes(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper5()
                        vd = findView_definition(view_name, null);
                        active_scope = vd;
                        if (vd == null) {
                                error_count++;
//				printError("ViewDecl5 - the view not found: " + view_name);
//				printError("" + view_name + " - view not found", null, true);
                                printErrorMsg("" + view_name + " - view not found", null, true);
                        }
                }
                // createDocumentationEntity2(vd, a_token);

    switch (jj_nt.kind) {
    case ABSTRACT:
    case SUPERTYPE:
      SupertypeConstraint5(vd);
      break;
    default:
      jj_la1[467] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case CONNOTATIONAL:
    case SUBTYPE:
      SubtypeViewDecl5(vd);
      break;
    case SEMICOLON:
      RootViewDecl5(vd);
      break;
    default:
      jj_la1[468] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

// root_view_decl = [supertype_constraint] ';' binding_header independent_view_project_clause {binding_header independent_view_project_clause}
  static final public void RootViewDecl5(jsdai.SExtended_dictionary_schema.EView_definition vd) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity partition_e = null;
        jsdai.SExtended_dictionary_schema.EView_partition partition = null;
    jj_consume_token(SEMICOLON);
    partition_e = BindingHeader5(vd);
                                            partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
    IndependentViewProjectClause5(vd, partition, true);
    label_155:
    while (true) {
      switch (jj_nt.kind) {
      case FROM:
      case IDENTIFIED_BY:
      case LOCAL:
      case ORDERED_BY:
      case PARTITION:
      case SELECT:
      case WHERE:
        ;
        break;
      default:
        jj_la1[469] = jj_gen;
        break label_155;
      }
      //           LOOKAHEAD(BindingHeader5(vd)) partition_e = BindingHeader5(vd) {partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;} 
                  partition_e = BindingHeader5(vd);
                                              partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
      IndependentViewProjectClause5(vd, partition, false);
    }
  }

// subtype_view_decl = [supertype_constraint] subtype_declaration ';' subtype_binding_header independent_view_project_clause {subtype_binding_header independent_view_project_clause}
  static final public void SubtypeViewDecl5(jsdai.SExtended_dictionary_schema.EView_definition vd) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity gen_partition = null;
    SubtypeDeclaration5(vd);
    jj_consume_token(SEMICOLON);
    gen_partition = SubtypeBindingHeader5(vd);
    IndependentViewProjectClause5(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, true);
    label_156:
    while (true) {
      switch (jj_nt.kind) {
      case PARTITION:
      case WHERE:
        ;
        break;
      default:
        jj_la1[470] = jj_gen;
        break label_156;
      }
      //	    LOOKAHEAD(SubtypeBindingHeader5(vd)) gen_partition = SubtypeBindingHeader5(vd) 
                  gen_partition = SubtypeBindingHeader5(vd);
      IndependentViewProjectClause5(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, false);
    }
  }

// dependent_view_decl = ':' base_type [supertype_constraint] ';' binding_header RETURN Expression5 {binding_header RETURN Expression5}
  static final public void DependentViewDecl5(Token a_token, String view_name) throws ParseException, jsdai.lang.SdaiException {
        jsdai.lang.EEntity bt = null;
        jsdai.lang.EEntity partition_e = null;
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration vld = null;
        jsdai.SExtended_dictionary_schema.EView_partition partition = null;
    jj_consume_token(COLON);
    bt = BaseType5(null);
                printDebug("Current view: " + view_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        vd = findView_definition(view_name, null);
                        if (vd != null) {
                                error_count++;
//				printError("duplicate view name \"" + view_name + "\"");
                        } else {
                                String wrong_name = findAnyName(view_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + view_name + "\". The same name used for a view and for " + wrong_name);
                                }
                                vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_view_definition.class);
                                ((jsdai.SExtended_dictionary_schema.EDependent_view_definition)vd).setDomain(null, bt);
                                active_scope = vd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                vld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$view_declaration.class);


//				vld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                vld.setParent(null, sd);
                                vld.setDefinition(null, vd);

                                vd.setName(null, view_name);
                                // supertypes is non-optional attribute, although there are no supertypes in dependent_views.
//				vd.createSupertypes(null);
                                vd.createGeneric_supertypes(null);
                        }
                } else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper5()
                        vd = findView_definition(view_name, null);
                        active_scope = vd;
                        if (vd == null) {
                                error_count++;
//				printError("ViewDecl5 - the view not found: " + view_name);
                                printErrorMsg("" + view_name + " - view not found", null, true);
                        }
                }
                // createDocumentationEntity2(vd, a_token);

    switch (jj_nt.kind) {
    case ABSTRACT:
    case SUPERTYPE:
      SupertypeConstraint5(vd);
      break;
    default:
      jj_la1[471] = jj_gen;
      ;
    }
    partition_e = BindingHeader5(vd);
                                          partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
    jj_consume_token(RETURN);
    Expression5();
    label_157:
    while (true) {
      switch (jj_nt.kind) {
      case FROM:
      case IDENTIFIED_BY:
      case LOCAL:
      case ORDERED_BY:
      case PARTITION:
      case RETURN:
      case WHERE:
        ;
        break;
      default:
        jj_la1[472] = jj_gen;
        break label_157;
      }
      // the choice problem here
                  partition_e = BindingHeader5(vd);
                                              partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
      jj_consume_token(RETURN);
      Expression5();
    }
  }

// independent_view_project_clause = SELECT view_attr_decl_stmt_list;
  static final public void IndependentViewProjectClause5(jsdai.SExtended_dictionary_schema.EView_definition vd, jsdai.SExtended_dictionary_schema.EView_partition partition, boolean first_partition) throws ParseException, jsdai.lang.SdaiException {
    jj_consume_token(SELECT);
    ViewAttrDeclStmtList5((jsdai.SExtended_dictionary_schema.EIndependent_view_definition)vd, partition, first_partition);
  }

  static final public void ViewDecl_previous5() throws ParseException, jsdai.lang.SdaiException {
        String view_name;
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration vld = null;
        Token a_token;
        boolean is_dependent_view = false;
        jsdai.lang.EEntity bt = null;
        jsdai.SExtended_dictionary_schema.EView_partition partition = null;
        jsdai.lang.EEntity partition_e = null;
        jsdai.lang.EEntity gen_partition = null;
    switch (jj_nt.kind) {
    case VIEW:
      //      <VIEW> ViewId5() [ ":" BaseType5(null) ] [ SupertypeRule5() ] ";" ( ViewSubtypeOfClause() ( SubtypeBindingHeader5() ViewProjectClause5() )+ ) | ( ( BindingHeader5() ViewProjectClause5() )+ ) <END_VIEW> ";"
      // not making the change from DIS
      //old	<VIEW> ViewId5() [ ":" BaseType5(null) ] [ SupertypeConstraint5(null) ] ";" ( ViewSubtypeOfClause() ( LOOKAHEAD(3) SubtypeBindingHeader5() ViewProjectClause5() )+ ) | ( ( BindingHeader5() ViewProjectClause5() )+ ) <END_VIEW> ";"
              a_token = jj_consume_token(VIEW);
      view_name = ViewId5();
      switch (jj_nt.kind) {
      case COLON:
        jj_consume_token(COLON);
        bt = BaseType5(null);
                                                                            is_dependent_view = true;
        break;
      default:
        jj_la1[473] = jj_gen;
        ;
      }
                printDebug("Current view: " + view_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        vd = findView_definition(view_name, null);
                        if (vd != null) {
                                error_count++;
//				printError("duplicate view name \"" + view_name + "\"");
                        } else {
                                String wrong_name = findAnyName(view_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + view_name + "\". The same name used for a view and for " + wrong_name);
                                }
                                if (is_dependent_view) {
                                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_view_definition.class);
                                        ((jsdai.SExtended_dictionary_schema.EDependent_view_definition)vd).setDomain(null, bt);
                                } else {
                                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CIndependent_view_definition.class);
                                }
                                active_scope = vd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                vld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$view_declaration.class);


//				vld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                vld.setParent(null, sd);
                                vld.setDefinition(null, vd);

                                vd.setName(null, view_name);
                                // supertypes is non-optional attribute, although there are no supertypes in dependent_views.
//				vd.createSupertypes(null);
                                vd.createGeneric_supertypes(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper5()
                        vd = findView_definition(view_name, null);
                        if (vd == null) {
                                error_count++;
//				printError("ViewDecl5 - the view not found: " + view_name);
                                printErrorMsg("" + view_name + " - view not found", null, true);
                        }
                }
                // createDocumentationEntity2(vd, a_token);

      SubSuper5(vd);
      jj_consume_token(SEMICOLON);
      partition_e = BindingHeader5(vd);
                                            partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
      ViewProjectClause5(vd, partition, true);
      label_158:
      while (true) {
        if (jj_2_81(100)) {
          ;
        } else {
          break label_158;
        }
        partition_e = BindingHeader5(vd);
                                                             partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
        ViewProjectClause5(vd, partition, false);
      }
      break;
    case PARTITION:
    case WHERE:
      gen_partition = SubtypeBindingHeader5(vd);
      ViewProjectClause5(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, true);
      label_159:
      while (true) {
        switch (jj_nt.kind) {
        case PARTITION:
        case WHERE:
          ;
          break;
        default:
          jj_la1[474] = jj_gen;
          break label_159;
        }
        //	    LOOKAHEAD(SubtypeBindingHeader5(vd)) gen_partition = SubtypeBindingHeader5(vd) 
                    gen_partition = SubtypeBindingHeader5(vd);
        ViewProjectClause5(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, false);
      }
      jj_consume_token(END_VIEW);
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[475] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  static final public void ViewDecl_old5() throws ParseException, jsdai.lang.SdaiException {
        String view_name;
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
        jsdai.SExtended_dictionary_schema.EDeclaration vld = null;
        Token a_token;
        boolean is_dependent_view = false;
        jsdai.lang.EEntity bt = null;
        jsdai.SExtended_dictionary_schema.EView_partition partition = null;
        jsdai.lang.EEntity partition_e = null;
        jsdai.lang.EEntity gen_partition = null;
    switch (jj_nt.kind) {
    case VIEW:
      //      <VIEW> ViewId5() [ ":" BaseType5(null) ] [ SupertypeRule5() ] ";" ( ViewSubtypeOfClause() ( SubtypeBindingHeader5() ViewProjectClause5() )+ ) | ( ( BindingHeader5() ViewProjectClause5() )+ ) <END_VIEW> ";"
      // not making the change from DIS
      //old	<VIEW> ViewId5() [ ":" BaseType5(null) ] [ SupertypeConstraint5(null) ] ";" ( ViewSubtypeOfClause() ( LOOKAHEAD(3) SubtypeBindingHeader5() ViewProjectClause5() )+ ) | ( ( BindingHeader5() ViewProjectClause5() )+ ) <END_VIEW> ";"
              a_token = jj_consume_token(VIEW);
      view_name = ViewId5();
      switch (jj_nt.kind) {
      case COLON:
        jj_consume_token(COLON);
        bt = BaseType5(null);
                                                                            is_dependent_view = true;
        break;
      default:
        jj_la1[476] = jj_gen;
        ;
      }
                printDebug("Current view: " + view_name);
                if (parser_pass == 1) {
                        // check if a view with this name already exists in the extent.
                        vd = findView_definition(view_name, null);
                        if (vd != null) {
                                error_count++;
//				printError("duplicate view name \"" + view_name + "\"");
                        } else {
                                String wrong_name = findAnyName(view_name);
                                if (wrong_name != null) {
                                        error_count++;
//					printError("duplicate name \"" + view_name + "\". The same name used for a view and for " + wrong_name);
                                }
                                if (is_dependent_view) {
                                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CDependent_view_definition.class);
                                        ((jsdai.SExtended_dictionary_schema.EDependent_view_definition)vd).setDomain(null, bt);
                                } else {
                                        vd = (jsdai.SExtended_dictionary_schema.EView_definition)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CIndependent_view_definition.class);
                                }
                                active_scope = vd;
//                              eld = (jsdai.SExtended_dictionary_schema.EEntity_declaration$local_declaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$local_declaration.class);
                                vld = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CLocal_declaration$view_declaration.class);

        if (sd == null) {
//              System.out.println("SD NULL, view_name: " + view_name + ", pass: " + parser_pass);
        } else {
        }

//				vld.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                vld.setParent(null, sd);
                                vld.setDefinition(null, vd);

                                vd.setName(null, view_name);
                                // supertypes is non-optional attribute, although there are no supertypes in dependent_views.
//				vd.createSupertypes(null);
                                vd.createGeneric_supertypes(null);
                        }
                }       else { // pass 2 or 3 - find the entity in the extent before passing it to SubSuper5()
                        vd = findView_definition(view_name, null);
                        if (vd == null) {
                                error_count++;
//				printError("ViewDecl5 - the view not found: " + view_name);
                                printErrorMsg("" + view_name + " - view not found", null, true);
                        }
                }
                // createDocumentationEntity2(vd, a_token);

printDebug("In ViewDecl5, before SubSuper5");
      SubSuper5(vd);
      jj_consume_token(SEMICOLON);
printDebug("In ViewDecl5, after SubSuper5");
printDebug("In ViewDecl5, starting subtype branch");
      gen_partition = SubtypeBindingHeader5(vd);
printDebug("In ViewDecl5, subtype branch, before ViewProjectClause5");
      ViewProjectClause5(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, true);
printDebug("In ViewDecl5, subtype branch, after 1st ViewProjectClause5");
      label_160:
      while (true) {
        if (jj_2_82(2147483647)) {
          ;
        } else {
          break label_160;
        }
        gen_partition = SubtypeBindingHeader5(vd);
        ViewProjectClause5(vd, (jsdai.SExtended_dictionary_schema.EView_partition)gen_partition, false);
      }
      break;
    case FROM:
    case IDENTIFIED_BY:
    case LOCAL:
    case ORDERED_BY:
    case PARTITION:
    case RETURN:
    case SELECT:
    case WHERE:
printDebug("In ViewDecl5, starting no-subtype branch");
      partition_e = BindingHeader5(vd);
                                          partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
printDebug("In ViewDecl5, no-subtype branch, before ViewProjectClause5");
      ViewProjectClause5(vd, partition, true);
printDebug("In ViewDecl5, no-subtype branch, after 1st ViewProjectClause5");
      label_161:
      while (true) {
        switch (jj_nt.kind) {
        case FROM:
        case IDENTIFIED_BY:
        case LOCAL:
        case ORDERED_BY:
        case PARTITION:
        case RETURN:
        case SELECT:
        case WHERE:
          ;
          break;
        default:
          jj_la1[477] = jj_gen;
          break label_161;
        }
        partition_e = BindingHeader5(vd);
                                            partition = (jsdai.SExtended_dictionary_schema.EView_partition)partition_e;
        ViewProjectClause5(vd, partition, false);
      }
      jj_consume_token(END_VIEW);
      jj_consume_token(SEMICOLON);
      break;
    default:
      jj_la1[478] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*--------- ISO 10303-14:B.2.228  ---*/
  static final public String ViewId5() throws ParseException, jsdai.lang.SdaiException {
        Token t;
    t = jj_consume_token(SIMPLE_ID);
                if (flag_oc) {
                        {if (true) return (t.image);}
                } else {
                        {if (true) return (t.image.toLowerCase());}
                }
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.229  ---*/
  static final public void ViewProjectClause5(jsdai.SExtended_dictionary_schema.EView_definition vd, jsdai.SExtended_dictionary_schema.EView_partition partition, boolean first_partition) throws ParseException, jsdai.lang.SdaiException {
    switch (jj_nt.kind) {
    case SELECT:
      jj_consume_token(SELECT);
      ViewAttrDeclStmtList5((jsdai.SExtended_dictionary_schema.EIndependent_view_definition)vd, partition, first_partition);
      break;
    case RETURN:
      jj_consume_token(RETURN);
      Expression5();
      break;
    default:
      jj_la1[479] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/*--------- ISO 10303-14:B.2.230 ---*/
  static final public jsdai.SExtended_dictionary_schema.EView_definition ViewReference5() throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EView_definition vd = null;
    if (jj_2_83(2)) {
      InterpretedRef5(PI_SCHEMA_MAP_OR_SCHEMA_VIEW);
      jj_consume_token(DOT);
    } else {
      ;
    }
    InterpretedRef5(PI_VIEW);
                {if (true) return vd;}
    throw new Error("Missing return statement in function");
  }

/*-+-------- ISO 10303-14:B.2.231  ---*/
// removed -

//R void ViewSubtypeOfClause() throws jsdai.lang.SdaiException :
//R {}
//C {
//	<SUBTYPE> <OF> "(" ViewReference5() ( "," ViewReference5() )* ")" 
// my correction:
//R	<SUBTYPE> <OF> "(" ViewReference5() ( "," ViewReference5() )* ")" ";" 
//R }


/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.315------------ */
  static final public void WhereClause5(jsdai.lang.EEntity parent) throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) WhereClause */
        X_WhereClause jjtn000 = new X_WhereClause(JJTWHERECLAUSE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        jjtreeOpenNodeScope(jjtn000);jsdai.SExtended_dictionary_schema.EWhere_rule wr = null;
        jsdai.SExtended_dictionary_schema.AWhere_rule ar = null;
        no_label_nr = 0;
        int Index5 = 1;
        if (parser_pass == 5) {
          if (parent instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                // the second Parameter5 - domain, just adding null - the current model, for now.
                ar = ((jsdai.SExtended_dictionary_schema.ENamed_type)parent).getWhere_rules(null, null);
          } else
          if (parent instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                // the second Parameter5 - domain, just adding null - the current model, for now.
                ar = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)parent).getWhere_rules(null, null);
          } else {
                        // may be from express x - binding_header
                        // printError("Internal error in WhereClause5");
                        // error_count++;
                        // System.out.println("name: " + parent.getName(null));
          }
        }
    try {
                where_rule_order_count = 0;
                active_scope = parent;
                printDebug("In WhereClause5, starting, parent: " + parent);
      jj_consume_token(WHERE);
      label_162:
      while (true) {
        wr = DomainRule5(parent);
                if (parser_pass == 5) { // DomainRule5() may return where_rule with logical Expression5 in the future, so better in pass 2
                        if (expression_instances) {
                                jjtn000.domain_rules.addElement(wr);
                                jjtn000.where_rules = ar;
                        }
                        if (ar != null) {
//				ar.addByIndex(Index5++, wr);
                                ar.addUnordered(wr);
                                Index5++;
                                if (parent instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                        wr.setParent_item(null, (jsdai.SExtended_dictionary_schema.ENamed_type)parent);
                                } else
                                if (parent instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                                        wr.setParent_item(null, (jsdai.SExtended_dictionary_schema.EGlobal_rule)parent);
                                } else {
                                        error_count++;
                                        printErrorMsg5(" name not available - internal error in WhereClause5", null, true);
                                        printEDebug("Internal error in WhereClause5");
                                }
                        }
                }
        jj_consume_token(SEMICOLON);
        if (isDomainRule()) {
          ;
        } else {
          break label_162;
        }
      }
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/*-------------------------------*/
/*
void ChoiceConflict () :
{}
{
	<BASED_ON> | <BASED_ON>
}
*/
/*-------------------------------*/


/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.316------------ */
  static final public void WhileControl5() throws ParseException, jsdai.lang.SdaiException {
 /*@bgen(jjtree) WhileControl */
  X_WhileControl jjtn000 = new X_WhileControl(JJTWHILECONTROL);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
  jjtreeOpenNodeScope(jjtn000);
    try {
      jj_consume_token(WHILE);
      LogicalExpression5();
    } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte000;}
          }
          if (jjte000 instanceof ParseException) {
            {if (true) throw (ParseException)jjte000;}
          }
          if (jjte000 instanceof jsdai.lang.SdaiException) {
            {if (true) throw (jsdai.lang.SdaiException)jjte000;}
          }
          {if (true) throw (Error)jjte000;}
    } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
            jjtreeCloseNodeScope(jjtn000);
          }
    }
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.317------------ */
  static final public int Width5() throws ParseException, jsdai.lang.SdaiException {
        int value;
    value = NumericExpression5();
                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

/* ------------------------------------------------------------------------------------ ISO 10303-11:A.2.318------------ */
  static final public int WidthSpec5() throws ParseException, jsdai.lang.SdaiException {
        int wide;
        boolean is_fixed = false;
    jj_consume_token(LPAREN);
    wide = Width5();
    jj_consume_token(RPAREN);
    switch (jj_nt.kind) {
    case FIXED:
      jj_consume_token(FIXED);
                                          is_fixed = true;
      break;
    default:
      jj_la1[480] = jj_gen;
      ;
    }
                if (parser_pass == 5) {
                        if (wide > 0) {
                                if (is_fixed) {
                                        wide = -wide;
                                }
                        }

                }
                {if (true) return wide;}
    throw new Error("Missing return statement in function");
  }

  static Object findInNestedScope(String name) throws ParseException {
                Object scope_object = null;
                // first search in the current scope, then go through the outer scopes.
                for (int i = 0; i < current_scope.size(); i++) {
                        scope_object = current_scope.elementAt(i);
                        // get it's name, after the change in the schema, it may be named_object, simple implementation.
                        String current_name = null; // not finished to implement.
                        if (name.equalsIgnoreCase(current_name)) {
                                return scope_object;
                        }
                }
                // go down through the stack of scopes and check each scope as well.
                // not needed, because we decided not to support nested declarations, do not happen in real life, there are some unclear things about them.
                return scope_object;
  }

  static jsdai.SExtended_dictionary_schema.EEntity_or_view_definition findEntity_or_view_definition(String entity_or_view_name, String generic_schema_name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia;
                jsdai.lang.SdaiIterator iter_inst;
                String instance_name;
                 // the generic_schema_name parameter is optional
                 // if present, the model of that schema is found and a local entity or view definition matching the name is searched for in that model
                 // if absent,  the current model is searched for local or interfaced entity or view definition matching that name.
                if (generic_schema_name != null) {
                        jsdai.lang.SdaiModel  the_model = findModel(generic_schema_name);
                        if (the_model == null) return null;
                        if(the_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                                the_model.startReadOnlyAccess();
                        }
                        ia = the_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EEntity_or_view_definition.class);
                        iter_inst = ia.createIterator();
                        while (iter_inst.next()) {
                                jsdai.SExtended_dictionary_schema.EEntity_or_view_definition def = (jsdai.SExtended_dictionary_schema.EEntity_or_view_definition)ia.getCurrentMemberObject(iter_inst);
                                instance_name = def.getName(null);
                                if (instance_name.equalsIgnoreCase(entity_or_view_name)) { // found! return it
                                        return def;
                                }
                        }
                        return null;
                } else {

                        ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EData_type_declaration.class);
                        iter_inst = ia.createIterator();
                        while (iter_inst.next()) {
                                jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                                if ((dec instanceof jsdai.SExtended_dictionary_schema.EEntity_declaration) || (dec instanceof jsdai.SExtended_dictionary_schema.EView_declaration)) {
                                        jsdai.SExtended_dictionary_schema.EEntity_or_view_definition inst = (jsdai.SExtended_dictionary_schema.EEntity_or_view_definition)dec.getDefinition(null);
                                        instance_name = inst.getName(null);
                                        if (instance_name.equalsIgnoreCase(entity_or_view_name)) { // found! return it
                                                return inst;
                                        } else
                                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                                        if (instance_name.equalsIgnoreCase(entity_or_view_name)) { // found! return it
                                                                return (jsdai.SExtended_dictionary_schema.EEntity_or_view_definition)dec.getDefinition(null);
                                                        }
                                                }
                                        }
                                }
                        }
                        return null;
                }
  }

  static jsdai.SExtended_dictionary_schema.EEntity_definition findEntityReference(String entity_name, String schema_name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia;
                jsdai.lang.SdaiIterator iter_inst;
                String instance_name;
                if (schema_name != null) {
                        jsdai.lang.SdaiModel  the_model = findModel(schema_name);
                        if (the_model == null) return null;
                        if(the_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                                the_model.startReadOnlyAccess();
                        }

                        ia = the_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EEntity_definition.class);
                        iter_inst = ia.createIterator();
                        while (iter_inst.next()) {
                                jsdai.SExtended_dictionary_schema.EEntity_definition def = (jsdai.SExtended_dictionary_schema.EEntity_definition)ia.getCurrentMemberObject(iter_inst);
                                instance_name = def.getName(null);
                                if (instance_name.equalsIgnoreCase(entity_name)) { // found! return it
                                        return def;
                                }
                        }
                        return null;
                } else {

                        ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EEntity_declaration.class);
                        iter_inst = ia.createIterator();
                        while (iter_inst.next()) {
                                jsdai.SExtended_dictionary_schema.EEntity_declaration dec = (jsdai.SExtended_dictionary_schema.EEntity_declaration)ia.getCurrentMemberObject(iter_inst);
                                if ((dec instanceof jsdai.SExtended_dictionary_schema.EEntity_declaration) || (dec instanceof jsdai.SExtended_dictionary_schema.EView_declaration)) {
                                        jsdai.SExtended_dictionary_schema.EEntity_definition inst = (jsdai.SExtended_dictionary_schema.EEntity_definition)dec.getDefinition(null);
                                        instance_name = inst.getName(null);
                                        if (instance_name.equalsIgnoreCase(entity_name)) { // found! return it
                                                return inst;
                                        } else
                                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                                        if (instance_name.equalsIgnoreCase(entity_name)) { // found! return it
                                                                return (jsdai.SExtended_dictionary_schema.EEntity_definition)dec.getDefinition(null);
                                                        }
                                                }
                                        }
                                }
                        }
                        return null;
                }
  }

  static jsdai.SExtended_dictionary_schema.EView_definition findView_definition(String name, jsdai.SExtended_dictionary_schema.ESchema_definition optional_schema) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EView_declaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.SExtended_dictionary_schema.EView_definition inst = (jsdai.SExtended_dictionary_schema.EView_definition)dec.getDefinition(null);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        } else
                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                                return (jsdai.SExtended_dictionary_schema.EView_definition)dec.getDefinition(null);
                                        }
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EEntity_definition findInterfacedEntity_definition(jsdai.lang.SdaiModel interfaced_model, String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.SExtended_dictionary_schema.EEntity_definition edf = null;
                HashMap hm = (HashMap)hm_entity_declarations.get(interfaced_model);
                if (hm != null) {
                        jsdai.SExtended_dictionary_schema.EEntity_declaration edc = (jsdai.SExtended_dictionary_schema.EEntity_declaration)hm.get(name.toLowerCase());
                        if (edc != null) {
                                edf = (jsdai.SExtended_dictionary_schema.EEntity_definition)edc.getDefinition(null);
                        }
                }
                return edf;
  }

  static jsdai.SExtended_dictionary_schema.EDefined_type findInterfacedDefined_type(jsdai.lang.SdaiModel interfaced_model, String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
                HashMap hm = (HashMap)hm_type_declarations.get(interfaced_model);
                if (hm != null) {
                        jsdai.SExtended_dictionary_schema.EType_declaration td = (jsdai.SExtended_dictionary_schema.EType_declaration)hm.get(name.toLowerCase());
                        if (td != null) {
                                dt = (jsdai.SExtended_dictionary_schema.EDefined_type)td.getDefinition(null);
                        }
                        }
                return dt;
  }

  static jsdai.SExtended_dictionary_schema.EEntity_definition findInterfacedEntity_definition_not_optimal(jsdai.lang.SdaiModel interfaced_model, String name) throws ParseException, jsdai.lang.SdaiException {
// System.out.println("interfaced model: " + interfaced_model + ", name: " + name);

                jsdai.lang.Aggregate ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EEntity_definition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EEntity_definition inst = (jsdai.SExtended_dictionary_schema.EEntity_definition)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
// System.out.println("current name: " + instance_name);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EDefined_type findDefined_type(String name) throws ParseException, jsdai.lang.SdaiException {
// System.out.println("<findDefined_type>: " + name);
                jsdai.SExtended_dictionary_schema.EDefined_type dt = null;
                if (hm_current_type_declarations != null) {
                        jsdai.SExtended_dictionary_schema.EType_declaration td = (jsdai.SExtended_dictionary_schema.EType_declaration)hm_current_type_declarations.get(name.toLowerCase());
                        if (td !=       null) {
// System.out.println("<findDefined_type-2>: " + td + ", name: " + name.toLowerCase());
                                dt = (jsdai.SExtended_dictionary_schema.EDefined_type)td.getDefinition(null);
// System.out.println("<findDefined_type-3>");
                        } else {
// System.out.println("<findDefined_type-4>");
                                dt = findDefined_type_non_optimal(name);
// System.out.println("<findDefined_type-5>");
                        }
                } else {
// System.out.println("<findDefined_type-6>");
                        return findDefined_type_non_optimal(name);
                }
                return dt;
  }

  static jsdai.SExtended_dictionary_schema.EDefined_type findDefined_type_non_optimal(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EType_declaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
//                      jsdai.SExtended_dictionary_schema.EDefined_type inst = (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)null);
                        jsdai.SExtended_dictionary_schema.EDefined_type inst = (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        } else
                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
//                                              return (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)null);
                                                return (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null);
                                        }
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EConstant_definition findConstant(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EConstant_declaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
//                      jsdai.SExtended_dictionary_schema.EDefined_type inst = (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)null);
                        jsdai.SExtended_dictionary_schema.EConstant_definition inst = (jsdai.SExtended_dictionary_schema.EConstant_definition)dec.getDefinition(null);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        } else
                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
//                                              return (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)null);
                                                return (jsdai.SExtended_dictionary_schema.EConstant_definition)dec.getDefinition(null);
                                        }
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EFunction_definition findFunction_needed_or_not(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EFunction_declaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
//                      jsdai.SExtended_dictionary_schema.EDefined_type inst = (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)null);
                        jsdai.SExtended_dictionary_schema.EFunction_definition inst = (jsdai.SExtended_dictionary_schema.EFunction_definition)dec.getDefinition(null);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        } else
                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
//                                              return (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)null);
                                                return (jsdai.SExtended_dictionary_schema.EFunction_definition)dec.getDefinition(null);
                                        }
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EProcedure_definition findProcedure(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EProcedure_declaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
//                      jsdai.SExtended_dictionary_schema.EDefined_type inst = (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)null);
                        jsdai.SExtended_dictionary_schema.EProcedure_definition inst = (jsdai.SExtended_dictionary_schema.EProcedure_definition)dec.getDefinition(null);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        } else
                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
//                                              return (jsdai.SExtended_dictionary_schema.EDefined_type)dec.getDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)null);
                                                return (jsdai.SExtended_dictionary_schema.EProcedure_definition)dec.getDefinition(null);
                                        }
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EDefined_type findInterfacedDefined_type_non_optimal(jsdai.lang.SdaiModel interfaced_model, String name) throws ParseException, jsdai.lang.SdaiException {
                if (interfaced_model == null) {
                        return null;
                }
                jsdai.lang.Aggregate ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDefined_type.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDefined_type inst = (jsdai.SExtended_dictionary_schema.EDefined_type)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EConstant_definition findInterfacedConstant(jsdai.lang.SdaiModel interfaced_model, String name) throws ParseException, jsdai.lang.SdaiException {
                if (interfaced_model == null) {
                        return null;
                }
                jsdai.lang.Aggregate ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EConstant_definition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EConstant_definition inst = (jsdai.SExtended_dictionary_schema.EConstant_definition)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EFunction_definition findInterfacedFunction(jsdai.lang.SdaiModel interfaced_model, String name) throws ParseException, jsdai.lang.SdaiException {
                if (interfaced_model == null) {
                        return null;
                }
                jsdai.lang.Aggregate ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EFunction_definition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EFunction_definition inst = (jsdai.SExtended_dictionary_schema.EFunction_definition)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EProcedure_definition findInterfacedProcedure(jsdai.lang.SdaiModel interfaced_model, String name) throws ParseException, jsdai.lang.SdaiException {
                if (interfaced_model == null) {
                        return null;
                }
                jsdai.lang.Aggregate ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EProcedure_definition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EProcedure_definition inst = (jsdai.SExtended_dictionary_schema.EProcedure_definition)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EGlobal_rule findInterfacedRule(jsdai.lang.SdaiModel interfaced_model, String name) throws ParseException, jsdai.lang.SdaiException {
                if (interfaced_model == null) {
                        return null;
                }
                jsdai.lang.Aggregate ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EGlobal_rule.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EGlobal_rule inst = (jsdai.SExtended_dictionary_schema.EGlobal_rule)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.ENamed_type findNamed_type(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.SExtended_dictionary_schema.ENamed_type nt1, nt2;
                nt1 = findDefined_type(name);
                nt2 = findEntity_definition(name, null);
                if (nt1 != null) {
                        if (nt2 != null) {
                                // If this method is called in the first compiler pass, it is likely to report the same error twice, depends on the implementation.
                                // It should not go into this branch if invoked in the 2nd parser pass, the error should be caught in the 1st pass by other checks.
                                error_count++;
//				if (parser_pass == 1) {
//					printError("Duplicate name, both an entity and a defined type have this name: " + name);
                                        printErrorMsg("" + name + " - duplicate name, both an entity and a defined type have this name", null, true);
//				}
                                printDebug("Duplicate name, both an entity and a defined type have this name: " + name);
                        } else {
                                return nt1;
                        }
                }
if (nt2 == null) {
//	printError("Named type " + name + " not found ");
//	printErrorMsg("" + name + " - named type not found", null, true);
}
                return nt2;
  }

  static String findAnyName(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia;
                jsdai.lang.SdaiIterator iter_inst;
                ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDefined_type.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDefined_type inst = (jsdai.SExtended_dictionary_schema.EDefined_type)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return "a defined type";
                        }
                }
                ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EEntity_definition.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EEntity_definition inst = (jsdai.SExtended_dictionary_schema.EEntity_definition)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return "an entity";
                        }
                }
                return null;
  }

  static boolean isEnumerationElementNotUnique(jsdai.lang.A_string elements, String element) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.SdaiIterator iter = elements.createIterator();
                while (iter.next()) {
                        String current = elements.getCurrentMember(iter);
                        if (current.equalsIgnoreCase(element))
                                return true;
                }
                return false;
  }

  static jsdai.SExtended_dictionary_schema.EView_attribute findView_attribute(String attr_name, jsdai.SExtended_dictionary_schema.EIndependent_view_definition vd) throws ParseException, jsdai.lang.SdaiException {
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EAttribute findAttribute_needed_or_not(String attribute_name, jsdai.SExtended_dictionary_schema.EEntity_definition ed, int attr_type) throws ParseException, jsdai.lang.SdaiException {
        String attr_key = null;
// System.out.println("XXX 01-02, in findAttribute");

                if (ed == null) {
                        printDDebug("XC: In findAttribute, parameter ed = null, attribute name: " + attribute_name + ", type: " + attr_type + ", pass: " + parser_pass);
                        return null;
                }
        jsdai.lang.SdaiModel mdl = ed.findEntityInstanceSdaiModel();
//              jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EAttribute.class);
                jsdai.lang.Aggregate ia = mdl.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EAttribute.class);
// printDDebug("##### in findAttribute - attribute number: " + ia.getMemberCount() + ", attribute_name: " + attribute_name + ", entity name: " + ed.getName(null) );
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EAttribute inst = (jsdai.SExtended_dictionary_schema.EAttribute)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
// printDDebug("##### in findAttribute - current name: " + instance_name);
// System.out.println("##### in findAttribute: " + attribute_name + " - current name: " + instance_name);
                        if (instance_name.equalsIgnoreCase(attribute_name)) {
// pre-X 				jsdai.SExtended_dictionary_schema.EEntity_definition ed2 = inst.getParent_entity(null);
                                // only Express
                        jsdai.SExtended_dictionary_schema.EEntity_definition ed2 = (jsdai.SExtended_dictionary_schema.EEntity_definition)inst.getParent_entity(null);
// System.out.println("##### in findAttribute: ed: " + ed + ", ed2: " + ed2);
                                if (ed2 == ed) {
                                        return (jsdai.SExtended_dictionary_schema.EAttribute)inst;
                                }
                        }
                }
// pre-X		jsdai.SExtended_dictionary_schema.AEntity_definition aed = ed.getSupertypes(null);
//		jsdai.SExtended_dictionary_schema.AEntity_or_view_definition aed = ed.getSupertypes(null);
                jsdai.SExtended_dictionary_schema.AEntity_or_view_definition aed = ed.getGeneric_supertypes(null);
// printDDebug("##### in findAttribute - supertype number: " + aed.getMemberCount() + ", attribute_name: " + attribute_name + ", entity name: " + ed.getName(null) );
                jsdai.lang.SdaiIterator iter_super = aed.createIterator();
                while (iter_super.next()) {
                        jsdai.SExtended_dictionary_schema.EEntity_definition ed1 = (jsdai.SExtended_dictionary_schema.EEntity_definition)aed.getCurrentMemberObject(iter_super);
                        jsdai.SExtended_dictionary_schema.EAttribute at = findAttribute(attribute_name, ed1, attr_type, ed, attr_key);
      if (at != null) return at;
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EAttribute findAttributeAnywhere(String attribute_name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EAttribute.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EAttribute inst = (jsdai.SExtended_dictionary_schema.EAttribute)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(attribute_name)) {
                                return (jsdai.SExtended_dictionary_schema.EAttribute)inst;
                        }
                }
                // above implementation searches the current model only, if not found I should look in all models, I suppose, to be added below
                return null;
  }

  static jsdai.lang.SdaiModel findReferencedModel(jsdai.SExtended_dictionary_schema.EGeneric_schema_definition ref_schema) throws ParseException, jsdai.lang.SdaiException {
          // temporary implementation
          if (ref_schema == null) return null;
          String schema_name = ref_schema.getName(null);
          String name_searched = schema_name.toUpperCase() + "_DICTIONARY_DATA";
          jsdai.lang.ASdaiModel models  = repository.getModels();
                jsdai.lang.SdaiIterator iter_models = models.createIterator();
                while (iter_models.next()) {
                        jsdai.lang.SdaiModel sm1 = models.getCurrentMember(iter_models);
                        String model_name = sm1.getName();
// printDDebug("findModel - searching: " + name_searched + ", current: " + model_name + ", nr of models: " + models.getMemberCount());
                        if (model_name.equalsIgnoreCase(name_searched)) {

// !!!!!!!!!!!!!!! not sure why it is needed (for expres x?) but it causes problems for incremental compilation
//				int smMode = sm1.getMode();
//				if(smMode == jsdai.lang.SdaiModel.NO_ACCESS) {
//					sm1.startReadWriteAccess();
//				} else if(smMode == jsdai.lang.SdaiModel.READ_ONLY) {
//					sm1.promoteSdaiModelToRW();
//				}
                                return sm1;
                        }
                }
                return null;
  }

  static jsdai.lang.SdaiModel findModel(String schema_name) throws ParseException, jsdai.lang.SdaiException {
// System.out.println("in findModel - schema name: " + schema_name);  
          String name_searched = schema_name.toUpperCase() + "_DICTIONARY_DATA";
          jsdai.lang.ASdaiModel models  = repository.getModels();
                jsdai.lang.SdaiIterator iter_models = models.createIterator();
                while (iter_models.next()) {
                        jsdai.lang.SdaiModel sm1 = models.getCurrentMember(iter_models);
                        String model_name = sm1.getName();
// System.out.println("in findModel - current: " + model_name);  

 printDDebug("findModel - searching: " + name_searched + ", current: " + model_name + ", nr of models: " + models.getMemberCount());
                        if (model_name.equalsIgnoreCase(name_searched)) {
                                return sm1;
                        }
                }
                return null;
  }

  static void listModels() throws ParseException, jsdai.lang.SdaiException {
//        String name_searched = schema_name.toUpperCase() + "_DICTIONARY_DATA";
          jsdai.lang.ASdaiModel models  = repository.getModels();
                jsdai.lang.SdaiIterator iter_models = models.createIterator();
//  System.out.println("-------- All models:--------------");
                while (iter_models.next()) {
                        jsdai.lang.SdaiModel sm1 = models.getCurrentMember(iter_models);
                        String model_name = sm1.getName();
// System.out.println("Model: " + model_name + ", nr of models: " + models.getMemberCount());
                }
  }

  static jsdai.SExtended_dictionary_schema.ESchema_definition findSchema_definition(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.ESchema_definition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.ESchema_definition inst = (jsdai.SExtended_dictionary_schema.ESchema_definition)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EGeneric_schema_definition findGeneric_schema_definition(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.SdaiModel  a_model = findModel(name);

                if (a_model == null) return null;
                if(a_model.getMode() == jsdai.lang.SdaiModel.NO_ACCESS) {
                        a_model.startReadOnlyAccess();
                }

                jsdai.lang.Aggregate ia = a_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EGeneric_schema_definition.class);
                printDebug("findGeneric_schema_definition count: " + ia.getMemberCount() + ", name: " + name);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EGeneric_schema_definition inst = (jsdai.SExtended_dictionary_schema.EGeneric_schema_definition)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
printDDebug("findInterpretedId2 - in loop - current name: " + instance_name);

                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static void createAllUsedDeclarations(jsdai.lang.SdaiModel interfaced_model) throws ParseException, jsdai.lang.SdaiException {
                jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
//              jsdai.SExtended_dictionary_schema.EEntity_declaration$used_declaration edc = null;
//              jsdai.SExtended_dictionary_schema.EType_declaration$used_declaration tdc = null;
                jsdai.lang.Aggregate ia;
                jsdai.lang.SdaiIterator iter_inst;
                ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EEntity_definition.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EEntity_definition ed_inst = (jsdai.SExtended_dictionary_schema.EEntity_definition)ia.getCurrentMemberObject(iter_inst);
                        // create declaration and set its attributes here
//        edc = checkEntityUsedDeclaration(ed_inst);
//        if (edc == null) {
                                if (neededEntityUsedDeclaration(ed_inst)) {
                                        dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$used_declaration.class);
                                        dc.setParent(null, sd);
                                        // parent_schema is now derived instead of explicit 
                                        // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                                // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                        // }
                                        dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)ed_inst);
                                        if (!(hm_current_entity_declarations.containsKey(ed_inst.getName(null).toLowerCase()))) {
                                                hm_current_entity_declarations.put(ed_inst.getName(null).toLowerCase(), dc);
                                        }
                                        Object t_object = ed_inst.getTemp();
                                        if (t_object == null) {
                                                ed_inst.setTemp(FLAG_USED);
                                        } else {
                                                if (t_object instanceof ECtRenamed) {
                                                        if (((ECtRenamed)t_object).interfaced_flag == null) {
                                                                ((ECtRenamed)t_object).interfaced_flag = FLAG_USED;
                                                        } else {
                                                                // already set
                                                        }
                                                } else
                                                if (t_object instanceof Integer) {
                                                        // already set
                                                } else {
                                                        System.out.println("<ExpressCompiler> INTERNAL ERROR - createAllUsedDeclarations - temp_object: " + t_object + ", entity: " + ed_inst);
                                                }
                                        }

                                }
                }
                ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDefined_type.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDefined_type dt_inst = (jsdai.SExtended_dictionary_schema.EDefined_type)ia.getCurrentMemberObject(iter_inst);
                        // create declaration and set its attributes here
//    tdc = checkTypeUsedDeclaration(dt_inst);
//    if (tdc == null) {
                        if (neededTypeUsedDeclaration(dt_inst)) {
                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CType_declaration$used_declaration.class);
                                dc.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                 // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)dt_inst);
                                if (!(hm_current_type_declarations.containsKey(dt_inst.getName(null).toLowerCase()))) {
                                        hm_current_type_declarations.put(dt_inst.getName(null).toLowerCase(), dc);
                                }
                                dt_inst.setTemp(FLAG_USED);
                        }
                }
  }

  static void createAllReferencedDeclarations(jsdai.lang.SdaiModel interfaced_model) throws ParseException, jsdai.lang.SdaiException {
                jsdai.SExtended_dictionary_schema.EDeclaration dc = null;
//              jsdai.SExtended_dictionary_schema.EEntity_declaration$referenced_declaration edc = null;
//              jsdai.SExtended_dictionary_schema.EReferenced_declaration$type_declaration tdc = null;
                jsdai.lang.Aggregate ia;
                jsdai.lang.SdaiIterator iter_inst;
                ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EEntity_definition.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EEntity_definition ed_inst = (jsdai.SExtended_dictionary_schema.EEntity_definition)ia.getCurrentMemberObject(iter_inst);
                        // create declaration and set its attributes here
//                      edc = checkEntityReferencedDeclaration(ed_inst);
//                      if (edc == null) {
                        if (neededEntityReferencedDeclaration(ed_inst)) {
                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CEntity_declaration$referenced_declaration.class);
                                dc.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                          // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)ed_inst);
                                if (!(hm_current_entity_declarations.containsKey(ed_inst.getName(null).toLowerCase()))) {
                                        hm_current_entity_declarations.put(ed_inst.getName(null).toLowerCase(), dc);
                                }
                                Object t_object = ed_inst.getTemp();
                                if (t_object == null) {
                                        ed_inst.setTemp(FLAG_REFERENCED);
                                } else {
                                        if (t_object instanceof ECtRenamed) {
                                                if (((ECtRenamed)t_object).interfaced_flag == null) {
                                                        ((ECtRenamed)t_object).interfaced_flag = FLAG_REFERENCED;
                                                } else {
                                                        // already set
                                                }
                                        } else
                                        if (t_object instanceof Integer) {
                                                // already set					
                                        } else {
                                                System.out.println("<ExpressCompiler> INTERNAL ERROR - createAllReferencedDeclarations - temp_object: " + t_object + ", entity: " + ed_inst);
                                        }
                                }
                        }
                }
                ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDefined_type.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDefined_type dt_inst = (jsdai.SExtended_dictionary_schema.EDefined_type)ia.getCurrentMemberObject(iter_inst);
                        // create declaration and set its attributes here
//                      tdc = checkTypeReferencedDeclaration(dt_inst);
//                      if (tdc == null) {
                        if (neededTypeReferencedDeclaration(dt_inst)) {
                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CReferenced_declaration$type_declaration.class);
                                dc.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.ENamed_type)dt_inst);
                                if (!(hm_current_type_declarations.containsKey(dt_inst.getName(null).toLowerCase()))) {
                                        hm_current_type_declarations.put(dt_inst.getName(null).toLowerCase(), dc);
                                }
                                dt_inst.setTemp(FLAG_REFERENCED);
                        }
                }
                ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EConstant_definition.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EConstant_definition cd_inst = (jsdai.SExtended_dictionary_schema.EConstant_definition)ia.getCurrentMemberObject(iter_inst);
                        // create declaration and set its attributes here
//                      tdc = checkTypeReferencedDeclaration(dt_inst);
//                      if (tdc == null) {
                        if (neededConstantReferencedDeclaration(cd_inst)) {
                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CConstant_declaration$referenced_declaration.class);
                                dc.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EConstant_definition)cd_inst);
                                cd_inst.setTemp(FLAG_REFERENCED);
                                if (!(hm_current_constant_declarations.containsKey(cd_inst.getName(null).toLowerCase()))) {
                                        hm_current_constant_declarations.put(cd_inst.getName(null).toLowerCase(), dc);
                                }
                        }
                }
                ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EFunction_definition.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EFunction_definition fd_inst = (jsdai.SExtended_dictionary_schema.EFunction_definition)ia.getCurrentMemberObject(iter_inst);
                        // create declaration and set its attributes here
//                      tdc = checkTypeReferencedDeclaration(dt_inst);
//                      if (tdc == null) {
                        if (neededFunctionReferencedDeclaration(fd_inst)) {
                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CFunction_declaration$referenced_declaration.class);
                                dc.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EFunction_definition)fd_inst);
                                if (!(hm_current_function_declarations.containsKey(fd_inst.getName(null).toLowerCase()))) {
                                        hm_current_function_declarations.put(fd_inst.getName(null).toLowerCase(), dc);
                                }
                                fd_inst.setTemp(FLAG_REFERENCED);
                        }
                }
                ia = interfaced_model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EProcedure_definition.class);
                iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EProcedure_definition pd_inst = (jsdai.SExtended_dictionary_schema.EProcedure_definition)ia.getCurrentMemberObject(iter_inst);
                        // create declaration and set its attributes here
//                      tdc = checkTypeReferencedDeclaration(dt_inst);
//                      if (tdc == null) {
                        if (neededProcedureReferencedDeclaration(pd_inst)) {
                                dc = (jsdai.SExtended_dictionary_schema.EDeclaration)model.createEntityInstance(jsdai.SExtended_dictionary_schema.CProcedure_declaration$referenced_declaration.class);
                                dc.setParent(null, sd);
                                // parent_schema is now derived instead of explicit 
                                // if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                        // dc.setParent_schema(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)sd);
                                // }
                                dc.setDefinition(null, (jsdai.SExtended_dictionary_schema.EProcedure_definition)pd_inst);
                                if (!(hm_current_procedure_declarations.containsKey(pd_inst.getName(null).toLowerCase()))) {
                                        hm_current_procedure_declarations.put(pd_inst.getName(null).toLowerCase(), dc);
                                }
                                pd_inst.setTemp(FLAG_REFERENCED);
                        }
                }
  }

  static String getDescription(Token t, int pass) throws ParseException, jsdai.lang.SdaiException {
                Token st = null;
                String str = null;
                if (t != null) {
                        st = t.specialToken;
                } else {
                        // should not happen?
                }
                if (parser_pass == pass) {
                        if (st != null) {
                                if (st.kind == DOCUMENT_COMMENT) {
                                        str = st.image.substring(3, st.image.length()-2);
                                }
                        }
                }
//              t = null;
                return str;
  }

//	void createExpressEntity(jsdai.lang.EEntity target, String express_code) throws jsdai.lang.SdaiException {
  static void createExpressEntity(jsdai.lang.EEntity target, String express_code, Token start_token, Token end_token) throws ParseException, jsdai.lang.SdaiException {
//System.out.println("========== target: " + target);		
//System.out.println("tokenized: " + express_code);		
//System.out.println("original : " + getOriginalExpressionString(start_token, end_token));		
//		String description = express_code;

                        String description = null;

                if (flag_original_expressions) {
                        description = getOriginalExpressionString(start_token, end_token);
                } else {
                        description = express_code;
                }

                if (description != null) {
                        jsdai.lang.SdaiModel sm = getExpressModel(); // finds or creates if not yet exists (or maybe better to create together with the main model always?
      jsdai.SExtended_dictionary_schema.EExpress_code ec = (jsdai.SExtended_dictionary_schema.EExpress_code)sm.createEntityInstance(jsdai.SExtended_dictionary_schema.CExpress_code.class);
                        // jsdai.SExtended_dictionary_schema.EDocumentation ec = (jsdai.SExtended_dictionary_schema.EDocumentation)sm.createEntityInstance(jsdai.SExtended_dictionary_schema.CDocumentation.class);

                        // New dictionary
                        jsdai.lang.A_string values = ec.createValues(null);
                        values.addByIndex(1, description);

                        // Old dictionary
                        // doc.setDescription(null, description);

                        // All this for jsdai 1.1, for jsdai 1.2 just one set method
                        if (target instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.EConstant_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.ENamed_type)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)target);
// System.out.println("Derived Attribute target:" + ((jsdai.SExtended_dictionary_schema.EDerived_attribute)target).getName(null));
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.EAttribute)target);
// System.out.println("Attribute target:" + ((jsdai.SExtended_dictionary_schema.EAttribute)target).getName(null));
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.EFunction_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EProcedure_definition) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.EProcedure_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.EGlobal_rule)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EWhere_rule) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.EWhere_rule)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound) {
                                ec.setTarget(null, (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)target);
                        }
                }
  }

  static void createDocumentationEntity(jsdai.lang.EEntity target) throws ParseException, jsdai.lang.SdaiException {
                String description = getDescription(doc_token, 1);
                if (description != null) {
                        jsdai.lang.SdaiModel sm = getDocModel(); // finds or creates if not yet exists (or maybe better to create together with the main model always?
                        jsdai.SExtended_dictionary_schema.EDocumentation doc = (jsdai.SExtended_dictionary_schema.EDocumentation)sm.createEntityInstance(jsdai.SExtended_dictionary_schema.CDocumentation.class);

                        // New dictionary
                        jsdai.lang.A_string values = doc.createValues(null);
                        values.addByIndex(1, description);

                        // Old dictionary
                        // doc.setDescription(null, description);

                        // All this for jsdai 1.1, for jsdai 1.2 just one set method
                        if (target instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EConstant_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.ENamed_type)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)target);
// printDDebug("Derived Attribute target:" + ((jsdai.SExtended_dictionary_schema.EDerived_attribute)target).getName(null));
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EAttribute)target);
// printDDebug("Attribute target:" + ((jsdai.SExtended_dictionary_schema.EAttribute)target).getName(null));
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EFunction_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EProcedure_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EProcedure_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EGlobal_rule)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EWhere_rule) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EWhere_rule)target);
                        }
                }
  }

  static void createDocumentationEntity2(jsdai.lang.EEntity target, Token a_token) throws ParseException, jsdai.lang.SdaiException {
                if (parser_pass != 1) return;
                String description = getDescription(a_token, 1);
                if (description != null) {
                        jsdai.lang.SdaiModel sm = getDocModel(); // finds or creates if not yet exists (or maybe better to create together with the main model always?
                        jsdai.SExtended_dictionary_schema.EDocumentation doc = (jsdai.SExtended_dictionary_schema.EDocumentation)sm.createEntityInstance(jsdai.SExtended_dictionary_schema.CDocumentation.class);

                        // New dictionary
                        jsdai.lang.A_string values = doc.createValues(null);
                        values.addByIndex(1, description);

                        // Old dictionary
                        // doc.setDescription(null, description);

                        // All this for jsdai 1.1, for jsdai 1.2 just one set method
                        if (target instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EConstant_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.ENamed_type)target);
                        } else
//                      if (target instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
//                              doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)target);
//printDDebug("Derived Attribute target:" + ((jsdai.SExtended_dictionary_schema.EDerived_attribute)target).getName(null));
//                      } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EAttribute)target);
// printDDebug("Attribute target:" + ((jsdai.SExtended_dictionary_schema.EAttribute)target).getName(null));
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EFunction_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EProcedure_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EProcedure_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EGlobal_rule)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EWhere_rule) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EWhere_rule)target);
                        }
                }
  }

  static void createDocumentationEntity3(jsdai.lang.EEntity target, Token a_token) throws ParseException, jsdai.lang.SdaiException {
                if (parser_pass != 4) return;
                String description = getDescription(a_token, 4);
// System.out.println("DOC 1");

                if (description != null) {
// System.out.println("DOC 2");
                        jsdai.lang.SdaiModel sm = getDocModel(); // finds or creates if not yet exists (or maybe better to create together with the main model always?
                        jsdai.SExtended_dictionary_schema.EDocumentation doc = (jsdai.SExtended_dictionary_schema.EDocumentation)sm.createEntityInstance(jsdai.SExtended_dictionary_schema.CDocumentation.class);

                        // New dictionary
                        jsdai.lang.A_string values = doc.createValues(null);
                        values.addByIndex(1, description);

                        // Old dictionary
                        // doc.setDescription(null, description);

                        // All this for jsdai 1.1, for jsdai 1.2 just one set method
                        if (target instanceof jsdai.SExtended_dictionary_schema.ESchema_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.ESchema_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EConstant_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.ENamed_type)target);
                        } else
//                      if (target instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
//                              doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EDerived_attribute)target);
//printDDebug("Derived Attribute target:" + ((jsdai.SExtended_dictionary_schema.EDerived_attribute)target).getName(null));
//                      } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EAttribute) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EAttribute)target);
// printDDebug("Attribute target:" + ((jsdai.SExtended_dictionary_schema.EAttribute)target).getName(null));
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EFunction_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EProcedure_definition) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EProcedure_definition)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EGlobal_rule)target);
                        } else
                        if (target instanceof jsdai.SExtended_dictionary_schema.EWhere_rule) {
                                doc.setTarget(null, (jsdai.SExtended_dictionary_schema.EWhere_rule)target);
                        }
                }
  }

  static jsdai.lang.SdaiModel getDocModel() throws ParseException, jsdai.lang.SdaiException {
          String name_searched = "_DOCUMENTATION_" + sd.getName(null).toUpperCase();
          jsdai.lang.ASdaiModel models  = repository.getModels();
                jsdai.lang.SdaiIterator iter_models = models.createIterator();
                while (iter_models.next()) {
                        jsdai.lang.SdaiModel sm1 = models.getCurrentMember(iter_models);
                        String model_name = sm1.getName();
// printDDebug("findModel - searching: " + name_searched + ", current: " + model_name + ", nr of models: " + models.getMemberCount());
                        if (model_name.equalsIgnoreCase(name_searched)) {
                                return sm1;
                        }
                }
                // model not found, create
// listModels();
// System.out.println("Creating model: : " + name_searched);

                model_doc = repository.createSdaiModel(name_searched, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                model_doc.startReadWriteAccess();
                return model_doc;
  }

  static jsdai.lang.SdaiModel getExpressModel() throws ParseException, jsdai.lang.SdaiException {
          String name_searched = "_EXPRESS_" + sd.getName(null).toUpperCase();
          jsdai.lang.ASdaiModel models  = repository.getModels();
                jsdai.lang.SdaiIterator iter_models = models.createIterator();
                while (iter_models.next()) {
                        jsdai.lang.SdaiModel sm1 = models.getCurrentMember(iter_models);
                        String model_name = sm1.getName();
// System.out.println("findModel - searching: " + name_searched + ", current: " + model_name + ", nr of models: " + models.getMemberCount());
                        if (model_name.equalsIgnoreCase(name_searched)) {
                                return sm1;
                        }
                }
                // model not found, create
// listModels();
// System.out.println("Creating model: : " + name_searched);

                model_express = repository.createSdaiModel(name_searched, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                model_express.startReadWriteAccess();
                return model_express;
  }

  static jsdai.lang.SdaiModel getJavaModel() throws ParseException, jsdai.lang.SdaiException {
          String name_searched = "_JAVA_" + sd.getName(null).toUpperCase();
          jsdai.lang.ASdaiModel models  = repository.getModels();
                jsdai.lang.SdaiIterator iter_models = models.createIterator();
                while (iter_models.next()) {
                        jsdai.lang.SdaiModel sm1 = models.getCurrentMember(iter_models);
                        String model_name = sm1.getName();
// System.out.println("findModel - searching: " + name_searched + ", current: " + model_name + ", nr of models: " + models.getMemberCount());
                        if (model_name.equalsIgnoreCase(name_searched)) {
                                return sm1;
                        }
                }
                // model not found, create
// listModels();
// System.out.println("Creating model: : " + name_searched);

                model_java = repository.createSdaiModel(name_searched, jsdai.SExtended_dictionary_schema.SExtended_dictionary_schema.class);
                model_java.startReadWriteAccess();
                return model_java;
  }

//      jsdai.SExtended_dictionary_schema.EEntity_declaration$referenced_declaration checkEntityReferencedDeclaration(jsdai.SExtended_dictionary_schema.EEntity_definition ed) {
  static jsdai.SExtended_dictionary_schema.EDeclaration checkEntityReferencedDeclaration(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
                return null;
  }

//      jsdai.SExtended_dictionary_schema.EReferenced_declaration$type_declaration checkTypeReferencedDeclaration(jsdai.SExtended_dictionary_schema.EDefined_type dt) {
  static jsdai.SExtended_dictionary_schema.EDeclaration checkTypeReferencedDeclaration(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
                return null;
  }

//      jsdai.SExtended_dictionary_schema.EEntity_declaration$used_declaration checkEntityUsedDeclaration(jsdai.SExtended_dictionary_schema.EEntity_definition ed) {
  static jsdai.SExtended_dictionary_schema.EDeclaration checkEntityUsedDeclaration(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
                return null;
  }

//      jsdai.SExtended_dictionary_schema.EType_declaration$used_declaration checkTypeUsedDeclaration(jsdai.SExtended_dictionary_schema.EDefined_type dt) {
  static jsdai.SExtended_dictionary_schema.EDeclaration checkTypeUsedDeclaration(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
                return null;
  }

  static boolean neededTypeReferencedDeclaration(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) dt;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
//              jsdai.lang.EEntity def = (jsdai.SExtended_dictionary_schema.ENamed_type)inst.getDefinition(null);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
                        if (definition == def) {
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid ones are used and referenced type declarations.
                                // invalid ones are local_declaration, used and referenced entity declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
                                        if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                                error_count++;
//						printError("REFERENCE FROM - Local declaration already exists for a type that is attempted to interface, a loop interfacing not allowed: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null));
                                                printErrorMsg("" + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null) + " - REFERENCE FROM - Local declaration already exists for a type that is attempted to interface, a loop interfacing is not allowed", null, true);
                                        }
                                        else {
                                                error_count++;
//						printError("REFERENCE FROM - Local declaration already exists, but the definition is not even a named type: " + dt.getName(null));
                                                printErrorMsg("" + dt.getName(null) + " - REFERENCE FROM - Local declaration already exists, but the definition is not even a named type", null, true);
                                        }
                                }
                                if (inst instanceof jsdai.SExtended_dictionary_schema.EEntity_declaration) {
                                        if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                                error_count++;
//						printError("REFERENCE FROM - Attempt to interface a type when an entity declaration already exists for that definition: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null));
                                                printErrorMsg("" + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null) + " - REFERENCE FROM - Attempt to interface a type when an entity declaration already exists for that definition", null, true);
                                        }
                                        else {
                                                error_count++;
//						printError("REFERENCE FROM - Declaration already exists, but the definition is not even a named type: " + dt.getName(null));
                                                printErrorMsg("" + dt.getName(null) + " - REFERENCE FROM - Declaration already exists, but the definition is not even a named type", null, true);
                                        }
                                }
                                return false;

                        } else {

                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(dt.getName(null))) {
                                // a name conflict
                                                        //error_count++;



                                                jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                                jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                                jsdai.lang.SdaiModel dt_model = dt.findEntityInstanceSdaiModel();
                                                jsdai.SExtended_dictionary_schema.ESchema_definition dt_schema = getSchema_definitionFromModel(dt_model);
                                                String def_schema_name = def_schema.getName(null);
                                                String dt_schema_name = dt_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//							printErrorMsg("" + ntt_name + " - attempting to interface a type with REFERENCE FROM from " + dt_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                        printWarningMsg("" + ntt_name + " - attempting to interface a type with REFERENCE FROM from " + dt_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                        }
                }

                        }






/*			
			
			} else if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
				String type_name = dt.getName(null);
				String current_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null);
				if (type_name.equalsIgnoreCase(current_name)) {
					error_count++;
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel dt_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition dt_schema = getSchema_definitionFromModel(dt_model);
					String def_schema_name = def_schema.getName(null);
					String dt_schema_name = dt_schema.getName(null);
//					printError("attempting to interface a type with REFERENCE FROM when a different named type already exists with the same name: " + type_name);
					if (def instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
						printErrorMsg("" + type_name + " - attempting to interface a type with REFERENCE FROM from " + dt_schema_name + " when a different defined type already exists with the same name, from schema " + def_schema_name, null, true);
					} else 
					if (def instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
						printErrorMsg("" + type_name + " - attempting to interface a type with REFERENCE FROM from " + dt_schema_name + " when an entity already exists with the same name, from schema " + def_schema_name, null, true);
					} else {
						// should not happen
						printErrorMsg("" + type_name + " - attempting to interface a type with REFERENCE FROM from " + dt_schema_name + " when a different named type already exists with the same name, from schema " + def_schema_name + " - INTERNAL ERROR", null, true);
					}
//					printErrorMsg("" + type_name + " - attempting to interface a type with REFERENCE FROM when a different named type already exists with the same name", null, true);
					return false;
				}
				
			} else 
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				// what not a named type but something else has the same name, shouldn't we print a warning or error message?
				String type_name = dt.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (type_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel dt_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition dt_schema = getSchema_definitionFromModel(dt_model);
					String def_schema_name = def_schema.getName(null);
					String dt_schema_name = dt_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + type_name + " - attempting to interface a type with REFERENCE FROM from " + dt_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}
*/

                }
                return true;
  }

  static boolean neededConstantReferencedDeclaration(jsdai.SExtended_dictionary_schema.EConstant_definition dt) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) dt;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
                        if (definition == def) {
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid ones are used and referenced type declarations.
                                // invalid ones are local_declaration, used and referenced entity declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
//					printError("Local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed", null, true);
                                } else {
//					printError("Interfaced declaration already exists for an express type that is attempted to interface: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - interfaced declaration already exists for an express type that is attempted to interface", null, true);
                                }
                                return false;

      } else {

                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(dt.getName(null))) {
                                // a name conflict
                                                        // error_count++;


                                        jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                        jsdai.lang.SdaiModel cd_model = dt.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition cd_schema = getSchema_definitionFromModel(cd_model);
                                        String def_schema_name = def_schema.getName(null);
                                        String cd_schema_name = cd_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//							printErrorMsg("" + ntt_name + " - attempting to interface a constant from " + cd_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                        printWarningMsg("" + ntt_name + " - attempting to interface a constant from " + cd_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                        }
                }
                        }
//      }			

/*			
			
			} else
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				String constant_name = dt.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (constant_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel cd_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition cd_schema = getSchema_definitionFromModel(cd_model);
					String def_schema_name = def_schema.getName(null);
					String cd_schema_name = cd_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + constant_name + " - attempting to interface a constant from " + cd_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}
*/

                }
                return true;
  }

  static boolean neededFunctionReferencedDeclaration(jsdai.SExtended_dictionary_schema.EFunction_definition dt) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) dt;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
                        if (definition == def) {
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid ones are used and referenced type declarations.
                                // invalid ones are local_declaration, used and referenced entity declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
//					printError("Local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed", null, true);
                                } else {
// 					printError("Interfaced declaration already exists for an express type that is attempted to interface: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - interfaced declaration already exists for an express type that is attempted to interface", null, true);
                                }
                                return false;

                        } else {

                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(dt.getName(null))) {
                                // a name conflict
                                                        // error_count++;


                                        jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                        jsdai.lang.SdaiModel fd_model = dt.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition fd_schema = getSchema_definitionFromModel(fd_model);
                                        String def_schema_name = def_schema.getName(null);
                                        String fd_schema_name = fd_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//							printErrorMsg("" + ntt_name + " - attempting to interface a function from " + fd_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                        printWarningMsg("" + ntt_name + " - attempting to interface a function from " + fd_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                        }
                }
                        }


//			}


/*			
			
			} else
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				String function_name = dt.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (function_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel fd_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition fd_schema = getSchema_definitionFromModel(fd_model);
					String def_schema_name = def_schema.getName(null);
					String fd_schema_name = fd_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + function_name + " - attempting to interface a function from " + fd_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}
*/

                }
                return true;
  }

  static boolean neededSubtype_constraintReferencedDeclaration(jsdai.SExtended_dictionary_schema.ESub_supertype_constraint dt) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) dt;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
                        if (definition == def) {
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid ones are used and referenced type declarations.
                                // invalid ones are local_declaration, used and referenced entity declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
//					printError("Local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed", null, true);
                                } else {
// 					printError("Interfaced declaration already exists for an express type that is attempted to interface: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - interfaced declaration already exists for an express type that is attempted to interface", null, true);
                                }
                                return false;

                        } else {

                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(dt.getName(null))) {
                                // a name conflict
                                                        // error_count++;


                                        jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                        jsdai.lang.SdaiModel fd_model = dt.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition fd_schema = getSchema_definitionFromModel(fd_model);
                                        String def_schema_name = def_schema.getName(null);
                                        String fd_schema_name = fd_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//							printErrorMsg("" + ntt_name + " - attempting to interface a subtype_constraint from " + fd_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                        printWarningMsg("" + ntt_name + " - attempting to interface a subtype_constraint from " + fd_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                        }
                }
                        }


//			}


/*			
			
			} else
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				String function_name = dt.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (function_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel fd_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition fd_schema = getSchema_definitionFromModel(fd_model);
					String def_schema_name = def_schema.getName(null);
					String fd_schema_name = fd_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + function_name + " - attempting to interface a function from " + fd_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}
*/

                }
                return true;
  }

  static boolean neededProcedureReferencedDeclaration(jsdai.SExtended_dictionary_schema.EProcedure_definition dt) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) dt;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
                        if (definition == def) {
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid ones are used and referenced type declarations.
                                // invalid ones are local_declaration, used and referenced entity declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
//					printError("Local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed", null, true);
                                } else {
//					printError("Interfaced declaration already exists for an express type that is attempted to interface: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - interfaced declaration already exists for an express type that is attempted to interface", null, true);
                                }
                                return false;

                        } else {

                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(dt.getName(null))) {
                                // a name conflict
                                                        // error_count++;


                                        jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                        jsdai.lang.SdaiModel pd_model = dt.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition pd_schema = getSchema_definitionFromModel(pd_model);
                                        String def_schema_name = def_schema.getName(null);
                                        String pd_schema_name = pd_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//							printErrorMsg("" + ntt_name + " - attempting to interface a procedure from " + pd_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                        printWarningMsg("" + ntt_name + " - attempting to interface a procedure from " + pd_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                        }
                }

                        }




/*			
			
			} else  
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				String procedure_name = dt.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (procedure_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel pd_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition pd_schema = getSchema_definitionFromModel(pd_model);
					String def_schema_name = def_schema.getName(null);
					String pd_schema_name = pd_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + procedure_name + " - attempting to interface a procedure from " + pd_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}
*/

                }
                return true;
  }

  static boolean neededRuleReferencedDeclaration(jsdai.SExtended_dictionary_schema.EGlobal_rule dt) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) dt;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
                        if (definition == def) {
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid ones are used and referenced type declarations.
                                // invalid ones are local_declaration, used and referenced entity declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
                                        error_count++;
//					printError("Local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - local declaration already exists for an express type that is attempted to interface, a loop interfacing not allowed", null, true);
                                } else {
                                        error_count++;
//					printError("Interfaced declaration already exists for an express type that is attempted to interface: " + dt.getName(null));
                                        printErrorMsg("" + dt.getName(null) + " - interfaced declaration already exists for an express type that is attempted to interface", null, true);
                                }
                                return false;

                        } else {


                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(dt.getName(null))) {
                                // a name conflict
                                                        // error_count++;


                                        jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                        jsdai.lang.SdaiModel gr_model = dt.findEntityInstanceSdaiModel();
                                        jsdai.SExtended_dictionary_schema.ESchema_definition gr_schema = getSchema_definitionFromModel(gr_model);
                                        String def_schema_name = def_schema.getName(null);
                                        String gr_schema_name = gr_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//							printErrorMsg("" + ntt_name + " - attempting to interface a global rule from " + gr_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                        printWarningMsg("" + ntt_name + " - attempting to interface a global rule from " + gr_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                        }
                }

                        }



/*			
			
			} else if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
				String rule_name = dt.getName(null);
				String current_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null);
				if (rule_name.equalsIgnoreCase(current_name)) {
					error_count++;
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel gr_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition gr_schema = getSchema_definitionFromModel(gr_model);
					String def_schema_name = def_schema.getName(null);
					String gr_schema_name = gr_schema.getName(null);
//					printError("attempting to interface a global rule with REFERENCE FROM when a named type already exists with the same name: " + rule_name);
					if (def instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
						printErrorMsg("" + rule_name + " - attempting to interface a global rule with REFERENCE FROM from " + gr_schema_name + " when a defined type already exists with the same name, from schema " + def_schema_name, null, true);
					} else 
					if (def instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
						printErrorMsg("" + rule_name + " - attempting to interface a global rule with REFERENCE FROM from " + gr_schema_name + " when an entity already exists with the same name, from schema " + def_schema_name, null, true);
					} else {
						// should not happen
						printErrorMsg("" + rule_name + " - attempting to interface a global rule with REFERENCE FROM from " + gr_schema_name + " when a named type already exists with the same name, from schema " + def_schema_name + " - INTERNAL ERROR", null, true);
					}
//					printErrorMsg("" + rule_name + " - attempting to interface a global rule with REFERENCE FROM when a named type already exists with the same name", null, true);
					return false;
				}

*/
// have to take care of nested stuff
/*	
			} else if (def instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
				String rule_name = dt.getName(null);
				String current_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)def).getName(null);
				// what if it is an inner function or procedure? They might be in dictionary, as it is now
				// also inner constants or something else
				if (rule_name.equalsIgnoreCase(current_name)) {
					error_count++;
					printError("attempting to interface a global rule with REFERENCE FROM when a function or procedure already exists with the same name: " + rule_name);
					return false;
				}
*/

/*
			} else  
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				// at least for now, an error message without stopping the compiler
				String rule_name = dt.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (rule_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel gr_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition gr_schema = getSchema_definitionFromModel(gr_model);
					String def_schema_name = def_schema.getName(null);
					String gr_schema_name = gr_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + rule_name + " - attempting to interface a global rule with REFERENCE FROM from " + gr_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}

*/

                }
                return true;
  }

  static boolean neededEntityReferencedDeclaration(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
                boolean is_schema_map = false;

                // I would like to know if it is a normal schema or schema_map
                if (sd instanceof jsdai.SExtended_dictionary_schema.ESchema_map_definition) {
                        is_schema_map = true;
                }

// System.out.println("X__X in needed, entity: " + ed.getName(null));
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) ed;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
//                      jsdai.lang.EEntity def = (jsdai.SExtended_dictionary_schema.ENamed_type)inst.getDefinition(null);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
                        if (definition == def) {
// System.out.println("X__X in needed, declaration already exists: " + inst);
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid ones are used and referenced entity declarations.
                                // invalid ones are local_declaration, used and referenced type declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
                                        if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
//						printError("Local declaration already exists for an entity that is attempted to interface, a loop interfacing not allowed: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null));
                                                printErrorMsg("" + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null) + " - local declaration already exists for an entity that is attempted to interface, a loop interfacing not allowed", null, true);
printDDebug("#@# neededEntityReferencedDeclaration, local exists. model: " + model);
                                        }
                                        else {
                                                error_count++;
//						printError("REFERENCE FROM - Local declaration already exists, but the definition is not even a named type: " + ed.getName(null));
                                                printErrorMsg("" + ed.getName(null) + " - REFERENCE FROM - Local declaration already exists, but the definition is not even a named type", null, true);
                                        }
                                }
                                if (inst instanceof jsdai.SExtended_dictionary_schema.EType_declaration) {
                                        if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                                error_count++;
//						printError("Attempt to interface an entity with REFERENCE FROM when a type declaration already exists for that definition: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null));
                                                printErrorMsg("" + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null) + " - attempt to interface an entity with REFERENCE FROM when a type declaration already exists for that definition", null, true);
                                        }
                                        else {
                                                error_count++;
//						printError("REFERENCE FROM - Declaration already exists, but the definition is not even a named type: " + ed.getName(null));
                                                printErrorMsg("" + ed.getName(null) + " - REFERENCE FROM - Declaration already exists, but the definition is not even a named type", null, true);
                                        }
                                }
// System.out.println("X__X in needed, returning FALSE");
                                return false;

                        } else {

                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(ed.getName(null))) {
                                if (!is_schema_map) {
                                // a name conflict
                                                        //	error_count++;


                                                        jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                                        jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                                        jsdai.lang.SdaiModel ed_model = ed.findEntityInstanceSdaiModel();
                                                        jsdai.SExtended_dictionary_schema.ESchema_definition ed_schema = getSchema_definitionFromModel(ed_model);
                                                        String def_schema_name = def_schema.getName(null);
                                                        String ed_schema_name = ed_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//								printErrorMsg("" + ntt_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                                printWarningMsg("" + ntt_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                }
                        }
                }


                        }





/*			
			
			
			} else if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
				String entity_name = ed.getName(null);
				String current_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null);
				if (entity_name.equalsIgnoreCase(current_name)) {
					error_count++;
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel ed_model = ed.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition ed_schema = getSchema_definitionFromModel(ed_model);
					String def_schema_name = def_schema.getName(null);
					String ed_schema_name = ed_schema.getName(null);
//					printError("attempting to interface an entity with REFERENCE FROM when a different named type already exists with the same name: " + entity_name);
					if (def instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
						printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a defined type already exists with the same name, from schema " + def_schema_name, null, true);
					} else 
					if (def instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
						printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different entity already exists with the same name, from schema " + def_schema_name, null, true);
					} else {
						// should not happen
						printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different named type already exists with the same name, from schema " + def_schema_name + " - INTERNAL ERROR", null, true);
					}
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM when a different named type already exists with the same name", null, true);
					return false;
				}
				
			} else 
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				// what not a named type but something else has the same name, shouldn't we print a warning or error message?
				String entity_name = ed.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (entity_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel ed_model = ed.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition ed_schema = getSchema_definitionFromModel(ed_model);
					String def_schema_name = def_schema.getName(null);
					String ed_schema_name = ed_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + entity_name + " - attempting to interface an entity with REFERENCE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}

*/

                }
// System.out.println("X__X in needed, returning TRUE");
                return true;
  }

  static boolean neededEntityUsedDeclaration(jsdai.SExtended_dictionary_schema.EEntity_definition ed) throws ParseException, jsdai.lang.SdaiException {
//System.out.println("<1>: " + ed);
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) ed;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
//                      jsdai.lang.EEntity def = (jsdai.SExtended_dictionary_schema.ENamed_type)inst.getDefinition(null);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
//if (ed.getName(null).equalsIgnoreCase("draughting_specification_reference")) {
//	System.out.println("<2>: " + def);
//}
                        if (definition == def) {
//System.out.println("<3>: " + def);
                                // check if it is a referenced entity declaration, if so, remove it and return true;
                                if (inst instanceof jsdai.SExtended_dictionary_schema.EReferenced_declaration) {
                                        if (hm_current_entity_declarations.containsValue(inst)) {
// System.out.println("__XX__ 01 removing from hm_current_entity_declarations: " +  ed.getName(null).toLowerCase());
                                                Object o = hm_current_entity_declarations.remove(ed.getName(null).toLowerCase());
                                                if (o != inst) {
                                                        // internal error, more than one declaration
                                                        hm_current_entity_declarations.put(ed.getName(null).toLowerCase(),o);
                                                        printDebug("In neededEntityUsedDeclaration - more than one declaration in hash map found");
                                                }
                                        }

                                        inst.deleteApplicationInstance();
                                        return true;
                                }
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid one is used entity declaration.
                                // invalid ones are local_declaration, used and referenced type declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
                                        if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                                error_count++;
//						printError("USE FROM - Local declaration already exists for an entity that is attempted to interface, a loop interfacing not allowed: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null));
                                                printErrorMsg("" + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null) + " - USE FROM - Local declaration already exists for an entity that is attempted to interface, a loop interfacing not allowed", null, true);
                                        }
                                        else {
                                                error_count++;
//					printError("USE FROM - Local declaration already exists, but the definition is not even a named type: " + ed.getName(null));
                                                printErrorMsg("" + ed.getName(null) + " - USE FROM - Local declaration already exists, but the definition is not even a named type", null, true);
                                        }
                                }
                                if (inst instanceof jsdai.SExtended_dictionary_schema.EType_declaration) {
                                        if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                        error_count++;
//					printError("Attempt to interface an entity with USE FROM when a type declaration already exists for that definition: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null));
                                        printErrorMsg("" + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null) + " - attempt to interface an entity with USE FROM when a type declaration already exists for that definition", null, true);
                                        }
                                        else {
                                                error_count++;
//						printError("USE FROM - Declaration already exists, but the definition is not even a named type: " + ed.getName(null));
                                                printErrorMsg("" + ed.getName(null) + " - USE FROM - Declaration already exists, but the definition is not even a named type", null, true);
                                        }
                                }
                                return false;
                        } else {

                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(ed.getName(null))) {
                                // a name conflict
                                                        // error_count++;
                                                        jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                                        jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                                        jsdai.lang.SdaiModel ed_model = ed.findEntityInstanceSdaiModel();
                                                        jsdai.SExtended_dictionary_schema.ESchema_definition ed_schema = getSchema_definitionFromModel(ed_model);
                                                        String def_schema_name = def_schema.getName(null);
                                                        String ed_schema_name = ed_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//							printErrorMsg("" + ntt_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                        printWarningMsg("" + ntt_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                        }
                }



                        }

/*			
			} else if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
				String entity_name = ed.getName(null);
				String current_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null);
				if (entity_name.equalsIgnoreCase(current_name)) {
					error_count++;
//					printError("attempting to interface an entity with USE FROM when a different named type already exists with the same name: " + entity_name);
					// let's print exactly if it is defined type of entity, and the schema where it is defined:
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel ed_model = ed.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition ed_schema = getSchema_definitionFromModel(ed_model);
					String def_schema_name = def_schema.getName(null);
					String ed_schema_name = ed_schema.getName(null);
					if (def instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
						printErrorMsg("" + entity_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + " when a defined type already exists with the same name, from schema " + def_schema_name, null, true);
					} else 
					if (def instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
						printErrorMsg("" + entity_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + " when a different entity already exists with the same name, from schema " + def_schema_name, null, true);
					} else {
						// should not happen
						printErrorMsg("" + entity_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + " when a different named type already exists with the same name, from schema " + def_schema_name + " - INTERNAL ERROR", null, true);
					}
					return false;
				}
				
			} else 
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				// what not a named type but something else has the same name, shouldn't we print a warning or error message?
				// at least for now, an error message without stopping the compiler
				String entity_name = ed.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (entity_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel ed_model = ed.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition ed_schema = getSchema_definitionFromModel(ed_model);
					String def_schema_name = def_schema.getName(null);
					String ed_schema_name = ed_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + entity_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}
*/

                }
                return true;
  }

  static boolean neededTypeUsedDeclaration(jsdai.SExtended_dictionary_schema.EDefined_type dt) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                jsdai.lang.EEntity definition = (jsdai.lang.EEntity) dt;
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration inst = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
//              jsdai.lang.EEntity def = (jsdai.SExtended_dictionary_schema.ENamed_type)inst.getDefinition(null);
                        jsdai.lang.EEntity def = (jsdai.lang.EEntity)inst.getDefinition(null);
                        if (definition == def) {
                                // check if it is a referenced type declaration, if so, remove it and return true;
                                if (inst instanceof jsdai.SExtended_dictionary_schema.EReferenced_declaration) {
                                        if (hm_current_type_declarations.containsValue(inst)) {
                                                Object o = hm_current_type_declarations.remove(dt.getName(null).toLowerCase());
                                                if (o != inst) {
                                                        // internal error, more than one declaration
                                                        hm_current_type_declarations.put(dt.getName(null).toLowerCase(),o);
                                                        printDebug("In neededEntityUsedDeclaration - more than one declaration in hash map found");
                                                }
                                        }

                                        inst.deleteApplicationInstance();
                                        return true;
                                }
                                // inconsistency checks may be added here - to see what kind of declaration is already present.
                                // valid one is used type declaration.
                                // invalid ones are local_declaration, used and referenced entity declarations, and other referenced declarations.
                                if (inst instanceof jsdai.SExtended_dictionary_schema.ELocal_declaration) {
                                        if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                                error_count++;
//						printError("USE FROM - Local declaration already exists for a type that is attempted to interface, a loop interfacing not allowed: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null));
                                                printErrorMsg("" + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null) + " - USE FROM - Local declaration already exists for a type that is attempted to interface, a loop interfacing not allowed", null, true);
                                        }
                                        else {
                                                error_count++;
//						printError("USE FROM - Local declaration already exists, but the definition is not even a named type: " + dt.getName(null));
                                                printErrorMsg("" + dt.getName(null) + " - USE FROM - Local declaration already exists, but the definition is not even a named type", null, true);
                                        }
                                }
                                if (inst instanceof jsdai.SExtended_dictionary_schema.EEntity_declaration) {
                                        if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                                                error_count++;
//						printError("Attempt to interface a type with USE FROM when a declaration already exists for that definition: " + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null));
                                                printErrorMsg("" + ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null) + " - attempt to interface a type with USE FROM when a declaration already exists for that definition", null, true);
                                        }
                                        else {
                                                error_count++;
//						printError("USE FROM - Declaration already exists, but the definition is not even a named type: " + dt.getName(null));
                                                printErrorMsg("" + dt.getName(null) + " - USE FROM - Declaration already exists, but the definition is not even a named type:", null, true);
                                        }
                                }
                                return false;

                        } else {

                                jsdai.lang.EEntity ntt = def;
                                String ntt_name = null;
                                String ntt_type_name = null;
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
                                ntt_type_name = "an entity";
                        } else {
                                ntt_type_name = "a type";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)ntt).getName(null);
                        if (ntt instanceof jsdai.SExtended_dictionary_schema.EFunction_definition) {
                                ntt_type_name = "a function";
                        } else {
                                ntt_type_name = "a procedure";
                        }
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EConstant_definition) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EConstant_definition)ntt).getName(null);
                        ntt_type_name = "a constant";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.EGlobal_rule) {
                        ntt_name = ((jsdai.SExtended_dictionary_schema.EGlobal_rule)ntt).getName(null);
                        ntt_type_name = "a global rule";
                } else
                if (ntt instanceof jsdai.SExtended_dictionary_schema.ESub_supertype_constraint) {
                        if (((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).testName(null)) {
                                ntt_name = ((jsdai.SExtended_dictionary_schema.ESub_supertype_constraint)ntt).getName(null);
                                ntt_type_name = "a subtype_constraint";
                        }
                }
                if (ntt_name != null) {
                        if (ntt_name.equalsIgnoreCase(dt.getName(null))) {
                                // a name conflict
                                                        // error_count++;


                                                jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
                                                jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
                                                jsdai.lang.SdaiModel dt_model = dt.findEntityInstanceSdaiModel();
                                                jsdai.SExtended_dictionary_schema.ESchema_definition dt_schema = getSchema_definitionFromModel(dt_model);
                                                String def_schema_name = def_schema.getName(null);
                                                String dt_schema_name = dt_schema.getName(null);
//		          original_source_schema_name = nt.findEntityInstanceSdaiModel().getName().toLowerCase();
//		          original_source_schema_name = original_source_schema_name.substring(0, original_source_schema_name.length()-16);
//        			printWarningMsg("" + ntt_name + " - attempting to interface " + nt_type_name + " from " + original_source_schema_name + " through " + source_schema_name + " into " + target_schema_name + " via chained USE FROMs but a local " + ntt_type_name + " already exists with this name", null, false); 

//							printErrorMsg("" + ntt_name + " - attempting to interface a type with USE FROM from " + dt_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                                                        printWarningMsg("" + ntt_name + " - attempting to interface a type with USE FROM from " + dt_schema_name + ", but " + ntt_type_name + " already is present with the same name, from schema " + def_schema_name, null, true);
                        }
                }



                        }

/*

			} else if (def instanceof jsdai.SExtended_dictionary_schema.ENamed_type) {
				String type_name = dt.getName(null);
				String current_name = ((jsdai.SExtended_dictionary_schema.ENamed_type)def).getName(null);
				if (type_name.equalsIgnoreCase(current_name)) {
					error_count++;
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel dt_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition dt_schema = getSchema_definitionFromModel(dt_model);
					String def_schema_name = def_schema.getName(null);
					String dt_schema_name = dt_schema.getName(null);
//					printError("attempting to interface a type with USE FROM when a different named type already exists with the same name: " + type_name);
					if (def instanceof jsdai.SExtended_dictionary_schema.EDefined_type) {
						printErrorMsg("" + type_name + " - attempting to interface a type with USE FROM from " + dt_schema_name + " when a different defined type already exists with the same name, from schema " + def_schema_name, null, true);
					} else 
					if (def instanceof jsdai.SExtended_dictionary_schema.EEntity_definition) {
						printErrorMsg("" + type_name + " - attempting to interface a type with USE FROM from " + dt_schema_name + " when an entity already exists with the same name, from schema " + def_schema_name, null, true);
					} else {
						// should not happen
						printErrorMsg("" + type_name + " - attempting to interface a type with USE FROM from " + dt_schema_name + " when a different named type already exists with the same name, from schema " + def_schema_name + " - INTERNAL ERROR", null, true);
					}
//					printErrorMsg("" + type_name + " - attempting to interface a type with USE FROM when a different named type already exists with the same name", null, true);
					return false;
				}
				
			} else 
			if (def instanceof jsdai.SExtended_dictionary_schema.EData_type) {
				// what not a named type but something else has the same name, shouldn't we print a warning or error message?
				String type_name = dt.getName(null);
				// assume that it is a data type anyway and has at least an internal name, but we are interested in constants, rules, functions, procedures
				String current_name = ((jsdai.SExtended_dictionary_schema.EData_type)def).getName(null);
				if (type_name.equalsIgnoreCase(current_name)) {
					jsdai.lang.SdaiModel def_model = def.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition def_schema = getSchema_definitionFromModel(def_model);
					jsdai.lang.SdaiModel dt_model = dt.findEntityInstanceSdaiModel();
					jsdai.SExtended_dictionary_schema.ESchema_definition dt_schema = getSchema_definitionFromModel(dt_model);
					String def_schema_name = def_schema.getName(null);
					String dt_schema_name = dt_schema.getName(null);
//					printErrorMsg("" + entity_name + " - attempting to interface an entity with USE FROM from " + ed_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
					printWarningMsg("" + type_name + " - attempting to interface a type with USE FROM from " + dt_schema_name + " when a different object already exists with the same name, from schema " + def_schema_name, null, true);
				}
			}
*/

                }
                return true;
  }

  static void jjtreeOpenNodeScope(Node n) throws ParseException {
      ((SimpleNode)n).first_token = getToken(1);
  }

  static void jjtreeCloseNodeScope(Node n) throws ParseException, jsdai.lang.SdaiException {
      ((SimpleNode)n).last_token = getToken(0);
  }

  static Object findInterpretedId_ALT(String name) throws ParseException, jsdai.lang.SdaiException {
                Object result = null;
                String its_name = null;

// printDDebug("#_# In findInterpretedId, before findParameter: " + name);
                result = findParameter(name);
                if (result != null) {
                        return result;
                }
                // only partially implemented so far, other types must be supported, and also not only current_scope, but also from the scope stack.
                for (int i = 0; i < current_scope.size(); i++) {
                        Object something = current_scope.elementAt(i);
                        if (something instanceof ECtVariable) {
                                its_name = ((ECtVariable)something).getName();
// printDDebug("#_# Variable - current name: " + its_name + ", name: " + name);
                                if (its_name.equalsIgnoreCase(name)) {
                                        return something;
                                }
                        } else
                        if (something instanceof jsdai.SExtended_dictionary_schema.EParameter) {
//                              its_name = ((jsdai.SExtended_dictionary_schema.EParameter)something).getName(null);
//printDDebug("#_# Parameter - current name: " + its_name + ", name: " + name);
//                              if (its_name.equalsIgnoreCase(name)) {
//                                      return something;
//                              }
                        }
                }
// printDDebug("#_# Scope stack size: " + scope_stack.size());
                for (int j = scope_stack.size()-1; j >= 0; j--) {
//		for (int  j= 0; j < scope_stack.size(); j++) {
                        Vector the_scope = (Vector)scope_stack.elementAt(j);
// printDDebug("#_# Scope stack index: " + j);
                        for (int i = 0; i < the_scope.size(); i++) {
                                        Object something = the_scope.elementAt(i);
                                if (something instanceof ECtVariable) {
                                        its_name = ((ECtVariable)something).getName();
// printDDebug("#_# current name: " + its_name + ", name: " + name);
                                        if (its_name.equalsIgnoreCase(name)) {
                                                result = (ECtVariable)something;
                                                return result;
                                                // break;
                                        }
                                }       else
                                if (something instanceof jsdai.SExtended_dictionary_schema.EParameter) {
//                                      its_name = ((jsdai.SExtended_dictionary_schema.EParameter)something).getName(null);
//printDDebug("#_# Parameter - current name: " + its_name + ", name: " + name);
//                                      if (its_name.equalsIgnoreCase(name)) {
//                                              return something;
//                                      }
                                }
                        }
                }
                return null;
  }

  static Object findInterpretedId2(String name, int possible_interpretations) throws ParseException, jsdai.lang.SdaiException {
                Object result = null;
                String its_name = null;

                switch(possible_interpretations) {
                        case PI_SCHEMA_OR_SCHEMA_MAP_OR_SCHEMA_VIEW:
                                printDDebug("findInterpretedId2 - in schema or schema_map or schema_view");
                                result = findGeneric_schema_definition(name);
                                if (result == null) printDDebug("findInterpretedId2 - in schema or schema_map or schema_view - NULL");
                                return result;
                                // break;
                        case PI_SOURCE_ENTITY_OR_VIEW: // entity reference or view reference
                                result = findEntity_definition(name, null);
                                if (result == null) {
                                        result = findView_definition(name, null);
                                }
                                return result;
                                // break;
                        case PI_SOURCE_SCHEMA_OR_TARGET_SCHEMA_OR_SCHEMA:
                                break;
                        case PI_SCHEMA_MAP_OR_SCHEMA_VIEW:
                        case PI_MAP:
                                result = findMap_definition(name, null);
// System.out.println("Returning from findInterpretedId2: " + result);

                                return result;
                        case PI_SOURCE_SCHEMA:
                        case PI_SCHEMA_MAP:
                        case PI_VIEW:
                        case PI_PARTITION:
                        case PI_CONSTANT:
                } // case		


//System.out.println("<about to find var, 05, name: " + name); 
                Object some = findVariableX(name);

                if (some != null) {
                        return some;
                }

                // only partially implemented so far, other types must be supported, and also not only current_scope, but also from the scope stack.
                for (int i = 0; i < current_scope.size(); i++) {
                        Object something = current_scope.elementAt(i);
// System.out.println("#_#_# Current scope: " + something + ", name to search: " + name);
                        if (something instanceof ECtVariable) {
                                its_name = ((ECtVariable)something).getName();
// System.out.println("#_# Variable - current name: " + its_name + ", name: " + name);
                                if (its_name.equalsIgnoreCase(name)) {
                                        return something;
                                }
                        } else
                        if (something instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                its_name = ((jsdai.SExtended_dictionary_schema.EParameter)something).getName(null);
// System.out.println("#_# Parameter - current name: " + its_name + ", name: " + name);
                                if (its_name.equalsIgnoreCase(name)) {
                                        return something;
                                }
                        }
                }
// System.out.println("#_# Scope stack size: " + scope_stack.size());
                for (int j = scope_stack.size()-1; j >= 0; j--) {
//		for (int  j = 0; j < scope_stack.size(); j++) {
                        Vector the_scope = (Vector)scope_stack.elementAt(j);
// System.out.println("#_# Scope stack index: " + j);
                        for (int i = 0; i < the_scope.size(); i++) {
                                Object something = the_scope.elementAt(i);
// System.out.println("#_#_# Current scope nr: " + j + ", scope element: " + something + ", name to search: " + name);
                                if (something instanceof ECtVariable) {
                                        its_name = ((ECtVariable)something).getName();
// System.out.println("#_# current name: " + its_name + ", name: " + name);
                                        if (its_name.equalsIgnoreCase(name)) {
                                                result = (ECtVariable)something;
                                                return result;
                                                // break;
                                        }
                                }       else
                                if (something instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                        its_name = ((jsdai.SExtended_dictionary_schema.EParameter)something).getName(null);
// System.out.println("#_# Parameter - current name: " + its_name + ", name: " + name);
                                        if (its_name.equalsIgnoreCase(name)) {
                                                return something;
                                        }
                                }
                        }
                }
                printDebug("referenced item not found:" + name);
                return null;
  }

  static Object findInterpretedId_needed_or_not(String name) throws ParseException, jsdai.lang.SdaiException {
                Object result = null;
                String its_name = null;
                // only partially implemented so far, other types must be supported, and also not only current_scope, but also from the scope stack.
                for (int i = 0; i < current_scope.size(); i++) {
                        Object something = current_scope.elementAt(i);
// System.out.println("#_#_# Current scope: " + something + ", name to search: " + name);
                        if (something instanceof ECtVariable) {
                                its_name = ((ECtVariable)something).getName();
// System.out.println("#_# Variable - current name: " + its_name + ", name: " + name);
                                if (its_name.equalsIgnoreCase(name)) {
                                        return something;
                                }
                        } else
                        if (something instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                its_name = ((jsdai.SExtended_dictionary_schema.EParameter)something).getName(null);
// System.out.println("#_# Parameter - current name: " + its_name + ", name: " + name);
                                if (its_name.equalsIgnoreCase(name)) {
                                        return something;
                                }
                        }
                }
// System.out.println("#_# Scope stack size: " + scope_stack.size());
                for (int j = scope_stack.size()-1; j >= 0; j--) {
//		for (int  j = 0; j < scope_stack.size(); j++) {
                        Vector the_scope = (Vector)scope_stack.elementAt(j);
// System.out.println("#_# Scope stack index: " + j);
                        for (int i = 0; i < the_scope.size(); i++) {
                                Object something = the_scope.elementAt(i);
// System.out.println("#_#_# Current scope nr: " + j + ", scope element: " + something + ", name to search: " + name);
                                if (something instanceof ECtVariable) {
                                        its_name = ((ECtVariable)something).getName();
// System.out.println("#_# current name: " + its_name + ", name: " + name);
                                        if (its_name.equalsIgnoreCase(name)) {
                                                result = (ECtVariable)something;
                                                return result;
                                                // break;
                                        }
                                }       else
                                if (something instanceof jsdai.SExtended_dictionary_schema.EParameter) {
                                        its_name = ((jsdai.SExtended_dictionary_schema.EParameter)something).getName(null);
// System.out.println("#_# Parameter - current name: " + its_name + ", name: " + name);
                                        if (its_name.equalsIgnoreCase(name)) {
                                                return something;
                                        }
                                }
                        }
                }
                return null;
  }

  static ECtVariable findVariable(String name) throws ParseException, jsdai.lang.SdaiException {
                ECtVariable result = null;
                String its_name = null;
                // only partially implemented so far, other types must be supported, and also not only current_scope, but also from the scope stack.
// System.out.println("#_# Current Scope size: " + current_scope.size() + ", scope instance: " + current_scope);
                for (int i = 0; i < current_scope.size(); i++) {
                        Object something = current_scope.elementAt(i);
                        if (something instanceof ECtVariable) {
                                its_name = ((ECtVariable)something).getName();
// System.out.println("#_# current name: " + its_name + ", name: " + name);
                                if (its_name.equalsIgnoreCase(name)) {
                                        result = (ECtVariable)something;
                                        return result;
                                        // break;
                                }
                        }
                        else {
// System.out.println("#_# not variable: " + something);
                        }
                }
                // get super-scopes
// System.out.println("#_# Scope stack size: " + scope_stack.size() + ", scope stack: " + scope_stack);
//		for (int  j= 0; j < scope_stack.size(); j++) {
                for (int j = scope_stack.size()-1; j >= 0; j--) {
                        Vector the_scope = (Vector)scope_stack.elementAt(j);
// System.out.println("#_# Scope stack index: " + j + ", size: " + the_scope.size() + ",  scope instance: " + scope_stack.elementAt(j));
                        for (int i = 0; i < the_scope.size(); i++) {
                                Object something = the_scope.elementAt(i);
                                if (something instanceof ECtVariable) {
                                        its_name = ((ECtVariable)something).getName();
// System.out.println("#_# current name: " + its_name + ", name: " + name);
                                        if (its_name.equalsIgnoreCase(name)) {
                                                result = (ECtVariable)something;
                                                return result;
                                                // break;
                                        }
                                }
                                else {
// System.out.println("#_# not variable: " + something);
                                }
                        }
                }

                return result;
  }

  static jsdai.SExtended_dictionary_schema.EParameter findParameter(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.SExtended_dictionary_schema.AParameter parameters = null;
                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EAlgorithm_definition) {
                        parameters = ((jsdai.SExtended_dictionary_schema.EAlgorithm_definition)active_scope).getParameters(null);
                } else
                if (active_scope instanceof jsdai.SExtended_dictionary_schema.EMap_definition) {
                        // target_parameters - INVERSE - actually, have to resolve source parameter
                        // parameters = ((jsdai.SExtended_dictionary_schema.EMap_definition)active_scope).getParameters(null);
                        return null;
                } else {
                        printVerbose("ERROR! wrong active_scope: " + active_scope);
                        return null;
                }

                jsdai.lang.SdaiIterator iter = parameters.createIterator();
                while (iter.next()) {
                        jsdai.SExtended_dictionary_schema.EParameter inst = (jsdai.SExtended_dictionary_schema.EParameter)parameters.getCurrentMemberObject(iter);
                        String its_name = inst.getName(null);
                        if (its_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
//		System.out.println("@#NULL find parameter null, name: " + name + ", active_scope: " + active_scope + ", pass: " + parser_pass);
                return null;
  }

  static jsdai.SExtended_dictionary_schema.ETarget_parameter findTarget_parameter_not_needed_anylonger_perhaps(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.ETarget_parameter.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.ETarget_parameter inst = (jsdai.SExtended_dictionary_schema.ETarget_parameter)ia.getCurrentMemberObject(iter_inst);
                        String its_name = inst.getName(null);
                        if (its_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EView_partition findView_partition(String name, jsdai.SExtended_dictionary_schema.EView_definition parent) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EView_partition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EView_partition inst = (jsdai.SExtended_dictionary_schema.EView_partition)ia.getCurrentMemberObject(iter_inst);
                        String its_name = inst.getName(null);
                        if (its_name.equalsIgnoreCase(name)) { // found! return it
                                jsdai.SExtended_dictionary_schema.EView_definition its_parent = (jsdai.SExtended_dictionary_schema.EView_definition)inst.getParent(null);
                                if (its_parent == parent) {
                                        return inst;
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EMap_partition findMap_partition(String name, jsdai.SExtended_dictionary_schema.EMap_definition parent) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EMap_partition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EMap_partition inst = (jsdai.SExtended_dictionary_schema.EMap_partition)ia.getCurrentMemberObject(iter_inst);
                        String its_name = inst.getName(null);
                        if (its_name.equalsIgnoreCase(name)) { // found! return it
                                jsdai.SExtended_dictionary_schema.EMap_definition its_parent = (jsdai.SExtended_dictionary_schema.EMap_definition)inst.getParent(null);
                                if (its_parent == parent) {
                                        return inst;
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EDependent_map_partition findDependent_map_partition(String name, jsdai.SExtended_dictionary_schema.EDependent_map_definition parent) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDependent_map_partition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDependent_map_partition inst = (jsdai.SExtended_dictionary_schema.EDependent_map_partition)ia.getCurrentMemberObject(iter_inst);
                        String its_name = inst.getName(null);
                        if (its_name.equalsIgnoreCase(name)) { // found! return it
                                jsdai.SExtended_dictionary_schema.EDependent_map_definition its_parent = (jsdai.SExtended_dictionary_schema.EDependent_map_definition)inst.getParent(null);
                                if (its_parent == parent) {
                                        return inst;
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EMap_definition findMap_definition_not_needed_perhaps(String name, jsdai.SExtended_dictionary_schema.ESchema_map_definition optional_schema) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EMap_declaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.SExtended_dictionary_schema.EMap_definition inst = (jsdai.SExtended_dictionary_schema.EMap_definition)dec.getDefinition(null);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        } else
                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                                return (jsdai.SExtended_dictionary_schema.EMap_definition)dec.getDefinition(null);
                                        }
                                }
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EDependent_map_definition findDependent_map_definition(String name, jsdai.SExtended_dictionary_schema.ESchema_definition optional_schema) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDependent_map_definition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDependent_map_definition inst = (jsdai.SExtended_dictionary_schema.EDependent_map_definition)ia.getCurrentMemberObject(iter_inst);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static jsdai.SExtended_dictionary_schema.EDependent_map_definition findDependent_map_definition_dec(String name, jsdai.SExtended_dictionary_schema.ESchema_definition optional_schema) throws ParseException, jsdai.lang.SdaiException {
//		jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDependent_map_declaration.class);
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EDeclaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.SExtended_dictionary_schema.EDependent_map_definition inst = (jsdai.SExtended_dictionary_schema.EDependent_map_definition)dec.getDefinition(null);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        } else
                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                                return (jsdai.SExtended_dictionary_schema.EDependent_map_definition)dec.getDefinition(null);
                                        }
                                }
                        }
                }
                return null;
  }

// this method should return the entity definition of a complex entity which is specified by the entity definitions
// of the leaf entities 
// supertypes should not be included into the input, but perhaps better to check.
// leaves may be from different schemas
// 
// PROBLEM: we may not have the complex entity in advance. Complex entities are created later.
// and we do not currently support incremental compilation, so all the related schemas, schema_views and schema_maps have to be
// compiled together. 
// What to do? 
// 1) to create the complex entity here in this method and to return it
// 2) to move the complex generator forward between the compiler passes. I need to investigate if it is possible, what it needs.
//   that approch is perhaps not possible, because I allow implicitly interfaced leafs for creating declarations.
  static jsdai.SExtended_dictionary_schema.EEntity_definition findComplexEntity(Vector entity_definitions) throws ParseException, jsdai.lang.SdaiException {
        jsdai.SExtended_dictionary_schema.EEntity_definition result = null;
        // perhaps
        return result;
  }

  static jsdai.SExtended_dictionary_schema.EConstant_definition findConstant_definition_needed_or_not(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EConstant_declaration.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EDeclaration dec = (jsdai.SExtended_dictionary_schema.EDeclaration)ia.getCurrentMemberObject(iter_inst);
                        jsdai.SExtended_dictionary_schema.EConstant_definition inst = (jsdai.SExtended_dictionary_schema.EConstant_definition)dec.getDefinition(null);
                        String instance_name = inst.getName(null);
                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        } else
                        if (dec instanceof jsdai.SExtended_dictionary_schema.EInterfaced_declaration) {
                                if (((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).testAlias_name(null)) {
                                        instance_name = ((jsdai.SExtended_dictionary_schema.EInterfaced_declaration)dec).getAlias_name(null);
                                        if (instance_name.equalsIgnoreCase(name)) { // found! return it
                                                return (jsdai.SExtended_dictionary_schema.EConstant_definition)dec.getDefinition(null);
                                        }
                                }
                        }
                }
                return null;
  }

  static boolean isDataTypePresent(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EData_type.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EData_type dt = (jsdai.SExtended_dictionary_schema.EData_type)ia.getCurrentMemberObject(iter_inst);
                        String data_type_name = null;
                        if(dt.testName(null)){
                                         data_type_name = dt.getName(null);
                                         if (data_type_name.equalsIgnoreCase(name)) { // found! return it
                                                         return true;
                                         }
                        }else{
                                  System.out.println("WARNING: data type without name: " + dt);
                        }
                }
                return false;
  }

  static jsdai.SExtended_dictionary_schema.EFunction_definition findFunction_in_this_model(String name) throws ParseException, jsdai.lang.SdaiException {
                jsdai.lang.Aggregate ia = model.getEntityExtentInstances(jsdai.SExtended_dictionary_schema.EFunction_definition.class);
                jsdai.lang.SdaiIterator iter_inst = ia.createIterator();
                while (iter_inst.next()) {
                        jsdai.SExtended_dictionary_schema.EFunction_definition inst = (jsdai.SExtended_dictionary_schema.EFunction_definition)ia.getCurrentMemberObject(iter_inst);
// System.out.println("#_# in findParameter: " + inst + ", searched: " + name);
                        String its_name = inst.getName(null);
// System.out.println("#_# in findParameter - name " + its_name + ", searched: " + name);
                        if (its_name.equalsIgnoreCase(name)) { // found! return it
                                return inst;
                        }
                }
                return null;
  }

  static String getBoundString(int aggregate_bound_type, jsdai.SExtended_dictionary_schema.EBound bounds [], boolean optional, boolean unique) throws ParseException, jsdai.lang.SdaiException {
        String result = "";
        if (bounds.length > 0) {
                if (bounds[0] == null) {
                        result = "_0";
                } else {
                        if (bounds[0] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                jsdai.SExtended_dictionary_schema.EInteger_bound i_b1 = (jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[0];
                        boolean integer_bound_set = i_b1.testBound_value(null);
                        if (integer_bound_set) {
                                int b1_value = i_b1.getBound_value(null);
                                        if (b1_value < 0) {
                                                b1_value = -b1_value;
                                                result = "_MINUS" + b1_value;
                                } else {
                                                result = "_" + b1_value;
                                }
                        } else {
                                        result = "_0";
                        }
                  } else {
                        jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound pdb1 = (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)bounds[0];
                        // population-dependent. Let's put 0 for now:
//				result = "_1PDB";		  		
//				result = "_1PDB" + unique_pdb_name2++;
                                 // attept to extract from the instance

                                if (pdb1.testMethod_name(null)) {
                                        result = "_1PDB" + pdb1.getMethod_name(null).substring(12);
                                } else {
                                        result = "_1PDB";
                                }

                  }
                }
        }
        if (bounds.length > 1) {
                if (bounds[1] != null) {
                        if (bounds[1] instanceof jsdai.SExtended_dictionary_schema.EInteger_bound) {
                                jsdai.SExtended_dictionary_schema.EInteger_bound i_b2 = (jsdai.SExtended_dictionary_schema.EInteger_bound)bounds[1];
                        boolean integer_bound2_set = i_b2.testBound_value(null);
                        if (integer_bound2_set) {
                                int b2_value = i_b2.getBound_value(null);
                                        if (b2_value < 0) {
                                                b2_value = -b2_value;
                                                result += "_MINUS" + b2_value;
                                } else {
                                                result += "_" + b2_value;
                                }
                        } else {
                                        // do nothing
                        }
                  } else {
                        // population-dependent. Let's do nothing for now:
//		 		result += "_2PDB";
//				result += "_2PDB" + unique_pdb_name2++;

                        jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound pdb2 = (jsdai.SExtended_dictionary_schema.EPopulation_dependent_bound)bounds[1];
                                if (pdb2.testMethod_name(null)) {
                                        result += "_2PDB" + pdb2.getMethod_name(null).substring(12);
                                } else {
                                        result += "_2PDB";
                                }
                  }
                }
        }
        if (optional) {
                result += "_OPTIONAL";
        }
        if (unique) {
                result += "_UNIQUE";
        }
        return result;
  }

  static String handleBackslash(String original) throws ParseException {
  StringBuffer sb = new StringBuffer(original);
  StringBuffer sb2 = new StringBuffer();

  for (int i = 0; i < sb.length(); i++) {
        char ch = sb.charAt(i);
        sb2.append(ch);
        if (ch == '\\') {
                sb2.append(ch);
        }
  }
  return sb2.toString();
  }

  static String getPDBname() throws ParseException {
        return ("calculatePDB" + unique_pdb_name++);
  }

  static void recoverFromParseException(int kind, ParseException e) throws ParseException, jsdai.lang.SdaiException {
// the thing is, if there is only TYPE and no END_TYPE, then skipping till the END_TYPE
// should also end when END_SCHEMA is encountered, however, it should return BEFORE END_SCHEMA,
// if END_SCHEMA is consumed, then SchemaDecl is not handled correctly

        //	ParseException e = generateParseException(); // generate the exception object.
//	System.out.println(e.toString()); // print the error message
        Token t;

         Token ttt = getToken(0);
         if (ttt.kind == EOF) {
//			printError("EOF, no further error recovery");
                        printErrorMsg("" + "" + "EOF, no further error recovery", null, true);
                        return;
         } else if (ttt.kind == kind) {
                // already skipped
                        getNextToken();
                        return;

         } else if (ttt.kind == END_SCHEMA) {
//			if (error_count > 1) error_count--;
                        // a risky busines - assuming that the END_SCHEMA token is already consumed and that will cause a secondary exception in SchemaDecl
                        // and error_count will be set then
//			error_count--;
                        System.out.println("END_SCHEMA encountered, proceeding with (possible) next schema");
                        return;
         }
         t = ttt;

        do {
                if (t.kind == END_SCHEMA) {
//			if (error_count > 1) error_count--;
                        System.out.println("END_SCHEMA encountered - proceeding with (possible) next schema");
                        return;
                } else {
                        // ok, this thing solves the problem with the secondary exception in SchemaDecl, so, END_SCHEMA token was not yet consumed
                        Token tt = getToken(1);
                        if (tt.kind == END_SCHEMA) {
                                System.out.println("END_SCHEMA encountered - proceeding with (possible) next schema");
                                return;
                        }
                }
                t = getNextToken();
                if (t.kind == END_SCHEMA) {
//			if (error_count > 1) error_count--;
                        System.out.println("END_SCHEMA encountered: proceeding with (possible) next schema");
                        // isn't it too late?
                        return;
                }
        } while (t.kind != kind && t.kind != EOF);
                // I expect semicolon here
                t = getNextToken();
                if (t.kind != SEMICOLON) {
                        if (parser_pass == 1) {
                                System.out.println("ERROR: no semicolon"); // print the error message	
                        }
        }
  }

  static void Garbage5() throws ParseException {
  }

  static void recoverToNextSchema(ParseException e) throws ParseException, jsdai.lang.SdaiException {
//	ParseException e = generateParseException(); // generate the exception object.
        if (parser_pass == 1) {
                System.out.println("ERROR: garbage between schemas"); // print the error message
//		System.out.println(e.toString()); // print the error message
//		printError(e.getMessage()); // print the error message
                printErrorMsg("" + "" + e.getMessage(), null, true); // print the error message
        }
        Token t;
        Token t0;
        for (;;) {
//	while (getToken(1).kind != EOF) {
                t0 = getToken(1);
                if ((t0.kind == SCHEMA) || (t0.kind == SCHEMA_VIEW) || (t0.kind == SCHEMA_MAP)) {
                        // return immediately so that the parsing can continue from this schema
                        break;
                } else
                if ((t0.kind == END_SCHEMA) || (t0.kind == END_SCHEMA_VIEW) || (t0.kind == END_SCHEMA_MAP)) {
                        // consume this token and the following semicolon so that the parsing can continue from the next schema
                        t = getNextToken();
                        t = getNextToken();
                        if (t.kind != SEMICOLON) {
                                if (parser_pass == 1) {
                                        System.out.println("ERROR: no semicolon"); // print the error message	
                                }
                                break;
                        }
                } else {
                         // just consume the token
                        t = getNextToken();
                }
        }
  }

  static int recoverToTheNextSchema(ParseException e) throws ParseException, jsdai.lang.SdaiException {
        Token t;
        Token t0;

         Token ttt = getToken(0);
                error_count++;

// System.out.println("<><> in recoverToTheNextSchema");

         if (ttt.kind == EOF) {
//			printError("EOF, no further error recovery");
                        printErrorMsg("" + "" + " - EOF, no further error recovery", null, true);
                        return -2;
         } else if (ttt.kind == END_SCHEMA) {
                // already skipped
// System.out.println("<><2> in recoverToTheNextSchema");
                        getNextToken();
                        if (schema_depth == 0) {
// System.out.println("<><3> in recoverToTheNextSchema");
                                // END_SCHEMA itself may have been a garbage
                                printErrorMsg("" + "" + " - END_SCHEMA found without corresponding SCHEMA", null, true);
                                return 0;
                        } else {
// System.out.println("<><4> in recoverToTheNextSchema");
                                return -3;
                        }
         }

// System.out.println("<><5> in recoverToTheNextSchema");


        if (e != null) {
//		System.out.println("EXCEPTION: " + e);
                // System.out.println("EXCEPTION: +++++++++++ Available info: ");

//		System.out.println("ERROR:" + e.getMessage());
                if (parser_pass == 1) {
//			printError(e.getMessage());
                        printErrorMsg("" + "" + e.getMessage(), null, true);
                }
        } else {
                if (parser_pass == 1) {
                        // System.out.println("ERROR: garbage between schemas found");
//			printError("garbage between schemas found");
                        printErrorMsg("" + "" + " - garbage between schemas found", null, true);
                }
        }
        if (schema_depth == 1) { // inside a schema, skip until and including <END_SCHEMA>; 
                if (parser_pass == 1) {
                        System.out.println("ERROR RECOVERY: a problem inside the schema, skipping to END_SCHEMA");
                }
                do {
                        t = getNextToken();
                        if (t.kind == EOF) {
//				printErrorMsg("" + "" + " - EOF, no further error recovery", null, true);
                                System.out.println("EOF, no further error recovery");
                                return -2;
                        }
                } while (t.kind != END_SCHEMA);
                // I expect semicolon here
                schema_depth--;
                t = getNextToken();
                if (t.kind != SEMICOLON) {
                        if (parser_pass == 1) {
                                System.out.println("ERROR: no semicolon"); // print the error message	
                        }
                }

          return 0;

        } else { // outside a schema, skip until just before <SCHEMA>
                if (parser_pass == 1) {
                        System.out.println("ERROR RECOVERY: a problem outside the schema, skipping to next SCHEMA");
                }

                // in multi-file mode, better get the next file
                // while (getToken(1).kind != SCHEMA) {
                        // t = getNextToken();
                // }

          return -1;


        }
  }

  static String getOriginalAttributeName(jsdai.SExtended_dictionary_schema.EAttribute attr) throws ParseException, jsdai.lang.SdaiException {
                jsdai.SExtended_dictionary_schema.EAttribute attr2 = attr;
                jsdai.SExtended_dictionary_schema.EAttribute attr3 = attr;


                for (;;) {

                        if (attr2 instanceof jsdai.SExtended_dictionary_schema.EExplicit_attribute) {
                                if (((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2).testRedeclaring(null)) {
                                        attr2 = ((jsdai.SExtended_dictionary_schema.EExplicit_attribute)attr2).getRedeclaring(null);
                                } else {
                                        return attr2.getName(null);
                                }
                        } else
                        if (attr2 instanceof jsdai.SExtended_dictionary_schema.EDerived_attribute) {
                                if (((jsdai.SExtended_dictionary_schema.EDerived_attribute)attr2).testRedeclaring(null)) {
                                        attr2 = (jsdai.SExtended_dictionary_schema.EAttribute)((jsdai.SExtended_dictionary_schema.EDerived_attribute)attr2).getRedeclaring(null);
                                } else {
                                        return attr2.getName(null);
                                }
                        } else
                        if (attr2 instanceof jsdai.SExtended_dictionary_schema.EInverse_attribute) {
                                if (((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr2).testRedeclaring(null)) {
                                        attr2 = ((jsdai.SExtended_dictionary_schema.EInverse_attribute)attr2).getRedeclaring(null);
                                } else {
                                        return attr2.getName(null);
                                }
                        } else {
                        // internal error 
                                return "_WRONG_ATTRIBUTE_";
                        }
                        if (attr3 == attr2) {
                                // no further progress, get out from this loop
// error moved to attribute redeclaring
//				printErrorMsg(""  + attr.getName(null) + " - attribute is redeclaring itself, entity:  " + attr.getParent(null).getName(null), null, true );
//				error_count++;
                                return attr.getName(null);
                        } else {
                                attr3 = attr2;
                        }
                }
  }

  static final private boolean jj_2_1(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_1();
    jj_save(0, xla);
    return retval;
  }

  static final private boolean jj_2_2(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_2();
    jj_save(1, xla);
    return retval;
  }

  static final private boolean jj_2_3(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_3();
    jj_save(2, xla);
    return retval;
  }

  static final private boolean jj_2_4(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_4();
    jj_save(3, xla);
    return retval;
  }

  static final private boolean jj_2_5(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_5();
    jj_save(4, xla);
    return retval;
  }

  static final private boolean jj_2_6(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_6();
    jj_save(5, xla);
    return retval;
  }

  static final private boolean jj_2_7(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_7();
    jj_save(6, xla);
    return retval;
  }

  static final private boolean jj_2_8(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_8();
    jj_save(7, xla);
    return retval;
  }

  static final private boolean jj_2_9(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_9();
    jj_save(8, xla);
    return retval;
  }

  static final private boolean jj_2_10(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_10();
    jj_save(9, xla);
    return retval;
  }

  static final private boolean jj_2_11(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_11();
    jj_save(10, xla);
    return retval;
  }

  static final private boolean jj_2_12(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_12();
    jj_save(11, xla);
    return retval;
  }

  static final private boolean jj_2_13(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_13();
    jj_save(12, xla);
    return retval;
  }

  static final private boolean jj_2_14(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_14();
    jj_save(13, xla);
    return retval;
  }

  static final private boolean jj_2_15(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_15();
    jj_save(14, xla);
    return retval;
  }

  static final private boolean jj_2_16(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_16();
    jj_save(15, xla);
    return retval;
  }

  static final private boolean jj_2_17(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_17();
    jj_save(16, xla);
    return retval;
  }

  static final private boolean jj_2_18(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_18();
    jj_save(17, xla);
    return retval;
  }

  static final private boolean jj_2_19(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_19();
    jj_save(18, xla);
    return retval;
  }

  static final private boolean jj_2_20(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_20();
    jj_save(19, xla);
    return retval;
  }

  static final private boolean jj_2_21(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_21();
    jj_save(20, xla);
    return retval;
  }

  static final private boolean jj_2_22(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_22();
    jj_save(21, xla);
    return retval;
  }

  static final private boolean jj_2_23(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_23();
    jj_save(22, xla);
    return retval;
  }

  static final private boolean jj_2_24(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_24();
    jj_save(23, xla);
    return retval;
  }

  static final private boolean jj_2_25(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_25();
    jj_save(24, xla);
    return retval;
  }

  static final private boolean jj_2_26(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_26();
    jj_save(25, xla);
    return retval;
  }

  static final private boolean jj_2_27(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_27();
    jj_save(26, xla);
    return retval;
  }

  static final private boolean jj_2_28(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_28();
    jj_save(27, xla);
    return retval;
  }

  static final private boolean jj_2_29(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_29();
    jj_save(28, xla);
    return retval;
  }

  static final private boolean jj_2_30(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_30();
    jj_save(29, xla);
    return retval;
  }

  static final private boolean jj_2_31(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_31();
    jj_save(30, xla);
    return retval;
  }

  static final private boolean jj_2_32(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_32();
    jj_save(31, xla);
    return retval;
  }

  static final private boolean jj_2_33(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_33();
    jj_save(32, xla);
    return retval;
  }

  static final private boolean jj_2_34(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_34();
    jj_save(33, xla);
    return retval;
  }

  static final private boolean jj_2_35(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_35();
    jj_save(34, xla);
    return retval;
  }

  static final private boolean jj_2_36(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_36();
    jj_save(35, xla);
    return retval;
  }

  static final private boolean jj_2_37(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_37();
    jj_save(36, xla);
    return retval;
  }

  static final private boolean jj_2_38(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_38();
    jj_save(37, xla);
    return retval;
  }

  static final private boolean jj_2_39(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_39();
    jj_save(38, xla);
    return retval;
  }

  static final private boolean jj_2_40(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_40();
    jj_save(39, xla);
    return retval;
  }

  static final private boolean jj_2_41(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_41();
    jj_save(40, xla);
    return retval;
  }

  static final private boolean jj_2_42(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_42();
    jj_save(41, xla);
    return retval;
  }

  static final private boolean jj_2_43(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_43();
    jj_save(42, xla);
    return retval;
  }

  static final private boolean jj_2_44(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_44();
    jj_save(43, xla);
    return retval;
  }

  static final private boolean jj_2_45(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_45();
    jj_save(44, xla);
    return retval;
  }

  static final private boolean jj_2_46(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_46();
    jj_save(45, xla);
    return retval;
  }

  static final private boolean jj_2_47(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_47();
    jj_save(46, xla);
    return retval;
  }

  static final private boolean jj_2_48(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_48();
    jj_save(47, xla);
    return retval;
  }

  static final private boolean jj_2_49(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_49();
    jj_save(48, xla);
    return retval;
  }

  static final private boolean jj_2_50(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_50();
    jj_save(49, xla);
    return retval;
  }

  static final private boolean jj_2_51(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_51();
    jj_save(50, xla);
    return retval;
  }

  static final private boolean jj_2_52(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_52();
    jj_save(51, xla);
    return retval;
  }

  static final private boolean jj_2_53(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_53();
    jj_save(52, xla);
    return retval;
  }

  static final private boolean jj_2_54(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_54();
    jj_save(53, xla);
    return retval;
  }

  static final private boolean jj_2_55(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_55();
    jj_save(54, xla);
    return retval;
  }

  static final private boolean jj_2_56(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_56();
    jj_save(55, xla);
    return retval;
  }

  static final private boolean jj_2_57(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_57();
    jj_save(56, xla);
    return retval;
  }

  static final private boolean jj_2_58(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_58();
    jj_save(57, xla);
    return retval;
  }

  static final private boolean jj_2_59(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_59();
    jj_save(58, xla);
    return retval;
  }

  static final private boolean jj_2_60(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_60();
    jj_save(59, xla);
    return retval;
  }

  static final private boolean jj_2_61(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_61();
    jj_save(60, xla);
    return retval;
  }

  static final private boolean jj_2_62(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_62();
    jj_save(61, xla);
    return retval;
  }

  static final private boolean jj_2_63(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_63();
    jj_save(62, xla);
    return retval;
  }

  static final private boolean jj_2_64(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_64();
    jj_save(63, xla);
    return retval;
  }

  static final private boolean jj_2_65(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_65();
    jj_save(64, xla);
    return retval;
  }

  static final private boolean jj_2_66(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_66();
    jj_save(65, xla);
    return retval;
  }

  static final private boolean jj_2_67(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_67();
    jj_save(66, xla);
    return retval;
  }

  static final private boolean jj_2_68(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_68();
    jj_save(67, xla);
    return retval;
  }

  static final private boolean jj_2_69(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_69();
    jj_save(68, xla);
    return retval;
  }

  static final private boolean jj_2_70(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_70();
    jj_save(69, xla);
    return retval;
  }

  static final private boolean jj_2_71(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_71();
    jj_save(70, xla);
    return retval;
  }

  static final private boolean jj_2_72(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_72();
    jj_save(71, xla);
    return retval;
  }

  static final private boolean jj_2_73(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_73();
    jj_save(72, xla);
    return retval;
  }

  static final private boolean jj_2_74(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_74();
    jj_save(73, xla);
    return retval;
  }

  static final private boolean jj_2_75(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_75();
    jj_save(74, xla);
    return retval;
  }

  static final private boolean jj_2_76(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_76();
    jj_save(75, xla);
    return retval;
  }

  static final private boolean jj_2_77(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_77();
    jj_save(76, xla);
    return retval;
  }

  static final private boolean jj_2_78(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_78();
    jj_save(77, xla);
    return retval;
  }

  static final private boolean jj_2_79(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_79();
    jj_save(78, xla);
    return retval;
  }

  static final private boolean jj_2_80(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_80();
    jj_save(79, xla);
    return retval;
  }

  static final private boolean jj_2_81(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_81();
    jj_save(80, xla);
    return retval;
  }

  static final private boolean jj_2_82(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_82();
    jj_save(81, xla);
    return retval;
  }

  static final private boolean jj_2_83(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    boolean retval = !jj_3_83();
    jj_save(82, xla);
    return retval;
  }

  static final private boolean jj_3R_203() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_312()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_313()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_314()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_315()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_316()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_317()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_398() {
    if (jj_3R_564()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_322() {
    if (jj_3R_475()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_309() {
    if (jj_scan_token(213)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_308() {
    if (jj_scan_token(AND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_51() {
    if (jj_3R_214()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_307() {
    if (jj_scan_token(MOD)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_208() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_322()) {
    jj_scanpos = xsp;
    if (jj_3R_323()) {
    jj_scanpos = xsp;
    if (jj_3R_324()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_306() {
    if (jj_scan_token(DIV)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_887() {
    if (jj_3R_914()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_305() {
    if (jj_scan_token(SLASH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_228() {
    if (jj_3R_363()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_67() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_228()) {
    jj_scanpos = xsp;
    if (jj_3R_229()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_849() {
    if (jj_scan_token(SUPERTYPE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_889()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_190() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_824() {
    if (jj_3R_848()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_767() {
    if (jj_scan_token(LBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_816()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_817()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_400() {
    if (jj_3R_565()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_656() {
    if (jj_scan_token(BINARY_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_419() {
    if (jj_3R_582()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_542() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_656()) {
    jj_scanpos = xsp;
    if (jj_3R_657()) {
    jj_scanpos = xsp;
    if (jj_3R_658()) {
    jj_scanpos = xsp;
    if (jj_3R_659()) {
    jj_scanpos = xsp;
    if (jj_3R_660()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_31() {
    if (jj_3R_191()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_192()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_825() {
    if (jj_scan_token(ABSTRACT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_849()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_935() {
    if (jj_scan_token(OPTIONAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_174() {
    if (jj_3R_192()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_31()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_304() {
    if (jj_scan_token(STAR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_886() {
    if (jj_3R_913()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_198() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_304()) {
    jj_scanpos = xsp;
    if (jj_3R_305()) {
    jj_scanpos = xsp;
    if (jj_3R_306()) {
    jj_scanpos = xsp;
    if (jj_3R_307()) {
    jj_scanpos = xsp;
    if (jj_3R_308()) {
    jj_scanpos = xsp;
    if (jj_3R_309()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_196() {
    if (jj_3R_171()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_201() {
    if (jj_3R_182()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_823() {
    if (jj_3R_847()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_17() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OP_AT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_934() {
    if (jj_3R_767()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_747() {
    if (jj_scan_token(UNTIL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_410()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_223() {
    if (jj_scan_token(FOR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_343()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_344()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_885() {
    if (jj_3R_912()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_399() {
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_253() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_399()) {
    jj_scanpos = xsp;
    if (jj_3R_400()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_911() {
    if (jj_scan_token(ARRAY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_934()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_935()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_936()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_796()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_950() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_890()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_252() {
    if (jj_scan_token(EXTENSIBLE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_168() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_252()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(ENUMERATION)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_253()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_22() {
    if (jj_3R_182()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_182() {
    if (jj_3R_171()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_822() {
    if (jj_3R_846()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_225() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_505() {
    if (jj_3R_647()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_949() {
    if (jj_3R_952()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_630() {
    if (jj_scan_token(216)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_947() {
    if (jj_3R_780()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_884() {
    if (jj_3R_911()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_10() {
    if (jj_3R_172()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_171() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_592() {
    if (jj_3R_689()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_847() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_884()) {
    jj_scanpos = xsp;
    if (jj_3R_885()) {
    jj_scanpos = xsp;
    if (jj_3R_886()) {
    jj_scanpos = xsp;
    if (jj_3R_887()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_37() {
    if (jj_3R_169()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_817() {
    if (jj_3R_780()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_414() {
    if (jj_3R_578()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_409() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_10()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_575()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_716() {
    if (jj_3R_778()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_629() {
    if (jj_scan_token(215)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_948() {
    if (jj_3R_631()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_941() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_948()) {
    jj_scanpos = xsp;
    if (jj_3R_949()) {
    jj_scanpos = xsp;
    if (jj_3R_950()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_821() {
    if (jj_3R_845()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_826() {
    if (jj_scan_token(SUPERTYPE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_850()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_270() {
    if (jj_scan_token(SELECT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_414()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_782() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_821()) {
    jj_scanpos = xsp;
    if (jj_3R_822()) {
    jj_scanpos = xsp;
    if (jj_3R_823()) {
    jj_scanpos = xsp;
    if (jj_3R_824()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_215() {
    if (jj_3R_328()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_956() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_202()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_679() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_628() {
    if (jj_scan_token(EQ)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_21() {
    if (jj_3R_181()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_689() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_71() {
    if (jj_3R_232()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_9() {
    if (jj_3R_171()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_539() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_627() {
    if (jj_scan_token(NE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_742() {
    if (jj_3R_801()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_741() {
    if (jj_3R_735()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_717() {
    if (jj_3R_779()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_671() {
    if (jj_scan_token(BINARY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_742()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_242() {
    if (jj_3R_384()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_772() {
    if (jj_scan_token(UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_926() {
    if (jj_scan_token(UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_670() {
    if (jj_scan_token(SET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_741()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_593()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_715() {
    if (jj_3R_777()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_905() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_213()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_3() {
    if (jj_3R_165()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_626() {
    if (jj_scan_token(GE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_634() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_715()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_716()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_717()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_691() {
    if (jj_3R_750()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_466() {
    if (jj_scan_token(MINUS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_331() {
    if (jj_scan_token(LIKE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_690() {
    if (jj_3R_165()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_593() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_690()) {
    jj_scanpos = xsp;
    if (jj_3R_691()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_625() {
    if (jj_scan_token(LE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_467() {
    if (jj_scan_token(NOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_925() {
    if (jj_3R_735()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_771() {
    if (jj_3R_767()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_181() {
    if (jj_scan_token(FOR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_269()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_270()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_465() {
    if (jj_scan_token(PLUS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_816() {
    if (jj_3R_780()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_330() {
    if (jj_scan_token(IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_303() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_465()) {
    jj_scanpos = xsp;
    if (jj_3R_466()) {
    jj_scanpos = xsp;
    if (jj_3R_467()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_36() {
    if (jj_3R_200()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_703() {
    if (jj_scan_token(LIST)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_771()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_772()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_650()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_955() {
    if (jj_3R_965()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_900() {
    if (jj_scan_token(LIST)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_925()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_926()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_764()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_624() {
    if (jj_scan_token(GT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_183() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_504() {
    if (jj_3R_342()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_329() {
    if (jj_3R_480()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_216() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_329()) {
    jj_scanpos = xsp;
    if (jj_3R_330()) {
    jj_scanpos = xsp;
    if (jj_3R_331()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_212() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_623() {
    if (jj_scan_token(LT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_480() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_623()) {
    jj_scanpos = xsp;
    if (jj_3R_624()) {
    jj_scanpos = xsp;
    if (jj_3R_625()) {
    jj_scanpos = xsp;
    if (jj_3R_626()) {
    jj_scanpos = xsp;
    if (jj_3R_627()) {
    jj_scanpos = xsp;
    if (jj_3R_628()) {
    jj_scanpos = xsp;
    if (jj_3R_629()) {
    jj_scanpos = xsp;
    if (jj_3R_630()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_942() {
    if (jj_scan_token(AND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_941()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_50() {
    if (jj_3R_213()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_905()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_920() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_364() {
    if (jj_3R_539()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_915() {
    if (jj_3R_941()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_942()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_213() {
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_843() {
    if (jj_scan_token(FIXED)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_897() {
    if (jj_3R_920()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_70() {
    if (jj_3R_231()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_482() {
    if (jj_3R_631()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_50()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_706() {
    if (jj_scan_token(BOOLEAN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_254() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_818() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_842()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_843()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_391() {
    if (jj_3R_550()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_390() {
    if (jj_3R_549()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_389() {
    if (jj_3R_395()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_388() {
    if (jj_3R_548()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_387() {
    if (jj_3R_547()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_20() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OP_AT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_632() {
    if (jj_3R_713()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_930() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_947()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_842() {
    if (jj_3R_780()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_591() {
    if (jj_3R_424()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OP_AT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_386() {
    if (jj_scan_token(PARTITION)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_546()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_778() {
    if (jj_scan_token(WHILE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_489()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_429() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_591()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_592()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_955()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_202()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_956()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_393() {
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_207() {
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_930()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_621() {
    if (jj_3R_712()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_924() {
    if (jj_3R_735()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_65() {
    if (jj_3R_226()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_899() {
    if (jj_scan_token(BAG)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_924()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_764()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_384() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_923() {
    if (jj_scan_token(UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_892() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_170()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_245() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_386()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_387()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_388()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_389()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_390()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_391()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_685() {
    if (jj_3R_184()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_867() {
    if (jj_3R_901()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_784() {
    if (jj_3R_826()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_738() {
    if (jj_3R_735()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_552() {
    if (jj_3R_666()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_916() {
    if (jj_scan_token(ANDOR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_915()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_807() {
    if (jj_3R_839()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_66() {
    if (jj_3R_227()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_65()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_668() {
    if (jj_scan_token(BAG)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_738()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_593()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_631() {
    if (jj_3R_225()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_376() {
    if (jj_3R_542()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_922() {
    if (jj_scan_token(OPTIONAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_890() {
    if (jj_3R_915()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_916()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_235() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_376()) {
    jj_scanpos = xsp;
    if (jj_3_66()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_749() {
    if (jj_3R_420()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_578() {
    if (jj_3R_684()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_685()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_866() {
    if (jj_3R_900()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_819() {
    if (jj_3R_780()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_907() {
    if (jj_scan_token(LE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_688() {
    if (jj_scan_token(BPATH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_749()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_177()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_783() {
    if (jj_3R_825()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_726() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_783()) {
    jj_scanpos = xsp;
    if (jj_3R_784()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_8() {
    if (jj_3R_170()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_892()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_806() {
    if (jj_3R_838()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_395() {
    if (jj_scan_token(WHERE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    if (jj_3R_552()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_552()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_499() {
    if (jj_3R_641()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_921() {
    if (jj_3R_735()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_906() {
    if (jj_scan_token(LT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_872() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_906()) {
    jj_scanpos = xsp;
    if (jj_3R_907()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_865() {
    if (jj_3R_899()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_170() {
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_765() {
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_638() {
    if (jj_3R_722()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_828() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_631()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_871() {
    if (jj_3R_217()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_898() {
    if (jj_scan_token(ARRAY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_921()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_922()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_923()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_764()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_967() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_725() {
    if (jj_3R_782()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_35() {
    if (jj_3R_198()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_199()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_341() {
    if (jj_scan_token(BIT_OR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_489()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_873() {
    if (jj_3R_217()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_856() {
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_403() {
    if (jj_3R_574()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_8()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_805() {
    if (jj_3R_837()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_827() {
    if (jj_scan_token(CONNOTATIONAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_874() {
    if (jj_3R_217()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_506() {
    if (jj_3R_631()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_83() {
    if (jj_3R_224()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_28() {
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_192() {
    if (jj_3R_199()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_35()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_646() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_83()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_224()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_864() {
    if (jj_3R_898()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_496() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_637()) {
    jj_scanpos = xsp;
    if (jj_3R_638()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_637() {
    if (jj_3R_721()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_674() {
    if (jj_scan_token(LOGICAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_957() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_28()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_967()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_785() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_827()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SUBTYPE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_631()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_828()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_973() {
    if (jj_3R_546()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_838() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_864()) {
    jj_scanpos = xsp;
    if (jj_3R_865()) {
    jj_scanpos = xsp;
    if (jj_3R_866()) {
    jj_scanpos = xsp;
    if (jj_3R_867()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_917() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_943()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_832() {
    if (jj_3R_476()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_220() {
    if (jj_scan_token(LBRACE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_340()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_341()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_420() {
    if (jj_3R_583()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_804() {
    if (jj_3R_836()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_246() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_392()) {
    jj_scanpos = xsp;
    if (jj_3R_393()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_392() {
    if (jj_scan_token(SELECT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_551()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_969() {
    if (jj_scan_token(BACKSLASH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_973()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_759() {
    if (jj_scan_token(UNKNOWN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_750() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_804()) {
    jj_scanpos = xsp;
    if (jj_3R_805()) {
    jj_scanpos = xsp;
    if (jj_3R_806()) {
    jj_scanpos = xsp;
    if (jj_3R_807()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_164() {
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_917()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_423() {
    if (jj_3R_587()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_774() {
    if (jj_3R_818()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_705() {
    if (jj_scan_token(BINARY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_774()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_430() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_957()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_831() {
    if (jj_3R_477()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_758() {
    if (jj_scan_token(TRUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_369() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_497() {
    if (jj_3R_639()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_45() {
    if (jj_3R_208()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_546() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_684() {
    if (jj_3R_588()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_775() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_819()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_483() {
    if (jj_scan_token(LBRACE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_871()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_872()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_873()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_872()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_874()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_288() {
    if (jj_3R_430()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_461() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_7() {
    if (jj_3R_169()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_757() {
    if (jj_scan_token(FALSE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_82() {
    if (jj_3R_247()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_724() {
    if (jj_3R_208()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_710() {
    if (jj_scan_token(REAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_775()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_695() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_757()) {
    jj_scanpos = xsp;
    if (jj_3R_758()) {
    jj_scanpos = xsp;
    if (jj_3R_759()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_609() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_7()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_410()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_650() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_724()) {
    jj_scanpos = xsp;
    if (jj_3R_725()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_424() {
    if (jj_3R_588()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_410() {
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_763() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_590()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_830() {
    if (jj_3R_782()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_243() {
    if (jj_3R_224()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_394() {
    if (jj_scan_token(PARTITION)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_546()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_287() {
    if (jj_3R_429()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_588() {
    if (jj_3R_268()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_796() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_830()) {
    jj_scanpos = xsp;
    if (jj_3R_831()) {
    jj_scanpos = xsp;
    if (jj_3R_832()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_49() {
    if (jj_3R_212()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_247() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_394()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_395()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_224() {
    if (jj_3R_214()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_286() {
    if (jj_3R_428()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_666() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_49()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_489()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_491() {
    if (jj_3R_634()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_342() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_664() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_214() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_285() {
    if (jj_3R_427()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_707() {
    if (jj_scan_token(INTEGER)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_206() {
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_699() {
    if (jj_3R_590()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_763()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_764()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_765()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_284() {
    if (jj_3R_426()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_283() {
    if (jj_3R_425()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_605() {
    if (jj_3R_699()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_550() {
    if (jj_scan_token(ORDERED_BY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_664()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_30() {
    if (jj_3R_190()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_850() {
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_890()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_282() {
    if (jj_3R_424()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_470() {
    if (jj_scan_token(LOCAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    if (jj_3R_605()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_605()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(END_LOCAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_490() {
    if (jj_3R_633()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_281() {
    if (jj_3R_423()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_603() {
    if (jj_3R_696()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_602() {
    if (jj_scan_token(REAL_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_280() {
    if (jj_3R_419()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_343() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_490()) {
    jj_scanpos = xsp;
    if (jj_3R_491()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_601() {
    if (jj_3R_695()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_81() {
    if (jj_3R_245()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_246()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_600() {
    if (jj_scan_token(INTEGER_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_964() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_890()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_279() {
    if (jj_3R_422()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_599() {
    if (jj_scan_token(BINARY_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_464() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_599()) {
    jj_scanpos = xsp;
    if (jj_3R_600()) {
    jj_scanpos = xsp;
    if (jj_3R_601()) {
    jj_scanpos = xsp;
    if (jj_3R_602()) {
    jj_scanpos = xsp;
    if (jj_3R_603()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_278() {
    if (jj_3R_421()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_952() {
    if (jj_scan_token(ONEOF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_890()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_964()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_770() {
    if (jj_3R_767()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_277() {
    if (jj_3R_420()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_484() {
    if (jj_scan_token(QUERY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_647()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(214)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_875()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(BIT_OR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_489()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_27() {
    if (jj_3R_188()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_702() {
    if (jj_scan_token(BAG)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_770()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_650()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_781() {
    if (jj_3R_498()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_276() {
    if (jj_3R_188()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_722() {
    if (jj_scan_token(BPATH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_781()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_220()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_29() {
    if (jj_3R_189()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_633() {
    if (jj_scan_token(EACH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_647()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_714()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(INDEXING)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_647()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_786() {
    if (jj_scan_token(SELECT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_551()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_349() {
    if (jj_3R_497()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_946() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_870()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_780() {
    if (jj_3R_217()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_348() {
    if (jj_3R_496()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_347() {
    if (jj_3R_495()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_652() {
    if (jj_3R_245()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_346() {
    if (jj_3R_494()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_415() {
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_420()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_945() {
    if (jj_3R_951()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_651() {
    if (jj_3R_726()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_345() {
    if (jj_3R_493()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_226() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_345()) {
    jj_scanpos = xsp;
    if (jj_3R_346()) {
    jj_scanpos = xsp;
    if (jj_3R_347()) {
    jj_scanpos = xsp;
    if (jj_3R_348()) {
    jj_scanpos = xsp;
    if (jj_3R_349()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_185() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_276()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isAttributeRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_277()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isConstantRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_278()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isFunctionCall();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_279()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isViewAttributeRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_280()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isSourceParameterRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_281()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isTargetParameterRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_282()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isViewCall();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_283()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isParameterRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_284()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isVariableRefX();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_285()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isPopulation();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_286()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isMapCall();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_287()) {
    jj_scanpos = xsp;
    if (jj_3R_288()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_583() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_776() {
    if (jj_3R_818()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_944() {
    if (jj_3R_574()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_928() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_944()) {
    jj_scanpos = xsp;
    if (jj_3R_945()) {
    jj_scanpos = xsp;
    if (jj_3R_946()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_809() {
    if (jj_scan_token(SUPERTYPE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_841()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_711() {
    if (jj_scan_token(STRING)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_776()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_959() {
    if (jj_3R_968()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_310() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_709() {
    if (jj_scan_token(NUMBER)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_740() {
    if (jj_scan_token(UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_540() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_650()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_651()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_245()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_652()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_239() {
    if (jj_3R_226()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_793() {
    if (jj_scan_token(ENCODED_STRING_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_643() {
    if (jj_3R_364()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_731() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_794()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_187() {
    if (jj_3R_290()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_787() {
    if (jj_3R_247()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_786()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_727() {
    if (jj_3R_785()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_247()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_786()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_787()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3_75() {
    if (jj_3R_238()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_239()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_371() {
    if (jj_3R_541()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_655() {
    if (jj_3R_728()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_186() {
    if (jj_3R_289()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_792() {
    if (jj_scan_token(SIMPLE_STRING_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_788() {
    if (jj_3R_245()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_786()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_739() {
    if (jj_3R_735()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_26() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_186()) {
    jj_scanpos = xsp;
    if (jj_3R_187()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_970() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_244()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_64() {
    if (jj_3R_225()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_730() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_792()) {
    jj_scanpos = xsp;
    if (jj_3R_793()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_495() {
    if (jj_scan_token(LBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_636()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_731()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_728() {
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_245()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_786()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_788()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_669() {
    if (jj_scan_token(LIST)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_739()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_740()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_593()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_642() {
    if (jj_3R_363()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_654() {
    if (jj_3R_727()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_653() {
    if (jj_3R_726()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_794() {
    if (jj_3R_720()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_80() {
    if (jj_3R_244()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_970()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_169() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_636() {
    if (jj_3R_720()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_370() {
    if (jj_3R_540()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_57() {
    if (jj_3R_220()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_644() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_820() {
    if (jj_scan_token(BY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_844()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_929() {
    if (jj_scan_token(AND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_928()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_720() {
    if (jj_3R_780()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_829() {
    if (jj_3R_220()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_500() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_642()) {
    jj_scanpos = xsp;
    if (jj_3R_643()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_959()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_902() {
    if (jj_3R_928()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_929()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_879() {
    if (jj_3R_909()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_661() {
    if (jj_3R_732()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_541() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_653()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_654()) {
    jj_scanpos = xsp;
    if (jj_3R_655()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_881() {
    if (jj_scan_token(ELSE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_960() {
    if (jj_3R_969()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_878() {
    if (jj_3R_908()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_617() {
    if (jj_3R_708()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_547() {
    if (jj_scan_token(FROM)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    if (jj_3R_661()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_661()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_732() {
    if (jj_3R_644()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_340()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_231() {
    if (jj_scan_token(VIEW)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_369()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_370()) {
    jj_scanpos = xsp;
    if (jj_3R_371()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(END_VIEW)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_486() {
    if (jj_scan_token(FOR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_878()) {
    jj_scanpos = xsp;
    if (jj_3R_879()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_721() {
    if (jj_scan_token(FPATH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_498()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_829()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_79() {
    if (jj_3R_243()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_503() {
    if (jj_3R_646()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_960()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3_80()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_616() {
    if (jj_3R_707()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_712() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_620() {
    if (jj_3R_711()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_777() {
    if (jj_3R_647()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_816()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(TO)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_817()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_820()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_714() {
    if (jj_3R_501()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_498()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_665() {
    if (jj_3R_734()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_551() {
    Token xsp;
    if (jj_3R_665()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_665()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_894() {
    if (jj_scan_token(LE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_477() {
    if (jj_3R_621()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_383() {
    if (jj_scan_token(213)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_893() {
    if (jj_scan_token(LT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_852() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_893()) {
    jj_scanpos = xsp;
    if (jj_3R_894()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_382() {
    if (jj_scan_token(AND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_381() {
    if (jj_scan_token(MOD)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_844() {
    if (jj_3R_780()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_380() {
    if (jj_scan_token(DIV)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_379() {
    if (jj_scan_token(SLASH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_615() {
    if (jj_3R_706()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_619() {
    if (jj_3R_710()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_639() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_880() {
    if (jj_scan_token(ELSIF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_489()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_851() {
    if (jj_3R_174()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_798() {
    if (jj_scan_token(OPTIONAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_834() {
    if (jj_scan_token(FIXED)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_853() {
    if (jj_3R_174()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_943() {
    if (jj_3R_748()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_498() {
    if (jj_3R_640()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_573() {
    if (jj_scan_token(216)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_854() {
    if (jj_3R_174()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_752() {
    if (jj_3R_809()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_903() {
    if (jj_scan_token(ANDOR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_902()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_378() {
    if (jj_scan_token(STAR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_240() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_378()) {
    jj_scanpos = xsp;
    if (jj_3R_379()) {
    jj_scanpos = xsp;
    if (jj_3R_380()) {
    jj_scanpos = xsp;
    if (jj_3R_381()) {
    jj_scanpos = xsp;
    if (jj_3R_382()) {
    jj_scanpos = xsp;
    if (jj_3R_383()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_614() {
    if (jj_3R_705()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_618() {
    if (jj_3R_709()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_682() {
    if (jj_3R_746()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_572() {
    if (jj_scan_token(215)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_801() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_833()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_834()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_476() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_614()) {
    jj_scanpos = xsp;
    if (jj_3R_615()) {
    jj_scanpos = xsp;
    if (jj_3R_616()) {
    jj_scanpos = xsp;
    if (jj_3R_617()) {
    jj_scanpos = xsp;
    if (jj_3R_618()) {
    jj_scanpos = xsp;
    if (jj_3R_619()) {
    jj_scanpos = xsp;
    if (jj_3R_620()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_870() {
    if (jj_3R_902()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_903()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_734() {
    if (jj_3R_639()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_798()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3_79()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_650()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_319() {
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_404() {
    if (jj_scan_token(LBRACE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_851()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_852()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_853()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_852()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_854()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_833() {
    if (jj_3R_748()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_571() {
    if (jj_scan_token(EQ)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_58() {
    if (jj_3R_221()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_487() {
    if (jj_scan_token(IF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_489()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(THEN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_880()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    xsp = jj_scanpos;
    if (jj_3R_881()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(END_IF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_746() {
    if (jj_scan_token(WHILE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_410()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_737() {
    if (jj_scan_token(UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_493() {
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_498()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_16() {
    if (jj_3R_178()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_751() {
    if (jj_3R_808()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_692() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_751()) {
    jj_scanpos = xsp;
    if (jj_3R_752()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_663() {
    if (jj_3R_221()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_63() {
    if (jj_3R_224()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_570() {
    if (jj_scan_token(NE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_683() {
    if (jj_3R_747()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_222() {
    if (jj_3R_342()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_647() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_953() {
    if (jj_3R_178()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_474() {
    if (jj_3R_609()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_59() {
    if (jj_3R_222()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_221() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_59()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_640() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_413() {
    if (jj_3R_577()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_681() {
    if (jj_3R_745()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_569() {
    if (jj_scan_token(GE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_549() {
    if (jj_scan_token(IDENTIFIED_BY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    if (jj_3R_663()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_663()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_649() {
    if (jj_3R_723()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_577() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_681()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_682()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_683()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_492() {
    if (jj_3R_635()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_811() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_574()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_736() {
    if (jj_scan_token(OPTIONAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_586() {
    if (jj_3R_290()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_257() {
    if (jj_scan_token(LIKE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_909() {
    if (jj_3R_634()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_568() {
    if (jj_scan_token(LE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_344() {
    if (jj_scan_token(SELECT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_492()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3_73() {
    if (jj_3R_235()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_237() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_256() {
    if (jj_scan_token(IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_62() {
    if (jj_3R_223()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_723() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_236() {
    if (jj_3R_377()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_810() {
    if (jj_scan_token(CONNOTATIONAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_567() {
    if (jj_scan_token(GT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_673() {
    if (jj_scan_token(INTEGER)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_15() {
    if (jj_3R_177()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_255() {
    if (jj_3R_401()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_667() {
    if (jj_scan_token(ARRAY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_735()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_736()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_737()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_593()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_173() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_255()) {
    jj_scanpos = xsp;
    if (jj_3R_256()) {
    jj_scanpos = xsp;
    if (jj_3R_257()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_585() {
    if (jj_3R_289()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_74() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_236()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_237()) {
    jj_scanpos = xsp;
    if (jj_3_73()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_339() {
    if (jj_3R_488()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_338() {
    if (jj_3R_487()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_337() {
    if (jj_3R_486()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_556() {
    if (jj_3R_670()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_336() {
    if (jj_3R_485()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_753() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_810()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SUBTYPE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_574()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_811()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_335() {
    if (jj_3R_484()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_812() {
    if (jj_3R_177()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_412() {
    if (jj_3R_576()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_334() {
    if (jj_3R_483()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_333() {
    if (jj_3R_482()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_779() {
    if (jj_scan_token(UNTIL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_489()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_422() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_585()) {
    jj_scanpos = xsp;
    if (jj_3R_586()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_953()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_566() {
    if (jj_scan_token(LT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_332() {
    if (jj_3R_481()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_932() {
    if (jj_3R_395()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_401() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_566()) {
    jj_scanpos = xsp;
    if (jj_3R_567()) {
    jj_scanpos = xsp;
    if (jj_3R_568()) {
    jj_scanpos = xsp;
    if (jj_3R_569()) {
    jj_scanpos = xsp;
    if (jj_3R_570()) {
    jj_scanpos = xsp;
    if (jj_3R_571()) {
    jj_scanpos = xsp;
    if (jj_3R_572()) {
    jj_scanpos = xsp;
    if (jj_3R_573()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_321() {
    if (jj_scan_token(WHERE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    if (jj_3R_474()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_474()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_962() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_244()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_859() {
    if (jj_3R_896()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_494() {
    if (jj_scan_token(BACKSLASH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_631()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_604() {
    if (jj_3R_698()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_269() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_412()) {
    jj_scanpos = xsp;
    if (jj_3R_413()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_24() {
    if (jj_3R_184()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_555() {
    if (jj_3R_669()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_42() {
    if (jj_3R_182()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_858() {
    if (jj_3R_895()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_469() {
    if (jj_scan_token(FROM)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    if (jj_3R_604()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_604()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_589() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_42()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_182()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_888() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_910()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_219() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_332()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isEntityConstructor();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_333()) {
    jj_scanpos = xsp;
    if (jj_3R_334()) {
    jj_scanpos = xsp;
    if (jj_3R_335()) {
    jj_scanpos = xsp;
    if (jj_3R_336()) {
    jj_scanpos = xsp;
    if (jj_3R_337()) {
    jj_scanpos = xsp;
    if (jj_3R_338()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isEnumerationReference();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_339()) {
    jj_scanpos = xsp;
    if (jj_3_74()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_6() {
    if (jj_3R_168()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_407() {
    if (jj_scan_token(FOR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_858()) {
    jj_scanpos = xsp;
    if (jj_3R_859()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_78() {
    if (jj_3R_212()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_320() {
    if (jj_scan_token(PARTITION)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_468()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_908() {
    if (jj_scan_token(EACH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_647()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_932()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_848() {
    if (jj_scan_token(GENERIC)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_888()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_687() {
    if (jj_scan_token(FPATH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_420()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_812()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_554() {
    if (jj_3R_668()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_205() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_320()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_321()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_584() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_318() {
    if (jj_scan_token(SELECT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_473()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_204() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_318()) {
    jj_scanpos = xsp;
    if (jj_3R_319()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_25() {
    if (jj_3R_185()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_24()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_302() {
    if (jj_3R_464()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_193() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_302()) {
    jj_scanpos = xsp;
    if (jj_3_25()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_295() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_553() {
    if (jj_3R_667()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_882() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_910()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_802() {
    if (jj_3R_748()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_396() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_553()) {
    jj_scanpos = xsp;
    if (jj_3R_554()) {
    jj_scanpos = xsp;
    if (jj_3R_555()) {
    jj_scanpos = xsp;
    if (jj_3R_556()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_56() {
    if (jj_scan_token(STARS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_219()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_581() {
    if (jj_3R_688()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_41() {
    if (jj_3R_205()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_267() {
    if (jj_scan_token(BIT_OR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_410()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_428() {
    if (jj_3R_574()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_544() {
    if (jj_scan_token(MINUS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_845() {
    if (jj_scan_token(GENERIC_ENTITY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_882()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_241() {
    if (jj_3R_219()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_56()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_961() {
    if (jj_3R_969()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_545() {
    if (jj_scan_token(NOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_418() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_580()) {
    jj_scanpos = xsp;
    if (jj_3R_581()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_580() {
    if (jj_3R_687()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_543() {
    if (jj_scan_token(PLUS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_385() {
    if (jj_scan_token(OP_UNDERSCORE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_377() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_543()) {
    jj_scanpos = xsp;
    if (jj_3R_544()) {
    jj_scanpos = xsp;
    if (jj_3R_545()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_841() {
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_870()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_55() {
    if (jj_3R_214()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_411() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_163()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_177() {
    if (jj_scan_token(LBRACE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_266()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_267()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_77() {
    if (jj_3R_242()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_340() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_55()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_214()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_576() {
    if (jj_scan_token(EACH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_590()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_680()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(INDEXING)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_590()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_965() {
    if (jj_scan_token(BACKSLASH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_972()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_244() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_54()) {
    jj_scanpos = xsp;
    if (jj_3R_385()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_54() {
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_61() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OP_AT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_815() {
    if (jj_3R_397()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_48() {
    if (jj_3R_211()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_863() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_897()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_697() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_762()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_468() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_933() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_641() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_837() {
    if (jj_scan_token(AGGREGATE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_863()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_764()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_814() {
    if (jj_3R_398()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_910() {
    if (jj_3R_933()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_417() {
    if (jj_scan_token(LBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_579()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_697()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_72() {
    if (jj_3R_233()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_234()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_896() {
    if (jj_3R_577()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_60() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OP_AT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_855() {
    if (jj_3R_174()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_328() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_803() {
    if (jj_scan_token(BY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_835()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_762() {
    if (jj_3R_686()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_648() {
    if (jj_3R_502()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OP_AT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_813() {
    if (jj_3R_750()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_217() {
    if (jj_3R_234()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_72()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_301() {
    if (jj_scan_token(XOR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_300() {
    if (jj_scan_token(OR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_764() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_813()) {
    jj_scanpos = xsp;
    if (jj_3R_814()) {
    jj_scanpos = xsp;
    if (jj_3R_815()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_299() {
    if (jj_scan_token(MINUS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_891() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_164()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_250() {
    if (jj_3R_398()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_579() {
    if (jj_3R_686()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_2() {
    if (jj_3R_164()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_891()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3_40() {
    if (jj_3R_203()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_204()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_507() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_648()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_649()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_961()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_244()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_962()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_769() {
    if (jj_scan_token(UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_402() {
    if (jj_scan_token(LBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_2()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_919() {
    if (jj_3R_321()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_686() {
    if (jj_3R_748()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_53() {
    if (jj_3R_216()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_217()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_268() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_607() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_298() {
    if (jj_scan_token(PLUS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_249() {
    if (jj_3R_397()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_191() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_298()) {
    jj_scanpos = xsp;
    if (jj_3R_299()) {
    jj_scanpos = xsp;
    if (jj_3R_300()) {
    jj_scanpos = xsp;
    if (jj_3R_301()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_869() {
    if (jj_3R_841()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_940() {
    if (jj_3R_767()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_768() {
    if (jj_scan_token(OPTIONAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_1() {
    if (jj_3R_163()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_411()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3_5() {
    if (jj_3R_167()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_163() {
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_971() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_857() {
    if (jj_scan_token(OTHERWISE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_914() {
    if (jj_scan_token(SET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_940()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_796()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_797() {
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_218() {
    if (jj_3R_217()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_53()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_178() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_1()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_472() {
    if (jj_scan_token(ORDERED_BY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_607()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_719() {
    if (jj_3R_226()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_745() {
    if (jj_3R_590()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_799()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(TO)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_800()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_803()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_248() {
    if (jj_3R_396()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_69() {
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_165() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_248()) {
    jj_scanpos = xsp;
    if (jj_3R_249()) {
    jj_scanpos = xsp;
    if (jj_3R_250()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_4() {
    if (jj_3R_166()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_963() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_69()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_971()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_744() {
    if (jj_3R_801()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_918() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_251()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_840() {
    if (jj_scan_token(SUPERTYPE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_869()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_677() {
    if (jj_scan_token(STRING)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_744()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_251() {
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_701() {
    if (jj_scan_token(ARRAY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_767()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_768()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_769()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_650()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_835() {
    if (jj_3R_748()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_743() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_802()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_232() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_613() {
    if (jj_3R_704()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_754() {
    if (jj_scan_token(SELECT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_473()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_166() {
    if (jj_3R_251()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_918()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_808() {
    if (jj_scan_token(ABSTRACT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_840()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_895() {
    if (jj_scan_token(EACH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_590()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_919()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_676() {
    if (jj_scan_token(REAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_743()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_595() {
    if (jj_3R_203()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_197() {
    if (jj_3R_184()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_761() {
    if (jj_scan_token(ENCODED_STRING_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_635() {
    if (jj_3R_718()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_719()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_406() {
    if (jj_scan_token(CASE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_856()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_4()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    xsp = jj_scanpos;
    if (jj_3R_857()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(END_CASE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_508() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_963()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_594() {
    if (jj_3R_692()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_958() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_870()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_167() {
    if (jj_3R_251()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_14() {
    if (jj_scan_token(STARS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_176()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_34() {
    if (jj_3R_196()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_197()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_238() {
    if (jj_3R_214()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_427() {
    if (jj_3R_590()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_612() {
    if (jj_3R_703()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_760() {
    if (jj_scan_token(SIMPLE_STRING_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_773() {
    if (jj_3R_767()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_861() {
    if (jj_scan_token(ELSE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_199() {
    if (jj_3R_176()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_14()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_696() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_760()) {
    jj_scanpos = xsp;
    if (jj_3R_761()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_362() {
    if (jj_3R_508()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_860() {
    if (jj_scan_token(ELSIF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_410()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_460() {
    if (jj_scan_token(VALUE_UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_459() {
    if (jj_scan_token(VALUE_IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_704() {
    if (jj_scan_token(SET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_773()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_650()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_458() {
    if (jj_scan_token(VALUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_18() {
    if (jj_3R_179()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_457() {
    if (jj_scan_token(USEDIN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_456() {
    if (jj_scan_token(TYPEOF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_455() {
    if (jj_scan_token(TAN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_951() {
    if (jj_scan_token(ONEOF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_870()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_958()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_454() {
    if (jj_scan_token(SQRT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_453() {
    if (jj_scan_token(SIZEOF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_452() {
    if (jj_scan_token(SIN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_311() {
    if (jj_scan_token(OP_UNDERSCORE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_408() {
    if (jj_scan_token(IF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_410()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(THEN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_860()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    xsp = jj_scanpos;
    if (jj_3R_861()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(END_IF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_611() {
    if (jj_3R_702()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_451() {
    if (jj_scan_token(ROLESOF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_13() {
    if (jj_3R_171()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_450() {
    if (jj_scan_token(ODD)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_449() {
    if (jj_scan_token(NVL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_266() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_13()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_171()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_448() {
    if (jj_scan_token(LOG10)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_606() {
    if (jj_3R_179()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_447() {
    if (jj_scan_token(LOG2)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_446() {
    if (jj_scan_token(LOG)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_445() {
    if (jj_scan_token(LOINDEX)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_444() {
    if (jj_scan_token(LOBOUND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_180() {
    if (jj_3R_268()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_443() {
    if (jj_scan_token(LENGTH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_442() {
    if (jj_scan_token(HIINDEX)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_441() {
    if (jj_scan_token(HIBOUND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_440() {
    if (jj_scan_token(FORMAT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_19() {
    if (jj_3R_180()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_439() {
    if (jj_scan_token(EXP)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_438() {
    if (jj_scan_token(EXTENT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_437() {
    if (jj_scan_token(EXISTS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_12() {
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_202() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_12()) {
    jj_scanpos = xsp;
    if (jj_3R_311()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_179() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_19()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_462() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_593()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_594()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_203()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RETURN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_595()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_436() {
    if (jj_scan_token(COS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_361() {
    if (jj_3R_507()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_172() {
    if (jj_3R_254()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_435() {
    if (jj_scan_token(BLENGTH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_708() {
    if (jj_scan_token(LOGICAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_434() {
    if (jj_scan_token(ATAN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_587() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_433() {
    if (jj_scan_token(ASIN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_431() {
    if (jj_scan_token(ABS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_432() {
    if (jj_scan_token(ACOS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_289() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_431()) {
    jj_scanpos = xsp;
    if (jj_3R_432()) {
    jj_scanpos = xsp;
    if (jj_3R_433()) {
    jj_scanpos = xsp;
    if (jj_3R_434()) {
    jj_scanpos = xsp;
    if (jj_3R_435()) {
    jj_scanpos = xsp;
    if (jj_3R_436()) {
    jj_scanpos = xsp;
    if (jj_3R_437()) {
    jj_scanpos = xsp;
    if (jj_3R_438()) {
    jj_scanpos = xsp;
    if (jj_3R_439()) {
    jj_scanpos = xsp;
    if (jj_3R_440()) {
    jj_scanpos = xsp;
    if (jj_3R_441()) {
    jj_scanpos = xsp;
    if (jj_3R_442()) {
    jj_scanpos = xsp;
    if (jj_3R_443()) {
    jj_scanpos = xsp;
    if (jj_3R_444()) {
    jj_scanpos = xsp;
    if (jj_3R_445()) {
    jj_scanpos = xsp;
    if (jj_3R_446()) {
    jj_scanpos = xsp;
    if (jj_3R_447()) {
    jj_scanpos = xsp;
    if (jj_3R_448()) {
    jj_scanpos = xsp;
    if (jj_3R_449()) {
    jj_scanpos = xsp;
    if (jj_3R_450()) {
    jj_scanpos = xsp;
    if (jj_3R_451()) {
    jj_scanpos = xsp;
    if (jj_3R_452()) {
    jj_scanpos = xsp;
    if (jj_3R_453()) {
    jj_scanpos = xsp;
    if (jj_3R_454()) {
    jj_scanpos = xsp;
    if (jj_3R_455()) {
    jj_scanpos = xsp;
    if (jj_3R_456()) {
    jj_scanpos = xsp;
    if (jj_3R_457()) {
    jj_scanpos = xsp;
    if (jj_3R_458()) {
    jj_scanpos = xsp;
    if (jj_3R_459()) {
    jj_scanpos = xsp;
    if (jj_3R_460()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_471() {
    if (jj_scan_token(IDENTIFIED_BY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    if (jj_3R_606()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_606()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_610() {
    if (jj_3R_701()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_755() {
    if (jj_3R_205()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_754()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_475() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_610()) {
    jj_scanpos = xsp;
    if (jj_3R_611()) {
    jj_scanpos = xsp;
    if (jj_3R_612()) {
    jj_scanpos = xsp;
    if (jj_3R_613()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_360() {
    if (jj_3R_506()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_693() {
    if (jj_3R_753()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_205()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_754()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_755()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_294() {
    if (jj_scan_token(HOOK)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_11() {
    if (jj_3R_173()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_174()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_791() {
    if (jj_scan_token(UNKNOWN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_297() {
    if (jj_3R_463()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_748() {
    if (jj_3R_174()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_598() {
    if (jj_3R_694()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_47() {
    if (jj_3R_210()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_560() {
    if (jj_3R_674()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_756() {
    if (jj_3R_203()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_754()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_416() {
    if (jj_scan_token(BACKSLASH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_574()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_200() {
    if (jj_3R_310()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_293() {
    if (jj_scan_token(SELF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_877() {
    if (jj_scan_token(OTHERWISE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_966() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_202()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_795() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_647()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_790() {
    if (jj_scan_token(TRUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_175() {
    if (jj_3R_174()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_11()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_694() {
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_203()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_754()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_756()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_292() {
    if (jj_scan_token(PI)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_359() {
    if (jj_3R_505()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_868() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_897()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_789() {
    if (jj_scan_token(FALSE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_698() {
    if (jj_3R_587()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_266()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_597() {
    if (jj_3R_693()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_291() {
    if (jj_scan_token(CONST_E)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_188() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_291()) {
    jj_scanpos = xsp;
    if (jj_3R_292()) {
    jj_scanpos = xsp;
    if (jj_3R_293()) {
    jj_scanpos = xsp;
    if (jj_3R_294()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_596() {
    if (jj_3R_692()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_729() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_789()) {
    jj_scanpos = xsp;
    if (jj_3R_790()) {
    jj_scanpos = xsp;
    if (jj_3R_791()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_559() {
    if (jj_3R_673()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_939() {
    if (jj_scan_token(UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_563() {
    if (jj_3R_677()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_39() {
    if (jj_3R_202()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_966()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_358() {
    if (jj_3R_504()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_426() {
    if (jj_3R_268()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_839() {
    if (jj_scan_token(GENERIC)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_868()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_405() {
    if (jj_scan_token(QUERY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_590()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(214)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_855()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(BIT_OR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_410()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_357() {
    if (jj_3R_503()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_76() {
    if (jj_3R_240()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_241()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_296() {
    if (jj_3R_462()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_680() {
    if (jj_3R_426()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_420()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_489() {
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_931() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_325()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_356() {
    if (jj_3R_502()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_234() {
    if (jj_3R_241()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_76()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3_46() {
    if (jj_3R_209()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_735() {
    if (jj_scan_token(LBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_799()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_800()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_325() {
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_290() {
    if (jj_3R_461()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_558() {
    if (jj_3R_672()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_562() {
    if (jj_3R_676()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_675() {
    if (jj_scan_token(NUMBER)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_355() {
    if (jj_3R_501()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_275() {
    if (jj_3R_419()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_274() {
    if (jj_3R_418()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_938() {
    if (jj_3R_767()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_209() {
    if (jj_3R_325()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_931()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_273() {
    if (jj_3R_417()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_862() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_897()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_272() {
    if (jj_3R_416()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_354() {
    if (jj_3R_497()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_463() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_596()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_597()) {
    jj_scanpos = xsp;
    if (jj_3R_598()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_575() {
    if (jj_3R_679()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_271() {
    if (jj_3R_415()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_913() {
    if (jj_scan_token(LIST)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_938()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_939()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_796()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_184() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_271()) {
    jj_scanpos = xsp;
    if (jj_3R_272()) {
    jj_scanpos = xsp;
    if (jj_3R_273()) {
    jj_scanpos = xsp;
    if (jj_3R_274()) {
    jj_scanpos = xsp;
    if (jj_3R_275()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_485() {
    if (jj_scan_token(CASE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_876()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_46()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    xsp = jj_scanpos;
    if (jj_3R_877()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(END_CASE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_954() {
    if (jj_3R_965()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_557() {
    if (jj_3R_671()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_561() {
    if (jj_3R_675()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_800() {
    if (jj_3R_748()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_353() {
    if (jj_3R_500()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_501() {
    if (jj_3R_644()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_836() {
    if (jj_scan_token(GENERIC_ENTITY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_862()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_397() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_557()) {
    jj_scanpos = xsp;
    if (jj_3R_558()) {
    jj_scanpos = xsp;
    if (jj_3R_559()) {
    jj_scanpos = xsp;
    if (jj_3R_560()) {
    jj_scanpos = xsp;
    if (jj_3R_561()) {
    jj_scanpos = xsp;
    if (jj_3R_562()) {
    jj_scanpos = xsp;
    if (jj_3R_563()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_622() {
    if (jj_scan_token(BASED_ON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_189() {
    if (jj_scan_token(VIEW)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_295()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_296()) {
    jj_scanpos = xsp;
    if (jj_3R_297()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(END_VIEW)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_210() {
    if (jj_3R_325()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_883() {
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_910()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_974() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_206()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_23() {
    if (jj_3R_183()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_352() {
    if (jj_3R_499()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_564() {
    if (jj_3R_678()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_38() {
    if (jj_3R_201()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_846() {
    if (jj_scan_token(AGGREGATE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_883()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_796()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_718() {
    if (jj_3R_645()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_425() {
    if (jj_3R_589()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_954()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3_39()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_538() {
    if (jj_scan_token(VALUE_UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_733() {
    if (jj_3R_647()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_795()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_796()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_797()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_537() {
    if (jj_scan_token(VALUE_IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_536() {
    if (jj_scan_token(VALUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_799() {
    if (jj_3R_748()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_535() {
    if (jj_scan_token(USEDIN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_534() {
    if (jj_scan_token(TYPEOF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_533() {
    if (jj_scan_token(TAN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_608() {
    if (jj_3R_700()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_532() {
    if (jj_scan_token(SQRT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_531() {
    if (jj_scan_token(SIZEOF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_530() {
    if (jj_scan_token(SIN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_479() {
    if (jj_3R_622()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_351() {
    if (jj_3R_498()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_662() {
    if (jj_3R_733()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_529() {
    if (jj_scan_token(ROLESOF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_528() {
    if (jj_scan_token(ODD)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_473() {
    Token xsp;
    if (jj_3R_608()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_608()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_527() {
    if (jj_scan_token(NVL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_68() {
    if (jj_3R_230()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_526() {
    if (jj_scan_token(LOG10)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_525() {
    if (jj_scan_token(LOG2)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_502() {
    if (jj_3R_645()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_524() {
    if (jj_scan_token(LOG)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_523() {
    if (jj_scan_token(LOINDEX)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_875() {
    if (jj_3R_217()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_522() {
    if (jj_scan_token(LOBOUND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_521() {
    if (jj_scan_token(LENGTH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_520() {
    if (jj_scan_token(HIINDEX)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_519() {
    if (jj_scan_token(HIBOUND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_518() {
    if (jj_scan_token(FORMAT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_517() {
    if (jj_scan_token(EXP)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_548() {
    if (jj_scan_token(LOCAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    if (jj_3R_662()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_662()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(END_LOCAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_350() {
    if (jj_3R_230()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_516() {
    if (jj_scan_token(EXTENT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_515() {
    if (jj_scan_token(EXISTS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_514() {
    if (jj_scan_token(COS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_582() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_513() {
    if (jj_scan_token(BLENGTH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_512() {
    if (jj_scan_token(ATAN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_511() {
    if (jj_scan_token(ASIN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_509() {
    if (jj_scan_token(ABS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_510() {
    if (jj_scan_token(ACOS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_766() {
    if (jj_scan_token(OPTIONAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_363() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_509()) {
    jj_scanpos = xsp;
    if (jj_3R_510()) {
    jj_scanpos = xsp;
    if (jj_3R_511()) {
    jj_scanpos = xsp;
    if (jj_3R_512()) {
    jj_scanpos = xsp;
    if (jj_3R_513()) {
    jj_scanpos = xsp;
    if (jj_3R_514()) {
    jj_scanpos = xsp;
    if (jj_3R_515()) {
    jj_scanpos = xsp;
    if (jj_3R_516()) {
    jj_scanpos = xsp;
    if (jj_3R_517()) {
    jj_scanpos = xsp;
    if (jj_3R_518()) {
    jj_scanpos = xsp;
    if (jj_3R_519()) {
    jj_scanpos = xsp;
    if (jj_3R_520()) {
    jj_scanpos = xsp;
    if (jj_3R_521()) {
    jj_scanpos = xsp;
    if (jj_3R_522()) {
    jj_scanpos = xsp;
    if (jj_3R_523()) {
    jj_scanpos = xsp;
    if (jj_3R_524()) {
    jj_scanpos = xsp;
    if (jj_3R_525()) {
    jj_scanpos = xsp;
    if (jj_3R_526()) {
    jj_scanpos = xsp;
    if (jj_3R_527()) {
    jj_scanpos = xsp;
    if (jj_3R_528()) {
    jj_scanpos = xsp;
    if (jj_3R_529()) {
    jj_scanpos = xsp;
    if (jj_3R_530()) {
    jj_scanpos = xsp;
    if (jj_3R_531()) {
    jj_scanpos = xsp;
    if (jj_3R_532()) {
    jj_scanpos = xsp;
    if (jj_3R_533()) {
    jj_scanpos = xsp;
    if (jj_3R_534()) {
    jj_scanpos = xsp;
    if (jj_3R_535()) {
    jj_scanpos = xsp;
    if (jj_3R_536()) {
    jj_scanpos = xsp;
    if (jj_3R_537()) {
    jj_scanpos = xsp;
    if (jj_3R_538()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_645() {
    if (jj_3R_342()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_660() {
    if (jj_3R_730()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_574() {
    if (jj_3R_183()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_32() {
    if (jj_3R_193()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_904() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_207()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_195() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_565() {
    if (jj_scan_token(BASED_ON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_368() {
    if (jj_scan_token(HOOK)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_659() {
    if (jj_scan_token(REAL_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_194() {
    if (jj_3R_303()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_375() {
    if (jj_scan_token(XOR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_478() {
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_374() {
    if (jj_scan_token(OR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_672() {
    if (jj_scan_token(BOOLEAN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_324() {
    if (jj_3R_477()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_44() {
    if (jj_3R_207()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_904()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_373() {
    if (jj_scan_token(MINUS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_327() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_478()) {
    jj_scanpos = xsp;
    if (jj_3R_479()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_421() {
    if (jj_3R_584()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_700() {
    if (jj_3R_582()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(COLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_766()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3_38()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_593()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_175()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_658() {
    if (jj_3R_729()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_326() {
    if (jj_scan_token(EXTENSIBLE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_211() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_326()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(ENUMERATION)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_327()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_227() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_350()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isAttributeRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_351()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isConstantRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_352()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isFunctionCall();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_353()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isViewAttributeRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_354()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isSourceParameterRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_355()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isTargetParameterRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_356()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isViewCall();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_357()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isParameterRef();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_358()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isVariableRefX();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_359()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isPopulation();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_360()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isMapCall();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_361()) {
    jj_scanpos = xsp;
    if (jj_3R_362()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_33() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_194()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    xsp = jj_scanpos;
    if (jj_3R_195()) {
    jj_scanpos = xsp;
    if (jj_3_32()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_481() {
    if (jj_scan_token(LBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_44()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RBRACKET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_367() {
    if (jj_scan_token(SELF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_265() {
    if (jj_3R_409()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_264() {
    if (jj_3R_408()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_317() {
    if (jj_3R_472()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_263() {
    if (jj_3R_407()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_316() {
    if (jj_3R_471()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_262() {
    if (jj_3R_406()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_315() {
    if (jj_3R_321()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_261() {
    if (jj_3R_405()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_314() {
    if (jj_3R_470()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_260() {
    if (jj_3R_404()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_259() {
    if (jj_3R_403()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_313() {
    if (jj_3R_469()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_258() {
    if (jj_3R_402()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_937() {
    if (jj_3R_767()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_366() {
    if (jj_scan_token(PI)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_52() {
    if (jj_3R_215()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(DOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_372() {
    if (jj_scan_token(PLUS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_927() {
    if (jj_3R_735()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_323() {
    if (jj_3R_476()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_233() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_372()) {
    jj_scanpos = xsp;
    if (jj_3R_373()) {
    jj_scanpos = xsp;
    if (jj_3R_374()) {
    jj_scanpos = xsp;
    if (jj_3R_375()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_876() {
    if (jj_3R_218()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_657() {
    if (jj_scan_token(INTEGER_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_590() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_488() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_52()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_632()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_889() {
    if (jj_3R_850()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_912() {
    if (jj_scan_token(BAG)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_937()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_796()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_901() {
    if (jj_scan_token(SET)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_927()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(OF)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_764()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3_43() {
    if (jj_3R_206()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_974()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  static final private boolean jj_3R_678() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_972() {
    if (jj_3R_468()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_176() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_258()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isEntityConstructor();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_259()) {
    jj_scanpos = xsp;
    if (jj_3R_260()) {
    jj_scanpos = xsp;
    if (jj_3R_261()) {
    jj_scanpos = xsp;
    if (jj_3R_262()) {
    jj_scanpos = xsp;
    if (jj_3R_263()) {
    jj_scanpos = xsp;
    if (jj_3R_264()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = isEnumerationReference();
    lookingAhead = false;
    if (!jj_semLA || jj_3R_265()) {
    jj_scanpos = xsp;
    if (jj_3_33()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_365() {
    if (jj_scan_token(CONST_E)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_230() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_365()) {
    jj_scanpos = xsp;
    if (jj_3R_366()) {
    jj_scanpos = xsp;
    if (jj_3R_367()) {
    jj_scanpos = xsp;
    if (jj_3R_368()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_229() {
    if (jj_3R_364()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_968() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_43()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(RPAREN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_312() {
    if (jj_scan_token(PARTITION)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_468()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(SEMICOLON)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_713() {
    if (jj_scan_token(SIMPLE_ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static final private boolean jj_3R_936() {
    if (jj_scan_token(UNIQUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  static private boolean jj_initialized_once = false;
  static public Compiler2TokenManager token_source;
  static SimpleCharStream jj_input_stream;
  static public Token token, jj_nt;
  static private Token jj_scanpos, jj_lastpos;
  static private int jj_la;
  static public boolean lookingAhead = false;
  static private boolean jj_semLA;
  static private int jj_gen;
  static final private int[] jj_la1 = new int[481];
  static final private int[] jj_la1_0 = {0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x4000000,0x0,0x0,0x0,0x0,0xc2200000,0x800000,0x0,0x0,0xc2200000,0x0,0x0,0x200000,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x0,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x800000,0x800000,0x20000,0x0,0x0,0x200000,0x0,0x0,0x200000,0x200000,0x0,0x200000,0x4000000,0x4000000,0x0,0x0,0x800000,0x800000,0x0,0x0,0x4000000,0x0,0x80,0x0,0x0,0x200000,0x0,0x0,0x200000,0x0,0x0,0x0,0x1000000,0x10000000,0x0,0xc2200000,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0xc0000000,0x0,0x0,0x20000,0x800000,0x0,0x800000,0x0,0x20000,0x0,0x0,0x1000000,0x20000,0x0,0xc2200000,0x20000,0x0,0x1000000,0x20000,0x0,0x0,0x1000000,0x20000,0x0,0x0,0x28000000,0x28000000,0x0,0x0,0x0,0x800000,0x0,0x20000,0x800000,0x1000000,0x80,0x0,0x0,0x0,0x0,0x60000,0x60000,0x80000,0x3ffe0000,0x0,0x3ffe0000,0x3ffe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x1000000,0x0,0x200000,0x0,0x0,0x20000,0x200000,0x80000,0x0,0x0,0x800000,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x1000000,0x200000,0x0,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x20000,0x0,0x0,0x0,0x1000000,0x4800000,0x0,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x4000000,0x0,0x0,0x0,0x0,0xc2200000,0x800000,0x0,0x0,0xc2200000,0x0,0x0,0x200000,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x0,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x20000,0x800000,0x800000,0x20000,0x0,0x0,0x200000,0x0,0x0,0x200000,0x200000,0x0,0x200000,0x4000000,0x4000000,0x0,0x0,0x800000,0x800000,0x0,0x0,0x4000000,0x0,0x80,0x0,0x0,0x200000,0x0,0x0,0x200000,0x0,0x0,0x0,0x1000000,0x10000000,0x0,0xc2200000,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0xc0000000,0x0,0x0,0x20000,0x800000,0x0,0x800000,0x0,0x20000,0x0,0x0,0x1000000,0x20000,0x0,0xc2200000,0x20000,0x0,0x1000000,0x20000,0x0,0x0,0x1000000,0x20000,0x0,0x0,0x28000000,0x28000000,0x0,0x0,0x0,0x800000,0x0,0x20000,0x800000,0x1000000,0x80,0x0,0x0,0x0,0x0,0x60000,0x60000,0x80000,0x0,0x80000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x1000000,0x0,0x200000,0x0,0x0,0x20000,0x200000,0x80000,0x0,0x0,0x800000,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x1000000,0x200000,0x0,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x20000,0x0,0x0,0x0,0x1000000,0x4800000,0x0,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,};
  static final private int[] jj_la1_1 = {0x0,0x0,0xa4400000,0x0,0x60,0x0,0x0,0x4400000,0x0,0x0,0x0,0x400,0x10080000,0x0,0x0,0x400,0x0,0x0,0x0,0x4440000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x43028000,0x0,0x0,0x0,0x0,0x0,0x10080000,0x0,0x2,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x8000000,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x43028000,0x10080000,0x0,0x0,0x4440000,0x4400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10080000,0x10080000,0x0,0x0,0x0,0x0,0x0,0x5,0x4000000,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100280,0x0,0x800000,0x0,0x0,0xa4440000,0x800,0x0,0x0,0x0,0x0,0x10080000,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x0,0x800000,0x1d,0x1d,0x0,0x0,0x0,0x10080000,0x800000,0x0,0x10080000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x8000000,0x0,0x0,0x0,0x60,0x60,0x0,0x0,0x0,0xa0000000,0x80000,0x10000000,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x200000,0x100000,0x0,0x0,0x0,0x2000,0x0,0x0,0x40000,0x0,0x60,0xa4400000,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x10000,0x10000,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa4400000,0x0,0x60,0x0,0x0,0x4400000,0x0,0x0,0x0,0x400,0x10080000,0x0,0x0,0x400,0x0,0x0,0x0,0x4440000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x43028000,0x0,0x0,0x0,0x0,0x0,0x10080000,0x0,0x2,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x8000000,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x43028000,0x0,0x10080000,0x0,0x0,0x4440000,0x4400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10080000,0x10080000,0x0,0x0,0x0,0x0,0x0,0x5,0x4000000,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100280,0x0,0x800000,0x0,0x0,0xa4440000,0x800,0x0,0x0,0x0,0x0,0x10080000,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x0,0x800000,0x1d,0x1d,0x0,0x0,0x0,0x10080000,0x800000,0x0,0x10080000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x8000000,0x0,0x0,0x0,0x60,0x60,0x0,0x0,0x0,0xa0000000,0x80000,0x10000000,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x200000,0x100000,0x0,0x0,0x0,0x2000,0x0,0x0,0x40000,0x0,0x60,0xa4400000,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x10000,0x10000,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
  static final private int[] jj_la1_2 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x40,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x40,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x1000,0x2,0x2,0x1000,0x1,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x2,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0xfffffffb,0x40000000,0xfffffffb,0xfffffffb,0x0,0x0,0x100,0x100,0x0,0x8,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x2,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x40,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x40,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x1000,0x2,0x2,0x1000,0x1,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x2,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x100,0x0,0x8,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x2,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
  static final private int[] jj_la1_3 = {0x0,0x0,0x44000000,0x0,0x0,0x0,0x0,0x40000000,0x10010,0x0,0x0,0x0,0x2400040,0x0,0x0,0x0,0x0,0x0,0x0,0x40060000,0x0,0x0,0x8000,0x0,0x0,0x200000,0x0,0x0,0x90184580,0x2000000,0x0,0x0,0x0,0x0,0x2400040,0x0,0x0,0x20200,0x10010,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90184580,0x2400040,0x0,0x0,0x40060000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2400040,0x2400040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x20a000,0x0,0x20a000,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x44060000,0x0,0x0,0x800,0x2000000,0x0,0x2400040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20800000,0x0,0x0,0x0,0x2400040,0x0,0x0,0x2400040,0x0,0x0,0x0,0x10010,0x10010,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x10000,0x0,0x10000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x200,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x402000,0x4000000,0x0,0x2400040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x44020220,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x208000,0x0,0x0,0x208000,0x0,0x0,0x0,0x0,0x208000,0x208000,0x0,0x1000,0x0,0x0,0x44000000,0x0,0x0,0x0,0x0,0x40000000,0x10010,0x0,0x0,0x0,0x2400040,0x0,0x0,0x0,0x0,0x0,0x0,0x40060000,0x0,0x0,0x8000,0x0,0x0,0x200000,0x0,0x0,0x90184580,0x2000000,0x0,0x0,0x0,0x0,0x2400040,0x0,0x0,0x20200,0x10010,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90184580,0x0,0x2400040,0x0,0x0,0x40060000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2400040,0x2400040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x20a000,0x0,0x20a000,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x44060000,0x0,0x0,0x800,0x2000000,0x0,0x2400040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20800000,0x0,0x0,0x0,0x2400040,0x0,0x0,0x2400040,0x0,0x0,0x0,0x10010,0x10010,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x10000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x200,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x402000,0x4000000,0x0,0x2400040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x44020220,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x208000,0x0,0x0,0x208000,0x0,0x0,0x0,0x0,0x208000,0x208000,0x0,0x1000,};
  static final private int[] jj_la1_4 = {0x2000,0x0,0x800410,0x0,0x10000,0x0,0x0,0x0,0x200000,0x0,0x1,0x0,0x1a000000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x1,0x0,0x0,0x20000,0x100000,0x2000182e,0x2000000,0x0,0x40000,0x0,0x40000,0x1a000000,0x0,0x100000,0x0,0x200000,0x0,0x0,0x4000,0x0,0x0,0x0,0x80000,0x0,0x20000,0x0,0x80000,0x0,0x800410,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x2000,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x10000000,0x0,0x2000182e,0x1a000000,0x0,0x0,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1a000000,0x1a000000,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100a0001,0x80000,0x100a0001,0x10000000,0x0,0x80,0x0,0x0,0x0,0x0,0x800410,0x0,0x0,0x0,0x2000000,0x0,0x1a000000,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1a000000,0x0,0x0,0x1a000000,0x0,0x1000000,0x0,0x40200000,0x40200000,0x4000000,0x0,0x0,0x0,0xffffffff,0x0,0x7fffffff,0xffffffff,0x0,0x200000,0x40000040,0x40200040,0x1000000,0x0,0x40200000,0x40200000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x400000,0x800410,0x0,0x1a000000,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x0,0x4000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x800410,0x0,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0xa0001,0x80000,0x0,0x100a0001,0x0,0x80000,0x80000,0x0,0x100a0001,0x100a0001,0x10000000,0x0,0x2000,0x0,0x800410,0x0,0x10000,0x0,0x0,0x0,0x200000,0x0,0x1,0x0,0x1a000000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x1,0x0,0x0,0x20000,0x100000,0x2000182e,0x2000000,0x0,0x40000,0x0,0x40000,0x1a000000,0x0,0x100000,0x0,0x200000,0x0,0x0,0x4000,0x0,0x0,0x0,0x80000,0x0,0x20000,0x0,0x80000,0x0,0x800410,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x2000,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x10000000,0x0,0x2000182e,0x0,0x1a000000,0x0,0x0,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1a000000,0x1a000000,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100a0001,0x80000,0x100a0001,0x10000000,0x0,0x80,0x0,0x0,0x0,0x0,0x800410,0x0,0x0,0x0,0x2000000,0x0,0x1a000000,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1a000000,0x0,0x0,0x1a000000,0x0,0x1000000,0x0,0x40200000,0x40200000,0x4000000,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x200000,0x40000040,0x40200040,0x1000000,0x0,0x40200000,0x40200000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x400000,0x800410,0x0,0x1a000000,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x0,0x4000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x800410,0x0,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0xa0001,0x80000,0x0,0x100a0001,0x0,0x80000,0x80000,0x0,0x100a0001,0x100a0001,0x10000000,0x0,};
  static final private int[] jj_la1_5 = {0x0,0x2000,0x810,0x0,0x0,0x0,0x0,0x10,0x100100,0x0,0x0,0x0,0x200,0x0,0x400000,0x0,0x8,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x3c204460,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x8,0x4,0x100100,0x0,0x40000,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x8,0x0,0x8,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x3c204460,0x200,0x0,0x0,0x10,0x10,0x0,0x0,0x400000,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x2000000,0x0,0x10,0x0,0x10,0x8,0x0,0x400000,0x880000,0x0,0x0,0x0,0x880000,0x0,0x0,0x0,0x0,0x4,0x0,0x1004,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x810,0x0,0x0,0x880000,0x0,0x0,0x200,0x40000000,0x0,0x40000000,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8080,0x0,0x0,0x0,0x8080,0x0,0x0,0x0,0x0,0x0,0x1000000,0x200,0x0,0x0,0x200,0x0,0x2000000,0x0,0x100100,0x100100,0x0,0x0,0x0,0x0,0xffffffff,0x100000,0xfffffffc,0xffffffff,0x0,0x0,0x0,0x80000000,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x200,0x0,0x0,0x2000,0x1000,0x2000,0x1000,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x814,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x2000,0x1000,0x4,0x0,0x2000,0x0,0x0,0x0,0x80000000,0x0,0x4,0x80000004,0x4,0x0,0x0,0x2000,0x810,0x0,0x0,0x0,0x0,0x10,0x100100,0x0,0x0,0x0,0x200,0x0,0x400000,0x0,0x8,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x3c204460,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x8,0x4,0x100100,0x0,0x40000,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x8,0x0,0x8,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x3c204460,0x0,0x200,0x0,0x0,0x10,0x10,0x0,0x0,0x400000,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x2000000,0x0,0x10,0x0,0x10,0x8,0x0,0x400000,0x880000,0x0,0x0,0x0,0x880000,0x0,0x0,0x0,0x0,0x4,0x0,0x1004,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x810,0x0,0x0,0x880000,0x0,0x0,0x200,0x40000000,0x0,0x40000000,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8080,0x0,0x0,0x0,0x8080,0x0,0x0,0x0,0x0,0x0,0x1000000,0x200,0x0,0x0,0x200,0x0,0x2000000,0x0,0x100100,0x100100,0x0,0x0,0x0,0x0,0x100003,0x100003,0x0,0x0,0x0,0x80000000,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x200,0x0,0x0,0x2000,0x1000,0x2000,0x1000,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x814,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x2000,0x1000,0x4,0x0,0x2000,0x0,0x0,0x0,0x80000000,0x0,0x4,0x80000004,0x4,0x0,};
  static final private int[] jj_la1_6 = {0x0,0x0,0x100,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x100,0x0,0x0,0x100,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x100,0x100,0x0,0x0,0x0,0x0,0x100,0x0,0x100,0x0,0x0,0x2,0x0,0x100,0x0,0x0,0x100,0x100,0x0,0x100,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2,0x0,0x104,0x100,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x2f0,0x100,0x0,0x0,0x0,0x100,0x0,0x0,0x100,0x2,0x2,0x2,0x0,0x100,0x200000,0x100,0x0,0x0,0x0,0x100,0x0,0x0,0x2f0,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x100,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x1800000,0x100,0x4,0x0,0x100,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x140,0x140,0x0,0xfffff,0x0,0xfffff,0xfffff,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x220,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x100,0x100,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,0x2,0x0,0x2,0x2,0x0,0x2,0x2,0x0,0x0,0x0,0x0,0x100,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x100,0x0,0x0,0x100,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x100,0x100,0x0,0x0,0x0,0x0,0x100,0x0,0x100,0x0,0x0,0x2,0x0,0x100,0x0,0x0,0x100,0x100,0x0,0x100,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2,0x0,0x104,0x100,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x2f0,0x100,0x0,0x0,0x0,0x100,0x0,0x0,0x100,0x2,0x2,0x2,0x0,0x100,0x200000,0x100,0x0,0x0,0x0,0x100,0x0,0x0,0x2f0,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x100,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x1800000,0x100,0x4,0x0,0x100,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x140,0x140,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x220,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x100,0x100,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,0x2,0x0,0x2,0x2,0x0,0x2,0x2,0x0,0x0,};
  static final private JJCalls[] jj_2_rtns = new JJCalls[83];
  static private boolean jj_rescan = false;
  static private int jj_gc = 0;

  public Compiler2(java.io.InputStream stream) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser.  You must");
      System.out.println("       either use ReInit() or set the JavaCC option STATIC to false");
      System.out.println("       during parser generation.");
      throw new Error();
    }
    jj_initialized_once = true;
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new Compiler2TokenManager(jj_input_stream);
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 481; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  static public void ReInit(java.io.InputStream stream) {
    jj_input_stream.ReInit(stream, 1, 1);
    token_source.ReInit(jj_input_stream);
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jjtree.reset();
    jj_gen = 0;
    for (int i = 0; i < 481; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  public Compiler2(java.io.Reader stream) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser.  You must");
      System.out.println("       either use ReInit() or set the JavaCC option STATIC to false");
      System.out.println("       during parser generation.");
      throw new Error();
    }
    jj_initialized_once = true;
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new Compiler2TokenManager(jj_input_stream);
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 481; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  static public void ReInit(java.io.Reader stream) {
    jj_input_stream.ReInit(stream, 1, 1);
    token_source.ReInit(jj_input_stream);
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jjtree.reset();
    jj_gen = 0;
    for (int i = 0; i < 481; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  public Compiler2(Compiler2TokenManager tm) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser.  You must");
      System.out.println("       either use ReInit() or set the JavaCC option STATIC to false");
      System.out.println("       during parser generation.");
      throw new Error();
    }
    jj_initialized_once = true;
    token_source = tm;
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jj_gen = 0;
    for (int i = 0; i < 481; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  public void ReInit(Compiler2TokenManager tm) {
    token_source = tm;
    token = new Token();
    token.next = jj_nt = token_source.getNextToken();
    jjtree.reset();
    jj_gen = 0;
    for (int i = 0; i < 481; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  static final private Token jj_consume_token(int kind) throws ParseException {
    Token oldToken = token;
    if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
    else jj_nt = jj_nt.next = token_source.getNextToken();
    if (token.kind == kind) {
      jj_gen++;
      if (++jj_gc > 100) {
        jj_gc = 0;
        for (int i = 0; i < jj_2_rtns.length; i++) {
          JJCalls c = jj_2_rtns[i];
          while (c != null) {
            if (c.gen < jj_gen) c.first = null;
            c = c.next;
          }
        }
      }
      return token;
    }
    jj_nt = token;
    token = oldToken;
    jj_kind = kind;
    throw generateParseException();
  }

  static final private boolean jj_scan_token(int kind) {
    if (jj_scanpos == jj_lastpos) {
      jj_la--;
      if (jj_scanpos.next == null) {
        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
      } else {
        jj_lastpos = jj_scanpos = jj_scanpos.next;
      }
    } else {
      jj_scanpos = jj_scanpos.next;
    }
    if (jj_rescan) {
      int i = 0; Token tok = token;
      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
      if (tok != null) jj_add_error_token(kind, i);
    }
    return (jj_scanpos.kind != kind);
  }

  static final public Token getNextToken() {
    if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
    else jj_nt = jj_nt.next = token_source.getNextToken();
    jj_gen++;
    return token;
  }

  static final public Token getToken(int index) {
    Token t = lookingAhead ? jj_scanpos : token;
    for (int i = 0; i < index; i++) {
      if (t.next != null) t = t.next;
      else t = t.next = token_source.getNextToken();
    }
    return t;
  }

  static private java.util.Vector jj_expentries = new java.util.Vector();
  static private int[] jj_expentry;
  static private int jj_kind = -1;
  static private int[] jj_lasttokens = new int[100];
  static private int jj_endpos;

  static private void jj_add_error_token(int kind, int pos) {
    if (pos >= 100) return;
    if (pos == jj_endpos + 1) {
      jj_lasttokens[jj_endpos++] = kind;
    } else if (jj_endpos != 0) {
      jj_expentry = new int[jj_endpos];
      for (int i = 0; i < jj_endpos; i++) {
        jj_expentry[i] = jj_lasttokens[i];
      }
      boolean exists = false;
      for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) {
        int[] oldentry = (int[])(enum.nextElement());
        if (oldentry.length == jj_expentry.length) {
          exists = true;
          for (int i = 0; i < jj_expentry.length; i++) {
            if (oldentry[i] != jj_expentry[i]) {
              exists = false;
              break;
            }
          }
          if (exists) break;
        }
      }
      if (!exists) jj_expentries.addElement(jj_expentry);
      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
    }
  }

  static final public ParseException generateParseException() {
    jj_expentries.removeAllElements();
    boolean[] la1tokens = new boolean[217];
    for (int i = 0; i < 217; i++) {
      la1tokens[i] = false;
    }
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 481; i++) {
      if (jj_la1[i] == jj_gen) {
        for (int j = 0; j < 32; j++) {
          if ((jj_la1_0[i] & (1<<j)) != 0) {
            la1tokens[j] = true;
          }
          if ((jj_la1_1[i] & (1<<j)) != 0) {
            la1tokens[32+j] = true;
          }
          if ((jj_la1_2[i] & (1<<j)) != 0) {
            la1tokens[64+j] = true;
          }
          if ((jj_la1_3[i] & (1<<j)) != 0) {
            la1tokens[96+j] = true;
          }
          if ((jj_la1_4[i] & (1<<j)) != 0) {
            la1tokens[128+j] = true;
          }
          if ((jj_la1_5[i] & (1<<j)) != 0) {
            la1tokens[160+j] = true;
          }
          if ((jj_la1_6[i] & (1<<j)) != 0) {
            la1tokens[192+j] = true;
          }
        }
      }
    }
    for (int i = 0; i < 217; i++) {
      if (la1tokens[i]) {
        jj_expentry = new int[1];
        jj_expentry[0] = i;
        jj_expentries.addElement(jj_expentry);
      }
    }
    jj_endpos = 0;
    jj_rescan_token();
    jj_add_error_token(0, 0);
    int[][] exptokseq = new int[jj_expentries.size()][];
    for (int i = 0; i < jj_expentries.size(); i++) {
      exptokseq[i] = (int[])jj_expentries.elementAt(i);
    }
    return new ParseException(token, exptokseq, tokenImage);
  }

  static final public void enable_tracing() {
  }

  static final public void disable_tracing() {
  }

  static final private void jj_rescan_token() {
    jj_rescan = true;
    for (int i = 0; i < 83; i++) {
      JJCalls p = jj_2_rtns[i];
      do {
        if (p.gen > jj_gen) {
          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
          switch (i) {
            case 0: jj_3_1(); break;
            case 1: jj_3_2(); break;
            case 2: jj_3_3(); break;
            case 3: jj_3_4(); break;
            case 4: jj_3_5(); break;
            case 5: jj_3_6(); break;
            case 6: jj_3_7(); break;
            case 7: jj_3_8(); break;
            case 8: jj_3_9(); break;
            case 9: jj_3_10(); break;
            case 10: jj_3_11(); break;
            case 11: jj_3_12(); break;
            case 12: jj_3_13(); break;
            case 13: jj_3_14(); break;
            case 14: jj_3_15(); break;
            case 15: jj_3_16(); break;
            case 16: jj_3_17(); break;
            case 17: jj_3_18(); break;
            case 18: jj_3_19(); break;
            case 19: jj_3_20(); break;
            case 20: jj_3_21(); break;
            case 21: jj_3_22(); break;
            case 22: jj_3_23(); break;
            case 23: jj_3_24(); break;
            case 24: jj_3_25(); break;
            case 25: jj_3_26(); break;
            case 26: jj_3_27(); break;
            case 27: jj_3_28(); break;
            case 28: jj_3_29(); break;
            case 29: jj_3_30(); break;
            case 30: jj_3_31(); break;
            case 31: jj_3_32(); break;
            case 32: jj_3_33(); break;
            case 33: jj_3_34(); break;
            case 34: jj_3_35(); break;
            case 35: jj_3_36(); break;
            case 36: jj_3_37(); break;
            case 37: jj_3_38(); break;
            case 38: jj_3_39(); break;
            case 39: jj_3_40(); break;
            case 40: jj_3_41(); break;
            case 41: jj_3_42(); break;
            case 42: jj_3_43(); break;
            case 43: jj_3_44(); break;
            case 44: jj_3_45(); break;
            case 45: jj_3_46(); break;
            case 46: jj_3_47(); break;
            case 47: jj_3_48(); break;
            case 48: jj_3_49(); break;
            case 49: jj_3_50(); break;
            case 50: jj_3_51(); break;
            case 51: jj_3_52(); break;
            case 52: jj_3_53(); break;
            case 53: jj_3_54(); break;
            case 54: jj_3_55(); break;
            case 55: jj_3_56(); break;
            case 56: jj_3_57(); break;
            case 57: jj_3_58(); break;
            case 58: jj_3_59(); break;
            case 59: jj_3_60(); break;
            case 60: jj_3_61(); break;
            case 61: jj_3_62(); break;
            case 62: jj_3_63(); break;
            case 63: jj_3_64(); break;
            case 64: jj_3_65(); break;
            case 65: jj_3_66(); break;
            case 66: jj_3_67(); break;
            case 67: jj_3_68(); break;
            case 68: jj_3_69(); break;
            case 69: jj_3_70(); break;
            case 70: jj_3_71(); break;
            case 71: jj_3_72(); break;
            case 72: jj_3_73(); break;
            case 73: jj_3_74(); break;
            case 74: jj_3_75(); break;
            case 75: jj_3_76(); break;
            case 76: jj_3_77(); break;
            case 77: jj_3_78(); break;
            case 78: jj_3_79(); break;
            case 79: jj_3_80(); break;
            case 80: jj_3_81(); break;
            case 81: jj_3_82(); break;
            case 82: jj_3_83(); break;
          }
        }
        p = p.next;
      } while (p != null);
    }
    jj_rescan = false;
  }

  static final private void jj_save(int index, int xla) {
    JJCalls p = jj_2_rtns[index];
    while (p.gen > jj_gen) {
      if (p.next == null) { p = p.next = new JJCalls(); break; }
      p = p.next;
    }
    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
  }

  static final class JJCalls {
    int gen;
    Token first;
    int arg;
    JJCalls next;
  }

}
