[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kdevelop/kdev4_python_newlexer
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2007-08-24 17:05:53
Message-ID: 1187975153.173990.2448.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 704336 by apaku:
Add keyword and identifier lexing, follows the scheme that Roberto used in his kwgen tool
M +0 -1 duchain/pythoneditorintegrator.h
M +1 -0 parser/CMakeLists.txt
A parser/kwcheck.cpp [License: GPL (v2+)]
A parser/kwcheck.h [License: GPL (v2+)]
M +21 -9 parser/pythonlexer.cpp
M +2 -0 parser/pythonlexer.h
--- branches/work/kdevelop/kdev4_python_newlexer/duchain/pythoneditorintegrator.h #704335:704336
@@ -24,7 +24,6 @@
#define PYTHONEDITORINTEGRATOR_H
#include <editorintegrator.h>
-#include "python_lexer.h"
#include "python_parser.h"
#include "pythonduchainexport.h"
--- branches/work/kdevelop/kdev4_python_newlexer/parser/CMakeLists.txt #704335:704336
@@ -9,6 +9,7 @@
pythondriver.cpp
parsesession.cpp
pythonlexer.cpp
+ kwcheck.cpp
)
if(KDEVPG_FOUND)
--- branches/work/kdevelop/kdev4_python_newlexer/parser/pythonlexer.cpp #704335:704336
@@ -28,6 +28,8 @@
#include <kdev-pg-location-table.h>
#include <kdev-pg-token-stream.h>
+#include "kwcheck.h"
+
namespace Python
{
@@ -118,17 +120,27 @@
case DefaultState:
it = ignoreWhitespace( it );
m_tokenBegin = m_curpos;
- //Now the stuff that will generate a proper token
- //QChar* c2 = m_curpos < m_contentSize ? it + 1 : 0 ;
- switch ( it->unicode() )
+ if( it->isLetter() || it->unicode() == '_' )
{
- case '\n':
- token = parser::Token_LINEBREAK;
- break;
- default:
- break;
+ QChar* start = it;
+ do{
+ it++;
+ m_curpos++;
+ }while( m_curpos < m_contentSize
+ && ( it->isLetterOrNumber() || it->unicode() == '_' ) );
+ token = checkForKeyword( start, m_curpos-m_tokenBegin+1 );
+ }else
+ {
+ switch ( it->unicode() )
+ {
+ case '\n':
+ token = parser::Token_LINEBREAK;
+ break;
+ default:
+ break;
+ }
+ break;
}
- break;
default:
token = parser::Token_INVALID;
break;
--- branches/work/kdevelop/kdev4_python_newlexer/parser/pythonlexer.h #704335:704336
@@ -54,6 +54,7 @@
QChar* ignoreWhitespace(QChar* it);
+
QStack<int> mState;
enum State
{
@@ -61,6 +62,7 @@
DefaultState = 0,
};
+
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic