private void WriteShortStringType(short_string_type_node type)
 {
 	bw.Write((byte)TypeKind.ShortString);
 	bw.Write(type.Length);
 }
Beispiel #2
0
		private string get_shortstring_name(short_string_type_node ctn)
		{
			return "@string["+ctn.Length.ToString()+"]";
		}
 private static basic_function_node make_short_string_plus_assign(short_string_type_node ctn)
 {
 	basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.plusassign_name,ctn,SemanticTree.basic_function_type.objassign);
 	bfn.compile_time_executor = SystemLibrary.static_executors.short_string_addassign_executor;
 	return bfn;
 }
 public short_string_type_node create_short_string_type(int length, location def_loc)
 {
     if (ShortStringTypes.ContainsKey(length))
         return ShortStringTypes[length];
     SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(null, SystemLibrary.SystemLibrary.string_type.Scope);
     short_string_type_node tctn = new short_string_type_node(//SemanticTree.type_access_level.tal_public, _cmn,
         scope, def_loc, length);
     tctn.add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
     tctn.add_name(compiler_string_consts.plus_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_add));
     tctn.scope.AddSymbol(compiler_string_consts.plusassign_name,new SymbolInfo(make_short_string_plus_assign(tctn)));
     type_intersection_node inter = new type_intersection_node(type_compare.greater_type);
     inter.another_to_this = new type_conversion(SystemLibrary.SystemLibrary.char_to_string);
     tctn.add_intersection_node(SystemLibrary.SystemLibrary.char_type, inter,false);
     ShortStringTypes.Add(length, tctn);
     return tctn;
 }
 public short_string_type_node create_short_string_type(int length, location def_loc)
 {
     if (ShortStringTypes.ContainsKey(length))
         return ShortStringTypes[length];
     //type_node base_type = SystemLibrary.SystemLibInitializer.ShortStringType.sym_info as type_node;
     //check_name_free(name, def_loc);
     SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(null, SystemLibrary.SystemLibrary.string_type.Scope);
     short_string_type_node tctn = new short_string_type_node(//SemanticTree.type_access_level.tal_public, _cmn,
         scope, def_loc, length);
     //tctn.IsFictive = true;
     //set_field_access_level(SemanticTree.field_access_level.fal_public);
     //_cmn.scope.AddSymbol(name, new SymbolInfo(tctn));
     //tctn.internal_is_value = false;//base_type.is_value;
     //tctn.is_class = false;//base_type.is_class;
     //common_property_node cpn = new common_property_node(compiler_string_consts.index_property_pascal_array_name,tctn,SystemLibrary.SystemLibrary.char_type,SystemLibrary.SystemLibInitializer.GetCharInShortStringProcedure.sym_info as function_node,
     //                                                    null,null,SemanticTree.field_access_level.fal_public,SemanticTree.polymorphic_state.ps_common);
    	//tctn.default_property = cpn;
     //SystemLibrary.SystemLibrary.make_type_conversion(tctn,SystemLibrary.SystemLibrary.string_type,type_compare.less_type,SemanticTree.basic_function_type.none,true);
     //SystemLibrary.SystemLibrary.make_type_conversion(SystemLibrary.SystemLibrary.string_type,tctn,type_compare.greater_type,SemanticTree.basic_function_type.none,true);
     //SystemLibrary.SystemLibrary.make_equivalence_operator(tctn);
     //SystemLibrary.SystemLibrary.make_not_equivalence_operator(tctn);
     tctn.add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
     tctn.add_name(compiler_string_consts.plus_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_add));
     //tctn.add_name(compiler_string_consts.eq_name,new SymbolInfo(SystemLibrary.SystemLibrary));
     //tctn.add_name(compiler_string_consts.noteq_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_type.find_in_type(compiler_string_consts.noteq_name).sym_info as function_node));
     /*tctn.add_name(compiler_string_consts.smeq_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_type.find_in_type(compiler_string_consts.smeq_name).sym_info as function_node));
     tctn.add_name(compiler_string_consts.sm_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_type.find_in_type(compiler_string_consts.sm_name).sym_info as function_node));
     tctn.add_name(compiler_string_consts.greq_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_type.find_in_type(compiler_string_consts.greq_name).sym_info as function_node));
     tctn.add_name(compiler_string_consts.gr_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_type.find_in_type(compiler_string_consts.gr_name).sym_info as function_node));*/
     //_ctn = tctn;
     //SystemLibrary.SystemLibrary.init_reference_type(tctn);
     //converted_namespace.types.AddElement(tctn);
     tctn.scope.AddSymbol(compiler_string_consts.plusassign_name,new SymbolInfo(make_short_string_plus_assign(tctn)));
     type_intersection_node inter = new type_intersection_node(type_compare.greater_type);
     inter.another_to_this = new type_conversion(SystemLibrary.SystemLibrary.char_to_string);
     tctn.add_intersection_node(SystemLibrary.SystemLibrary.char_type, inter,false);
     ShortStringTypes.Add(length, tctn);
     return tctn;
 }