summaryrefslogtreecommitdiffstats
path: root/languages/perl/perlparser.h
blob: 01ded7d88554119fecc7815ec08cf38d13604196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/***************************************************************************
                          perlparser.h  -  description
                             -------------------
    begin                : Sun Nov 2 2003
    copyright            : (C) 2003 by luc
    email                : luc@lieve
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef PERLPARSER_H
#define PERLPARSER_H

#include "kdevlanguagesupport.h"
#include <codemodel.h>


/**perl source to classview parser
  *@author luc
  */

class perlparser {
  public: 
  perlparser(KDevCore* core,CodeModel* model, QString interpreter);
  perlparser();
  ~perlparser();

  void initialParse();
  void parse(const QString &fileName);
  void parseLines(QStringList* lines,const QString& fileName);
  const QStringList UseFiles();
  QString findLib( const QString& lib);

  private:
  //global functions to add to ClassStore
  void addPackage(const QString& fileName ,int lineNr , const QString& name);
  void addAttributetoScript(const QString& fileName ,int lineNr ,const QString& name);
  void addAttributetoPackage(const QString& fileName ,int lineNr ,const QString& name);
  void addClass(const QString& fileName ,int lineNr );
  void addConstructor(const QString& fileName ,int lineNr ,const QString& methodname);
  void addGlobalSub(const QString& fileName ,int lineNr , const QString& name, bool privatesub);
  void addScriptSub(const QString& fileName ,int lineNr , const QString& name, bool privatesub);
  void addClassMethod(const QString& fileName ,int lineNr , const QString& name , bool privatesub);
  void addPackageSub(const QString& fileName ,int lineNr , const QString& name, bool privatesub);
  void addParentClass(const QString& parent);
  void addScript(const QString& fileName ,int lineNr , const QString& name);
  void addUseLib(const QString& lib);
  void getPerlINC();

  bool    m_inpackage;
  bool    m_inscript;
  bool    m_inclass;

  QString m_lastsub;
  QString m_lastparentclass;
  QString m_lastattr;
  QString m_lastpackagename;
  QString m_lastscriptname;

  NamespaceDom m_lastscript;
  NamespaceDom m_lastpackage;
  ClassDom m_lastclass;

  //CodeModel
  CodeModel* m_model;
  KDevCore* m_core;
  FileDom m_file;

  //this willhav a list of INC paths
  QStringList m_INClist;
  //this will get a list off all files "use" in the perl files
  //and need additional parsing to include the classes in the classview
  QStringList m_usefiles;

  QString m_interpreter;
  
  
};

#endif