Ignore:
Timestamp:
Apr 30, 2008, 8:04:04 PM (16 years ago)
Author:
dai_9181
Message:

幾つかの構文解析系の処理をLexicalAnalyzerに実装し直した

Location:
trunk/ab5.0/abdev/BasicCompiler_Common/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Class.h

    r510 r511  
    411411
    412412    // クラス継承
    413     bool Inherits( const char *inheritNames, int nowLine );
    414413    bool InheritsClass( const CClass &inheritsClass, const Types &actualTypeParameters, int nowLine );
    415     bool InheritsInterface( const CClass &inheritsClass, int nowLine );
    416414
    417415    // インターフェイス実装
    418416    bool Implements( const CClass &interfaceClass, const Types &actualTypeParameters, int nowLine );
    419     bool Implements( const char *interfaceNames, int nowLine );
    420417
    421418    //メンバ、メソッドの追加
     
    423420    void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine );
    424421    void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
    425 
    426     void AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
    427         bool isVirtual, bool isOverride, bool isAutoGeneration, char *buffer, int nowLine);
    428422
    429423    //重複チェック
     
    593587    bool Insert( CClass *pClass, int nowLine );
    594588    CClass *Add( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name,int nowLine);
    595     virtual void CollectClassesForNameOnly( const BasicSource &source );
    596589
    597590    // vtblを一時的に生成
     
    603596    virtual void InitStaticMember();
    604597
    605 private:
    606     bool MemberVar_LoopRefCheck(const CClass &objClass);
    607 public:
    608     virtual void GetClass_recur(const char *lpszInheritsClass);
    609     void LookaheadClass( const char *className );
    610     bool LoopRefCheck( const CClass &objClass );
    611     virtual void GetAllClassInfo();
    612598    virtual void Compile_System_InitializeUserTypes();
    613599    virtual void Compile_System_InitializeUserTypesForBaseType();
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/LexicalAnalyzer.h

    r508 r511  
    77{
    88public:
     9
     10    // 名前空間を収集
    911    static bool CollectNamespaces( const char *source, NamespaceScopesCollection &namespaceScopesCollection );
     12
     13    // フルネーム識別子をシンボルに変換する
    1014    static Symbol FullNameToSymbol( const char *fullName );
    1115    static Symbol FullNameToSymbol( const std::string &fullName );
     16
     17    // クラスの名前情報を収集する
     18    static void CollectClassesForNameOnly( const char *source, Classes &classes );
     19
     20    // クラスを収集する
     21    static void AddMethod(CClass *pobj_c, UserProc *pUserProc, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
     22        bool isVirtual, bool isOverride, const char *interfaceName, bool isAutoGeneration, int nowLine);
     23    static bool Inherits( CClass &currentClass, const char *inheritNames, int nowLine );
     24    static bool Implements( CClass &currentClass, const char *interfaceNames, int nowLine );
     25    static void LookaheadClass( const char *className, Classes &classes );
     26    static bool LoopRefCheck( const CClass &objClass );
     27    static void CollectClasses( const char *source, Classes &classes );
     28
     29    // グローバルプロシージャを収集する
     30    static UserProc* ParseUserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, char *buffer,int nowLine,bool isVirtual,CClass *pobj_c, bool isStatic, char *interfaceName = NULL );
     31    static void CollectProcedures( const BasicSource &source, UserProcs &userProcs, DllProcs &dllProcs );
    1232};
    1333
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Procedure.h

    r382 r511  
    180180public:
    181181
    182     UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport, int id )
     182    UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport )
    183183        : Procedure( namespaceScopes, name, kind, isCdecl )
    184184        , importedNamespaces( importedNamespaces )
     
    187187        , pMethod( NULL )
    188188        , isMacro( isMacro )
     189        , secondParmNum( 0 )
     190        , realSecondParmNum( 1 )
    189191        , isExport( isExport )
    190192        , isSystem( false )
     
    193195        , beginOpAddress( 0 )
    194196        , endOpAddress( 0 )
    195         , id( id )
    196     {
     197    {
     198        static int id_base=0;
     199        id = ( id_base ++ );
    197200    }
    198201    UserProc()
     
    204207            delete pParam;
    205208        }
     209    }
     210
     211    void SetReturnType( const Type &newReturnType )
     212    {
     213        returnType = newReturnType;
    206214    }
    207215
     
    244252        return realParams;
    245253    }
     254    void SetRealParams( const Parameters &params )
     255    {
     256        realParams = params;
     257    }
    246258    int GetRealSecondParmNum() const
    247259    {
     
    396408class UserProcs : public Jenga::Common::Hashmap<UserProc>
    397409{
    398     std::vector<std::string> macroNames;
    399 
    400410    // XMLシリアライズ用
    401411private:
     
    407417        ar & boost::serialization::make_nvp("Hashmap_UserProcImpl",
    408418            boost::serialization::base_object<Jenga::Common::Hashmap<UserProc>>(*this));
    409         ar & BOOST_SERIALIZATION_NVP( macroNames );
    410419    }
    411420
     
    420429
    421430    bool Insert( UserProc *pUserProc, int nowLine );
    422 
    423     UserProc *AddUserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, char *buffer,int nowLine,bool isVirtual,CClass *pobj_c, bool isStatic, char *interfaceName = NULL );
    424431
    425432    void EnumGlobalProcs( const char *simpleName, const char *localName, std::vector<const UserProc *> &subs );
     
    511518};
    512519
    513 void CollectProcedures( const BasicSource &source, UserProcs &userProcs, DllProcs &dllProcs );
    514 
    515520class ProcPointer : public Procedure
    516521{
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Variable.h

    r509 r511  
    5757
    5858public:
    59     Variable( const string &name, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData )
    60         : Symbol( ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( name ) )
    61         , type( type )
    62         , isConst( isConst )
    63         , isRef( isRef )
    64         , isArray( false )
    65         , isParameter( false)
    66         , paramStrForConstructor( paramStrForConstructor )
    67         , hasInitData( hasInitData )
    68     {
    69     }
    70     Variable( const NamespaceScopes &namespaceScopes, const string &name, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData )
    71         : Symbol( namespaceScopes, name )
    72         , type( type )
    73         , isConst( isConst )
    74         , isRef( isRef )
    75         , isArray( false )
    76         , isParameter( false)
    77         , paramStrForConstructor( paramStrForConstructor )
    78         , hasInitData( hasInitData )
    79     {
    80     }
    81     Variable( const Variable &var )
    82         : Symbol( var )
    83         , type( var.type )
    84         , isConst( var.isConst )
    85         , isRef( var.isRef )
    86         , isArray( var.isArray )
    87         , subscripts( var.subscripts )
    88         , isParameter( false )
    89         , paramStrForConstructor( var.paramStrForConstructor )
    90         , hasInitData( var.hasInitData )
    91     {
    92     }
    93     Variable()
    94     {
    95     }
    96     ~Variable()
    97     {
    98     }
     59    Variable( const string &name, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData );
     60    Variable( const NamespaceScopes &namespaceScopes, const string &name, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData );
     61    Variable( const Variable &var );
     62    Variable();
    9963
    10064    void SetArray( const Subscripts &subscripts ){
Note: See TracChangeset for help on using the changeset viewer.