📄 cparser.c
字号:
my_free( classname_g ); /* 08.04.97 */ classname_g = classname_save; /* 08.04.97 */ Put_symbol( paf , get_scope( Class->name.buf ) , get_name( Class->name.buf ) , filename_g , lineno , charno , f_lineno( -1 ) , f_charno( -1 ) + 1 , (unsigned long) attr , (char *) 0 , (char *) 0 , (char *) 0 , comment , Class->lineno_beg , Class->charno_beg , Class->lineno_end , Class->charno_end ); niveau--; return True; default: niveau--; return True; } niveau--; return True;}extern int base_spec( Class_t Class ){ Save_d(); niveau++; step( 1 ); while( base_specifier( Class )) { switch( token( 0 )) { case LBRACE: niveau--; return True; case ',': step( 1 ); break; default: goto end; break; } }end: while( True ) { switch( token( 0 )) { case LBRACE: niveau--; return True; case ';': /* 17.02.97 rigo */ case 0: Restore_d(); niveau--; return False; } step( 1 ); } niveau--;}extern int base_specifier( Class_t Class ){ LongString aname; LongString atemplate_args; char *template_args; char *pc; int lineno; int charno; unsigned long attr = 0; niveau++; LongStringInit( &aname, -1 ); LongStringInit( &atemplate_args, -1 ); while( True ) { switch( token( 0 )) { case SN_VIRTUAL : attr |= PAF_VIRTUAL ; step( 1 ); break; case SN_PRIVATE : attr |= PAF_PRIVATE ; step( 1 ); break; case SN_PROTECTED : attr |= PAF_PROTECTED; step( 1 ); break; case SN_PUBLIC : attr |= PAF_PUBLIC ; step( 1 ); break; case SN_CLCL : case SN_IDENTIFIER: if( token( 0 ) == SN_IDENTIFIER && token( 1 ) == SN_IDENTIFIER ) { /* struct x : PRIVATE y { ... } miatt */ step( 1 ); } lineno = f_lineno( 0 ); charno = f_charno( 0 ); if( complete_class_name( &aname )) { if( attr == 0 ) { switch( Class->access ) { case SN_PUBLIC : attr = PAF_PUBLIC ; break; case SN_PRIVATE: attr = PAF_PRIVATE; break; } } if( aname.buf != 0 && ( pc = strchr( aname.buf, '<' ))) { LongStringMyCopy( &atemplate_args, pc ); template_args = atemplate_args.buf; *pc = 0; } else { template_args = 0; } Put_symbol( PAF_CLASS_INHERIT , Class->name.buf , aname.buf , filename_g , lineno , charno , f_lineno( 0 ) , f_charno( 0 ) , attr , (char *) 0 , (char *) 0 , template_args , get_comment( f_lineno( 0 )) , lineno , charno , f_lineno( 0 ) , f_charno( 0 ) ); LongStringMyFree( &aname ); LongStringMyFree( &atemplate_args ); niveau--; return True; } else { LongStringMyFree( &aname ); LongStringMyFree( &atemplate_args ); niveau--; return False; } break; case 0: default: /* 10.02.97 rigo */ LongStringMyFree( &aname ); LongStringMyFree( &atemplate_args ); niveau--; return False; break; } }}extern int member_list( Class_t Class ){ niveau++; step( 1 ); while( member( Class )) { } niveau--; return True;}extern int member( Class_t Class ){#ifndef VERSION_COMPARE if( skip_member_macro()) /* 01.08.97 rigo */ { return member( Class ); }#endif niveau++; switch( token( 0 )) { case RBRACE : niveau--; return False; case SN_PRIVATE : case SN_PUBLIC : case SN_PROTECTED : if( token( 1 ) == ':' ) { Class->access = token( 0 ); step( 1 ); step( 1 ); niveau--; return True; } else { step( 1 ); niveau--; return True; } break; default: if( member_declaration( Class )) { niveau--; return True; } else { niveau--; return False; } } niveau--;}extern int member_declaration( Class_t Class ){ if( ! _member_declaration( Class )) { keyw_cpp = ! keyw_cpp; if( _member_declaration( Class )) {#ifdef TEST printf( "change mode: %s (%d.%d)\n" , filename_g , f_lineno(0) , f_charno(0) );#endif return True; } else { keyw_cpp = ! keyw_cpp; /* restore mode */ return skip_member_declaration(); } } return True;}extern int _member_declaration( Class_t Class ){ Save_d(); sDeclaration_t sDeclaration; int lineno_beg; int charno_beg; int retval; niveau++; sDeclaration.Declaration = 0; sDeclaration.type = DECLARATION_UNKNOWN; LongStringInit( &sDeclaration.name, -1 ); sDeclaration.storage_class = 0; sDeclaration.fct_specifier = 0; sDeclaration.s_const = 0; sDeclaration.s_volatile = 0; sDeclaration.s_char = 0; sDeclaration.s_short = 0; sDeclaration.s_int = 0; sDeclaration.s_long = 0; sDeclaration.s_signed = 0; sDeclaration.s_unsigned = 0; sDeclaration.s_float = 0; sDeclaration.s_double = 0; sDeclaration.s_bool = 0; sDeclaration.s_void = 0; LongStringInit( &sDeclaration.type_name, -1 ); sDeclaration.type_of_type_name = 0; LongStringInit( &sDeclaration.complete_class_name, -1 ); sDeclaration.lineno_beg = 0; sDeclaration.charno_beg = 0; sDeclaration.lineno_end = 0; sDeclaration.charno_end = 0; sDeclaration.sClass.ClassParent = Class; LongStringInit( &sDeclaration.sClass.name, -1 ); sDeclaration.sClass.access = 0; sDeclaration.sClass.lineno_beg = 0; sDeclaration.sClass.charno_beg = 0; sDeclaration.sClass.lineno_end = 0; sDeclaration.sClass.charno_end = 0; LongStringInit( &sDeclaration.sEnum.name, -1 ); sDeclaration.sEnum.lineno_beg = 0; sDeclaration.sEnum.charno_beg = 0; sDeclaration.sEnum.lineno_end = 0; sDeclaration.sEnum.charno_end = 0; while( True ) { switch( token( 0 )) { case ';' : /* empty member_declarator_list */ step( 1 ); class_empty_declarator_list( Class, &sDeclaration ); Return( True ) case SN_INTERFACE : case SN_CLASS : case SN_STRUCT : case SN_UNION : if( ! f_class( &sDeclaration, &sDeclaration.sClass )) { Restore_d(); Return( False ) } break; case SN_ENUM : if( ! f_enum( &sDeclaration, &sDeclaration.sEnum )) { Restore_d(); Return( False ) } break; case SN_AUTO : sDeclaration.storage_class = SN_AUTO ; step( 1 ); break; case SN_REGISTER : sDeclaration.storage_class = SN_REGISTER; step( 1 ); break; case SN_STATIC : sDeclaration.storage_class = SN_STATIC ; step( 1 ); break; case SN_EXTERN : sDeclaration.storage_class = SN_EXTERN ; step( 1 ); break; case SN_INLINE : sDeclaration.fct_specifier = SN_INLINE ; step( 1 ); break; case SN_VIRTUAL : sDeclaration.fct_specifier = SN_VIRTUAL ; step( 1 ); break; case SN_FRIEND : sDeclaration.storage_class = SN_FRIEND ; step( 1 ); break; case SN_TYPEDEF : sDeclaration.storage_class = SN_TYPEDEF ; step( 1 ); break; case SN_CONST : sDeclaration.s_const = True ; step( 1 ); break; case SN_VOLATILE : sDeclaration.s_volatile = True ; step( 1 ); break; case SN_CHAR : sDeclaration.s_char = True ; step( 1 ); break; case SN_SHORT : sDeclaration.s_short = True ; step( 1 ); break; case SN_INT : sDeclaration.s_int = True ; step( 1 ); break; case SN_LONG : sDeclaration.s_long = True ; step( 1 ); break; case SN_SIGNED : sDeclaration.s_signed = True ; step( 1 ); break; case SN_UNSIGNED : sDeclaration.s_unsigned = True ; step( 1 ); break; case SN_FLOAT : sDeclaration.s_float = True ; step( 1 ); break; case SN_DOUBLE : sDeclaration.s_double = True ; step( 1 ); break; case SN_BOOL : sDeclaration.s_bool = True ; step( 1 ); break; case SN_VOID : sDeclaration.s_void = True ; step( 1 ); break; case SN_IDENTIFIER :/* printf( "IDENTIFIER: %s\n", identstring( 0 )); */ /* ha az ident utan * vagy & vagy ident all ( kiveve az 'ident iden ((' konstrukciot ), akkor nem lehet deklarator_list */ if(( token( 1 ) == '*' ) || ( token( 1 ) == '&' ) || ( token( 1 ) == SN_IDENTIFIER && ( token( 2 ) != '(' || token( 3 ) != '(' )) ) { } else { if( member_declarator_list( Class, &sDeclaration )) { Return( True ) } } LongStringMySetLen( &sDeclaration.type_name, 0 ); sDeclaration.type_of_type_name = 0; lineno_beg = f_lineno( 0 ); charno_beg = f_charno( 0 ); if( ! complete_class_name( &sDeclaration.type_name )) { Restore_d(); Return( False ) } else { LongStringsMyCopy( &sDeclaration.complete_class_name , &sDeclaration.type_name ); sDeclaration.lineno_beg = lineno_beg; sDeclaration.charno_beg = charno_beg; sDeclaration.lineno_end = f_lineno( -1 ); sDeclaration.charno_end = f_charno( -1 ) + 1; } break; case SN_CLCL : if( member_declarator_list( Class, &sDeclaration )) { Return( True ) } LongStringMySetLen( &sDeclaration.type_name, 0 ); sDeclaration.type_of_type_name = 0; lineno_beg = f_lineno( 0 ); charno_beg = f_charno( 0 ); if( ! complete_class_name( &sDeclaration.type_name )) { Restore_d(); Return( False ) } else { LongStringsMyCopy( &sDeclaration.complete_class_name , &sDeclaration.type_name ); sDeclaration.lineno_beg = lineno_beg; sDeclaration.charno_beg = charno_beg; sDeclaration.lineno_end = f_lineno( -1 ); sDeclaration.charno_end = f_charno( -1 ) + 1; } break; case SN_OPERATOR : case '(' : case '*' : case '&' : case '~' : if( member_declarator_list( Class, &sDeclaration )) { Return( True ) } else { Restore_d(); Return( False ) } break; default : Restore_d(); Return( False ) break; } }return_label: LongStringMyFree( &sDeclaration.name ); LongStringMyFree( &sDeclaration.type_name ); LongStringMyFree( &sDeclaration.complete_class_name ); LongStringMyFree( &sDeclaration.sClass.name ); LongStringMyFree( &sDeclaration.sEnum.name ); niveau--; return retval;}extern int member_declarator_list( Class_t Class, Declaration_t Declaration ){ int retval; Save_d(); sDeclarator_t sDeclarator; niveau++; LongStringInit( &sDeclarator.name , -1 ); LongStringInit( &sDeclarator.type , -1 ); LongStringInit( &sDeclarator.types, -1 ); LongStringInit( &sDeclarator.names, -1 ); while( True ) { LongStringMyFree( &sDeclarator.name ); LongStringMyFree( &sDeclarator.type ); LongStringMyFree( &sDeclarator.types ); LongStringMyFree( &sDeclarator.names ); sDeclarator.base_typ = 0; sDeclarator.pure = 0; sDeclara
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -