Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2007-11-20 10:57:40 +0000
committerMarkus Schorn2007-11-20 10:57:40 +0000
commit7788841cb39466c4a85abb6a88176187af16ee56 (patch)
treefbab5d3316c348d62aeba4e33f9ea8aee6bcdee0 /core/org.eclipse.cdt.core/src
parent51e8002672d6eecdff7a1c332cfc03c445a11741 (diff)
downloadorg.eclipse.cdt-7788841cb39466c4a85abb6a88176187af16ee56.tar.gz
org.eclipse.cdt-7788841cb39466c4a85abb6a88176187af16ee56.tar.xz
org.eclipse.cdt-7788841cb39466c4a85abb6a88176187af16ee56.zip
Removal of old parser (bug 209772).
Diffstat (limited to 'core/org.eclipse.cdt.core/src')
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java33
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserTimeOut.java125
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java2
4 files changed, 8 insertions, 154 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java
index e76f44a0532..f48365106c7 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java
@@ -13,17 +13,12 @@ package org.eclipse.cdt.core;
import java.util.StringTokenizer;
import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IToken;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ScannerInfo;
import org.eclipse.cdt.internal.core.CharOperation;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.model.CModelStatus;
+import org.eclipse.cdt.internal.core.parser.scanner.ILexerLog;
+import org.eclipse.cdt.internal.core.parser.scanner.Lexer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -323,30 +318,14 @@ public class CConventions {
// create a scanner and get the type of the token
// assuming that you are given a valid identifier
IToken token = null;
- IScanner scanner = ParserFactory.createScanner(
- new CodeReader(name.toCharArray()),
- new ScannerInfo(),
- ParserMode.QUICK_PARSE,
- ParserLanguage.CPP,
- null,
- null,
- null
- );
-
+ Lexer lexer= new Lexer(name.toCharArray(), new Lexer.LexerOptions(), ILexerLog.NULL, null);
try {
- token = scanner.nextToken();
- } catch (Exception e) {
- }
-
- if ((token != null) && (token.getType() == IToken.tIDENTIFIER)) {
- try {
- scanner.nextToken();
- } catch (EndOfFileException e) {
+ token = lexer.nextToken();
+ if (token.getType() == IToken.tIDENTIFIER && lexer.nextToken().getType() == IToken.tEND_OF_INPUT) {
return true;
- } catch (Exception e) {
}
+ } catch (Exception e) {
}
-
return false;
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java
index 9a4f0410f1c..16e8f05381a 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/CodeReaderCache.java
@@ -14,7 +14,7 @@ package org.eclipse.cdt.core.parser;
import java.io.File;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
+import org.eclipse.cdt.internal.core.parser.EmptyIterator;
import org.eclipse.cdt.internal.core.util.ILRUCacheable;
import org.eclipse.cdt.internal.core.util.LRUCache;
import org.eclipse.cdt.internal.core.util.OverflowingLRUCache;
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserTimeOut.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserTimeOut.java
deleted file mode 100644
index 2a1194e80b6..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserTimeOut.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.parser;
-
-
-/**
- * @author bgheorgh
- *
- */
-public class ParserTimeOut implements Runnable {
-
-
- protected Thread thread;
- protected boolean enabled;
- protected IParser cancellable;
- private int timeout = 0;
- private int threadPriority = Thread.MIN_PRIORITY + 1;
- boolean debug = false;
- private String threadName = null;
- boolean readyToRun = true;
-
- public ParserTimeOut(){
- reset();
- }
-
- public ParserTimeOut(String threadName){
- this.threadName = threadName;
- reset();
- }
-
- public void run() {
- while (this.thread != null) {
- try {
- synchronized(this){
- if (enabled){
- readyToRun = false;
- wait(timeout);
- if (enabled){
- if(cancellable != null)
- cancellable.cancel();
- enabled = false;
- }
- }
- else{
- while(!enabled){
- readyToRun = true;
- wait();
- }
- }
- }
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- public synchronized void startTimer(){
- enabled = true;
- notify();
- }
-
- public synchronized void stopTimer(){
- enabled= false;
- notify();
- }
-
-
-
- public void reset() {
- enabled=false;
- if (threadName!=null){
- thread = new Thread(this, threadName);
- }
- else{
- thread = new Thread(this, "Time Out Thread"); //$NON-NLS-1$
- }
- thread.setDaemon(true);
- thread.setPriority(threadPriority);
- thread.start();
- }
- /**
- * @return Returns the threadPriority.
- */
- public int getThreadPriority() {
- return threadPriority;
- }
- /**
- * @param threadPriority The threadPriority to set.
- */
- public void setThreadPriority(int threadPriority) {
- this.threadPriority = threadPriority;
- }
-
- /**
- * @param pm The pm to set.
- */
- public void setParser(IParser c) {
- this.cancellable = c;
- }
- /**
- * @return Returns the timeout.
- */
- public int getTimeout() {
- return timeout;
- }
- /**
- * @param timeout The timeout to set.
- */
- public void setTimeout(int timeout) {
- this.timeout = timeout;
- }
-
- public boolean isReadyToRun(){
- return readyToRun;
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java
index 904e8bf4cea..b77ee6f7a39 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/PartialWorkingCopyCodeReaderFactory.java
@@ -21,7 +21,7 @@ import org.eclipse.cdt.core.model.IWorkingCopyProvider;
import org.eclipse.cdt.core.parser.CodeReader;
import org.eclipse.cdt.core.parser.ICodeReaderCache;
import org.eclipse.cdt.core.parser.ParserUtil;
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
+import org.eclipse.cdt.internal.core.parser.EmptyIterator;
/**
* @author jcamelon

Back to the top