diff --git a/core/org.eclipse.cdt.core/.cvsignore b/core/org.eclipse.cdt.core/.cvsignore
new file mode 100644
index 00000000000..ba077a4031a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/core/org.eclipse.cdt.core/.project b/core/org.eclipse.cdt.core/.project
new file mode 100644
index 00000000000..95eceb11fac
--- /dev/null
+++ b/core/org.eclipse.cdt.core/.project
@@ -0,0 +1,28 @@
+
+
start
end(exclusive).
+ * @param text
, the String object to search in
+ * @param start
, the starting index of the search range, inclusive
+ * @param end
, the ending index of the search range, exclusive
+ * @return an StringMatcher.Position
object that keeps the starting
+ * (inclusive) and ending positions (exclusive) of the first occurrence of the
+ * pattern in the specified range of the text; return null if not found or subtext
+ * is empty (start==end). A pair of zeros is returned if pattern is empty string
+ * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
+ * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
+ */
+
+ public StringMatcher.Position find(String text, int start, int end) {
+ if (fPattern == null || text == null)
+ throw new IllegalArgumentException();
+
+ int tlen= text.length();
+ if (start < 0)
+ start= 0;
+ if (end > tlen)
+ end= tlen;
+ if (end < 0 || start >= end)
+ return null;
+ if (fLength == 0)
+ return new Position(start, start);
+ if (fIgnoreWildCards) {
+ int x= posIn(text, start, end);
+ if (x < 0)
+ return null;
+ return new Position(x, x + fLength);
+ }
+
+ int segCount= fSegments.length;
+ if (segCount == 0) //pattern contains only '*'(s)
+ return new Position(start, end);
+
+ int curPos= start;
+ int matchStart= -1;
+ for (int i= 0; i < segCount && curPos < end; ++i) {
+ String current= fSegments[i];
+ int nextMatch= regExpPosIn(text, curPos, end, current);
+ if (nextMatch < 0)
+ return null;
+ if (i == 0)
+ matchStart= nextMatch;
+ curPos= nextMatch + current.length();
+ }
+ return new Position(matchStart, curPos);
+ }
+ /**
+ * StringMatcher constructor takes in a String object that is a simple
+ * pattern which may contain * for 0 and many characters and
+ * ? for exactly one character. Also takes as parameter a boolean object
+ * specifying if case should be ignored
+ * @deprecated Use StringMatcher(pattern, ignoreCase, ignoreWildCards).
+ */
+ public StringMatcher(String aPattern, boolean ignoreCase) {
+ this(aPattern, ignoreCase, false);
+ }
+ /**
+ * StringMatcher constructor takes in a String object that is a simple
+ * pattern which may contain * for 0 and many characters and
+ * ? for exactly one character.
+ *
+ * Literal '*' and '?' characters must be escaped in the pattern
+ * e.g., "\*" means literal "*", etc.
+ *
+ * Escaping any other character (including the escape character itself),
+ * just results in that character in the pattern.
+ * e.g., "\a" means "a" and "\\" means "\"
+ *
+ * If invoking the StringMatcher with string literals in Java, don't forget
+ * escape characters are represented by "\\".
+ *
+ * @param aPattern the pattern to match text against
+ * @param ignoreCase if true, case is ignored
+ * @param ignoreWildCards if true, wild cards and their escape sequences are ignored
+ * (everything is taken literally).
+ */
+ public StringMatcher(String aPattern, boolean ignoreCase, boolean ignoreWildCards) {
+ fIgnoreCase= ignoreCase;
+ fIgnoreWildCards= ignoreWildCards;
+ fLength= aPattern.length();
+
+ /* convert case */
+ if (fIgnoreCase) {
+ fPattern= aPattern.toUpperCase();
+ } else {
+ fPattern= aPattern;
+ }
+
+ if (fIgnoreWildCards) {
+ parseNoWildCards();
+ } else {
+ parseWildCards();
+ }
+ }
+ /**
+ * Given the starting (inclusive) and the ending (exclusive) poisitions in the
+ * text
, determine if the given substring matches with aPattern
+ * @return true if the specified portion of the text matches the pattern
+ * @param String text
, a String object that contains the substring to match
+ * @param int start marks the starting position (inclusive) of the substring
+ * @param int end marks the ending index (exclusive) of the substring
+ */
+ public boolean match(String text, int start, int end) {
+ if (null == fPattern || null == text)
+ throw new IllegalArgumentException();
+
+ if (start > end)
+ return false;
+
+ if (fIgnoreWildCards)
+ return fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
+ int segCount= fSegments.length;
+ if (segCount == 0) //pattern contains only '*'(s) or empty pattern
+ return true;
+ if (start == end)
+ return fLength == 0;
+ if (fLength == 0)
+ return start == end;
+
+ int tlen= text.length();
+ if (start < 0)
+ start= 0;
+ if (end > tlen)
+ end= tlen;
+
+ int tCurPos= start;
+ int bound= end - fBound;
+ if (bound < 0)
+ return false;
+ int i= 0;
+ String current= fSegments[i];
+ int segLength= current.length();
+
+ /* process first segment */
+ if (!fHasLeadingStar) {
+ if (!regExpRegionMatches(text, start, current, 0, segLength)) {
+ return false;
+ } else {
+ ++i;
+ tCurPos= tCurPos + segLength;
+ }
+ }
+
+ /* process middle segments */
+ for (; i < segCount && tCurPos <= bound; ++i) {
+ current= fSegments[i];
+ int currentMatch;
+ int k= current.indexOf(fSingleWildCard);
+ if (k < 0) {
+ currentMatch= textPosIn(text, tCurPos, end, current);
+ if (currentMatch < 0)
+ return false;
+ } else {
+ currentMatch= regExpPosIn(text, tCurPos, end, current);
+ if (currentMatch < 0)
+ return false;
+ }
+ tCurPos= currentMatch + current.length();
+ }
+
+ /* process final segment */
+ if (!fHasTrailingStar && tCurPos != end) {
+ int clen= current.length();
+ return regExpRegionMatches(text, end - clen, current, 0, clen);
+ }
+ return i == segCount;
+ }
+ /**
+ * match the given text
with the pattern
+ * @return true if matched eitherwise false
+ * @param text
, a String object
+ */
+ public boolean match(String text) {
+ return match(text, 0, text.length());
+ }
+ /**
+ * This method parses the given pattern into segments seperated by wildcard '*' characters.
+ * Since wildcards are not being used in this case, the pattern consists of a single segment.
+ */
+ private void parseNoWildCards() {
+ fSegments= new String[1];
+ fSegments[0]= fPattern;
+ fBound= fLength;
+ }
+ /**
+ * This method parses the given pattern into segments seperated by wildcard '*' characters.
+ * @param p, a String object that is a simple regular expression with * and/or ?
+ */
+ private void parseWildCards() {
+ if (fPattern.startsWith("*")) //$NON-NLS-1$
+ fHasLeadingStar= true;
+ if (fPattern.endsWith("*")) { //$NON-NLS-1$
+ /* make sure it's not an escaped wildcard */
+ if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
+ fHasTrailingStar= true;
+ }
+ }
+
+ Vector temp= new Vector();
+
+ int pos= 0;
+ StringBuffer buf= new StringBuffer();
+ while (pos < fLength) {
+ char c= fPattern.charAt(pos++);
+ switch (c) {
+ case '\\' :
+ if (pos >= fLength) {
+ buf.append(c);
+ } else {
+ char next= fPattern.charAt(pos++);
+ /* if it's an escape sequence */
+ if (next == '*' || next == '?' || next == '\\') {
+ buf.append(next);
+ } else {
+ /* not an escape sequence, just insert literally */
+ buf.append(c);
+ buf.append(next);
+ }
+ }
+ break;
+ case '*' :
+ if (buf.length() > 0) {
+ /* new segment */
+ temp.addElement(buf.toString());
+ fBound += buf.length();
+ buf.setLength(0);
+ }
+ break;
+ case '?' :
+ /* append special character representing single match wildcard */
+ buf.append(fSingleWildCard);
+ break;
+ default :
+ buf.append(c);
+ }
+ }
+
+ /* add last buffer to segment list */
+ if (buf.length() > 0) {
+ temp.addElement(buf.toString());
+ fBound += buf.length();
+ }
+
+ fSegments= new String[temp.size()];
+ temp.copyInto(fSegments);
+ }
+ /**
+ * @param text
, a string which contains no wildcard
+ * @param start
, the starting index in the text for search, inclusive
+ * @param end
, the stopping point of search, exclusive
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int posIn(String text, int start, int end) { //no wild card in pattern
+ int max= end - fLength;
+
+ if (!fIgnoreCase) {
+ int i= text.indexOf(fPattern, start);
+ if (i == -1 || i > max)
+ return -1;
+ return i;
+ }
+
+ for (int i= start; i <= max; ++i) {
+ if (text.regionMatches(true, i, fPattern, 0, fLength))
+ return i;
+ }
+
+ return -1;
+ }
+ /**
+ * @param text
, a simple regular expression that may only contain '?'(s)
+ * @param start
, the starting index in the text for search, inclusive
+ * @param end
, the stopping point of search, exclusive
+ * @param p
, a simple regular expression that may contains '?'
+ * @param caseIgnored
, wether the pattern is not casesensitive
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int regExpPosIn(String text, int start, int end, String p) {
+ int plen= p.length();
+
+ int max= end - plen;
+ for (int i= start; i <= max; ++i) {
+ if (regExpRegionMatches(text, i, p, 0, plen))
+ return i;
+ }
+ return -1;
+ }
+ /**
+ *
+ * @return boolean
+ * @param text
, a String to match
+ * @param start
, int that indicates the starting index of match, inclusive
+ * @param end
int that indicates the ending index of match, exclusive
+ * @param p
, String, String, a simple regular expression that may contain '?'
+ * @param ignoreCase
, boolean indicating wether code>p
is case sensitive
+ */
+ protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
+ while (plen-- > 0) {
+ char tchar= text.charAt(tStart++);
+ char pchar= p.charAt(pStart++);
+
+ /* process wild cards */
+ if (!fIgnoreWildCards) {
+ /* skip single wild cards */
+ if (pchar == fSingleWildCard) {
+ continue;
+ }
+ }
+ if (pchar == tchar)
+ continue;
+ if (fIgnoreCase) {
+ char tc= Character.toUpperCase(tchar);
+ if (tc == pchar)
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ /**
+ * @param text
, the string to match
+ * @param start
, the starting index in the text for search, inclusive
+ * @param end
, the stopping point of search, exclusive
+ * @param code>p
, a string that has no wildcard
+ * @param ignoreCase
, boolean indicating wether code>p
is case sensitive
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int textPosIn(String text, int start, int end, String p) {
+
+ int plen= p.length();
+ int max= end - plen;
+
+ if (!fIgnoreCase) {
+ int i= text.indexOf(p, start);
+ if (i == -1 || i > max)
+ return -1;
+ return i;
+ }
+
+ for (int i= 0; i <= max; ++i) {
+ if (text.regionMatches(true, i, p, 0, plen))
+ return i;
+ }
+
+ return -1;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CModelException.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CModelException.java
new file mode 100644
index 00000000000..dbe943a1445
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CModelException.java
@@ -0,0 +1,117 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.internal.core.model.CModelStatus;
+
+/**
+ * A checked exception representing a failure in the C model.
+ * C model exceptions contain a C-specific status object describing the
+ * cause of the exception.
+ *
+ * @see ICModelStatus
+ * @see ICModelStatusConstants
+ */
+public class CModelException extends CoreException {
+ /**
+ * Creates a C model exception that wrappers the given Throwable
.
+ * The exception contains a C-specific status object with severity
+ * IStatus.ERROR
and the given status code.
+ *
+ * @param exception the Throwable
+ * @param code one of the C-specific status codes declared in
+ * ICModelStatusConstants
+ * @return the new C model exception
+ * @see ICModelStatusConstants
+ * @see org.eclipse.core.runtime.IStatus#ERROR
+ */
+ public CModelException(Throwable e, int code) {
+ this(new CModelStatus(code, e));
+ }
+
+ /**
+ * Creates a C model exception for the given CoreException
.
+ * Equivalent to
+ * CModelException(exception,ICModelStatusConstants.CORE_EXCEPTION
.
+ *
+ * @param exception the CoreException
+ * @return the new C model exception
+ */
+ public CModelException(CoreException exception) {
+ this(new CModelStatus(exception));
+ }
+
+ /**
+ * Creates a C model exception for the given C-specific status object.
+ *
+ * @param status the C-specific status object
+ * @return the new C model exception
+ */
+ public CModelException(ICModelStatus status) {
+ super(status);
+ }
+
+ /**
+ * Returns the underlying Throwable
that caused the failure.
+ *
+ * @return the wrappered Throwable
, or null
if the
+ * direct case of the failure was at the C model layer
+ */
+ public Throwable getException() {
+ return getStatus().getException();
+ }
+
+ /**
+ * Returns the C model status object for this exception.
+ * Equivalent to (ICModelStatus) getStatus()
.
+ *
+ * @return a status object
+ */
+ public ICModelStatus getCModelStatus() {
+ return (ICModelStatus) getStatus();
+ }
+
+ /**
+ * Returns whether this exception indicates that a C model element does not
+ * exist. Such exceptions have a status with a code of
+ * ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST
.
+ * This is a convenience method.
+ *
+ * @return true
if this exception indicates that a C model
+ * element does not exist
+ * @see ICModelStatus#doesNotExist
+ * @see ICModelStatusConstants#ELEMENT_DOES_NOT_EXIST
+ */
+ public boolean doesNotExist() {
+ ICModelStatus cModelStatus = getCModelStatus();
+ return cModelStatus != null && cModelStatus.doesNotExist();
+ }
+
+ /**
+ * Returns a printable representation of this exception suitable for debugging
+ * purposes only.
+ */
+ public String toString() {
+ StringBuffer buffer= new StringBuffer();
+ buffer.append("C Model Exception: "); //$NON-NLS-1$
+ if (getException() != null) {
+ if (getException() instanceof CoreException) {
+ CoreException c= (CoreException)getException();
+ buffer.append("Core Exception [code "); //$NON-NLS-1$
+ buffer.append(c.getStatus().getCode());
+ buffer.append("] "); //$NON-NLS-1$
+ buffer.append(c.getStatus().getMessage());
+ } else {
+ buffer.append(getException().toString());
+ }
+ } else {
+ buffer.append(getStatus().toString());
+ }
+ return buffer.toString();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java
new file mode 100644
index 00000000000..76a09f62266
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java
@@ -0,0 +1,252 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+//import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.internal.core.model.CModelManager;
+
+// This should be done in the Plugin.
+
+public class CoreModel {
+
+ private static CoreModel cmodel = null;
+ private static CModelManager manager = null;
+
+ /**
+ * Plugin string id.
+ */
+ public final static String PLUGIN_ID = "org.eclipse.cdt.core";
+
+ /**
+ * C nature string name, "cnature".
+ */
+ public final static String C_NATURE_NAME = "cnature";
+ /**
+ * C nature string id, PLUGIN_ID + C_NATURE_NAME
+ */
+ public final static String C_NATURE_ID = PLUGIN_ID + "." + C_NATURE_NAME;
+
+ /**
+ * C++ nature string name, "ccnature"
+ */
+ public final static String CC_NATURE_NAME = "ccnature";
+ /**
+ * C++ nature string id, PLUGIN_ID + CC_NATURE_NAME
+ */
+ public final static String CC_NATURE_ID = PLUGIN_ID + "." + CC_NATURE_NAME;
+
+ /**
+ * Returns the plugin id.
+ */
+ public static String getPluginId() {
+ return PLUGIN_ID;
+ }
+
+ /**
+ * Returns the C nature Name.
+ */
+ public static String getCNatureName () {
+ return C_NATURE_NAME;
+ }
+
+ /**
+ * Returns the C++ nature name.
+ */
+ public static String getCCNatureName () {
+ return CC_NATURE_NAME;
+ }
+
+ /**
+ * Returns the C nature Id.
+ */
+ public static String getCNatureId () {
+ return C_NATURE_ID;
+ }
+
+ /**
+ * Returns the C++ nature Id.
+ */
+ public static String getCCNatureId () {
+ return CC_NATURE_ID;
+ }
+
+ /**
+ * Creates an ICElement form and IPath.
+ * Returns null if not found.
+ */
+ public ICElement create(IPath path) {
+ return manager.create(path);
+ }
+
+ /**
+ * Creates an ICElement form and IFile.
+ * Returns null if not found.
+ */
+ public ICElement create(IFile file) {
+ return manager.create(file);
+ }
+
+ /**
+ * Creates an ICElement form and IFolder.
+ * Returns null if not found.
+ */
+ public ICElement create(IFolder folder) {
+ return manager.create(folder);
+ }
+
+ /**
+ * Creates an ICElement form and IProject.
+ * Returns null if not found.
+ */
+ public ICElement create(IProject project) {
+ return manager.create(project);
+ }
+
+ /**
+ * Creates an ICElement form and IWorkspaceRoot.
+ * Returns null if not found.
+ */
+ public ICElement create(IWorkspaceRoot root) {
+ return manager.create(root);
+ }
+
+ /**
+ * Creates an ICElement form and IResource.
+ * Returns null if not found.
+ */
+ public ICElement create(IResource resource) {
+ return manager.create(resource);
+ }
+
+ /**
+ * Returns the default ICRoot.
+ */
+ public ICElement getCRoot() {
+ return manager.getCRoot();
+ }
+
+ /**
+ * Return true if IFile is a shared library, i.e. libxx.so
+ */
+ public static boolean isSharedLib(IFile file) {
+ return manager.isSharedLib(file);
+ }
+
+ /**
+ * Return true if IFile is a an object(ELF), i.e. *.o
+ */
+ public static boolean isObject(IFile file) {
+ return manager.isObject(file);
+ }
+
+ /**
+ * Return true if IFile is an ELF executable
+ */
+ public static boolean isExecutable(IFile file) {
+ return manager.isExecutable(file);
+ }
+
+ /**
+ * Return true if IFile is an ELF.
+ */
+ public static boolean isBinary(IFile file) {
+ return manager.isBinary(file);
+ }
+
+ /**
+ * Return true if IFile is an Achive, *.a
+ */
+ public static boolean isArchive(IFile file) {
+ return manager.isArchive(file);
+ }
+
+ /**
+ * Return true if IFile is a TranslationUnit.
+ */
+ public static boolean isTranslationUnit(IFile file) {
+ return manager.isTranslationUnit(file);
+ }
+
+ /**
+ * Return true if name is a valid name for a translation unit.
+ */
+ public static boolean isValidTranslationUnitName(String name){
+ return manager.isValidTranslationUnitName(name);
+ }
+
+ /**
+ * Return true if project has C nature.
+ */
+ public static boolean hasCNature(IProject project){
+ return manager.hasCNature(project);
+ }
+
+ public static boolean hasCCNature(IProject project){
+ return manager.hasCCNature(project);
+ }
+
+ public static void addCNature(IProject project, IProgressMonitor monitor) throws CModelException {
+ manager.addCNature(project, monitor);
+ }
+
+ public static void addCCNature(IProject project, IProgressMonitor monitor) throws CModelException {
+ manager.addCCNature(project, monitor);
+ }
+
+ public static void removeCNature(IProject project, IProgressMonitor monitor) throws CModelException {
+ manager.removeCNature(project, monitor);
+ }
+
+ public static void removeCCNature(IProject project, IProgressMonitor monitor) throws CModelException {
+ manager.removeCCNature(project, monitor);
+ }
+
+ public static void addNature(IProject project, String natureId, IProgressMonitor monitor)
+ throws CModelException {
+ manager.addNature(project, natureId, monitor);
+ }
+
+ public static void removeNature(IProject project, String natureId, IProgressMonitor monitor)
+ throws CModelException {
+ manager.removeNature(project, natureId, monitor);
+ }
+
+ /**
+ * Return the singleton.
+ */
+ public static CoreModel getDefault() {
+ if (cmodel == null) {
+ cmodel = new CoreModel();
+ manager = CModelManager.getDefault();
+ }
+ return cmodel;
+ }
+
+ public static void addElementChangedListener(IElementChangedListener listener) {
+ manager.addElementChangedListener(listener);
+ }
+
+ /**
+ * Removes the given element changed listener.
+ * Has no affect if an identical listener is not registered.
+ *
+ * @param listener the listener
+ */
+ public static void removeElementChangedListener(IElementChangedListener listener) {
+ manager.removeElementChangedListener(listener);
+ }
+
+ private CoreModel() {
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ElementChangedEvent.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ElementChangedEvent.java
new file mode 100644
index 00000000000..92feb5953fa
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ElementChangedEvent.java
@@ -0,0 +1,33 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import java.util.EventObject;
+
+/**
+ * An element changed event describes a change to the structure or contents
+ * of a tree of C elements. The changes to the elements are described by
+ * the associated delta object carried by this event.
+ *
+ * @see IElementChangedListener
+ * @see ICElementDelta
+ */
+public class ElementChangedEvent extends EventObject {
+ /**
+ * Creates an new element changed event (based on a ICElementDelta
).
+ *
+ * @param delta the C element delta.
+ */
+ public ElementChangedEvent(ICElementDelta delta) {
+ super(delta);
+ }
+ /**
+ * Returns the delta describing the change.
+ *
+ */
+ public ICElementDelta getDelta() {
+ return (ICElementDelta) source;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/Flags.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/Flags.java
new file mode 100644
index 00000000000..30925076c86
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/Flags.java
@@ -0,0 +1,188 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.internal.core.model.IConstants;
+
+/**
+ * Utility class for decoding modifier flags in C elements.
+ *
+ * This class provides static methods only; it is not intended to be
+ * instantiated or subclassed by clients.
+ *
+ *
+ */
+public final class Flags {
+ /**
+ * Not instantiable.
+ */
+ private Flags() {}
+
+ /**
+ * Returns whether the given integer includes the abstract
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the abstract
modifier is included
+ */
+ public static boolean isAbstract(int flags) {
+ return (flags & IConstants.AccAbstract) != 0;
+ }
+
+ /**
+ *
+ * Return whether the give integer include the keyword export
modifier.
+ * @param flags the flags
+ * @return true
if the element is export
+ */
+ public static boolean isExport(int flags) {
+ return (flags & IConstants.AccExport) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the inline
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the inline
modifier is included
+ */
+ public static boolean isInline(int flags) {
+ return (flags & IConstants.AccInline) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the explicit
modifier.
+ *
+ * @param flags the flags
+ * @return true
if explicit
modifier is included
+ */
+ public static boolean isExplicit(int flags) {
+ return (flags & IConstants.AccExplicit) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the private
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the private
modifier is included
+ */
+ public static boolean isPrivate(int flags) {
+ return (flags & IConstants.AccPrivate) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the protected
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the protected
modifier is included
+ */
+ public static boolean isProtected(int flags) {
+ return (flags & IConstants.AccProtected) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the public
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the public
modifier is included
+ */
+ public static boolean isPublic(int flags) {
+ return (flags & IConstants.AccPublic) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the static
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the static
modifier is included
+ */
+ public static boolean isStatic(int flags) {
+ return (flags & IConstants.AccStatic) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the extern
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the extern
modifier is included
+ */
+ public static boolean isExtern(int flags) {
+ return (flags & IConstants.AccExtern) != 0;
+ }
+ /**
+ * Returns whether the given integer includes the mutable
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the mutable
modifier is included
+ */
+ public static boolean isMutable(int flags) {
+ return (flags & IConstants.AccMutable) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the indication that the
+ * element is a register storage specifier.
+ *
+ * @param flags the flags
+ * @return true
if the element is marked register storage specifier
+ */
+ public static boolean isRegister(int flags) {
+ return (flags & IConstants.AccRegister) != 0;
+ }
+ /**
+ * Returns whether the given integer includes the virtual
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the virtual
modifier is included
+ */
+ public static boolean isVirtual(int flags) {
+ return (flags & IConstants.AccVirtual) != 0;
+ }
+
+ /**
+ * Returns whether the given integer includes the volatile
modifier.
+ *
+ * @param flags the flags
+ * @return true
if the volatile
modifier is included
+ */
+ public static boolean isVolatile(int flags) {
+ return (flags & IConstants.AccVolatile) != 0;
+ }
+
+ /**
+ * Returns a standard string describing the given modifier flags.
+ * Only modifier flags are included in the output; the deprecated and
+ * synthetic flags are ignored if set.
+ *
+ * Examples results:
+ *
+ * "public static"
+ * "private"
+ *
+ *
+ *
+ * @param flags the flags
+ * @return the standard string representation of the given flags
+ */
+ public static String toString(int flags) {
+ StringBuffer sb = new StringBuffer();
+
+ if (isPublic(flags)) sb.append("public "); //$NON-NLS-1$
+ if (isProtected(flags)) sb.append("protected "); //$NON-NLS-1$
+ if (isPrivate(flags)) sb.append("private "); //$NON-NLS-1$
+ if (isStatic(flags)) sb.append("static "); //$NON-NLS-1$
+ if (isAbstract(flags)) sb.append("abstract "); //$NON-NLS-1$
+ if (isVirtual(flags)) sb.append("virtual "); //$NON-NLS-1$
+ if (isInline(flags)) sb.append("inline "); //$NON-NLS-1$
+ if (isExtern(flags)) sb.append("extern "); //$NON-NLS-1$
+ if (isExport(flags)) sb.append("export "); //$NON-NLS-1$
+ if (isVolatile(flags)) sb.append("volatile "); //$NON-NLS-1$
+ if (isExplicit(flags)) sb.append("explicit "); //$NON-NLS-1$
+
+ int len = sb.length();
+ if (len == 0) return ""; //$NON-NLS-1$
+ sb.setLength(len-1);
+ return sb.toString();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IArchive.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IArchive.java
new file mode 100644
index 00000000000..449164dd1b0
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IArchive.java
@@ -0,0 +1,18 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * An IArchive represents a group of files combined into a
+ * single file(the Archive), for example libxx.a.
+ */
+public interface IArchive extends ICFile {
+ /**
+ * Return the binaries contain in the archive.
+ * It does not actually extract the files.
+ */
+ public IBinary[] getBinaries();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IArchiveContainer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IArchiveContainer.java
new file mode 100644
index 00000000000..8e0f54c9b7a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IArchiveContainer.java
@@ -0,0 +1,14 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a container of all the IArchive's found in the project
+ * while inspecting the project.
+ */
+public interface IArchiveContainer extends IParent, ICElement {
+ public IArchive[] getArchives();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBinary.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBinary.java
new file mode 100644
index 00000000000..1a68f3793b6
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBinary.java
@@ -0,0 +1,35 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a Binary file, for example an ELF excutable.
+ * An ELF parser will inspect the binary.
+ */
+public interface IBinary extends ICFile {
+ /**
+ * Return whether the file was compiling with debug symbols.
+ */
+ public boolean hasDebug();
+
+ public boolean isExecutable();
+
+ public boolean isObject();
+
+ public boolean isSharedLib();
+
+ public String [] getNeededSharedLibs();
+
+ public String getSoname();
+
+ public String getCPU();
+
+ public long getText();
+
+ public long getData();
+
+ public long getBSS();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBinaryContainer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBinaryContainer.java
new file mode 100644
index 00000000000..0746357341c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IBinaryContainer.java
@@ -0,0 +1,15 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a container of all the IBinary's found in the project
+ * while inspecting the project.
+ */
+public interface IBinaryContainer extends IParent, ICElement {
+
+ public IBinary[] getBinaries();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
new file mode 100644
index 00000000000..75660dccca8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
@@ -0,0 +1,289 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * Common protocol for all elements provided by the C model.
+ */
+public interface ICElement extends IAdaptable {
+
+ /**
+ * IResource from 10-20
+ */
+
+ /**
+ * Constant representing a C Root workspace (IWorkspaceRoot object).
+ * A C element with this type can be safely cast to ICRoot
.
+ */
+ public static final int C_ROOT = 10;
+
+ /**
+ * Constant representing a C project(IProject object).
+ * A C element with this type can be safely cast to ICProject
.
+ */
+ public static final int C_PROJECT = 11;
+
+ /**
+ * Constant representing a folder(ICFolder object).
+ * A C element with this type can be safely cast to ICFolder
.
+ */
+ public static final int C_FOLDER = 12;
+
+ /**
+ * Constant representing a file(ICFile object).
+ * A C element with this type can be safely cast to ICFile
.
+ */
+ public static final int C_FILE = 13;
+
+ /**
+ * Virtual container serving as a place holder.
+ */
+ public static final int C_CONTAINER = 30;
+
+ /**
+ * Constant representing a C/C++ children of a Translation Unit
+ */
+ public static final int C_UNIT = 60;
+
+ /**
+ * Namespace.
+ */
+ public static final int C_NAMESPACE = 61;
+
+ /**
+ * Using.
+ */
+ public static final int C_USING = 62;
+
+ /**
+ * Enumeration.
+ */
+ public static final int C_ENUMERATION = 63;
+
+ /**
+ * Constant representing a class structure.
+ */
+ public static final int C_CLASS = 64;
+
+ /**
+ * Constant representing a struct structure.
+ */
+ public static final int C_STRUCT = 65;
+
+ /**
+ * Constant representing a union structure.
+ */
+ public static final int C_UNION = 66;
+
+ /**
+ * A method definition part of a structure(class, struct, union).
+ */
+ public static final int C_METHOD = 67;
+
+ /**
+ * A method declaration part of a structure(class, struct, union).
+ */
+ public static final int C_METHOD_DECLARATION = 68;
+
+ /**
+ * A Field definition part of a structure(class, struct, union).
+ */
+ public static final int C_FIELD = 69;
+
+ /**
+ * a C/C++ function prototype.
+ */
+ public static final int C_FUNCTION_DECLARATION = 70;
+
+ /**
+ * a C/C++ function.
+ */
+ public static final int C_FUNCTION = 71;
+
+ /**
+ * Preprocessor #include directive.
+ */
+ public static final int C_INCLUDE = 72;
+
+ /**
+ * C++ template class.
+ */
+ public static final int C_TEMPLATE = 73;
+
+ /**
+ * Global variable.
+ */
+ public static final int C_VARIABLE = 74;
+
+ /**
+ * variable Declaration.
+ */
+ public static final int C_VARIABLE_DECLARATION = 75;
+
+ /**
+ * Local Variable.
+ */
+ public static final int C_VARIABLE_LOCAL = 76;
+
+ /**
+ * A preprocessor macro.
+ */
+ public static final int C_MACRO = 77;
+
+ /**
+ * a Typedef.
+ */
+ public static final int C_TYPEDEF = 78;
+
+ /**
+ * Modifier indicating a class constructor
+ */
+ public static final int C_CLASS_CTOR = 0x100;
+
+ /**
+ * Modifier indicating a class destructor
+ */
+ public static final int C_CLASS_DTOR = 0x200;
+
+ /**
+ * Modifier indicating a static storage attribute
+ */
+ public static final int C_STORAGE_STATIC = 0x400;
+
+ /**
+ * Modifier indicating an extern storage attribute
+ */
+ public static final int C_STORAGE_EXTERN = 0x800;
+
+ /**
+ * Modifier indicating a private class
+ */
+ public static final int CPP_PRIVATE = 0x1000;
+
+ /**
+ * Modifier indicating a public class
+ */
+
+ public static final int CPP_PUBLIC = 0x2000;
+
+ /**
+ * Modifier indicating a friend class
+ */
+ public static final int CPP_FRIEND = 0x4000;
+
+ /**
+ * Returns whether this C element exists in the model.
+ *
+ * @return true
if this element exists in the C model
+ */
+ boolean exists();
+
+ /**
+ * Returns the resource that corresponds directly to this element,
+ * or null
if there is no resource that corresponds to
+ * this element.
+ *
+ * For example, the corresponding resource for an ATranslationUnit
+ * is its underlying IFile
.
+ *
+ * @return the corresponding resource, or null
if none
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ IResource getCorrespondingResource() throws CModelException;
+
+ /**
+ * Returns the name of this element.
+ *
+ * @return the element name
+ */
+ String getElementName();
+
+ /**
+ * Returns this element's kind encoded as an integer.
+ * This is a handle-only method.
+ *
+ * @return the kind of element; one of the constants declared in
+ * ICElement
+ * @see ICElement
+ */
+ public int getElementType();
+
+ /**
+ * Returns the C model.
+ *
+ * @return the C model
+ */
+ ICRoot getCRoot();
+
+ /**
+ * Returns the C project this element is contained in,
+ * or null
if this element is not contained in any C project
+ *
+ * @return the containing C project, or null
if this element is
+ * not contained in a C project
+ */
+ ICProject getCProject();
+
+ /**
+ * Returns the element directly containing this element,
+ * or null
if this element has no parent.
+ *
+ * @return the parent element, or null
if this element has no parent
+ */
+ ICElement getParent();
+
+ /**
+ * Returns the path to the innermost resource enclosing this element.
+ * If this element is not included in an external archive,
+ * the path returned is the full, absolute path to the underlying resource,
+ * relative to the workbench.
+ * If this element is included in an external archive,
+ * the path returned is the absolute path to the archive in the file system.
+ * This is a handle-only method.
+ *
+ */
+ IPath getPath();
+
+ /**
+ * Returns the underlying resource that contains
+ * this element, or null
if this element is not contained
+ * in a resource.
+ *
+ * @return the underlying resource, or null
if none
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its underlying resource
+ */
+ IResource getUnderlyingResource() throws CModelException;
+
+ /**
+ * Returns whether this C element is read-only. An element is read-only
+ * if its structure cannot be modified by the C model.
+ *
+ * @return true
if this element is read-only
+ */
+ boolean isReadOnly();
+
+ /**
+ * Returns whether the structure of this element is known. For example, for a
+ * translation unit that could not be parsed, false
is returned.
+ * If the structure of an element is unknown, navigations will return reasonable
+ * defaults. For example, getChildren
will return an empty collection.
+ *
+ * Note: This does not imply anything about consistency with the
+ * underlying resource/buffer contents.
+ *
+ *
+ * @return true
if the structure of this element is known
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ boolean isStructureKnown() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java
new file mode 100644
index 00000000000..680d2f5698c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java
@@ -0,0 +1,187 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.core.resources.IResourceDelta;
+
+/**
+ * A C element delta describes changes in C element between two discrete
+ * points in time. Given a delta, clients can access the element that has
+ * changed, and any children that have changed.
+ *
+ * Deltas have a different status depending on the kind of change they represent.
+ * The list below summarizes each status (as returned by getKind
)
+ * and its meaning:
+ *
+ * ADDED
- The element described by the delta
+ * has been added.
+ * REMOVED
- The element described by the delta
+ * has been removed.
+ * CHANGED
- The element described by the delta
+ * has been changed in some way.
+ *
+ *
+ *
+ * Move operations are indicated by other change flags, layered on top
+ * of the change flags described above. If element A is moved to become B,
+ * the delta for the change in A will have status REMOVED
,
+ * with change flag F_MOVED_TO
. In this case,
+ * getMovedToElement
on delta A will return the handle for B.
+ * The delta for B will have status ADDED
, with change flag
+ * F_MOVED_FROM
, and getMovedFromElement
on delta
+ * B will return the handle for A. (Note, the handle to A in this case represents
+ * an element that no longer exists).
+ *
+ *
+ * Note that the move change flags only describe the changes to a single element, they
+ * do not imply anything about the parent or children of the element.
+ */
+public interface ICElementDelta {
+
+ /**
+ * Status constant indicating that the element has been added.
+ */
+ public int ADDED = 1;
+
+ /**
+ * Status constant indicating that the element has been removed.
+ */
+ public int REMOVED = 2;
+
+ /**
+ * Status constant indicating that the element has been changed,
+ * as described by the change flags.
+ */
+ public int CHANGED = 4;
+
+ /**
+ * Change flag indicating that the content of the element has changed.
+ */
+ public int F_CONTENT = 0x0001;
+
+ /**
+ * Change flag indicating that the modifiers of the element have changed.
+ */
+ public int F_MODIFIERS = 0x0002;
+
+ /**
+ * Change flag indicating that there are changes to the children of the element.
+ */
+ public int F_CHILDREN = 0x0008;
+
+ /**
+ * Change flag indicating that the element was moved from another location.
+ * The location of the old element can be retrieved using getMovedFromElement
.
+ */
+ public int F_MOVED_FROM = 0x0010;
+
+ /**
+ * Change flag indicating that the element was moved to another location.
+ * The location of the new element can be retrieved using getMovedToElement
.
+ */
+ public int F_MOVED_TO = 0x0020;
+
+ /**
+ * Change flag indicating that the underlying IProject
has been
+ * opened.
+ */
+ public int F_OPENED = 0x0200;
+
+ /**
+ * Change flag indicating that the underlying IProject
has been
+ * closed.
+ */
+ public int F_CLOSED = 0x0400;
+
+ //public int F_ADDED_TO_CLASSPATH = 0x0040;
+ //public int F_REMOVED_FROM_CLASSPATH = 0x0080;
+ //public int F_CLASSPATH_REORDER = 0x0100;
+ //public int F_SUPER_TYPES = 0x0800;
+
+ /**
+ * Change flag indicating that a source jar has been attached to a binary jar.
+ */
+ public int F_SOURCEATTACHED = 0x1000;
+
+ /**
+ * Change flag indicating that a source jar has been detached to a binary jar.
+ */
+ public int F_SOURCEDETACHED = 0x2000;
+
+ /**
+ * Change flag indicating that this is a fine-grained delta, i.e. an analysis down
+ * to the members level was done to determine if there were structural changes to
+ * members.
+ */
+ public int F_FINE_GRAINED = 0x4000;
+
+ /**
+ * Returns deltas for the children that have been added.
+ */
+ public ICElementDelta[] getAddedChildren();
+
+ /**
+ * Returns deltas for the affected (added, removed, or changed) children.
+ */
+ public ICElementDelta[] getAffectedChildren();
+
+ /**
+ * Returns deltas for the children which have changed.
+ */
+ public ICElementDelta[] getChangedChildren();
+
+ /**
+ * Returns the element that this delta describes a change to.
+ */
+ public ICElement getElement();
+
+ /**
+ * Returns flags that describe how an element has changed.
+ *
+ * @see ICElementDelta#F_CHILDREN
+ * @see ICElementDelta#F_CONTENT
+ * @see ICElementDelta#F_MODIFIERS
+ * @see ICElementDelta#F_MOVED_FROM
+ * @see ICElementDelta#F_MOVED_TO
+ */
+ public int getFlags();
+
+ /**
+ * Returns the kind of this delta - one of ADDED
, REMOVED
,
+ * or CHANGED
.
+ */
+ public int getKind();
+
+ /**
+ * Returns an element describing this element before it was moved
+ * to its current location, or null
if the
+ * F_MOVED_FROM
change flag is not set.
+ */
+ public ICElement getMovedFromElement();
+
+ /**
+ * Returns an element describing this element in its new location,
+ * or null
if the F_MOVED_TO
change
+ * flag is not set.
+ */
+ public ICElement getMovedToElement();
+
+ /**
+ * Returns deltas for the children which have been removed.
+ */
+ public ICElementDelta[] getRemovedChildren();
+
+ /**
+ * Returns the collection of resource deltas.
+ *
+ * Note that resource deltas, like C element deltas, are generally only valid
+ * for the dynamic scope of an event notification. Clients must not hang on to
+ * these objects.
+ *
+ *
+ * @return the underlying resource deltas, or null
if none
+ */
+ public IResourceDelta[] getResourceDeltas();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICFile.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICFile.java
new file mode 100644
index 00000000000..ef747add31e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICFile.java
@@ -0,0 +1,22 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * A C File Resource.
+ */
+public interface ICFile extends IParent, ICElement {
+
+ public boolean isBinary();
+
+ public boolean isArchive();
+
+ public boolean isTranslationUnit();
+
+ public IFile getFile();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICFolder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICFolder.java
new file mode 100644
index 00000000000..42eefe863d7
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICFolder.java
@@ -0,0 +1,16 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFolder;
+
+/**
+ * A C Folder Resource.
+ */
+public interface ICFolder extends IParent, ICElement {
+
+ public IFolder getFolder();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelMarker.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelMarker.java
new file mode 100644
index 00000000000..512e88573c9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelMarker.java
@@ -0,0 +1,35 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.internal.CCorePlugin;
+
+
+/**
+ * Markers used by the C model.
+ *
+ * This interface declares constants only; it is not intended to be implemented
+ * or extended.
+ *
+ */
+public interface ICModelMarker {
+
+ /**
+ * C model problem marker type (value "org.eclipse.cdt.core.problem"
).
+ * This can be used to recognize those markers in the workspace that flag problems
+ * detected by the C ompilers.
+ */
+ public static final String C_MODEL_PROBLEM_MARKER = CCorePlugin.PLUGIN_ID + ".problem"; //$NON-NLS-1$
+
+ /**
+ * C model extension to the marker problem markers which may hold a hint on
+ * the variable name that caused the error. Used by the ui to highlight the variable
+ * itself if it can be found.
+ */
+ public static final String C_MODEL_MARKER_VARIABLE = "problem.variable"; //$NON-NLS-1$
+}
+
+
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelStatus.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelStatus.java
new file mode 100644
index 00000000000..f62c6d50faa
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelStatus.java
@@ -0,0 +1,79 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * Represents the outcome of an C model operation. Status objects are
+ * used inside CModelException
objects to indicate what went
+ * wrong.
+ *
+ * C model status object are distinguished by their plug-in id:
+ * getPlugin
returns "org.eclipse.cdt.core"
.
+ * getCode
returns one of the status codes declared in
+ * ICModelStatusConstants
.
+ *
+ *
+ * A C model status may also carry additional information (that is, in
+ * addition to the information defined in IStatus
):
+ *
+ * - elements - optional handles to C elements associated with the failure
+ * - string - optional string associated with the failure
+ *
+ *
+ * This interface is not intended to be implemented by clients.
+ *
+ *
+ * @see org.eclipse.core.runtime.IStatus
+ * @see ICModelStatusConstants
+ */
+public interface ICModelStatus extends IStatus {
+ /**
+ * Returns any C elements associated with the failure (see specification
+ * of the status code), or an empty array if no elements are related to this
+ * particular status code.
+ *
+ * @return the list of C element culprits
+ * @see ICModelStatusConstants
+ */
+ ICElement[] getElements();
+
+ /**
+ * Returns the path associated with the failure (see specification
+ * of the status code), or null
if the failure is not
+ * one of DEVICE_PATH
, INVALID_PATH
,
+ * PATH_OUTSIDE_PROJECT
, or RELATIVE_PATH
.
+ *
+ * @return the path that caused the failure, or null
if none
+ * @see ICModelStatusConstants#DEVICE_PATH
+ * @see ICModelStatusConstants#INVALID_PATH
+ * @see ICModelStatusConstants#PATH_OUTSIDE_PROJECT
+ * @see ICModelStatusConstants#RELATIVE_PATH
+ */
+ IPath getPath();
+
+ /**
+ * Returns the string associated with the failure (see specification
+ * of the status code), or null
if no string is related to this
+ * particular status code.
+ *
+ * @return the string culprit, or null
if none
+ * @see ICModelStatusConstants
+ */
+ String getString();
+
+ /**
+ * Returns whether this status indicates that a C model element does not exist.
+ * This convenience method is equivalent to
+ * getCode() == ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST
.
+ *
+ * @return true
if the status code indicates that a C model
+ * element does not exist
+ * @see ICModelStatusConstants#ELEMENT_DOES_NOT_EXIST
+ */
+ boolean doesNotExist();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelStatusConstants.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelStatusConstants.java
new file mode 100644
index 00000000000..21fe3c6a202
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICModelStatusConstants.java
@@ -0,0 +1,224 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Status codes used with C model status objects.
+ *
+ * This interface declares constants only; it is not intended to be implemented
+ * or extended.
+ *
+ *
+ * @see ICModelStatus
+ * @see org.eclipse.core.runtime.IStatus#getCode
+ */
+public interface ICModelStatusConstants {
+
+ /**
+ * Status constant indicating that a variable path was not resolvable
+ * indicating either the referred variable is undefined, unbound or the resolved
+ * variable path does not correspond to an existing file or folder.
+ */
+ public static final int CP_VARIABLE_PATH_UNBOUND = 965;
+
+ /**
+ * Status constant indicating a core exception occurred.
+ * Use getException
to retrieve a CoreException
.
+ */
+ public static final int CORE_EXCEPTION = 966;
+
+ /**
+ * Status constant indicating one or more of the elements
+ * supplied are not of a valid type for the operation to
+ * process.
+ * The element(s) can be retrieved using getElements
on the status object.
+ */
+ public static final int INVALID_ELEMENT_TYPES = 967;
+
+ /**
+ * Status constant indicating that no elements were
+ * provided to the operation for processing.
+ */
+ public static final int NO_ELEMENTS_TO_PROCESS = 968;
+
+ /**
+ * Status constant indicating that one or more elements
+ * supplied do not exist.
+ * The element(s) can be retrieved using getElements
on the status object.
+ *
+ * @see ICModelStatus#isDoesNotExist
+ */
+ public static final int ELEMENT_DOES_NOT_EXIST = 969;
+
+ /**
+ * Status constant indicating that a null
path was
+ * supplied to the operation.
+ */
+ public static final int NULL_PATH = 970;
+
+ /**
+ * Status constant indicating that a path outside of the
+ * project was supplied to the operation. The path can be retrieved using
+ * getPath
on the status object.
+ */
+ public static final int PATH_OUTSIDE_PROJECT = 971;
+
+ /**
+ * Status constant indicating that a relative path
+ * was supplied to the operation when an absolute path is
+ * required. The path can be retrieved using getPath
on the
+ * status object.
+ */
+ public static final int RELATIVE_PATH = 972;
+
+ /**
+ * Status constant indicating that a path specifying a device
+ * was supplied to the operation when a path with no device is
+ * required. The path can be retrieved using getPath
on the
+ * status object.
+ */
+ public static final int DEVICE_PATH = 973;
+
+ /**
+ * Status constant indicating that a string
+ * was supplied to the operation that was null
.
+ */
+ public static final int NULL_STRING = 974;
+
+ /**
+ * Status constant indicating that the operation encountered
+ * a read-only element.
+ * The element(s) can be retrieved using getElements
on the status object.
+ */
+ public static final int READ_ONLY = 976;
+
+ /**
+ * Status constant indicating that a naming collision would occur
+ * if the operation proceeded.
+ */
+ public static final int NAME_COLLISION = 977;
+
+ /**
+ * Status constant indicating that a destination provided for a copy/move/rename operation
+ * is invalid.
+ * The destination element can be retrieved using getElements
on the status object.
+ */
+ public static final int INVALID_DESTINATION = 978;
+
+ /**
+ * Status constant indicating that a path provided to an operation
+ * is invalid. The path can be retrieved using getPath
on the
+ * status object.
+ */
+ public static final int INVALID_PATH = 979;
+
+ /**
+ * Status constant indicating the given source position is out of bounds.
+ */
+ public static final int INDEX_OUT_OF_BOUNDS = 980;
+
+ /**
+ * Status constant indicating there is an update conflict
+ * for a working copy. The translation unit on which the
+ * working copy is based has changed since the working copy
+ * was created.
+ */
+ public static final int UPDATE_CONFLICT = 981;
+
+ /**
+ * Status constant indicating that null
was specified
+ * as a name argument.
+ */
+ public static final int NULL_NAME = 982;
+
+ /**
+ * Status constant indicating that a name provided is not syntactically correct.
+ * The name can be retrieved from getString
.
+ */
+ public static final int INVALID_NAME = 983;
+
+ /**
+ * Status constant indicating that the specified contents
+ * are not valid.
+ */
+ public static final int INVALID_CONTENTS = 984;
+
+ /**
+ * Status constant indicating that an java.io.IOException
+ * occurred.
+ */
+ public static final int IO_EXCEPTION = 985;
+
+ /**
+ * Status constant indicating that a DOMException
+ * occurred.
+ */
+ public static final int DOM_EXCEPTION = 986;
+
+ /**
+ * Status constant indicating that a TargetException
+ * occurred.
+ */
+ public static final int TARGET_EXCEPTION = 987;
+
+ /**
+ * Status constant indicating that the C builder
+ * could not be initialized.
+ */
+ public static final int BUILDER_INITIALIZATION_ERROR = 990;
+
+ /**
+ * Status constant indicating that the C builder's last built state
+ * could not be serialized or deserialized.
+ */
+ public static final int BUILDER_SERIALIZATION_ERROR = 991;
+
+ /**
+ * Status constant indicating that an error was encountered while
+ * trying to evaluate a code snippet, or other item.
+ */
+ public static final int EVALUATION_ERROR = 992;
+
+ /**
+ * Status constant indicating that a sibling specified is not valid.
+ */
+ public static final int INVALID_SIBLING = 993;
+
+ /**
+ * Status indicating that a C element could not be created because
+ * the underlying resource is invalid.
+ * @see CCore
+ */
+ public static final int INVALID_RESOURCE = 995;
+
+ /**
+ * Status indicating that a C element could not be created because
+ * the underlying resource is not of an appropriate type.
+ * @see CCore
+ */
+ public static final int INVALID_RESOURCE_TYPE = 996;
+
+ /**
+ * Status indicating that a C element could not be created because
+ * the project owning underlying resource does not have the C nature.
+ * @see CCore
+ */
+ public static final int INVALID_PROJECT = 997;
+
+ //public static final int INVALID_NAMESPACE = 998;
+
+ /**
+ * Status indicating that the corresponding resource has no local contents yet.
+ * This might happen when attempting to use a resource before its contents
+ * has been made locally available.
+ */
+ public static final int NO_LOCAL_CONTENTS = 999;
+
+ ///**
+ //* Status constant indicating that a classpath entry was invalid
+ //*/
+ //public static final int INVALID_CLASSPATH = 964;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java
new file mode 100644
index 00000000000..26648b46920
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java
@@ -0,0 +1,43 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * A C project represents a view of a project resource in terms of C
+ * elements such as ICFile, ICFolder ....
+ * CCore.create(project)
.
+ *
+ *
+ * @see CCore#create(org.eclipse.core.resources.IProject)
+ * @see IBuildEntry
+ */
+public interface ICProject extends IParent, ICElement {
+
+ /**
+ * Returns the ICElement
corresponding to the given
+ * path, or null
if no such
+ * ICElement
is found.
+ *
+ * @exception CModelException if the given path is null
+ * or absolute
+ */
+ ICElement findElement(IPath path) throws CModelException;
+
+ /**
+ * Return the ArchiveContainer of this Project.
+ */
+ IArchiveContainer getArchiveContainer();
+
+ /**
+ * Return the BinaryContainer of this Project.
+ */
+ IBinaryContainer getBinaryContainer();
+
+ IProject getProject();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICRoot.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICRoot.java
new file mode 100644
index 00000000000..2c44ce1c002
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICRoot.java
@@ -0,0 +1,179 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * Represent the root C element corresponding to the workspace.
+ * Since there is only one such root element, it is commonly referred to as
+ * the C model element.
+ * The C model element needs to be opened before it can be navigated or manipulated.
+ * The C model element has no parent (it is the root of the C element
+ * hierarchy). Its children are ICProject
s.
+ *
+ * This interface provides methods for performing copy, move, rename, and
+ * delete operations on multiple C elements.
+ *
+ *
+ * @see CCore#create(org.eclipse.core.resources.IWorkspaceRoot)
+ */
+public interface ICRoot extends ICElement, IParent {
+ /**
+ * Copies the given elements to the specified container(s).
+ * If one container is specified, all elements are copied to that
+ * container. If more than one container is specified, the number of
+ * elements and containers must match, and each element is copied to
+ * its associated container.
+ *
+ * Optionally, each copy can positioned before a sibling
+ * element. If null
is specified for a given sibling, the copy
+ * is inserted as the last child of its associated container.
+ *
+ *
+ * Optionally, each copy can be renamed. If
+ * null
is specified for the new name, the copy
+ * is not renamed.
+ *
+ *
+ * Optionally, any existing child in the destination container with
+ * the same name can be replaced by specifying true
for
+ * force. Otherwise an exception is thrown in the event that a name
+ * collision occurs.
+ *
+ *
+ * @param elements the elements to copy
+ * @param containers the container, or list of containers
+ * @param siblings the list of siblings element any of which may be
+ * null
; or null
+ * @param renamings the list of new names any of which may be
+ * null
; or null
+ * @param replace true
if any existing child in a target container
+ * with the target name should be replaced, and false
to throw an
+ * exception in the event of a name collision
+ * @param monitor a progress monitor
+ * @exception CModelException if an element could not be copied. Reasons include:
+ *
+ * - A specified element, container, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - A container is of an incompatible type (
INVALID_DESTINATION
)
+ * - A sibling is not a child of it associated container (
INVALID_SIBLING
)
+ * - A new name is invalid (
INVALID_NAME
)
+ * - A child in its associated container already exists with the same
+ * name and
replace
has been specified as false
(NAME_COLLISION
)
+ * - A container or element is read-only (
READ_ONLY
)
+ *
+ */
+ void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException;
+ /**
+ * Deletes the given elements, forcing the operation if necessary and specified.
+ *
+ * @param elements the elements to delete
+ * @param force a flag controlling whether underlying resources that are not
+ * in sync with the local file system will be tolerated
+ * @param monitor a progress monitor
+ * @exception CModelException if an element could not be deleted. Reasons include:
+ *
+ * - A specified element does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - An element is read-only (
READ_ONLY
)
+ *
+ */
+ void delete(ICElement[] elements, boolean force, IProgressMonitor monitor) throws CModelException;
+
+ /**
+ * Moves the given elements to the specified container(s).
+ * If one container is specified, all elements are moved to that
+ * container. If more than one container is specified, the number of
+ * elements and containers must match, and each element is moved to
+ * its associated container.
+ *
+ * Optionally, each element can positioned before a sibling
+ * element. If null
is specified for sibling, the element
+ * is inserted as the last child of its associated container.
+ *
+ *
+ * Optionally, each element can be renamed. If
+ * null
is specified for the new name, the element
+ * is not renamed.
+ *
+ *
+ * Optionally, any existing child in the destination container with
+ * the same name can be replaced by specifying true
for
+ * force. Otherwise an exception is thrown in the event that a name
+ * collision occurs.
+ *
+ *
+ * @param elements the elements to move
+ * @param containers the container, or list of containers
+ * @param siblings the list of siblings element any of which may be
+ * null
; or null
+ * @param renamings the list of new names any of which may be
+ * null
; or null
+ * @param replace true
if any existing child in a target container
+ * with the target name should be replaced, and false
to throw an
+ * exception in the event of a name collision
+ * @param monitor a progress monitor
+ * @exception CModelException if an element could not be moved. Reasons include:
+ *
+ * - A specified element, container, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - A container is of an incompatible type (
INVALID_DESTINATION
)
+ * - A sibling is not a child of it associated container (
INVALID_SIBLING
)
+ * - A new name is invalid (
INVALID_NAME
)
+ * - A child in its associated container already exists with the same
+ * name and
replace
has been specified as false
(NAME_COLLISION
)
+ * - A container or element is read-only (
READ_ONLY
)
+ *
+ *
+ * @exception IllegalArgumentException any element or container is null
+ */
+ void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException;
+
+ /**
+ * Renames the given elements as specified.
+ * If one container is specified, all elements are renamed within that
+ * container. If more than one container is specified, the number of
+ * elements and containers must match, and each element is renamed within
+ * its associated container.
+ *
+ * @param elements the elements to rename
+ * @param destinations the container, or list of containers
+ * @param names the list of new names
+ * @param replace true
if an existing child in a target container
+ * with the target name should be replaced, and false
to throw an
+ * exception in the event of a name collision
+ * @param monitor a progress monitor
+ * @exception CModelException if an element could not be renamed. Reasons include:
+ *
+ * - A specified element does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - A new name is invalid (
INVALID_NAME
)
+ * - A child already exists with the same name and
replace
has been specified as false
(NAME_COLLISION
)
+ * - An element is read-only (
READ_ONLY
)
+ *
+ */
+ void rename(ICElement[] elements, ICElement[] destinations, String[] names, boolean replace, IProgressMonitor monitor) throws CModelException;
+
+ /**
+ * Returns the C project with the given name. This is a handle-only method.
+ * The project may or may not exist.
+ */
+ ICProject getCProject(String name);
+
+ /**
+ * Returns the C projects.
+ */
+ ICProject[] getCProjects();
+
+ /**
+ * Returns the workspace associated with this C model.
+ */
+ IWorkspace getWorkspace();
+
+ IWorkspaceRoot getRoot();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IElementChangedListener.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IElementChangedListener.java
new file mode 100644
index 00000000000..ae43d79e3d9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IElementChangedListener.java
@@ -0,0 +1,20 @@
+package org.eclipse.cdt.core.model;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * An element changed listener receives notification of changes to C elements
+ * maintained by the C model.
+ */
+public interface IElementChangedListener {
+
+ /**
+ * Notifies that one or more attributes of one or more C elements have changed.
+ * The specific details of the change are described by the given event.
+ *
+ * @param event the change event
+ */
+ public void elementChanged(ElementChangedEvent event);
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IEnumeration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IEnumeration.java
new file mode 100644
index 00000000000..0ea78c05c1e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IEnumeration.java
@@ -0,0 +1,12 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * An Enumeration type.
+ */
+public interface IEnumeration extends IVariable {
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IField.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IField.java
new file mode 100644
index 00000000000..f49ebb3c405
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IField.java
@@ -0,0 +1,20 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a field(variable) declared in an IStructure(struct, class, union).
+ */
+public interface IField extends IMember, IVariable {
+
+ /**
+ * Returns whether this storage specifier is mutable for the member.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public boolean isMutable() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunction.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunction.java
new file mode 100644
index 00000000000..3b66b6edcf2
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunction.java
@@ -0,0 +1,78 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a function.
+ */
+public interface IFunction extends ICElement, ISourceReference, ISourceManipulation {
+
+ /**
+ * Returns the exceptions this method throws, in the order declared in the source.
+ * or an empty array if this method throws no exceptions.
+ *
+ * For example, a source method declaring "void f(int a) throw (x2, x3);"
,
+ * would return the array {"x2", "x3"}
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ *
+ */
+ public String[] getExceptions() throws CModelException;
+
+ /**
+ * Returns the number of parameters of this method.
+ */
+ public int getNumberOfParameters();
+
+ /**
+ * Returns the initializer of parameters pos for this method.
+ * Returns an empty string if this argument has no initializer.
+ *
+ *
For example, a method declared as void foo(String text, int length=9)
+ * would return the array {"9"}
.
+ *
+ * @exception CModelException if this argument does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public String getParameterInitializer(int pos);
+
+ /**
+ * Returns the type signatures for the parameters of this method.
+ * Returns an empty array if this method has no parameters.
+ * This is a handle-only method.
+ *
+ *
For example, a source method declared as void foo(string text, int length)
+ * would return the array {"string","int"}
.
+ *
+ * @see Signature
+ */
+ public String[] getParameterTypes();
+
+ /**
+ * Returns the type signature of the return value of this method.
+ * For constructors, this returns the signature for void.
+ *
+ *
For example, a source method declared as int getName()
+ * would return "int"
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ *
+ * @see Signature
+ */
+ public String getReturnType() throws CModelException;
+
+ /**
+ * Returns the access Control of the member. The value can be
+ * can be examined using class Flags
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @see Flags
+ */
+ public int getAccessControl() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java
new file mode 100644
index 00000000000..53272f1eff8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java
@@ -0,0 +1,80 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a function
+ */
+public interface IFunctionDeclaration extends ICElement, ISourceReference, ISourceManipulation {
+
+ /**
+ * Returns the type signatures of the exceptions this method throws,
+ * in the order declared in the source. Returns an empty array
+ * if this method throws no exceptions.
+ *
+ *
For example, a source method declaring "void f(int a) throw (x1, x2);"
,
+ * would return the array {"x1", "x2"}
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ *
+ * @see Signature
+ */
+ String[] getExceptions() throws CModelException;
+
+ /**
+ * Returns the number of parameters of this method.
+ */
+ int getNumberOfParameters();
+
+ /**
+ * Returns the initializer of parameters position for this method.
+ * Returns an empty string if this argument has no initializer.
+ *
+ *
For example, a method declared as public void foo(String text, int length=9)
+ * would return the array {"9"}
.
+ *
+ * @exception CModelException if this argument does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ String getParameterInitializer(int pos);
+
+ /**
+ * Returns the type signatures for the parameters of this method.
+ * Returns an empty array if this method has no parameters.
+ * This is a handle-only method.
+ *
+ *
For example, a source method declared as void foo(string text, int length)
+ * would return the array {"string","int"}
.
+ *
+ * @see Signature
+ */
+ String[] getParameterTypes();
+
+ /**
+ * Returns the type signature of the return value of this method.
+ * For constructors, this returns the signature for void.
+ *
+ *
For example, a source method declared as public String getName()
+ * would return "String"
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ *
+ * @see Signature
+ */
+ String getReturnType() throws CModelException;
+
+ /**
+ * Returns the access Control of the member. The access qualifier
+ * can be examine using the AccessControl class.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @see IAccessControl
+ */
+ int getAccessControl() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java
new file mode 100644
index 00000000000..e6e22ecc7c9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java
@@ -0,0 +1,25 @@
+package org.eclipse.cdt.core.model;
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents an include declaration in a C translation unit.
+ */
+public interface IInclude extends ICElement, ISourceReference, ISourceManipulation {
+ /**
+ * Returns the name that of the included file.
+ * For example, for the statement "#include
,
+ * this returns "stdio.h"
.
+ */
+ String getIncludeName();
+
+ /**
+ * Returns whether the included was search on "standard places" like /usr/include first .
+ * An include is standard if it starts with "\<"
.
+ * For example, "#include \"
returns true and
+ * "#include "foobar.h"
returns false.
+ */
+ boolean isStandard();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java
new file mode 100644
index 00000000000..ae8f968cda3
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java
@@ -0,0 +1,21 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Place holder of the inherited class from struct or class(IStructure).
+ */
+public interface IInheritance {
+ /**
+ * Return the inherited structures.
+ */
+ public IStructure [] getBaseTypes() throws CModelException;
+
+ /**
+ * Return the access control for each inherited structure.
+ */
+ public int getAccessControl(int pos) throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILibraryReference.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILibraryReference.java
new file mode 100644
index 00000000000..43c12887f82
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILibraryReference.java
@@ -0,0 +1,11 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ */
+public interface ILibraryReference extends IParent, ICElement {
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMacro.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMacro.java
new file mode 100644
index 00000000000..6c6445347ee
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMacro.java
@@ -0,0 +1,14 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a field declared in a type.
+ */
+public interface IMacro extends ICElement, ISourceManipulation, ISourceReference {
+ String getIdentifierList();
+ String getTokenSequence();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java
new file mode 100644
index 00000000000..a0667250b8c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java
@@ -0,0 +1,48 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Common protocol for C elements that can be members of types.
+ * This set consists of IType
, IMethod
,
+ * IField
.
+ */
+public interface IMember extends ICElement, ISourceReference, ISourceManipulation {
+
+ ///**
+ //* Returns the structure in which this member is declared, or null
+ //* if this member is not declared in a type (for example, a top-level type).
+ //*/
+ //IStructure belongsTo() throws CModelException;
+
+ /**
+ * Returns true if the member as class scope.
+ * For example static methods in C++ have class scope
+ *
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public boolean hasClassScope() throws CModelException;
+
+ /**
+ * Returns whether this method/field is declared constant.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public boolean isConst() throws CModelException;
+
+ /**
+ * Returns the access Control of the member. The access qualifier
+ * can be examine using the AccessControl class.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @see IAccessControl
+ */
+ public int getAccessControl() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethod.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethod.java
new file mode 100644
index 00000000000..196287c1f4c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethod.java
@@ -0,0 +1,117 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents the definition method of a class.
+ */
+public interface IMethod extends IMember {
+
+ /**
+ * Returns the type signatures of the exceptions this method throws,
+ * in the order declared in the source. Returns an empty array
+ * if this method throws no exceptions.
+ *
+ *
For example, a source method declaring "throws IOException"
,
+ * would return the array {"QIOException;"}
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ *
+ * @see Signature
+ */
+ String[] getExceptions() throws CModelException;
+
+ /**
+ * Returns the number of parameters of this method.
+ */
+ int getNumberOfParameters();
+
+ /**
+ * Returns the initializer of parameters pos for this method.
+ * Returns an empty string if this argument has no initializer.
+ *
+ *
For example, a method declared as public void foo(String text, int length=9)
+ * would return the array {"9"}
.
+ *
+ * @exception CModelException if this argument does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ String getParameterInitializer(int pos);
+
+ /**
+ * Returns the type signatures for the parameters of this method.
+ * Returns an empty array if this method has no parameters.
+ * This is a handle-only method.
+ *
+ *
For example, a source method declared as void foo(String text, int length)
+ * would return the array {"String","int"}
.
+ *
+ * @see Signature
+ */
+ String[] getParameterTypes();
+
+ /**
+ * Returns the type signature of the return value of this method.
+ * For constructors, this returns the signature for void.
+ *
+ *
For example, a source method declared as public String getName()
+ * would return "String"
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ *
+ * @see Signature
+ */
+ String getReturnType() throws CModelException;
+
+ /**
+ * Returns whether this method is a constructor.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isConstructor() throws CModelException;
+
+ /**
+ * Returns whether this method is a destructor.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isDestructor() throws CModelException;
+
+ /**
+ * Returns whether this method is an operator method.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isOperator() throws CModelException;
+
+ /**
+ * Returns whether this method is declared pure virtual.
+ *
+ *
For example, a source method declared as virtual void m() = 0;
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isAbstract() throws CModelException;
+
+ /**
+ * Returns whether this method is declared virtual.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isVirtual() throws CModelException;
+
+ /**
+ * return true if the member is a friend.
+ */
+ public boolean isFriend() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java
new file mode 100644
index 00000000000..9a2fac2bf45
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java
@@ -0,0 +1,117 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents the declaration method of a class
+ */
+public interface IMethodDeclaration extends IMember {
+
+ /**
+ * Returns the type signatures of the exceptions this method throws,
+ * in the order declared in the source. Returns an empty array
+ * if this method throws no exceptions.
+ *
+ *
For example, a source method declaring "throws IOException"
,
+ * would return the array {"QIOException;"}
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ *
+ * @see Signature
+ */
+ String[] getExceptions() throws CModelException;
+
+ /**
+ * Returns the number of parameters of this method.
+ */
+ int getNumberOfParameters();
+
+ /**
+ * Returns the initializer of parameters pos for this method.
+ * Returns an empty string if this argument has no initializer.
+ *
+ *
For example, a method declared as public void foo(String text, int length=9)
+ * would return the array {"9"}
.
+ *
+ * @exception CModelException if this argument does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ String getParameterInitializer(int pos);
+
+ /**
+ * Returns the type signatures for the parameters of this method.
+ * Returns an empty array if this method has no parameters.
+ * This is a handle-only method.
+ *
+ *
For example, a source method declared as void foo(String text, int length)
+ * would return the array {"String","int"}
.
+ *
+ * @see Signature
+ */
+ String[] getParameterTypes();
+
+ /**
+ * Returns the type signature of the return value of this method.
+ * For constructors, this returns the signature for void.
+ *
+ *
For example, a source method declared as public String getName()
+ * would return "String"
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ *
+ * @see Signature
+ */
+ String getReturnType() throws CModelException;
+
+ /**
+ * Returns whether this method is a constructor.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isConstructor() throws CModelException;
+
+ /**
+ * Returns whether this method is a destructor.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isDestructor() throws CModelException;
+
+ /**
+ * Returns whether this method is an operator method.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isOperator() throws CModelException;
+
+ /**
+ * Returns whether this method is declared pure virtual.
+ *
+ *
For example, a source method declared as virtual void m() = 0;
.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isAbstract() throws CModelException;
+
+ /**
+ * Returns whether this method is declared virtual.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ boolean isVirtual() throws CModelException;
+
+ /**
+ * return true if the member is a friend.
+ */
+ public boolean isFriend() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/INamespace.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/INamespace.java
new file mode 100644
index 00000000000..e43b046cedd
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/INamespace.java
@@ -0,0 +1,16 @@
+package org.eclipse.cdt.core.model;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a package declaration in a C translation unit.
+ */
+public interface INamespace extends ICElement, ISourceManipulation, ISourceReference {
+ /**
+ * Returns the name of the package the statement refers to.
+ * This is a handle-only method.
+ */
+ String getElementName();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IParent.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IParent.java
new file mode 100644
index 00000000000..a31077e022f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IParent.java
@@ -0,0 +1,31 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Common protocol for C elements that contain other C elements.
+ */
+public interface IParent {
+
+ /**
+ * Returns the immediate children of this element.
+ * The children are in no particular order.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ ICElement[] getChildren(); //throws CModelException;
+
+ /**
+ * Returns whether this element has one or more immediate children.
+ * This is a convenience method, and may be more efficient than
+ * testing whether getChildren
is an empty array.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ boolean hasChildren(); //throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceManipulation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceManipulation.java
new file mode 100644
index 00000000000..2cf3f0b2870
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceManipulation.java
@@ -0,0 +1,109 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * Common protocol for C elements that support source code manipulations such
+ * as copy, move, rename, and delete.
+ */
+public interface ISourceManipulation {
+ /**
+ * Copies this element to the given container.
+ *
+ * @param container the container
+ * @param sibling the sibling element before which the copy should be inserted,
+ * or null
if the copy should be inserted as the last child of
+ * the container
+ * @param rename the new name for the element, or null
if the copy
+ * retains the name of this element
+ * @param replace true
if any existing child in the container with
+ * the target name should be replaced, and false
to throw an
+ * exception in the event of a name collision
+ * @param monitor a progress monitor
+ * @exception CModelException if this element could not be copied. Reasons include:
+ *
+ * - This C element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - The container is of an incompatible type (INVALID_DESTINATION)
+ *
- The sibling is not a child of the given container (INVALID_SIBLING)
+ *
- The new name is invalid (INVALID_NAME)
+ *
- A child in the container already exists with the same name (NAME_COLLISION)
+ * and
replace
has been specified as false
+ * - The container or this element is read-only (READ_ONLY)
+ *
+ *
+ * @exception IllegalArgumentException if container is null
+ */
+ void copy(ICElement container, ICElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws CModelException;
+
+ /**
+ * Deletes this element, forcing if specified and necessary.
+ *
+ * @param force a flag controlling whether underlying resources that are not
+ * in sync with the local file system will be tolerated (same as the force flag
+ * in IResource operations).
+ * @param monitor a progress monitor
+ * @exception CModelException if this element could not be deleted. Reasons include:
+ *
+ * - This C element does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource (CORE_EXCEPTION)
+ * - This element is read-only (READ_ONLY)
+ *
+ */
+ void delete(boolean force, IProgressMonitor monitor) throws CModelException;
+
+ /**
+ * Moves this element to the given container.
+ *
+ * @param container the container
+ * @param sibling the sibling element before which the element should be inserted,
+ * or null
if the element should be inserted as the last child of
+ * the container
+ * @param rename the new name for the element, or null
if the
+ * element retains its name
+ * @param replace true
if any existing child in the container with
+ * the target name should be replaced, and false
to throw an
+ * exception in the event of a name collision
+ * @param monitor a progress monitor
+ * @exception CModelException if this element could not be moved. Reasons include:
+ *
+ * - This C element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - The container is of an incompatible type (INVALID_DESTINATION)
+ *
- The sibling is not a child of the given container (INVALID_SIBLING)
+ *
- The new name is invalid (INVALID_NAME)
+ *
- A child in the container already exists with the same name (NAME_COLLISION)
+ * and
replace
has been specified as false
+ * - The container or this element is read-only (READ_ONLY)
+ *
+ *
+ * @exception IllegalArgumentException if container is null
+ */
+
+ void move(ICElement container, ICElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws CModelException;
+
+ /**
+ * Renames this element to the given name.
+ *
+ * @param name the new name for the element
+ * @param replace true
if any existing element with the target name
+ * should be replaced, and false
to throw an exception in the
+ * event of a name collision
+ * @param monitor a progress monitor
+ * @exception CModelException if this element could not be renamed. Reasons include:
+ *
+ * - This C element does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - The new name is invalid (INVALID_NAME)
+ *
- A child in the container already exists with the same name (NAME_COLLISION)
+ * and
replace
has been specified as false
+ * - This element is read-only (READ_ONLY)
+ *
+ */
+ void rename(String name, boolean replace, IProgressMonitor monitor) throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceRange.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceRange.java
new file mode 100644
index 00000000000..d5d2d752f0a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceRange.java
@@ -0,0 +1,42 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * A source range defines an element's source coordinates
+ */
+public interface ISourceRange {
+
+ /**
+ * Returns the 0-based starting position of this element.
+ */
+ public int getStartPos();
+
+ /**
+ * Returns the number of characters of the source code for this element.
+ */
+ public int getLength();
+
+ /**
+ * Returns the Id starting position of this element.
+ */
+ public int getIdStartPos();
+
+ /**
+ * Returns the number of characters of the Id for this element.
+ */
+ public int getIdLength();
+
+ /**
+ * Returns the 1-based starting line of this element.
+ */
+ public int getStartLine();
+
+ /**
+ * Returns the 1-based ending line of this element.
+ */
+ public int getEndLine();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceReference.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceReference.java
new file mode 100644
index 00000000000..daa5f1f21ee
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceReference.java
@@ -0,0 +1,51 @@
+package org.eclipse.cdt.core.model;
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Common protocol for C elements that have associated source code.
+ *
+ * Note: For IBinary
, IArchive
and other members
+ * derived from a binary type, the implementation returns source iff the
+ * element has attached source code and debuging information.
+ *
+ */
+
+public interface ISourceReference {
+
+ /**
+ * Returns the source code associated with this element.
+ *
+ * For binary files, this returns the source of the entire translation unit
+ * associated with the binary file (if there is one).
+ *
+ *
+ * @return the source code, or null
if this element has no
+ * associated source code
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ String getSource() throws CModelException;
+
+ /**
+ * Returns the source range associated with this element.
+ *
+ * For binary files, this returns the range of the entire translation unit
+ * associated with the binary file (if there is one).
+ *
+ *
+ * @return the source range, or null
if if this element has no
+ * associated source code
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ ISourceRange getSourceRange() throws CModelException;
+
+ /**
+ * Returns the translation unit in which this member is declared, or null
+ * if this member is not declared in a translation unit (for example, a binary type).
+ */
+ ITranslationUnit getTranslationUnit();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java
new file mode 100644
index 00000000000..c0cacfe885d
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java
@@ -0,0 +1,27 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represent struct(ure), class or union.
+ */
+public interface IStructure extends IInheritance, IParent, ICElement, IVariable {
+ //public String instantiatesTemplate();
+
+ public IField getField(String name);
+ public IField[] getFields();
+
+ public IMethod getMethod(String name);
+ public IMethod [] getMethods();
+
+ public boolean isUnion();
+
+ public boolean isClass();
+
+ public boolean isStruct();
+
+ public boolean isAbstract();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java
new file mode 100644
index 00000000000..888fcb3b55e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java
@@ -0,0 +1,120 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * Represents an entire C translation unit (.c
source file).
+ * The children are of type IStructureElement
,
+ * IInclude
, etc..
+ * and appear in the order in which they are declared in the source.
+ * If a .c
file cannot be parsed, its structure remains unknown.
+ * Use ICElement.isStructureKnown
to determine whether this is
+ * the case.
+ */
+public interface ITranslationUnit extends ICFile , ISourceReference, ISourceManipulation {
+ /**
+ * Creates and returns an include declaration in this translation unit
+ * with the given name.
+ *
+ * Optionally, the new element can be positioned before the specified
+ * sibling. If no sibling is specified, the element will be inserted
+ * as the last import declaration in this translation unit.
+ *
+ * If the translation unit already includes the specified include declaration,
+ * the import is not generated (it does not generate duplicates).
+ *
+ * @param name the name of the include declaration to add (For example: "stdio.h"
or
+ * "sys/types.h"
)
+ * @param sibling the existing element which the include declaration will be inserted immediately before (if
+ * null
, then this include will be inserted as the last include declaration.
+ * @param monitor the progress monitor to notify
+ * @return the newly inserted include declaration (or the previously existing one in case attempting to create a duplicate)
+ *
+ * @exception CModelException if the element could not be created. Reasons include:
+ *
+ * - This C element does not exist or the specified sibling does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - The specified sibling is not a child of this translation unit (INVALID_SIBLING)
+ *
- The name is not a valid import name (INVALID_NAME)
+ *
+ */
+ IInclude createInclude(String name, ICElement sibling, IProgressMonitor monitor) throws CModelException;
+
+ /**
+ * Creates and returns a namesapce declaration in this translation unit
+ * with the given package name.
+ *
+ * If the translation unit already includes the specified package declaration,
+ * it is not generated (it does not generate duplicates).
+ *
+ * @param name the name of the namespace declaration to add (For example, "std"
)
+ * @param monitor the progress monitor to notify
+ * @return the newly inserted namespace declaration (or the previously existing one in case attempting to create a duplicate)
+ *
+ * @exception CModelException if the element could not be created. Reasons include:
+ *
+ * - This C element does not exist (ELEMENT_DOES_NOT_EXIST)
+ * - A
CoreException
occurred while updating an underlying resource
+ * - The name is not a valid package name (INVALID_NAME)
+ *
+ */
+ IUsing createUsing (String name, IProgressMonitor monitor) throws CModelException;
+
+ /**
+ * Returns the smallest element within this translation unit that
+ * includes the given source position (that is, a method, field, etc.), or
+ * null
if there is no element other than the translation
+ * unit itself at the given position, or if the given position is not
+ * within the source range of this translation unit.
+ *
+ * @param position a source position inside the translation unit
+ * @return the innermost C element enclosing a given source position or null
+ * if none (excluding the translation unit).
+ * @exception CModelException if the translation unit does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ ICElement getElementAtLine(int line) throws CModelException;
+
+ ICElement getElement(String name) throws CModelException;
+
+ /**
+ * Returns the include declaration in this translation unit with the given name.
+ *
+ * @param the name of the include to find (For example: "stdio.h"
+ * or "sys/types.h"
)
+ * @return a handle onto the corresponding include declaration. The include declaration may or may not exist.
+ */
+ IInclude getInclude(String name) ;
+
+ /**
+ * Returns the include declarations in this translation unit
+ * in the order in which they appear in the source.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ IInclude[] getIncludes() throws CModelException;
+
+ /**
+ * Returns the first namespace declaration in this translation unit with the given package name
+ * This is a handle-only method. The namespace declaration may or may not exist.
+ *
+ * @param name the name of the namespace declaration (For example, "std"
)
+ */
+ IUsing getUsing(String name);
+
+ /**
+ * Returns the namespace declarations in this translation unit
+ * in the order in which they appear in the source.
+ *
+ * @return an array of namespace declaration (normally of size one)
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+ IUsing[] getUsings() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITypeDef.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITypeDef.java
new file mode 100644
index 00000000000..eae2e26fbcc
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITypeDef.java
@@ -0,0 +1,16 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a field declared in a type.
+ */
+public interface ITypeDef extends ICElement, ISourceManipulation, ISourceReference {
+ /**
+ * Return the type beeing alias.
+ */
+ String getType() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IUsing.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IUsing.java
new file mode 100644
index 00000000000..2002f55a0e0
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IUsing.java
@@ -0,0 +1,16 @@
+package org.eclipse.cdt.core.model;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a "using" declaration in C translation unit.
+ */
+public interface IUsing extends ICElement, ISourceManipulation, ISourceReference {
+ /**
+ * Returns the name of the package the statement refers to.
+ * This is a handle-only method.
+ */
+ String getElementName();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariable.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariable.java
new file mode 100644
index 00000000000..5708996a27d
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariable.java
@@ -0,0 +1,15 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a global variable.
+ */
+public interface IVariable extends ICElement , ISourceManipulation, ISourceReference {
+ public String getType();
+ public String getInitializer();
+ public int getAccessControl() throws CModelException;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java
new file mode 100644
index 00000000000..ea79d61beb8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java
@@ -0,0 +1,15 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents the declaration of a variable.
+ */
+public interface IVariableDeclaration extends ICElement, ISourceManipulation, ISourceReference {
+
+ public String getType ();
+ public int getAccesControl();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableLocal.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableLocal.java
new file mode 100644
index 00000000000..f88ee6452d6
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableLocal.java
@@ -0,0 +1,12 @@
+package org.eclipse.cdt.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Represents a static variable.
+ */
+public interface IVariableLocal extends IVariable {
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Archive.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Archive.java
new file mode 100644
index 00000000000..14a515fdf98
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Archive.java
@@ -0,0 +1,44 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IFile;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IArchive;
+import org.eclipse.cdt.core.model.IBinary;
+
+public class Archive extends CFile implements IArchive {
+
+ public Archive(ICElement parent, IFile file) {
+ super(parent, file);
+ }
+
+ public Archive(ICElement parent, IPath path) {
+ super (parent, path);
+ }
+
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ public boolean isArchive() {
+ return true;
+ }
+
+ public IBinary[] getBinaries() {
+ return (IBinary[])getChildren();
+ }
+
+ public CElementInfo createElementInfo() {
+ return new ArchiveInfo(this);
+ }
+
+ protected ArchiveInfo getArchiveInfo() {
+ return (ArchiveInfo)getElementInfo();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveContainer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveContainer.java
new file mode 100644
index 00000000000..ad1261403a6
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveContainer.java
@@ -0,0 +1,87 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+
+import org.eclipse.cdt.core.model.IArchive;
+import org.eclipse.cdt.core.model.IArchiveContainer;
+import org.eclipse.cdt.core.model.ICElement;
+
+public class ArchiveContainer extends Parent implements IArchiveContainer {
+
+ CProject cProject;
+ private long modificationStamp;
+
+ public ArchiveContainer (CProject cProject) {
+ super (cProject, null, "lib", CElement.C_CONTAINER);
+ this.cProject = cProject;
+ IProject project = cProject.getProject();
+ IFolder folder = project.getFolder("Virtual.lib");
+ setUnderlyingResource(folder);
+ }
+
+ public IArchive[] getArchives() {
+ ICElement[] e = getChildren(false);
+ IArchive[] a = new IArchive[e.length];
+ System.arraycopy(e, 0, a, 0, e.length);
+ return a;
+ }
+
+ public boolean hasChildren() {
+ return (getChildren().length > 0);
+ }
+
+ public ICElement [] getChildren() {
+ return getChildren(true);
+ }
+
+ public ICElement [] getChildren(boolean sync) {
+ if (!cProject.hasRunElf()) {
+ // It is vital to set this to true first, if not we are going to loop
+ cProject.setRunElf(true);
+ ElfRunner runner = new ElfRunner(cProject);
+ Thread thread = new Thread(runner, "Archive Runner");
+ // thread.setPriority(Thread.NORM_PRIORITY - 1);
+ thread.setDaemon(true);
+ thread.start();
+ if (sync) {
+ try {
+ thread.join();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ return super.getChildren();
+ }
+
+ //public IResource getUnderlyingResource() {
+ // return null;
+ //}
+
+ public IResource getCorrespondingResource() {
+ return null;
+ }
+
+ void addChildIfLib(IFile file) {
+ CModelManager factory = CModelManager.getDefault();
+ if (factory.isArchive(file)) {
+ ICElement celement = factory.create(file);
+ if (celement != null) {
+ if (celement instanceof IArchive) {
+ addChild (celement);
+ }
+ }
+ }
+ }
+
+ public CElementInfo createElementInfo() {
+ return new CElementInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveInfo.java
new file mode 100644
index 00000000000..3aac72d6fbf
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveInfo.java
@@ -0,0 +1,77 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.cdt.core.model.ICElement;
+
+import org.eclipse.cdt.utils.elf.AR;
+import org.eclipse.cdt.utils.elf.ElfHelper;
+
+/**
+ * Info for ICProject.
+ */
+
+class ArchiveInfo extends CFileInfo {
+
+ /**
+ */
+ public ArchiveInfo(CElement element) {
+ super(element);
+ }
+
+ public ICElement [] getChildren() {
+ init();
+ return super.getChildren();
+ }
+
+ public void init() {
+ if (hasChanged()) {
+ removeChildren();
+ loadInfo();
+ }
+ }
+
+ public boolean isArchive() {
+ return true;
+ }
+
+ protected void loadInfo() {
+ IPath location = ((CFile)getElement()).getLocation();
+ IFile file = ((CFile)getElement()).getFile();
+ try {
+ AR ar = new AR(location.toOSString());
+ AR.ARHeader[] header = ar.getHeaders();
+ for (int i = 0; i < header.length; i++) {
+ ElfHelper helper = new ElfHelper(header[i].getElf());
+ //IPath path = new Path(header[i].getObjectName());
+ // FIXME: We should create a special IResource for this files
+ // but for now, just bypass.
+ Binary binary = new Binary(getElement(), file, header[i].getObjectName()) {
+ public IResource getCorrespondingResource() {
+ return null;
+ }
+ };
+ // Force the loading so we can dispose;
+ ((BinaryInfo)(binary.getElementInfo())).elfHelper = helper;
+ // Force the loading of the chidren right away so we can
+ // dispose of the elf Elper.
+ binary.getChildren();
+ ((BinaryInfo)(binary.getElementInfo())).elfHelper = null;
+ helper.dispose();
+ addChild(binary);
+ }
+ ar.dispose();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
new file mode 100644
index 00000000000..f0bb5fe6884
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
@@ -0,0 +1,80 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IFile;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IBinary;
+
+public class Binary extends CFile implements IBinary {
+
+ public Binary(ICElement parent, IFile file) {
+ super(parent, file);
+ }
+
+ public Binary(ICElement parent, IPath path) {
+ super (parent, path);
+ }
+
+ public Binary(ICElement parent, IFile file, String name) {
+ super(parent, file, name);
+ }
+
+
+ public boolean isReadOnly () {
+ return true;
+ }
+
+ public boolean isBinary() {
+ return true;
+ }
+
+ public boolean hasDebug () {
+ return ((BinaryInfo)getElementInfo()).hasDebug();
+ }
+
+ public boolean isExecutable() {
+ return ((BinaryInfo)getElementInfo()).isExecutable();
+ }
+
+ public boolean isObject() {
+ return ((BinaryInfo)getElementInfo()).isObject();
+ }
+
+ public boolean isSharedLib() {
+ return ((BinaryInfo)getElementInfo()).isSharedLib();
+ }
+
+ public String [] getNeededSharedLibs() {
+ return ((BinaryInfo)getElementInfo()).getNeededSharedLibs();
+ }
+
+ public String getCPU() {
+ return ((BinaryInfo)getElementInfo()).getCPU();
+ }
+
+ public long getText() {
+ return ((BinaryInfo)getElementInfo()).getText();
+ }
+
+ public long getData() {
+ return ((BinaryInfo)getElementInfo()).getData();
+ }
+
+ public long getBSS() {
+ return ((BinaryInfo)getElementInfo()).getBSS();
+ }
+
+ public String getSoname() {
+ return ((BinaryInfo)getElementInfo()).getSoname();
+ }
+
+ public CElementInfo createElementInfo() {
+ return new BinaryInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryContainer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryContainer.java
new file mode 100644
index 00000000000..02962288bcb
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryContainer.java
@@ -0,0 +1,147 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.IBinaryContainer;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICRoot;
+
+public class BinaryContainer extends Parent implements IBinaryContainer {
+
+ CProject cProject;
+ private long modificationStamp;
+
+ public BinaryContainer (CProject cProject) {
+ this (cProject, "bin");
+ }
+
+ public BinaryContainer (CProject cProject, String name) {
+ super (cProject, null, name, CElement.C_CONTAINER);
+ this.cProject = cProject;
+ IProject project = cProject.getProject();
+ IFolder folder = project.getFolder("Virtual.bin");
+ setUnderlyingResource(folder);
+ }
+
+ public IBinary[] getBinaries() {
+ ICElement[] e = getChildren(false);
+ IBinary[] b = new IBinary[e.length];
+ System.arraycopy(e, 0, b, 0, e.length);
+ return b;
+ }
+
+ public boolean hasChildren() {
+ return (getChildren().length > 0);
+ }
+
+ public ICElement [] getChildren() {
+ return getChildren(true);
+ }
+
+ public ICElement [] getChildren(boolean sync) {
+ // The first time probe the entire project to discover binaries.
+ if (!cProject.hasRunElf()) {
+ cProject.setRunElf(true);
+ ElfRunner runner = new ElfRunner(cProject);
+ Thread thread = new Thread(runner, "Elf Runner");
+ // thread.setPriority(Thread.NORM_PRIORITY - 1);
+ thread.setDaemon(true);
+ thread.start();
+ if (sync) {
+ try {
+ thread.join();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ return super.getChildren();
+ }
+
+ public IResource getCorrespondingResource() {
+ return null;
+ }
+
+ //public IResource getUnderlyingResource() {
+ // return null;
+ //}
+
+ void addChildIfExec(CoreModel factory, IFile file) {
+ // Attempt to speed things up by rejecting up front
+ // Things we know should not be Elf/Binary files.
+ if (!factory.isTranslationUnit(file)) {
+ ICElement celement = factory.create(file);
+ if (celement != null) {
+ if (celement instanceof IBinary) {
+ IBinary bin = (IBinary)celement;
+ if (bin.isExecutable() || bin.isSharedLib()) {
+ addChild (bin);
+ }
+ }
+ }
+ }
+ }
+
+ public CElementInfo createElementInfo() {
+ return new CElementInfo(this);
+ }
+
+ class Visitor implements IResourceVisitor {
+ CoreModel factory = CoreModel.getDefault();
+ BinaryContainer cbin;
+
+ public Visitor (BinaryContainer element) {
+ cbin = element;
+ }
+
+ public boolean visit(IResource res) throws CoreException {
+ if (res instanceof IFile) {
+ cbin.addChildIfExec(factory, (IFile)res);
+ return false;
+ }
+ return true;
+ }
+ }
+
+ class BinaryRunnable implements Runnable {
+ BinaryContainer cbin;
+
+ public BinaryRunnable(BinaryContainer element) {
+ cbin = element;
+ }
+
+ public void run() {
+ try {
+ ((IProject)cbin.getCProject().getUnderlyingResource()).accept(new Visitor(cbin));
+ } catch (CoreException e) {
+ //e.printStackTrace();
+ }
+ // Fired the event.
+ ICElement[] children = cbin.getChildren();
+ if (children.length > 0) {
+ CModelManager factory = CModelManager.getDefault();
+ ICElement root = (ICRoot)factory.getCRoot();
+ CElementDelta cdelta = new CElementDelta(root);
+ cdelta.added(cbin.getCProject());
+ cdelta.added(cbin);
+ for (int i = 0; i < children.length; i++) {
+ ICElement child = children[i];
+ cdelta.added(child);
+ }
+ factory.registerCModelDelta(cdelta);
+ factory.fire();
+ }
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryInfo.java
new file mode 100644
index 00000000000..b47cacafeab
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryInfo.java
@@ -0,0 +1,253 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.cdt.core.model.ICElement;
+
+import org.eclipse.cdt.utils.elf.Elf;
+import org.eclipse.cdt.utils.elf.ElfHelper;
+
+class BinaryInfo extends CFileInfo {
+
+ String [] needed;
+ ElfHelper.Sizes sizes;
+ Elf.Attribute attribute;
+ String soname;
+ Map hash;
+ ElfHelper elfHelper = null;
+
+ public BinaryInfo(CElement element) {
+ super(element);
+ needed = new String[0];
+ sizes = null;
+ attribute = null;
+ soname = "";
+ hash = new HashMap();
+ }
+
+ public boolean isBinary() {
+ return true;
+ }
+
+ public ICElement [] getChildren() {
+ initChildren();
+ return super.getChildren();
+ }
+
+ public String getCPU() {
+ init();
+ String cpu = null;
+ if (attribute != null)
+ cpu = attribute.getCPU();
+ return (cpu == null) ? "" : cpu;
+ }
+
+ public boolean isSharedLib() {
+ init();
+ if (attribute != null)
+ return attribute.getType() == attribute.ELF_TYPE_SHLIB;
+ return false;
+ }
+
+ public boolean isExecutable() {
+ init();
+ if (attribute != null)
+ return attribute.getType() == attribute.ELF_TYPE_EXE;
+ return false;
+ }
+
+ public boolean isObject() {
+ init();
+ if (attribute != null)
+ return attribute.getType() == attribute.ELF_TYPE_OBJ;
+ return false;
+ }
+
+ public boolean hasDebug () {
+ init();
+ if (attribute != null)
+ return attribute.hasDebug();
+ return false;
+ }
+
+ public String [] getNeededSharedLibs() {
+ init();
+ return needed;
+ }
+
+ public long getText() {
+ init();
+ if (sizes != null) {
+ return sizes.text;
+ }
+ return 0;
+ }
+
+ public long getData() {
+ init();
+ if (sizes != null) {
+ return sizes.data;
+ }
+ return 0;
+ }
+
+ public long getBSS() {
+ init();
+ if (sizes != null) {
+ return sizes.bss;
+ }
+ return 0;
+ }
+
+ public String getSoname() {
+ init();
+ return soname;
+ }
+
+ private void addFunction(Elf.Symbol [] symbol, boolean external) {
+ for (int i = 0; i < symbol.length; i++) {
+ ICElement parent = getElement();
+ String filename = null;
+ try {
+ filename = symbol[i].getFilename();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ Function function = null;
+
+ // Addr2line returns the funny "??" when it can find the file.
+ if (filename != null && !filename.equals("??")) {
+ TranslationUnit tu = null;
+ IPath path = new Path(filename);
+ if (hash.containsKey(path)) {
+ tu = (TranslationUnit)hash.get(path);
+ } else {
+ tu = new TranslationUnit(parent, path);
+ hash.put(path, tu);
+ addChild(tu);
+ }
+ function = new Function(tu, symbol[i].toString());
+ tu.addChild(function);
+ } else {
+ function = new Function(parent, symbol[i].toString());
+ addChild(function);
+ }
+ if (function != null)
+ if (!external)
+ function.getFunctionInfo().setAccessControl(IConstants.AccStatic);
+ }
+ }
+
+ private void addVariable(Elf.Symbol[] symbol, boolean external) {
+ for (int i = 0; i < symbol.length; i++) {
+ String filename = null;
+ try {
+ filename = symbol[i].getFilename();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ ICElement parent = getElement();
+ Variable variable = null;
+ // Addr2line returns the funny "??" when it can not find the file.
+ if (filename != null && !filename.equals("??")) {
+ TranslationUnit tu = null;
+ IPath path = new Path(filename);
+ if (hash.containsKey(path)) {
+ tu = (TranslationUnit)hash.get(path);
+ } else {
+ tu = new TranslationUnit(parent, path);
+ hash.put(path, tu);
+ addChild(tu);
+ }
+ variable = new Variable(tu, symbol[i].toString());
+ tu.addChild(variable);
+ } else {
+ variable = new Variable(parent, symbol[i].toString());
+ addChild(variable);
+ }
+ if (variable != null)
+ if (!external)
+ variable.getVariableInfo().setAccessControl(IConstants.AccStatic);
+ }
+ }
+
+ protected void init() {
+ if (hasChanged()) {
+ loadInfo();
+ }
+ }
+
+ protected void initChildren() {
+ if (hasChanged() || !isStructureKnown()) {
+ removeChildren();
+ loadInfoChildren();
+ }
+ }
+
+
+ protected ElfHelper getElfHelper() throws IOException {
+ if (elfHelper != null) {
+ return elfHelper;
+ }
+ CFile file = (CFile)getElement();
+ if (file != null) {
+ IPath path = ((CFile)getElement()).getLocation();
+ if (path == null)
+ path = new Path("");
+ return new ElfHelper(path.toOSString());
+ }
+ throw new IOException("No file assiocated with Binary");
+ }
+
+ protected void loadInfo() {
+ try {
+ ElfHelper helper = this.getElfHelper();
+ Elf.Dynamic[] sharedlibs = helper.getNeeded();
+ needed = new String[sharedlibs.length];
+ for (int i = 0; i < sharedlibs.length; i++) {
+ needed[i] = sharedlibs[i].toString();
+ }
+
+ sizes = helper.getSizes();
+ soname = helper.getSoname();
+ attribute = helper.getElf().getAttributes();
+ helper.dispose();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ }
+
+ protected void loadInfoChildren() {
+ try {
+ setIsStructureKnown(true);
+ ElfHelper helper = this.getElfHelper();
+ addFunction(helper.getExternalFunctions(), true);
+ addFunction(helper.getLocalFunctions(), false);
+ addVariable(helper.getExternalObjects(), true);
+ addVariable(helper.getLocalObjects(), false);
+
+ Elf.Dynamic[] sharedlibs = helper.getNeeded();
+ needed = new String[sharedlibs.length];
+ for (int i = 0; i < sharedlibs.length; i++) {
+ needed[i] = sharedlibs[i].toString();
+ }
+
+ sizes = helper.getSizes();
+ soname = helper.getSoname();
+ attribute = helper.getElf().getAttributes();
+ helper.dispose();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java
new file mode 100644
index 00000000000..c66ebbe2ebc
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java
@@ -0,0 +1,267 @@
+package org.eclipse.cdt.internal.core.model;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICRoot;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.CModelException;
+
+public abstract class CElement extends PlatformObject implements ICElement {
+
+ protected int fType;
+
+ protected ICElement fParent;
+
+ protected CElementInfo fCElementInfo;
+
+ protected String fName;
+
+ protected int fStartPos;
+ protected int fLength;
+ protected int fIdStartPos;
+ protected int fIdLength;
+ protected int fStartLine;
+ protected int fEndLine;
+
+ protected CElement[] empty = new CElement[0];
+
+ protected CElement(ICElement parent, String name, int type) {
+ fParent= parent;
+ fName= name;
+ fType= type;
+ fCElementInfo = null;
+ }
+
+ // setters
+
+ public void setElementType (int type) {
+ fType= type;
+ }
+
+ public void setElementName(String name) {
+ fName = name;
+ }
+
+ public void setParent (ICElement parent) {
+ fParent = parent;
+ }
+
+ // getters
+
+ public int getElementType() {
+ return fType;
+ }
+
+ public String getElementName() {
+ return fName;
+ }
+
+ public ICElement getParent() {
+ return fParent;
+ }
+
+ public IPath getPath() {
+ try {
+ IResource res = getUnderlyingResource();
+ if (res != null)
+ return res.getFullPath();
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public boolean exists() {
+ try {
+ return getCorrespondingResource() != null;
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ public boolean isReadOnly () {
+ return true;
+ }
+
+ public boolean isStructureKnown() throws CModelException {
+ return getElementInfo().isStructureKnown();
+ }
+
+ public ICRoot getCRoot () {
+ return getParent().getCRoot();
+ }
+
+ public ICProject getCProject() {
+ return getParent().getCProject();
+ }
+
+ protected void addChild(ICElement e) {
+ }
+
+ public void setPos(int startPos, int length) {
+ fStartPos = startPos;
+ fLength = length;
+ }
+
+ public int getStartPos() {
+ return fStartPos;
+ }
+
+ public int getLength() {
+ return fLength;
+ }
+
+ public void setIdPos(int startPos, int length) {
+ fIdStartPos= startPos;
+ fIdLength= length;
+ }
+
+ public int getIdStartPos() {
+ return fIdStartPos;
+ }
+
+ public int getIdLength() {
+ return fIdLength;
+ }
+
+ public int getStartLine() {
+ return fStartLine;
+ }
+
+ public int getEndLine() {
+ return fEndLine;
+ }
+
+ public void setLines(int startLine, int endLine) {
+ fStartLine = startLine;
+ fEndLine = endLine;
+ }
+
+
+ public abstract IResource getUnderlyingResource() throws CModelException;
+
+ public abstract IResource getCorrespondingResource() throws CModelException;
+
+ protected abstract CElementInfo createElementInfo();
+
+ /**
+ * Finds a member corresponding to a give element.
+ */
+ //public ICElement findEqualMember(ICElement elem) {
+ // if (this instanceof IParent) {
+ // ICElement[] members = ((IParent)this).getChildren();
+ // if (members != null) {
+ // for (int i= members.length - 1; i >= 0; i--) {
+ // ICElement curr= members[i];
+ // if (curr.equals(elem)) {
+ // return curr;
+ // } else {
+ // ICElement res= curr.findEqualMember(elem);
+ // if (res != null) {
+ // return res;
+ // }
+ // }
+ // }
+ // }
+ // return null;
+ //}
+
+ /**
+ * Tests if an element has the same name, type and an equal parent.
+ */
+ public boolean equals (Object o) {
+ if (this == o)
+ return true;
+ if (o instanceof CElement) {
+ CElement other = (CElement) o;
+ try {
+ IResource tres = getCorrespondingResource();
+ IResource ores = other.getCorrespondingResource();
+ if (ores != null && tres != null) {
+ return tres.equals(ores);
+ }
+ } catch (CModelException e) {
+ //e.printStackTrace();
+ }
+ if (fType != other.fType)
+ return false;
+ if (fName.equals(other.fName)) {
+ if (fParent != null && fParent.equals(other.fParent)) {
+ return true;
+ }
+ if (fParent == null && other.fParent == null)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public CElementInfo getElementInfo () {
+ if (fCElementInfo == null) {
+ fCElementInfo = createElementInfo();
+ }
+ return fCElementInfo;
+ }
+
+ public String toString() {
+ return getElementName();
+ }
+
+ public String toDebugString() {
+ return getElementName() + " " + getTypeString(getElementType());
+ }
+
+ // util
+ public static String getTypeString(int type) {
+ switch (type) {
+ case C_ROOT:
+ return "CROOT";
+ case C_PROJECT:
+ return "CPROJECT";
+ case C_FOLDER:
+ return "CFOLDER";
+ case C_FILE:
+ return "CFILE";
+ case C_FUNCTION:
+ return "C_FUNCTION";
+ case C_FUNCTION_DECLARATION:
+ return "C_FUNCTION_DECLARATION";
+ case C_VARIABLE:
+ return "C_VARIABLE";
+ case C_VARIABLE_DECLARATION:
+ return "C_VARIABLE_DECLARATION";
+ case C_INCLUDE:
+ return "C_INCLUDE";
+ case C_MACRO:
+ return "C_MACRO";
+ case C_STRUCT:
+ return "C_STRUCT";
+ case C_CLASS:
+ return "C_CLASS";
+ case C_UNION:
+ return "C_UNION";
+ case C_FIELD:
+ return "C_FIELD";
+ case C_METHOD:
+ return "C_METHOD";
+ default:
+ return "UNKNOWN";
+ }
+ }
+
+ /**
+ * Runs a C Model Operation
+ */
+ protected void runOperation(CModelOperation operation, IProgressMonitor monitor) throws CModelException {
+ CModelManager.getDefault().runOperation(operation, monitor);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDelta.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDelta.java
new file mode 100644
index 00000000000..ad99aaa2e2f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDelta.java
@@ -0,0 +1,736 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IResourceDelta;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.IArchive;
+import org.eclipse.cdt.core.model.ICElementDelta;
+import org.eclipse.cdt.core.model.CModelException;
+
+
+/**
+ * @see ICElementDelta
+ */
+public class CElementDelta implements ICElementDelta {
+ /**
+ * The element that this delta describes the change to.
+ * @see #getElement()
+ */
+ protected ICElement fChangedElement;
+
+ /**
+ * @see #getKind()
+ */
+ private int fKind = 0;
+
+ /**
+ * @see #getFlags()
+ */
+ private int fChangeFlags = 0;
+
+ /**
+ * @see #getMovedFromHandle()
+ */
+ protected ICElement fMovedFromHandle = null;
+
+ /**
+ * @see #getMovedToHandle()
+ */
+ protected ICElement fMovedToHandle = null;
+
+ /**
+ * Collection of resource deltas that correspond to non c resources deltas.
+ */
+ protected IResourceDelta[] resourceDeltas = null;
+
+ /**
+ * Counter of resource deltas
+ */
+ protected int resourceDeltasCounter;
+
+ /**
+ * Empty array of ICElementDelta
+ */
+ protected static ICElementDelta[] fgEmptyDelta= new ICElementDelta[] {};
+
+ /**
+ * @see #getAffectedChildren()
+ */
+ protected ICElementDelta[] fAffectedChildren = fgEmptyDelta;
+
+ /**
+ * Creates the root delta. To create the nested delta
+ * hierarchies use the following convenience methods. The root
+ * delta can be created at any level (i.e. project, folder).
+ *
+ * added(ICElement)
+ * changed(ICElement)
+ * moved(ICElement, ICElement)
+ * removed(ICElement)
+ * renamed(ICElement, ICElement)
+ *
+ */
+ public CElementDelta(ICElement element) {
+ super();
+ fChangedElement = element;
+ }
+
+ /**
+ * Adds the child delta to the collection of affected children. If the
+ * child is already in the collection, walk down the hierarchy.
+ */
+ protected void addAffectedChild(CElementDelta child) {
+ switch (fKind) {
+ case ADDED:
+ case REMOVED:
+ // no need to add a child if this parent is added or removed
+ return;
+ case CHANGED:
+ fChangeFlags |= F_CHILDREN;
+ break;
+ default:
+ fKind = CHANGED;
+ fChangeFlags |= F_CHILDREN;
+ }
+
+ // if a child delta is added to a translation unit delta or below,
+ // it's a fine grained delta
+ try {
+ if (fChangedElement.getCorrespondingResource() == null) {
+ fineGrained();
+ }
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+
+ if (fAffectedChildren.length == 0) {
+ fAffectedChildren = new ICElementDelta[] {child};
+ return;
+ }
+
+ // Check if we already have the delta.
+ ICElementDelta existingChild = null;
+ int existingChildIndex = -1;
+ for (int i = 0; i < fAffectedChildren.length; i++) {
+ // handle case of two jars that can be equals but not in the same project
+ if (equalsAndSameParent(fAffectedChildren[i].getElement(), child.getElement())) {
+ existingChild = fAffectedChildren[i];
+ existingChildIndex = i;
+ break;
+ }
+ }
+
+ if (existingChild == null) { //new affected child
+ fAffectedChildren= growAndAddToArray(fAffectedChildren, child);
+ } else {
+ switch (existingChild.getKind()) {
+ case ADDED:
+ switch (child.getKind()) {
+ // child was added then added -> it is added
+ case ADDED:
+ // child was added then changed -> it is added
+ case CHANGED:
+ return;
+
+ // child was added then removed -> noop
+ case REMOVED:
+ fAffectedChildren = removeAndShrinkArray(fAffectedChildren, existingChildIndex);
+ return;
+ }
+ break;
+ case REMOVED:
+ switch (child.getKind()) {
+ // child was removed then added -> it is changed
+ case ADDED:
+ child.fKind = CHANGED;
+ fAffectedChildren[existingChildIndex] = child;
+ return;
+
+ // child was removed then changed -> it is removed
+ case CHANGED:
+ // child was removed then removed -> it is removed
+ case REMOVED:
+ return;
+ }
+ break;
+ case CHANGED:
+ switch (child.getKind()) {
+ // child was changed then added -> it is added
+ case ADDED:
+ // child was changed then removed -> it is removed
+ case REMOVED:
+ fAffectedChildren[existingChildIndex] = child;
+ return;
+
+ // child was changed then changed -> it is changed
+ case CHANGED:
+ ICElementDelta[] children = child.getAffectedChildren();
+ for (int i = 0; i < children.length; i++) {
+ CElementDelta childsChild = (CElementDelta) children[i];
+ ((CElementDelta) existingChild).addAffectedChild(childsChild);
+ }
+ // add the non-c resource deltas if needed
+ // note that the child delta always takes
+ // precedence over this existing child delta
+ // as non-c resource deltas are always
+ // created last (by the DeltaProcessor)
+ IResourceDelta[] resDeltas = child.getResourceDeltas();
+ if (resDeltas != null) {
+ ((CElementDelta)existingChild).resourceDeltas = resDeltas;
+ ((CElementDelta)existingChild).resourceDeltasCounter = child.resourceDeltasCounter;
+ }
+ return;
+ }
+ break;
+ default:
+ // unknown -> existing child becomes the child with the existing child's flags
+ int flags = existingChild.getFlags();
+ fAffectedChildren[existingChildIndex] = child;
+ child.fChangeFlags |= flags;
+ }
+ }
+ }
+
+ /**
+ * Creates the nested deltas resulting from an add operation.
+ * Convenience method for creating add deltas.
+ * The constructor should be used to create the root delta
+ * and then an add operation should call this method.
+ */
+ public void added(ICElement element) {
+ CElementDelta addedDelta = new CElementDelta(element);
+ addedDelta.fKind = ADDED;
+ insertDeltaTree(element, addedDelta);
+ // Added also to the Containers
+ if (element instanceof IArchive) {
+ CProject cproj = (CProject)element.getCProject();
+ ArchiveContainer container = (ArchiveContainer)cproj.getArchiveContainer();
+ container.addChild(element);
+ } else if (element instanceof IBinary) {
+ if (((IBinary)element).isExecutable() ||((IBinary)element).isSharedLib()) {
+ CProject cproj = (CProject)element.getCProject();
+ BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
+ container.addChild(element);
+ }
+ }
+ }
+
+ /**
+ * Adds the child delta to the collection of affected children. If the
+ * child is already in the collection, walk down the hierarchy.
+ */
+ protected void addResourceDelta(IResourceDelta child) {
+ switch (fKind) {
+ case ADDED:
+ case REMOVED:
+ // no need to add a child if this parent is added or removed
+ return;
+ case CHANGED:
+ fChangeFlags |= F_CONTENT;
+ break;
+ default:
+ fKind = CHANGED;
+ fChangeFlags |= F_CONTENT;
+ }
+ if (resourceDeltas == null) {
+ resourceDeltas = new IResourceDelta[5];
+ resourceDeltas[resourceDeltasCounter++] = child;
+ return;
+ }
+ if (resourceDeltas.length == resourceDeltasCounter) {
+ // need a resize
+ System.arraycopy(resourceDeltas, 0, (resourceDeltas = new IResourceDelta[resourceDeltasCounter * 2]), 0, resourceDeltasCounter);
+ }
+ resourceDeltas[resourceDeltasCounter++] = child;
+ }
+
+ /**
+ * Creates the nested deltas resulting from a change operation.
+ * Convenience method for creating change deltas.
+ * The constructor should be used to create the root delta
+ * and then a change operation should call this method.
+ */
+ public void changed(ICElement element, int changeFlag) {
+ CElementDelta changedDelta = new CElementDelta(element);
+ changedDelta.fKind = CHANGED;
+ changedDelta.fChangeFlags |= changeFlag;
+ insertDeltaTree(element, changedDelta);
+ }
+
+ /**
+ * Creates the nested deltas for a closed element.
+ */
+ public void closed(ICElement element) {
+ CElementDelta delta = new CElementDelta(element);
+ delta.fKind = CHANGED;
+ delta.fChangeFlags |= F_CLOSED;
+ insertDeltaTree(element, delta);
+ }
+
+ /**
+ * Returns whether the two c elements are equals and have the same parent.
+ */
+ protected boolean equalsAndSameParent(ICElement e1, ICElement e2) {
+ ICElement parent1;
+ return e1.equals(e2) && ((parent1 = e1.getParent()) != null) && parent1.equals(e2.getParent());
+ }
+
+ /**
+ * Creates the nested delta deltas based on the affected element
+ * its delta, and the root of this delta tree. Returns the root
+ * of the created delta tree.
+ */
+ protected CElementDelta createDeltaTree(ICElement element, CElementDelta delta) {
+ CElementDelta childDelta = delta;
+ ArrayList ancestors= getAncestors(element);
+ if (ancestors == null) {
+ if (equalsAndSameParent(delta.getElement(), getElement())) {
+ // handle case of two jars that can be equals but not in the
+ // same project
+ // the element being changed is the root element
+ fKind= delta.fKind;
+ fChangeFlags = delta.fChangeFlags;
+ fMovedToHandle = delta.fMovedToHandle;
+ fMovedFromHandle = delta.fMovedFromHandle;
+ } else {
+ // the given delta is not the root or a child - illegal
+ //Assert.isTrue(false);
+ }
+ } else {
+ for (int i = 0, size = ancestors.size(); i < size; i++) {
+ ICElement ancestor = (ICElement) ancestors.get(i);
+ CElementDelta ancestorDelta = new CElementDelta(ancestor);
+ ancestorDelta.addAffectedChild(childDelta);
+ childDelta = ancestorDelta;
+ }
+ }
+ return childDelta;
+ }
+
+ /**
+ * Returns the CElementDelta
for the given element
+ * in the delta tree, or null, if no delta for the given element is found.
+ */
+ protected CElementDelta find(ICElement e) {
+ if (equalsAndSameParent(fChangedElement, e)) { // handle case of two jars that can be equals but not in the same project
+ return this;
+ } else {
+ for (int i = 0; i < fAffectedChildren.length; i++) {
+ CElementDelta delta = ((CElementDelta)fAffectedChildren[i]).find(e);
+ if (delta != null) {
+ return delta;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Mark this delta as a fine-grained delta.
+ */
+ public void fineGrained() {
+ fChangeFlags |= F_FINE_GRAINED;
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public ICElementDelta[] getAddedChildren() {
+ return getChildrenOfType(ADDED);
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public ICElementDelta[] getAffectedChildren() {
+ return fAffectedChildren;
+ }
+
+ /**
+ * Returns a collection of all the parents of this element up to (but
+ * not including) the root of this tree in bottom-up order. If the given
+ * element is not a descendant of the root of this tree, null
+ * is returned.
+ */
+ private ArrayList getAncestors(ICElement element) {
+ ICElement parent = element.getParent();
+ if (parent == null) {
+ return null;
+ }
+ ArrayList parents = new ArrayList();
+ while (!parent.equals(fChangedElement)) {
+ parents.add(parent);
+ parent = parent.getParent();
+ if (parent == null) {
+ return null;
+ }
+ }
+ parents.trimToSize();
+ return parents;
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public ICElementDelta[] getChangedChildren() {
+ return getChildrenOfType(CHANGED);
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ protected ICElementDelta[] getChildrenOfType(int type) {
+ int length = fAffectedChildren.length;
+ if (length == 0) {
+ return new ICElementDelta[] {};
+ }
+ ArrayList children= new ArrayList(length);
+ for (int i = 0; i < length; i++) {
+ if (fAffectedChildren[i].getKind() == type) {
+ children.add(fAffectedChildren[i]);
+ }
+ }
+
+ ICElementDelta[] childrenOfType = new ICElementDelta[children.size()];
+ children.toArray(childrenOfType);
+ return childrenOfType;
+ }
+
+ /**
+ * Returns the delta for a given element. Only looks below this
+ * delta.
+ */
+ protected CElementDelta getDeltaFor(ICElement element) {
+ if (equalsAndSameParent(getElement(), element)) // handle case of two jars that can be equals but not in the same project
+ return this;
+ if (fAffectedChildren.length == 0)
+ return null;
+ int childrenCount = fAffectedChildren.length;
+ for (int i = 0; i < childrenCount; i++) {
+ CElementDelta delta = (CElementDelta)fAffectedChildren[i];
+ if (equalsAndSameParent(delta.getElement(), element)) { // handle case of two jars that can be equals but not in the same project
+ return delta;
+ } else {
+ delta = ((CElementDelta)delta).getDeltaFor(element);
+ if (delta != null)
+ return delta;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public ICElement getElement() {
+ return fChangedElement;
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public int getFlags() {
+ return fChangeFlags;
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public int getKind() {
+ return fKind;
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public ICElement getMovedFromElement() {
+ return fMovedFromHandle;
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public ICElement getMovedToElement() {
+ return fMovedToHandle;
+ }
+
+ /**
+ * @see ICElementDelta
+ */
+ public ICElementDelta[] getRemovedChildren() {
+ return getChildrenOfType(REMOVED);
+ }
+
+ /**
+ * Return the collection of resource deltas. Return null if none.
+ */
+ public IResourceDelta[] getResourceDeltas() {
+ if (resourceDeltas == null)
+ return null;
+ if (resourceDeltas.length != resourceDeltasCounter) {
+ System.arraycopy(resourceDeltas, 0, resourceDeltas = new IResourceDelta[resourceDeltasCounter], 0, resourceDeltasCounter);
+ }
+ return resourceDeltas;
+ }
+
+ /**
+ * Adds the new element to a new array that contains all of the elements of the old array.
+ * Returns the new array.
+ */
+ protected ICElementDelta[] growAndAddToArray(ICElementDelta[] array, ICElementDelta addition) {
+ ICElementDelta[] old = array;
+ array = new ICElementDelta[old.length + 1];
+ System.arraycopy(old, 0, array, 0, old.length);
+ array[old.length] = addition;
+ return array;
+ }
+
+ /**
+ * Creates the delta tree for the given element and delta, and then
+ * inserts the tree as an affected child of this node.
+ */
+ protected void insertDeltaTree(ICElement element, CElementDelta delta) {
+ CElementDelta childDelta= createDeltaTree(element, delta);
+ if (!equalsAndSameParent(element, getElement())) {
+ addAffectedChild(childDelta);
+ }
+ }
+
+
+ /**
+ * Creates the nested deltas resulting from an move operation.
+ * Convenience method for creating the "move from" delta.
+ * The constructor should be used to create the root delta
+ * and then the move operation should call this method.
+ */
+ public void movedFrom(ICElement movedFromElement, ICElement movedToElement) {
+ CElementDelta removedDelta = new CElementDelta(movedFromElement);
+ removedDelta.fKind = REMOVED;
+ removedDelta.fChangeFlags |= F_MOVED_TO;
+ removedDelta.fMovedToHandle = movedToElement;
+ insertDeltaTree(movedFromElement, removedDelta);
+ }
+
+ /**
+ * Creates the nested deltas resulting from an move operation.
+ * Convenience method for creating the "move to" delta.
+ * The constructor should be used to create the root delta
+ * and then the move operation should call this method.
+ */
+ public void movedTo(ICElement movedToElement, ICElement movedFromElement) {
+ CElementDelta addedDelta = new CElementDelta(movedToElement);
+ addedDelta.fKind = ADDED;
+ addedDelta.fChangeFlags |= F_MOVED_FROM;
+ addedDelta.fMovedFromHandle = movedFromElement;
+ insertDeltaTree(movedToElement, addedDelta);
+ }
+
+ /**
+ * Creates the nested deltas for an opened element.
+ */
+ public void opened(ICElement element) {
+ CElementDelta delta = new CElementDelta(element);
+ delta.fKind = CHANGED;
+ delta.fChangeFlags |= F_OPENED;
+ insertDeltaTree(element, delta);
+ }
+
+ /**
+ * Removes the child delta from the collection of affected children.
+ */
+ protected void removeAffectedChild(CElementDelta child) {
+ int index = -1;
+ if (fAffectedChildren != null) {
+ for (int i = 0; i < fAffectedChildren.length; i++) {
+ if (equalsAndSameParent(fAffectedChildren[i].getElement(), child.getElement())) { // handle case of two jars that can be equals but not in the same project
+ index = i;
+ break;
+ }
+ }
+ }
+ if (index >= 0) {
+ fAffectedChildren= removeAndShrinkArray(fAffectedChildren, index);
+ }
+ }
+
+ /**
+ * Removes the element from the array.
+ * Returns the a new array which has shrunk.
+ */
+ protected ICElementDelta[] removeAndShrinkArray(ICElementDelta[] old, int index) {
+ ICElementDelta[] array = new ICElementDelta[old.length - 1];
+ if (index > 0)
+ System.arraycopy(old, 0, array, 0, index);
+ int rest = old.length - index - 1;
+ if (rest > 0)
+ System.arraycopy(old, index + 1, array, index, rest);
+ return array;
+ }
+
+ /**
+ * Creates the nested deltas resulting from an delete operation.
+ * Convenience method for creating removed deltas.
+ * The constructor should be used to create the root delta
+ * and then the delete operation should call this method.
+ */
+ public void removed(ICElement element) {
+ CElementDelta removedDelta= new CElementDelta(element);
+ insertDeltaTree(element, removedDelta);
+ CElementDelta actualDelta = getDeltaFor(element);
+ if (actualDelta != null) {
+ actualDelta.fKind = REMOVED;
+ actualDelta.fChangeFlags = 0;
+ actualDelta.fAffectedChildren = fgEmptyDelta;
+ }
+ }
+
+ /**
+ * Creates the nested deltas resulting from a change operation.
+ * Convenience method for creating change deltas.
+ * The constructor should be used to create the root delta
+ * and then a change operation should call this method.
+ */
+ public void sourceAttached(ICElement element) {
+ CElementDelta attachedDelta = new CElementDelta(element);
+ attachedDelta.fKind = CHANGED;
+ attachedDelta.fChangeFlags |= F_SOURCEATTACHED;
+ insertDeltaTree(element, attachedDelta);
+ }
+
+ /**
+ * Creates the nested deltas resulting from a change operation.
+ * Convenience method for creating change deltas.
+ * The constructor should be used to create the root delta
+ * and then a change operation should call this method.
+ */
+ public void sourceDetached(ICElement element) {
+ CElementDelta detachedDelta = new CElementDelta(element);
+ detachedDelta.fKind = CHANGED;
+ detachedDelta.fChangeFlags |= F_SOURCEDETACHED;
+ insertDeltaTree(element, detachedDelta);
+ }
+
+ /**
+ * Returns a string representation of this delta's
+ * structure suitable for debug purposes.
+ *
+ * @see toString
+ */
+ public String toDebugString(int depth) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i= 0; i < depth; i++) {
+ buffer.append('\t');
+ }
+ buffer.append(((CElement)getElement()).toDebugString());
+ buffer.append(" ["); //$NON-NLS-1$
+ switch (getKind()) {
+ case ICElementDelta.ADDED :
+ buffer.append('+');
+ break;
+ case ICElementDelta.REMOVED :
+ buffer.append('-');
+ break;
+ case ICElementDelta.CHANGED :
+ buffer.append('*');
+ break;
+ default :
+ buffer.append('?');
+ break;
+ }
+ buffer.append("]: {"); //$NON-NLS-1$
+ int changeFlags = getFlags();
+ boolean prev = false;
+ if ((changeFlags & ICElementDelta.F_CHILDREN) != 0) {
+ if (prev)
+ buffer.append(" | "); //$NON-NLS-1$
+ buffer.append("CHILDREN"); //$NON-NLS-1$
+ prev = true;
+ }
+ if ((changeFlags & ICElementDelta.F_CONTENT) != 0) {
+ if (prev)
+ buffer.append(" | "); //$NON-NLS-1$
+ buffer.append("CONTENT"); //$NON-NLS-1$
+ prev = true;
+ }
+ if ((changeFlags & ICElementDelta.F_MOVED_FROM) != 0) {
+ if (prev)
+ buffer.append(" | "); //$NON-NLS-1$
+ //buffer.append("MOVED_FROM(" + ((CElement)getMovedFromElement()).toStringWithAncestors() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ prev = true;
+ }
+ if ((changeFlags & ICElementDelta.F_MOVED_TO) != 0) {
+ if (prev)
+ buffer.append(" | "); //$NON-NLS-1$
+ //buffer.append("MOVED_TO(" + ((CElement)getMovedToElement()).toStringWithAncestors() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ prev = true;
+ }
+ if ((changeFlags & ICElementDelta.F_MODIFIERS) != 0) {
+ if (prev)
+ buffer.append(" | "); //$NON-NLS-1$
+ buffer.append("MODIFIERS CHANGED"); //$NON-NLS-1$
+ prev = true;
+ }
+ //if ((changeFlags & ICElementDelta.F_SUPER_TYPES) != 0) {
+ // if (prev)
+ // buffer.append(" | "); //$NON-NLS-1$
+ // buffer.append("SUPER TYPES CHANGED"); //$NON-NLS-1$
+ // prev = true;
+ //}
+ if ((changeFlags & ICElementDelta.F_FINE_GRAINED) != 0) {
+ if (prev)
+ buffer.append(" | "); //$NON-NLS-1$
+ buffer.append("FINE GRAINED"); //$NON-NLS-1$
+ prev = true;
+ }
+ buffer.append("}"); //$NON-NLS-1$
+ ICElementDelta[] children = getAffectedChildren();
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ buffer.append("\n"); //$NON-NLS-1$
+ buffer.append(((CElementDelta) children[i]).toDebugString(depth + 1));
+ }
+ }
+
+ for (int i = 0; i < resourceDeltasCounter; i++) {
+ buffer.append("\n");//$NON-NLS-1$
+ for (int j = 0; j < depth+1; j++) {
+ buffer.append('\t');
+ }
+ IResourceDelta resourceDelta = resourceDeltas[i];
+ buffer.append(resourceDelta.toString());
+ buffer.append("["); //$NON-NLS-1$
+ switch (resourceDelta.getKind()) {
+ case IResourceDelta.ADDED :
+ buffer.append('+');
+ break;
+ case IResourceDelta.REMOVED :
+ buffer.append('-');
+ break;
+ case IResourceDelta.CHANGED :
+ buffer.append('*');
+ break;
+ default :
+ buffer.append('?');
+ break;
+ }
+ buffer.append("]"); //$NON-NLS-1$
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Returns a string representation of this delta's
+ * structure suitable for debug purposes.
+ */
+ public String toString() {
+ return toDebugString(0);
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementInfo.java
new file mode 100644
index 00000000000..333c15e2ac0
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementInfo.java
@@ -0,0 +1,184 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.File;
+
+import org.eclipse.core.resources.IResource;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * Holds cached structure and properties for a C element.
+ * Subclassed to carry properties for specific kinds of elements.
+ */
+class CElementInfo {
+
+ protected CElement element;
+
+ /**
+ * Collection of handles of immediate children of this
+ * object. This is an empty array if this element has
+ * no children.
+ */
+ protected ICElement[] fChildren;
+
+ /**
+ * Shared empty collection used for efficiency.
+ */
+ protected static ICElement[] fgEmptyChildren = new ICElement[]{};
+ /**
+ * Is the structure of this element known
+ * @see ICElement.isStructureKnown()
+ */
+ protected boolean fIsStructureKnown = false;
+
+ protected long modificationStamp = 0;
+
+ protected CElementInfo(CElement element) {
+ this.element = element;
+ fChildren = fgEmptyChildren;
+ }
+
+ protected CElement getElement() {
+ return element;
+ }
+
+ protected void addChild(ICElement child) {
+ if (fChildren == fgEmptyChildren) {
+ setChildren(new ICElement[] {child});
+ } else {
+ if (!includesChild(child)) {
+ setChildren(growAndAddToArray(fChildren, child));
+ }
+ }
+ }
+
+ protected ICElement[] getChildren() {
+ return fChildren;
+ }
+
+ /**
+ * Adds the new element to a new array that contains all of the elements of the old array.
+ * Returns the new array.
+ */
+ protected ICElement[] growAndAddToArray(ICElement[] array, ICElement addition) {
+ ICElement[] old = array;
+ array = new ICElement[old.length + 1];
+ System.arraycopy(old, 0, array, 0, old.length);
+ array[old.length] = addition;
+ return array;
+ }
+
+ /**
+ * Returns true
if this child is in my children collection
+ */
+ protected boolean includesChild(ICElement child) {
+
+ for (int i= 0; i < fChildren.length; i++) {
+ if (fChildren[i].equals(child)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @see ICElement.isStructureKnown()
+ */
+ protected boolean isStructureKnown() {
+ return fIsStructureKnown;
+ }
+
+ /**
+ * Returns an array with all the same elements as the specified array except for
+ * the element to remove. Assumes that the deletion is contained in the array.
+ */
+ protected ICElement[] removeAndShrinkArray(ICElement[] array, ICElement deletion) {
+ ICElement[] old = array;
+ array = new ICElement[old.length - 1];
+ int j = 0;
+ for (int i = 0; i < old.length; i++) {
+ if (!old[i].equals(deletion)) {
+ array[j] = old[i];
+ } else {
+ System.arraycopy(old, i + 1, array, j, old.length - (i + 1));
+ return array;
+ }
+ j++;
+ }
+ return array;
+ }
+
+ protected void removeChild(ICElement child) {
+ if (includesChild(child)) {
+ setChildren(removeAndShrinkArray(fChildren, child));
+ }
+ }
+
+ protected void removeChildren () {
+ fChildren = fgEmptyChildren;
+ }
+
+ protected void setChildren(ICElement[] children) {
+ fChildren = children;
+ }
+
+ protected boolean hasChildren() {
+ return fChildren.length > 0;
+ }
+
+ protected void setChanged() {
+ modificationStamp = 0;
+ }
+
+ protected boolean hasChanged () {
+ IResource r = null;
+ boolean b = false;
+ try {
+ r = getElement().getUnderlyingResource();
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ if (r != null && r.exists()) {
+ long modif = 0;
+ switch(r.getType()) {
+ // Adding/Removing does not count as changing, in Eclipse
+ // Ask the underlying file system
+ case IResource.FOLDER:
+ case IResource.PROJECT:
+ case IResource.ROOT:
+ File file = r.getLocation().toFile();
+ modif = file.lastModified();
+ break;
+
+ case IResource.FILE:
+ modif = r.getModificationStamp();
+ break;
+ }
+ b = (modif != modificationStamp);
+ modificationStamp = modif;
+ }
+ return b;
+ }
+
+ /**
+ * Sets whether the structure of this element known
+ * @see ICElement.isStructureKnown()
+ */
+ protected void setIsStructureKnown(boolean newIsStructureKnown) {
+ fIsStructureKnown = newIsStructureKnown;
+ }
+
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new Error();
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFile.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFile.java
new file mode 100644
index 00000000000..5ac68f0a25d
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFile.java
@@ -0,0 +1,76 @@
+package org.eclipse.cdt.internal.core.model;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+//import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICFile;
+
+public class CFile extends CResource implements ICFile {
+
+ IPath location;
+
+ public CFile(ICElement parent, IFile file) {
+ this(parent, file, file.getLocation(), file.getName());
+ }
+
+ public CFile(ICElement parent, IFile file, String name) {
+ this(parent, file, file.getLocation(), name);
+ }
+
+ public CFile(ICElement parent, IPath location) {
+ this(parent, ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(location),
+ location, location.lastSegment());
+ }
+
+ public CFile(ICElement parent, IResource res, IPath location, String name) {
+ super(parent, res, name, CElement.C_FILE);
+ this.location = location;
+ }
+
+
+ public IPath getLocation () {
+ return location;
+ }
+
+ public void setLocation(IPath location) {
+ this.location = location;
+ }
+
+ public IFile getFile () {
+ try {
+ return (IFile)getUnderlyingResource();
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public boolean isBinary() {
+ return getCFileInfo().isBinary();
+ }
+
+ public boolean isArchive() {
+ return getCFileInfo().isArchive();
+ }
+
+ public boolean isTranslationUnit() {
+ return getCFileInfo().isTranslationUnit();
+ }
+
+ protected CFileInfo getCFileInfo() {
+ return (CFileInfo)getElementInfo();
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new CFileInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFileInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFileInfo.java
new file mode 100644
index 00000000000..b31f3745031
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFileInfo.java
@@ -0,0 +1,32 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+public class CFileInfo extends CResourceInfo {
+
+ /**
+ * Constructs a new C Model Info
+ */
+ protected CFileInfo(CElement element) {
+ super(element);
+ }
+
+ protected boolean hasChildren() {
+ return false;
+ }
+
+ public boolean isBinary() {
+ return false;
+ }
+
+ public boolean isArchive() {
+ return false;
+ }
+
+ public boolean isTranslationUnit() {
+ return (this instanceof TranslationUnitInfo);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFolder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFolder.java
new file mode 100644
index 00000000000..a7547a12ef9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFolder.java
@@ -0,0 +1,32 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFolder;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICFolder;
+import org.eclipse.cdt.core.model.CModelException;
+
+public class CFolder extends CResource implements ICFolder {
+
+ public CFolder (ICElement parent, IFolder folder) {
+ super (parent, folder, ICElement.C_FOLDER);
+ }
+
+ public IFolder getFolder () {
+ try {
+ return (IFolder)getUnderlyingResource();
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new CFolderInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFolderInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFolderInfo.java
new file mode 100644
index 00000000000..c95dbc0ed66
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CFolderInfo.java
@@ -0,0 +1,18 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ */
+public class CFolderInfo extends CResourceInfo {
+
+ /**
+ * Constructs a new C Model Info
+ */
+ protected CFolderInfo(CElement element) {
+ super(element);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
new file mode 100644
index 00000000000..4910f547dc8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
@@ -0,0 +1,701 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IArchive;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.IElementChangedListener;
+import org.eclipse.cdt.core.model.ElementChangedEvent;
+import org.eclipse.cdt.core.model.ICElementDelta;
+import org.eclipse.cdt.core.model.CModelException;
+
+import org.eclipse.cdt.core.model.CoreModel;
+
+import org.eclipse.cdt.utils.elf.Elf;
+import org.eclipse.cdt.utils.elf.AR;
+
+public class CModelManager implements IResourceChangeListener {
+
+ // FIXME: Get it from the plugin class.
+ private static String C_NATURE_ID = CoreModel.getCNatureId();
+ private static String CC_NATURE_ID = CoreModel.getCCNatureId();
+
+ private HashMap fParsedResources = new HashMap();
+
+ /**
+ * Used to convert IResourceDelta
s into IJavaElementDelta
s.
+ */
+ protected DeltaProcessor fDeltaProcessor= new DeltaProcessor();
+
+ /**
+ * Queue of deltas created explicily by the C Model that
+ * have yet to be fired.
+ */
+ private ArrayList fCModelDeltas= new ArrayList();
+
+ /**
+ * Turns delta firing on/off. By default it is on.
+ */
+ protected boolean fFire= true;
+
+ /**
+ * Collection of listeners for C element deltas
+ */
+ protected ArrayList fElementChangedListeners= new ArrayList();
+
+ public static final String [] cExtensions = {"c", "cxx", "cc", "C", "cpp", "h", "hh"};
+
+ static CModelManager factory = null;
+
+ private CModelManager() {
+ }
+
+ public static CModelManager getDefault() {
+ if (factory == null) {
+ factory = new CModelManager ();
+
+ // Register to the workspace;
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(factory,
+ IResourceChangeEvent.PRE_AUTO_BUILD
+ | IResourceChangeEvent.POST_CHANGE
+ | IResourceChangeEvent.PRE_DELETE
+ | IResourceChangeEvent.PRE_CLOSE);
+ }
+ return factory;
+ }
+
+ /**
+ * Returns the CRoot for the given workspace, creating
+ * it if it does not yet exist.
+ */
+ public ICElement getCRoot(IWorkspaceRoot root) {
+ return create(root);
+ }
+
+ public ICElement getCRoot () {
+ return create(ResourcesPlugin.getWorkspace().getRoot());
+ }
+
+ public ICElement create (IPath path) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ // Assume it is fullpath relative to workspace
+ IResource res = root.findMember(path);
+ if (res == null) {
+ IPath rootPath = root.getLocation();
+ if (path.equals(rootPath))
+ return getCRoot(root);
+ res = root.getContainerForLocation(path);
+ if (res == null)
+ res = root.getFileForLocation(path);
+ }
+ return create (res);
+ }
+
+ public ICElement create (IResource resource) {
+ if (resource == null) {
+ return null;
+ }
+ int type = resource.getType();
+ switch (type) {
+ case IResource.PROJECT :
+ return create((IProject)resource);
+ case IResource.FILE :
+ return create((IFile)resource);
+ case IResource.FOLDER :
+ return create((IFolder)resource);
+ case IResource.ROOT :
+ return create((IWorkspaceRoot)resource);
+ default :
+ return null;
+ }
+ }
+
+ public ICElement create(ICElement parent, IResource resource) {
+ int type = resource.getType();
+ switch (type) {
+ case IResource.PROJECT :
+ return create(parent, (IProject)resource);
+ case IResource.FILE :
+ return create(parent, (IFile)resource);
+ case IResource.FOLDER :
+ return create(parent, (IFolder)resource);
+ case IResource.ROOT :
+ return create(parent, (IWorkspaceRoot)resource);
+ default :
+ return null;
+ }
+ }
+
+ public ICElement create(IFile file) {
+ IResource parent = file.getParent();
+ ICElement celement = null;
+ if (parent instanceof IFolder) {
+ celement = create ((IFolder)parent);
+ } else if (parent instanceof IProject) {
+ celement = create ((IProject)parent);
+ }
+ if (celement != null)
+ return create (celement, file);
+ return celement;
+ }
+
+ public synchronized ICElement create(ICElement parent, IFile file) {
+ ICElement celement = (ICElement)fParsedResources.get(file);
+ if (celement == null) {
+ if (file.exists()) {
+ if (isArchive(file)) {
+ celement = new Archive(parent, file);
+ } else if (isBinary(file)) {
+ celement = new Binary(parent, file);
+ } else if (isTranslationUnit(file)) {
+ celement = new TranslationUnit(parent, file);
+ } else {
+ celement = new CFile(parent, file);
+ }
+ fParsedResources.put(file, celement);
+ }
+ }
+ // Added also to the Containers
+ if (celement != null) {
+ if (celement instanceof IArchive) {
+ CProject cproj = (CProject)celement.getCProject();
+ ArchiveContainer container = (ArchiveContainer)cproj.getArchiveContainer();
+ container.addChild(celement);
+ } else if (celement instanceof IBinary) {
+ IBinary bin = (IBinary)celement;
+ if (bin.isExecutable() || bin.isSharedLib()) {
+ CProject cproj = (CProject)celement.getCProject();
+ BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
+ container.addChild(bin);
+ }
+ }
+ }
+ return celement;
+ }
+
+ public ICElement create(IFolder folder) {
+ IResource parent = folder.getParent();
+ ICElement celement = null;
+ if (parent instanceof IFolder) {
+ celement = create ((IFolder)parent);
+ } else if (parent instanceof IProject) {
+ celement = create ((IProject)parent);
+ }
+ if (celement != null)
+ return create (celement, folder);
+ return celement;
+ }
+
+ public synchronized ICElement create(ICElement parent, IFolder folder) {
+ ICElement celement = (ICElement)fParsedResources.get(folder);
+ if (celement == null) {
+ celement = new CFolder(parent, folder);
+ fParsedResources.put(folder, celement);
+ }
+ return celement;
+ }
+
+ public ICElement create(IProject project) {
+ IResource parent = project.getParent();
+ ICElement celement = null;
+ if (parent instanceof IWorkspaceRoot) {
+ celement = create ((IWorkspaceRoot)parent);
+ }
+ return create(celement, project);
+ }
+
+ public synchronized ICElement create(ICElement parent, IProject project) {
+ ICElement celement = (ICElement)fParsedResources.get(project);
+ if (celement == null) {
+ if (hasCNature(project)) {
+ celement = new CProject(parent, project);
+ fParsedResources.put(project, celement);
+ }
+ }
+ return celement;
+ }
+
+ public ICElement create(IWorkspaceRoot root) {
+ ICElement celement = (ICElement)fParsedResources.get(root);
+ if (celement == null) {
+ celement = new CRoot(root);
+ fParsedResources.put(root, celement);
+ }
+ return celement;
+ }
+
+ public static void addCNature(IProject project, IProgressMonitor monitor) throws CModelException {
+ addNature(project, C_NATURE_ID, monitor);
+ }
+
+ public static void addCCNature(IProject project, IProgressMonitor monitor) throws CModelException {
+ addNature(project, CC_NATURE_ID, monitor);
+ }
+
+ public static void removeCNature(IProject project, IProgressMonitor monitor) throws CModelException {
+ removeNature(project, C_NATURE_ID, monitor);
+ }
+
+ public static void removeCCNature(IProject project, IProgressMonitor monitor) throws CModelException {
+ removeNature(project, CC_NATURE_ID, monitor);
+ }
+
+ /**
+ * Utility method for adding a nature to a project.
+ *
+ * @param proj the project to add the nature
+ * @param natureId the id of the nature to assign to the project
+ * @param monitor a progress monitor to indicate the duration of the operation, or
+ * null
if progress reporting is not required.
+ *
+ */
+ public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CModelException {
+ try {
+ IProjectDescription description = project.getDescription();
+ String[] prevNatures= description.getNatureIds();
+ for (int i= 0; i < prevNatures.length; i++) {
+ if (natureId.equals(prevNatures[i]))
+ return;
+ }
+ String[] newNatures= new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+ newNatures[prevNatures.length]= natureId;
+ description.setNatureIds(newNatures);
+ project.setDescription(description, monitor);
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+
+ /**
+ * Utility method for removing a project nature from a project.
+ *
+ * @param proj the project to remove the nature from
+ * @param natureId the nature id to remove
+ * @param monitor a progress monitor to indicate the duration of the operation, or
+ * null
if progress reporting is not required.
+ */
+ public static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CModelException {
+ try {
+ IProjectDescription description = project.getDescription();
+ String[] prevNatures= description.getNatureIds();
+ List newNatures = new ArrayList(Arrays.asList(prevNatures));
+ newNatures.remove(natureId);
+ description.setNatureIds((String[])newNatures.toArray(new String[newNatures.size()]));
+ project.setDescription(description, monitor);
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+
+ private void removeChildrenContainer(Parent container, IResource resource) {
+ ICElement[] children = container.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ try {
+ IResource r = children[i].getUnderlyingResource();
+ if (r.equals(resource)) {
+//System.out.println("RELEASE Archive/binary " + children[i].getElementName());
+ container.removeChild(children[i]);
+ break;
+ }
+ } catch (CModelException e) {
+ }
+ }
+ }
+
+
+ public void releaseCElement(IResource resource) {
+ ICElement celement = getCElement(resource);
+ if (celement == null) {
+ if (resource.exists()) {
+ celement = create(resource);
+ } else {
+ // Make sure they are not in the Containers.
+ CProject cproj = (CProject)create(resource.getProject());
+ if (cproj != null) {
+ Parent container = (Parent)cproj.getArchiveContainer();
+ removeChildrenContainer(container, resource);
+ container = (Parent)cproj.getBinaryContainer();
+ removeChildrenContainer(container, resource);
+ }
+ }
+ }
+ releaseCElement(celement);
+ }
+
+ public void releaseCElement(ICElement celement) {
+
+ // Guard.
+ if (celement == null)
+ return;
+
+//System.out.println("RELEASE " + celement.getElementName());
+
+ // Remove from the containers.
+ if (celement.getElementType() == ICElement.C_FILE) {
+ CFile cfile = (CFile)celement;
+ if (cfile.isArchive()) {
+//System.out.println("RELEASE Archive " + cfile.getElementName());
+ CProject cproj = (CProject)cfile.getCProject();
+ ArchiveContainer container = (ArchiveContainer)cproj.getArchiveContainer();
+ container.removeChild(cfile);
+ } else if (cfile.isBinary()) {
+ if (! ((IBinary)celement).isObject()) {
+//System.out.println("RELEASE Binary " + cfile.getElementName());
+ CProject cproj = (CProject)cfile.getCProject();
+ BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
+ container.removeChild(cfile);
+ }
+ }
+ }
+
+ Parent parent = (Parent)celement.getParent();
+ if (parent != null) {
+ parent.removeChild(celement);
+ }
+ fParsedResources.remove(celement);
+ }
+
+ public ICElement getCElement(IResource res) {
+ return (ICElement)fParsedResources.get(res);
+ }
+
+ public ICElement getCElement(IPath path) {
+ Iterator iterator = fParsedResources.keySet().iterator();
+ while (iterator.hasNext()) {
+ IResource res = (IResource)iterator.next();
+ if (res.getFullPath().equals(path)) {
+ return (ICElement)fParsedResources.get(res);
+ }
+ }
+ return null;
+ }
+
+ public static boolean isSharedLib(IFile file) {
+ try {
+ Elf.Attribute attribute = Elf.getAttributes(file.getLocation().toOSString());
+ if (attribute.getType() == Elf.Attribute.ELF_TYPE_SHLIB) {
+ return true;
+ }
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ return false;
+ }
+
+ public static boolean isObject(IFile file) {
+ try {
+ Elf.Attribute attribute = Elf.getAttributes(file.getLocation().toOSString());
+ if (attribute.getType() == Elf.Attribute.ELF_TYPE_OBJ) {
+ return true;
+ }
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ return false;
+ }
+
+ public static boolean isExecutable(IFile file) {
+ try {
+ Elf.Attribute attribute = Elf.getAttributes(file.getLocation().toOSString());
+ if (attribute.getType() == Elf.Attribute.ELF_TYPE_EXE) {
+ return true;
+ }
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ return false;
+ }
+
+ public static boolean isBinary(IFile file) {
+ try {
+ Elf.Attribute attribute = Elf.getAttributes(file.getLocation().toOSString());
+ if (attribute.getType() == Elf.Attribute.ELF_TYPE_EXE
+ || attribute.getType() == Elf.Attribute.ELF_TYPE_OBJ
+ || attribute.getType() == Elf.Attribute.ELF_TYPE_SHLIB) {
+ return true;
+ }
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ return false;
+ }
+
+ public static boolean isArchive(IFile file) {
+ AR ar = null;
+ try {
+ ar = new AR(file.getLocation().toOSString());
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ if (ar != null) {
+ ar.dispose();
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isTranslationUnit(IFile file) {
+ return isValidTranslationUnitName(file.getName());
+ }
+
+ public static boolean isValidTranslationUnitName(String name){
+ if (name == null) {
+ return false;
+ }
+ int index = name.lastIndexOf('.');
+ if (index == -1) {
+ return false;
+ }
+ String ext = name.substring(index + 1);
+ for (int i = 0; i < cExtensions.length; i++) {
+ if (ext.equals(cExtensions[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /* Only project with C nature and Open. */
+ public static boolean hasCNature (IProject p) {
+ boolean ok = false;
+ try {
+ ok = (p.isOpen() && p.hasNature(C_NATURE_ID));
+ } catch (CoreException e) {
+ //throws exception if the project is not open.
+ //System.out.println (e);
+ //e.printStackTrace();
+ }
+ return ok;
+ }
+
+ /* Only project with C++ nature and Open. */
+ public static boolean hasCCNature (IProject p) {
+ boolean ok = false;
+ try {
+ ok = (p.isOpen() && p.hasNature(CC_NATURE_ID));
+ } catch (CoreException e) {
+ //throws exception if the project is not open.
+ //System.out.println (e);
+ //e.printStackTrace();
+ }
+ return ok;
+ }
+
+ /**
+ * addElementChangedListener method comment.
+ */
+ public synchronized void addElementChangedListener(IElementChangedListener listener) {
+ if (fElementChangedListeners.indexOf(listener) < 0) {
+ fElementChangedListeners.add(listener);
+ }
+ }
+
+ /**
+ * removeElementChangedListener method comment.
+ */
+ public synchronized void removeElementChangedListener(IElementChangedListener listener) {
+ int i = fElementChangedListeners.indexOf(listener);
+ if (i != -1) {
+ fElementChangedListeners.remove(i);
+ }
+ }
+
+ /**
+ * Registers the given delta with this manager. This API is to be
+ * used to registerd deltas that are created explicitly by the C
+ * Model. Deltas created as translations of IResourceDeltas
+ * are to be registered with #registerResourceDelta
.
+ */
+ public synchronized void registerCModelDelta(ICElementDelta delta) {
+ fCModelDeltas.add(delta);
+ }
+
+ /**
+ * Notifies this C Model Manager that some resource changes have happened
+ * on the platform, and that the C Model should update any required
+ * internal structures such that its elements remain consistent.
+ * Translates IResourceDeltas
into ICElementDeltas
.
+ *
+ * @see IResourceDelta
+ * @see IResource
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+
+ if (event.getSource() instanceof IWorkspace) {
+ IResource resource = event.getResource();
+ IResourceDelta delta = event.getDelta();
+ switch(event.getType()){
+ case IResourceChangeEvent.PRE_DELETE :
+ if(resource.getType() == IResource.PROJECT
+ && hasCNature((IProject)resource)) {
+ releaseCElement(resource);
+ }
+ break;
+
+ case IResourceChangeEvent.PRE_AUTO_BUILD :
+ // will close project if affected by the property file change
+ break;
+
+ case IResourceChangeEvent.POST_CHANGE :
+ if (delta != null) {
+ try {
+ ICElementDelta[] translatedDeltas = fDeltaProcessor.processResourceDelta(delta);
+ if (translatedDeltas.length > 0) {
+ for (int i= 0; i < translatedDeltas.length; i++) {
+ registerCModelDelta(translatedDeltas[i]);
+ }
+ }
+ fire();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * Note that the project is about to be deleted.
+ *
+ * fix for 1FW67PA
+ */
+ public void deleting(IResource resource) {
+ deleting(getCElement(resource));
+ }
+
+ public void deleting(ICElement celement) {
+ releaseCElement(celement);
+ }
+
+ /**
+ * Fire C Model deltas, flushing them after the fact.
+ * If the firing mode has been turned off, this has no effect.
+ */
+ public synchronized void fire() {
+ if (fFire) {
+ mergeDeltas();
+ try {
+ Iterator iterator = fCModelDeltas.iterator();
+ while (iterator.hasNext()) {
+ ICElementDelta delta= (ICElementDelta) iterator.next();
+
+ // Refresh internal scopes
+
+ ElementChangedEvent event= new ElementChangedEvent(delta);
+ // Clone the listeners since they could remove themselves when told about the event
+ // (eg. a type hierarchy becomes invalid (and thus it removes itself) when the type is removed
+ ArrayList listeners= (ArrayList) fElementChangedListeners.clone();
+ for (int i= 0; i < listeners.size(); i++) {
+ IElementChangedListener listener= (IElementChangedListener) listeners.get(i);
+ listener.elementChanged(event);
+ }
+ }
+ } finally {
+ // empty the queue
+ this.flush();
+ }
+ }
+ }
+
+ /**
+ * Flushes all deltas without firing them.
+ */
+ protected synchronized void flush() {
+ fCModelDeltas= new ArrayList();
+ }
+
+ /**
+ * Merged all awaiting deltas.
+ */
+ private void mergeDeltas() {
+ if (fCModelDeltas.size() <= 1)
+ return;
+
+ Iterator deltas = fCModelDeltas.iterator();
+ ICElement cRoot = getCRoot();
+ CElementDelta rootDelta = new CElementDelta(cRoot);
+ boolean insertedTree = false;
+ while (deltas.hasNext()) {
+ CElementDelta delta = (CElementDelta)deltas.next();
+ ICElement element = delta.getElement();
+ if (cRoot.equals(element)) {
+ ICElementDelta[] children = delta.getAffectedChildren();
+ for (int j = 0; j < children.length; j++) {
+ CElementDelta projectDelta = (CElementDelta) children[j];
+ rootDelta.insertDeltaTree(projectDelta.getElement(), projectDelta);
+ insertedTree = true;
+ }
+ } else {
+ rootDelta.insertDeltaTree(element, delta);
+ insertedTree = true;
+ }
+ }
+ if (insertedTree){
+ fCModelDeltas = new ArrayList(1);
+ fCModelDeltas.add(rootDelta);
+ } else {
+ fCModelDeltas = new ArrayList(0);
+ }
+ }
+
+ /**
+ * Runs a C Model Operation
+ */
+ public void runOperation(CModelOperation operation, IProgressMonitor monitor) throws CModelException {
+ boolean hadAwaitingDeltas = !fCModelDeltas.isEmpty();
+ try {
+ if (operation.isReadOnly()) {
+ operation.run(monitor);
+ } else {
+ // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode
+ getCRoot().getUnderlyingResource().getWorkspace().run(operation, monitor);
+ }
+ } catch (CoreException ce) {
+ if (ce instanceof CModelException) {
+ throw (CModelException)ce;
+ } else {
+ if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {
+ Throwable e= ce.getStatus().getException();
+ if (e instanceof CModelException) {
+ throw (CModelException) e;
+ }
+ }
+ throw new CModelException(ce);
+ }
+ } finally {
+// fire only if there were no awaiting deltas (if there were, they would come from a resource modifying operation)
+// and the operation has not modified any resource
+ if (!hadAwaitingDeltas && !operation.hasModifiedResource()) {
+ fire();
+ } // else deltas are fired while processing the resource delta
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelOperation.java
new file mode 100644
index 00000000000..95117b3699c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelOperation.java
@@ -0,0 +1,553 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.ICRoot;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+import org.eclipse.cdt.core.model.ICElementDelta;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * Defines behavior common to all C Model operations
+ */
+public abstract class CModelOperation implements IWorkspaceRunnable, IProgressMonitor {
+ /**
+ * The elements this operation operates on,
+ * or null
if this operation
+ * does not operate on specific elements.
+ */
+ protected ICElement[] fElementsToProcess;
+
+ /**
+ * The parent elements this operation operates with
+ * or null
if this operation
+ * does not operate with specific parent elements.
+ */
+ protected ICElement[] fParentElements;
+
+ /**
+ * An empty collection of ICElement
s - the common
+ * empty result if no elements are created, or if this
+ * operation is not actually executed.
+ */
+ protected static ICElement[] fgEmptyResult= new ICElement[] {};
+
+ /**
+ * Collection of ICElementDelta
s created by this operation.
+ * This collection starts out null
and becomes an
+ * array of ICElementDelta
s if the operation creates any
+ * deltas. This collection is registered with the C Model notification
+ * manager if the operation completes successfully.
+ */
+ protected ICElementDelta[] fDeltas= null;
+
+ /**
+ * The elements created by this operation - empty
+ * until the operation actually creates elements.
+ */
+ protected ICElement[] fResultElements= fgEmptyResult;
+
+ /**
+ * The progress monitor passed into this operation
+ */
+ protected IProgressMonitor fMonitor= null;
+
+ /**
+ * A flag indicating whether this operation is nested.
+ */
+ protected boolean fNested = false;
+
+ /**
+ * Conflict resolution policy - by default do not force (fail on a conflict).
+ */
+ protected boolean fForce= false;
+
+ /*
+ * Whether the operation has modified resources, and thus whether resource
+ * delta notifcation will happen.
+ */
+ protected boolean hasModifiedResource = false;
+
+ /**
+ * A common constructor for all C Model operations.
+ */
+ protected CModelOperation(ICElement[] elements) {
+ fElementsToProcess = elements;
+ }
+
+ /**
+ * Common constructor for all C Model operations.
+ */
+ protected CModelOperation(ICElement[] elementsToProcess, ICElement[] parentElements) {
+ fElementsToProcess = elementsToProcess;
+ fParentElements= parentElements;
+ }
+
+ /**
+ * A common constructor for all C Model operations.
+ */
+ protected CModelOperation(ICElement[] elementsToProcess, ICElement[] parentElements, boolean force) {
+ fElementsToProcess = elementsToProcess;
+ fParentElements= parentElements;
+ fForce= force;
+ }
+
+ /**
+ * A common constructor for all C Model operations.
+ */
+ protected CModelOperation(ICElement[] elements, boolean force) {
+ fElementsToProcess = elements;
+ fForce= force;
+ }
+
+ /**
+ * Common constructor for all C Model operations.
+ */
+ protected CModelOperation(ICElement element) {
+ fElementsToProcess = new ICElement[]{element};
+ }
+
+ /**
+ * A common constructor for all C Model operations.
+ */
+ protected CModelOperation(ICElement element, boolean force) {
+ fElementsToProcess = new ICElement[]{element};
+ fForce= force;
+ }
+
+ /**
+ * Adds the given delta to the collection of deltas
+ * that this operation has created. These deltas are
+ * automatically registered with the C Model Manager
+ * when the operation completes.
+ */
+ protected void addDelta(ICElementDelta delta) {
+ if (fDeltas == null) {
+ fDeltas= new ICElementDelta[] {delta};
+ } else {
+ ICElementDelta[] copy= new ICElementDelta[fDeltas.length + 1];
+ System.arraycopy(fDeltas, 0, copy, 0, fDeltas.length);
+ copy[fDeltas.length]= delta;
+ fDeltas= copy;
+ }
+ }
+
+ /**
+ * @see IProgressMonitor
+ */
+ public void beginTask(String name, int totalWork) {
+ if (fMonitor != null) {
+ fMonitor.beginTask(name, totalWork);
+ }
+ }
+
+ /**
+ * Checks with the progress monitor to see whether this operation
+ * should be canceled. An operation should regularly call this method
+ * during its operation so that the user can cancel it.
+ *
+ * @exception OperationCanceledException if cancelling the operation has been requested
+ * @see IProgressMonitor#isCanceled
+ */
+ protected void checkCanceled() {
+ if (isCanceled()) {
+ throw new OperationCanceledException("operation.cancelled"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Common code used to verify the elements this operation is processing.
+ * @see CModelOperation#verify()
+ */
+ protected ICModelStatus commonVerify() {
+ if (fElementsToProcess == null || fElementsToProcess.length == 0) {
+ return new CModelStatus(ICModelStatusConstants.NO_ELEMENTS_TO_PROCESS);
+ }
+ for (int i = 0; i < fElementsToProcess.length; i++) {
+ if (fElementsToProcess[i] == null) {
+ return new CModelStatus(ICModelStatusConstants.NO_ELEMENTS_TO_PROCESS);
+ }
+ }
+ return CModelStatus.VERIFIED_OK;
+ }
+
+ /**
+ * Convenience method to copy resources
+ */
+ protected void copyResources(IResource[] resources, IPath destinationPath) throws CModelException {
+ IProgressMonitor subProgressMonitor = getSubProgressMonitor(resources.length);
+ IWorkspace workspace = resources[0].getWorkspace();
+ try {
+ workspace.copy(resources, destinationPath, false, subProgressMonitor);
+ this.hasModifiedResource = true;
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+
+ /**
+ * Convenience method to create a file
+ */
+ protected void createFile(IContainer folder, String name, InputStream contents, boolean force) throws CModelException {
+ IFile file= folder.getFile(new Path(name));
+ try {
+ file.create(contents, force, getSubProgressMonitor(1));
+ this.hasModifiedResource = true;
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+
+ /**
+ * Convenience method to create a folder
+ */
+ protected void createFolder(IContainer parentFolder, String name, boolean force) throws CModelException {
+ IFolder folder= parentFolder.getFolder(new Path(name));
+ try {
+ // we should use true to create the file locally. Only VCM should use tru/false
+ folder.create(force, true, getSubProgressMonitor(1));
+ this.hasModifiedResource = true;
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+
+ /**
+ * Convenience method to delete a resource
+ */
+ protected void deleteResource(IResource resource, boolean force) throws CModelException {
+ try {
+ resource.delete(force, getSubProgressMonitor(1));
+ this.hasModifiedResource = true;
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+
+ /**
+ * Convenience method to delete resources
+ */
+ protected void deleteResources(IResource[] resources, boolean force) throws CModelException {
+ if (resources == null || resources.length == 0) return;
+ IProgressMonitor subProgressMonitor = getSubProgressMonitor(resources.length);
+ IWorkspace workspace = resources[0].getWorkspace();
+ try {
+ workspace.delete(resources, force, subProgressMonitor);
+ this.hasModifiedResource = true;
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+
+ /**
+ * @see IProgressMonitor
+ */
+ public void done() {
+ if (fMonitor != null) {
+ fMonitor.done();
+ }
+ }
+
+ /**
+ * Verifies the operation can proceed and executes the operation.
+ * Subclasses should override #verify
and
+ * executeOperation
to implement the specific operation behavior.
+ *
+ * @exception CModelException The operation has failed.
+ */
+ protected void execute() throws CModelException {
+ ICModelStatus status= verify();
+ if (status.isOK()) {
+ executeOperation();
+ } else {
+ throw new CModelException(status);
+ }
+ }
+
+ /**
+ * Convenience method to run an operation within this operation
+ */
+ public void executeNestedOperation(CModelOperation operation, int subWorkAmount) throws CModelException {
+ IProgressMonitor subProgressMonitor = getSubProgressMonitor(subWorkAmount);
+ // fix for 1FW7IKC, part (1)
+ try {
+ operation.setNested(true);
+ operation.run(subProgressMonitor);
+ if (operation.hasModifiedResource()) {
+ this.hasModifiedResource = true;
+ }
+ //accumulate the nested operation deltas
+ if (operation.fDeltas != null) {
+ for (int i = 0; i < operation.fDeltas.length; i++) {
+ addDelta(operation.fDeltas[i]);
+ }
+ }
+ } catch (CoreException ce) {
+ if (ce instanceof CModelException) {
+ throw (CModelException)ce;
+ } else {
+ // translate the core exception to a c model exception
+ if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {
+ Throwable e = ce.getStatus().getException();
+ if (e instanceof CModelException) {
+ throw (CModelException) e;
+ }
+ }
+ throw new CModelException(ce);
+ }
+ }
+ }
+
+ /**
+ * Performs the operation specific behavior. Subclasses must override.
+ */
+ protected abstract void executeOperation() throws CModelException;
+
+ /**
+ * Returns the elements to which this operation applies,
+ * or null
if not applicable.
+ */
+ protected ICElement[] getElementsToProcess() {
+ return fElementsToProcess;
+ }
+
+ /**
+ * Returns the element to which this operation applies,
+ * or null
if not applicable.
+ */
+ protected ICElement getElementToProcess() {
+ if (fElementsToProcess == null || fElementsToProcess.length == 0) {
+ return null;
+ }
+ return fElementsToProcess[0];
+ }
+
+ /**
+ * Returns the C Model this operation is operating in.
+ */
+ public ICRoot getCRoot() {
+ if (fElementsToProcess == null || fElementsToProcess.length == 0) {
+ return getParentElement().getCRoot();
+ } else {
+ return fElementsToProcess[0].getCRoot();
+ }
+ }
+
+ /**
+ * Returns the parent element to which this operation applies,
+ * or null
if not applicable.
+ */
+ protected ICElement getParentElement() {
+ if (fParentElements == null || fParentElements.length == 0) {
+ return null;
+ }
+ return fParentElements[0];
+ }
+
+ /**
+ * Returns the parent elements to which this operation applies,
+ * or null
if not applicable.
+ */
+ protected ICElement[] getParentElements() {
+ return fParentElements;
+ }
+
+ /**
+ * Returns the elements created by this operation.
+ */
+ public ICElement[] getResultElements() {
+ return fResultElements;
+ }
+
+ /**
+ * Creates and returns a subprogress monitor if appropriate.
+ */
+ protected IProgressMonitor getSubProgressMonitor(int workAmount) {
+ IProgressMonitor sub = null;
+ if (fMonitor != null) {
+ sub = new SubProgressMonitor(fMonitor, workAmount, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
+ }
+ return sub;
+ }
+
+ /**
+ * Returns the IWorkspace
this operation is working in, or
+ * null
if this operation has no elements to process.
+ */
+ protected IWorkspace getWorkspace() {
+ if (fElementsToProcess != null && fElementsToProcess.length > 0) {
+ ICProject project = fElementsToProcess[0].getCProject();
+ if (project != null) {
+ return project.getCRoot().getWorkspace();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns whether this operation has performed any resource modifications.
+ * Returns false if this operation has not been executed yet.
+ */
+ public boolean hasModifiedResource() {
+ return !this.isReadOnly() && this.hasModifiedResource;
+ }
+
+ public void internalWorked(double work) {
+ if (fMonitor != null) {
+ fMonitor.internalWorked(work);
+ }
+ }
+
+ /**
+ * @see IProgressMonitor
+ */
+ public boolean isCanceled() {
+ if (fMonitor != null) {
+ return fMonitor.isCanceled();
+ }
+ return false;
+ }
+
+ /**
+ * Returns true
if this operation performs no resource modifications,
+ * otherwise false
. Subclasses must override.
+ */
+ public boolean isReadOnly() {
+ return false;
+ }
+
+ /**
+ * Convenience method to move resources
+ */
+ protected void moveResources(IResource[] resources, IPath destinationPath) throws CModelException {
+ IProgressMonitor subProgressMonitor = null;
+ if (fMonitor != null) {
+ subProgressMonitor = new SubProgressMonitor(fMonitor, resources.length, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
+ }
+ IWorkspace workspace = resources[0].getWorkspace();
+ try {
+ workspace.move(resources, destinationPath, false, subProgressMonitor);
+ this.hasModifiedResource = true;
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+
+ /**
+ * Creates and returns a new ICElementDelta
+ * on the C Model.
+ */
+ public CElementDelta newCElementDelta() {
+ return new CElementDelta(getCRoot());
+ }
+
+ /**
+ * Registers any deltas this operation created, with the
+ * C Model manager.
+ */
+ protected void registerDeltas() {
+ if (fDeltas != null && !fNested) {
+ // hook to ensure working copies remain consistent
+ //makeWorkingCopiesConsistent(fDeltas);
+ CModelManager manager= CModelManager.getDefault();
+ for (int i= 0; i < fDeltas.length; i++) {
+ manager.registerCModelDelta(fDeltas[i]);
+ }
+ }
+ }
+
+ /**
+ * Main entry point for C Model operations. Executes this operation
+ * and registers any deltas created.
+ *
+ * @see IWorkspaceRunnable
+ * @exception CoreException if the operation fails
+ */
+ public void run(IProgressMonitor monitor) throws CoreException {
+ try {
+ fMonitor = monitor;
+ execute();
+ } finally {
+ registerDeltas();
+ }
+ }
+
+ /**
+ * @see IProgressMonitor
+ */
+ public void setCanceled(boolean b) {
+ if (fMonitor != null) {
+ fMonitor.setCanceled(b);
+ }
+ }
+
+ /**
+ * Sets whether this operation is nested or not.
+ * @see CreateElementInCUOperation#checkCanceled
+ */
+ protected void setNested(boolean nested) {
+ fNested = nested;
+ }
+
+ /**
+ * @see IProgressMonitor
+ */
+ public void setTaskName(String name) {
+ if (fMonitor != null) {
+ fMonitor.setTaskName(name);
+ }
+ }
+
+ /**
+ * @see IProgressMonitor
+ */
+ public void subTask(String name) {
+ if (fMonitor != null) {
+ fMonitor.subTask(name);
+ }
+ }
+ /**
+ * Returns a status indicating if there is any known reason
+ * this operation will fail. Operations are verified before they
+ * are run.
+ *
+ * Subclasses must override if they have any conditions to verify
+ * before this operation executes.
+ *
+ * @see ICModelStatus
+ */
+ protected ICModelStatus verify() {
+ return commonVerify();
+ }
+
+ /**
+ * @see IProgressMonitor
+ */
+ public void worked(int work) {
+ if (fMonitor != null) {
+ fMonitor.worked(work);
+ checkCanceled();
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelStatus.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelStatus.java
new file mode 100644
index 00000000000..0e9588f6ea8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelStatus.java
@@ -0,0 +1,259 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.ICElement;
+
+import org.eclipse.cdt.core.model.CoreModel;
+
+/**
+ * @see ICModelStatus
+ */
+
+public class CModelStatus extends Status implements ICModelStatus, ICModelStatusConstants, IResourceStatus {
+
+ // FIXME: Use the value in the plugin.
+ private static String PLUGIN_ID = CoreModel.getPluginId();
+
+ /**
+ * The elements related to the failure, or null
+ * if no elements are involved.
+ */
+ protected ICElement[] fElements = new ICElement[0];
+ /**
+ * The path related to the failure, or null
+ * if no path is involved.
+ */
+ protected IPath fPath;
+ /**
+ * The String
related to the failure, or null
+ * if no String
is involved.
+ */
+ protected String fString;
+ /**
+ * Empty children
+ */
+ protected final static IStatus[] fgEmptyChildren = new IStatus[] {};
+ protected IStatus[] fChildren= fgEmptyChildren;
+
+ /**
+ * Singleton OK object
+ */
+ public static final ICModelStatus VERIFIED_OK = new CModelStatus(OK);
+
+ /**
+ * Constructs an C model status with no corresponding elements.
+ */
+ public CModelStatus() {
+ // no code for an multi-status
+ super(ERROR, PLUGIN_ID, 0, "CModelStatus", null); //$NON-NLS-1$
+ }
+
+ /**
+ * Constructs an C model status with no corresponding elements.
+ */
+ public CModelStatus(int code) {
+ super(ERROR, PLUGIN_ID, code, "CModelStatus", null); //$NON-NLS-1$
+ //fElements= CElementInfo.fgEmptyChildren;
+ }
+
+ /**
+ * Constructs an C model status with the given corresponding
+ * elements.
+ */
+ public CModelStatus(int code, ICElement[] elements) {
+ super(ERROR, PLUGIN_ID, code, "CModelStatus", null); //$NON-NLS-1$
+ fElements= elements;
+ fPath= null;
+ }
+
+ /**
+ * Constructs an C model status with no corresponding elements.
+ */
+ public CModelStatus(int code, String string) {
+ super(ERROR, PLUGIN_ID, code, "CModelStatus", null); //$NON-NLS-1$
+ //fElements= CElementInfo.fgEmptyChildren;
+ fPath= null;
+ fString = string;
+ }
+
+ /**
+ * Constructs an C model status with no corresponding elements.
+ */
+ public CModelStatus(int code, Throwable throwable) {
+ super(ERROR, PLUGIN_ID, code, "CModelStatus", throwable); //$NON-NLS-1$
+ //fElements= CElementInfo.fgEmptyChildren;
+ }
+
+ /**
+ * Constructs an C model status with no corresponding elements.
+ */
+ public CModelStatus(int code, IPath path) {
+ super(ERROR, PLUGIN_ID, code, "CModelStatus", null); //$NON-NLS-1$
+ //fElements= CElementInfo.fgEmptyChildren;
+ fPath= path;
+ }
+
+ /**
+ * Constructs an C model status with the given corresponding
+ * element.
+ */
+ public CModelStatus(int code, ICElement element) {
+ this(code, new ICElement[]{element});
+ }
+
+ /**
+ * Constructs an C model status with the given corresponding
+ * element and string
+ */
+ public CModelStatus(int code, ICElement element, String string) {
+ this(code, new ICElement[]{element});
+ fString= string;
+ }
+
+ /**
+ * Constructs an C model status with no corresponding elements.
+ */
+ public CModelStatus(CoreException coreException) {
+ super(ERROR, PLUGIN_ID, CORE_EXCEPTION, "CModelStatus", coreException); //$NON-NLS-1$
+ //fElements= CElementInfo.fgEmptyChildren;
+ }
+
+ protected int getBits() {
+ int severity = 1 << (getCode() % 100 / 33);
+ int category = 1 << ((getCode() / 100) + 3);
+ return severity | category;
+ }
+
+ /**
+ * @see IStatus
+ */
+ public IStatus[] getChildren() {
+ return fChildren;
+ }
+
+ /**
+ * @see ICModelStatus
+ */
+ public ICElement[] getElements() {
+ return fElements;
+ }
+
+ /**
+ * Returns the message that is relevant to the code of this status.
+ */
+ public String getMessage() {
+ return "Error in C Plugin";
+ }
+ /**
+ * @see IOperationStatus
+ */
+ public IPath getPath() {
+ return fPath;
+ }
+
+ /**
+ * @see IStatus
+ */
+ public int getSeverity() {
+ if (fChildren == fgEmptyChildren) return super.getSeverity();
+ int severity = -1;
+ for (int i = 0, max = fChildren.length; i < max; i++) {
+ int childrenSeverity = fChildren[i].getSeverity();
+ if (childrenSeverity > severity) {
+ severity = childrenSeverity;
+ }
+ }
+ return severity;
+ }
+
+ /**
+ * @see ICModelStatus
+ */
+ public String getString() {
+ return fString;
+ }
+
+ /**
+ * @see ICModelStatus
+ */
+ public boolean doesNotExist() {
+ return getCode() == ELEMENT_DOES_NOT_EXIST;
+ }
+
+ /**
+ * @see IStatus
+ */
+ public boolean isMultiStatus() {
+ return fChildren != fgEmptyChildren;
+ }
+
+ /**
+ * @see ICModelStatus
+ */
+ public boolean isOK() {
+ return getCode() == OK;
+ }
+
+ /**
+ * @see IStatus#matches
+ */
+ public boolean matches(int mask) {
+ if (! isMultiStatus()) {
+ return matches(this, mask);
+ } else {
+ for (int i = 0, max = fChildren.length; i < max; i++) {
+ if (matches((CModelStatus) fChildren[i], mask))
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Helper for matches(int).
+ */
+ protected boolean matches(CModelStatus status, int mask) {
+ int severityMask = mask & 0x7;
+ int categoryMask = mask & ~0x7;
+ int bits = status.getBits();
+ return ((severityMask == 0) || (bits & severityMask) != 0) && ((categoryMask == 0) || (bits & categoryMask) != 0);
+ }
+
+ /**
+ * Creates and returns a new ICModelStatus
that is a
+ * a multi-status status.
+ *
+ * @see IStatus#.isMultiStatus()
+ */
+ public static ICModelStatus newMultiStatus(ICModelStatus[] children) {
+ CModelStatus jms = new CModelStatus();
+ jms.fChildren = children;
+ return jms;
+ }
+
+ /**
+ * Returns a printable representation of this exception for debugging
+ * purposes.
+ */
+ public String toString() {
+ if (this == VERIFIED_OK){
+ return "CModelStatus[OK]"; //$NON-NLS-1$
+ }
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("C Model Status ["); //$NON-NLS-1$
+ buffer.append(getMessage());
+ buffer.append("]"); //$NON-NLS-1$
+ return buffer.toString();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java
new file mode 100644
index 00000000000..c41784556fd
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java
@@ -0,0 +1,69 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IBinaryContainer;
+import org.eclipse.cdt.core.model.IArchiveContainer;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+
+public class CProject extends CResource implements ICProject {
+
+ boolean elfDone = false;
+
+ public CProject (ICElement parent, IProject project) {
+ super (parent, project, CElement.C_PROJECT);
+ }
+
+ public IBinaryContainer getBinaryContainer() {
+ return getCProjectInfo().getBinaryContainer();
+ }
+
+ public IArchiveContainer getArchiveContainer() {
+ return getCProjectInfo().getArchiveContainer();
+ }
+
+ public IProject getProject() {
+ try {
+ return getUnderlyingResource().getProject();
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public ICProject getCProject() {
+ return this;
+ }
+
+ public ICElement findElement(IPath path) throws CModelException {
+ ICElement celem = CModelManager.getDefault().create(path);
+ if (celem == null)
+ new CModelStatus(ICModelStatusConstants.INVALID_PATH, path);
+ return celem;
+ }
+
+ synchronized protected boolean hasRunElf() {
+ return elfDone;
+ }
+
+ synchronized protected void setRunElf(boolean done) {
+ elfDone = done;
+ }
+
+ protected CProjectInfo getCProjectInfo() {
+ return (CProjectInfo)getElementInfo();
+ }
+
+ protected CElementInfo createElementInfo() {
+ return new CProjectInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProjectInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProjectInfo.java
new file mode 100644
index 00000000000..0a0e1e3e62e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProjectInfo.java
@@ -0,0 +1,52 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IArchiveContainer;
+import org.eclipse.cdt.core.model.IBinaryContainer;
+
+/**
+ * Info for ICProject.
+ */
+
+class CProjectInfo extends CResourceInfo {
+
+ private BinaryContainer vBin;
+ private ArchiveContainer vLib;
+
+ public IBinaryContainer getBinaryContainer() {
+ if (vBin == null) {
+ vBin = new BinaryContainer((CProject)getElement());
+ addChild(vBin);
+ }
+ return vBin;
+ }
+
+ public IArchiveContainer getArchiveContainer() {
+ if (vLib == null) {
+ vLib = new ArchiveContainer((CProject)getElement());
+ addChild(vLib);
+ }
+ return vLib;
+ }
+
+ public ICElement[] getChildren() {
+ // ensure that BinaryContqainer and ArchiveContainer
+ // have been added as children. Side affect of get methods!
+ getBinaryContainer();
+ getArchiveContainer();
+ return super.getChildren();
+ }
+
+ /**
+ */
+ public CProjectInfo(CElement element) {
+ super(element);
+ vBin = null;
+ vLib = null;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CResource.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CResource.java
new file mode 100644
index 00000000000..abb010c5ff1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CResource.java
@@ -0,0 +1,40 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.CModelException;
+
+public abstract class CResource extends Parent {
+
+ public CResource (ICElement parent, IPath path, int type) {
+ // Check if the file is under the workspace.
+ this (parent, ResourcesPlugin.getWorkspace().getRoot().getFileForLocation (path),
+ path.lastSegment(), type);
+ }
+
+ public CResource (ICElement parent, IResource resource, int type) {
+ this (parent, resource, resource.getName(), type);
+ }
+
+ public CResource (ICElement parent, IResource resource, String name, int type) {
+ super (parent, resource, name, type);
+ }
+
+ public IResource getUnderlyingResource() throws CModelException {
+ return resource;
+ }
+
+ public IResource getCorrespondingResource() throws CModelException {
+ return resource;
+ }
+
+ protected abstract CElementInfo createElementInfo ();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CResourceInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CResourceInfo.java
new file mode 100644
index 00000000000..41ec313a1b4
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CResourceInfo.java
@@ -0,0 +1,70 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.core.model.ICElement;
+
+/**
+ */
+public class CResourceInfo extends CElementInfo {
+
+ /**
+ * Constructs a new C Model Info
+ */
+ protected CResourceInfo(CElement element) {
+ super(element);
+ }
+
+ // Always return true, save the unnecessary probing from the Treeviewer.
+ protected boolean hasChildren () {
+ return true;
+ }
+
+ protected ICElement [] getChildren () {
+ try {
+ IResource[] resources = null;
+ IResource res = getElement().getUnderlyingResource();
+ if (res != null) {
+ //System.out.println (" Resource: " + res.getFullPath().toOSString());
+ switch(res.getType()) {
+ case IResource.ROOT:
+ case IResource.PROJECT:
+ case IResource.FOLDER:
+ IContainer container = (IContainer)res;
+ resources = container.members(false);
+ break;
+
+ case IResource.FILE:
+ break;
+ }
+ }
+
+ if (resources != null) {
+ CModelManager factory = CModelManager.getDefault();
+ for (int i = 0; i < resources.length; i++) {
+ // Check for Valid C projects only.
+ if(resources[i].getType() == IResource.PROJECT) {
+ IProject proj = (IProject)resources[i];
+ if (!factory.hasCNature(proj)) {
+ continue;
+ }
+ }
+ addChild(factory.create(getElement(), resources[i]));
+ }
+ }
+ } catch (CoreException e) {
+ //System.out.println (e);
+ //CPlugin.log (e);
+ e.printStackTrace();
+ }
+ return super.getChildren();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CRoot.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CRoot.java
new file mode 100644
index 00000000000..8d573a8b6c7
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CRoot.java
@@ -0,0 +1,113 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.ICRoot;
+import org.eclipse.cdt.core.model.CModelException;
+
+public class CRoot extends CResource implements ICRoot {
+
+ public CRoot(IWorkspaceRoot root) {
+ super (null, root, root.getName(), ICElement.C_ROOT);
+ }
+
+ public ICRoot getCModel() {
+ return this;
+ }
+ public ICProject getCProject(String name) {
+ CModelManager factory = CModelManager.getDefault();
+ return (ICProject)factory.create(getWorkspace().getRoot().getProject(name));
+ }
+
+ public ICProject[] getCProjects() {
+ return (ICProject[])getChildren();
+ }
+
+ public IWorkspace getWorkspace() {
+ try {
+ return getUnderlyingResource().getWorkspace();
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public IWorkspaceRoot getRoot() {
+ try {
+ return (IWorkspaceRoot)getUnderlyingResource();
+ } catch (CModelException e) {
+ }
+ return null;
+ }
+
+ public void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
+ String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
+ if (elements != null && elements[0] != null
+ && elements[0].getCorrespondingResource() != null ) {
+ runOperation(new CopyResourceElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
+ } else {
+ throw new CModelException (new CModelStatus());
+ //runOperation(new CopyElementsOperation(elements, containers, force), elements, siblings, renamings, monitor);
+ }
+ }
+
+ public void delete(ICElement[] elements, boolean force, IProgressMonitor monitor)
+ throws CModelException {
+ if (elements != null && elements[0] != null
+ && elements[0].getCorrespondingResource() != null) {
+ runOperation(new DeleteResourceElementsOperation(elements, force), monitor);
+ } else {
+ throw new CModelException (new CModelStatus());
+ //runOperation(new DeleteElementsOperation(elements, force), monitor);
+ }
+ }
+
+ public void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
+ String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
+ if (elements != null && elements[0] != null
+ && elements[0].getCorrespondingResource() == null) {
+ runOperation(new MoveResourceElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
+ } else {
+ throw new CModelException (new CModelStatus());
+ //runOperation(new MoveElementsOperation(elements, containers, force), elements, siblings, renamings, monitor);
+ }
+ }
+
+ public void rename(ICElement[] elements, ICElement[] destinations, String[] renamings,
+ boolean force, IProgressMonitor monitor) throws CModelException {
+ if (elements != null && elements[0] != null
+ && elements[0].getCorrespondingResource() == null) {
+ runOperation(new RenameResourceElementsOperation(elements, destinations,
+ renamings, force), monitor);
+ } else {
+ throw new CModelException (new CModelStatus());
+ //runOperation(new RenameElementsOperation(elements, containers, renamings, force), monitor);
+ }
+ }
+
+ /**
+ * Configures and runs the MultiOperation
.
+ */
+ protected void runOperation(MultiOperation op, ICElement[] elements, ICElement[] siblings, String[] renamings, IProgressMonitor monitor) throws CModelException {
+ op.setRenamings(renamings);
+ if (siblings != null) {
+ for (int i = 0; i < elements.length; i++) {
+ op.setInsertBefore(elements[i], siblings[i]);
+ }
+ }
+ runOperation(op, monitor);
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new CRootInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CRootInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CRootInfo.java
new file mode 100644
index 00000000000..7baefdef5c6
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CRootInfo.java
@@ -0,0 +1,19 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * @see ICModel
+ */
+public class CRootInfo extends CResourceInfo {
+
+ /**
+ * Constructs a new C Model Info
+ */
+ protected CRootInfo(CElement element) {
+ super(element);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CopyElementsOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CopyElementsOperation.java
new file mode 100644
index 00000000000..80fe7b62e8c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CopyElementsOperation.java
@@ -0,0 +1,218 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import java.util.HashMap;
+import java.util.Map;
+
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IParent;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * This operation copies/moves a collection of elements from their current
+ * container to a new container, optionally renaming the
+ * elements.
+ * Notes:
+ * - If there is already an element with the same name in
+ * the new container, the operation either overwrites or aborts,
+ * depending on the collision policy setting. The default setting is
+ * abort.
+ *
+ *
- When constructors are copied to a type, the constructors
+ * are automatically renamed to the name of the destination
+ * type.
+ *
+ *
- When main types are renamed (move within the same parent),
+ * the compilation unit and constructors are automatically renamed
+ *
+ *
- The collection of elements being copied must all share the
+ * same type of container (for example, must all be type members).
+ *
+ *
- The elements are inserted in the new container in the order given.
+ *
+ *
- The elements can be positioned in the new container - see #setInsertBefore.
+ * By default, the elements are inserted based on the default positions as specified in
+ * the creation operation for that element type.
+ *
+ *
- This operation can be used to copy and rename elements within
+ * the same container.
+ *
+ *
- This operation only copies elements contained within compilation units.
+ *
+ *
+ */
+public class CopyElementsOperation extends MultiOperation {
+
+ private Map fSources = new HashMap();
+
+ /**
+ * When executed, this operation will copy the given elements to the
+ * given containers. The elements and destination containers must be in
+ * the correct order. If there is > 1 destination, the number of destinations
+ * must be the same as the number of elements being copied/moved/renamed.
+ */
+ public CopyElementsOperation(ICElement[] elementsToCopy, ICElement[] destContainers, boolean force) {
+ super(elementsToCopy, destContainers, force);
+ }
+
+ /**
+ * When executed, this operation will copy the given elements to the
+ * given container.
+ */
+ public CopyElementsOperation(ICElement[] elementsToCopy, ICElement destContainer, boolean force) {
+ this(elementsToCopy, new ICElement[]{destContainer}, force);
+ }
+
+ /**
+ * Returns the String
to use as the main task name
+ * for progress monitoring.
+ */
+ protected String getMainTaskName() {
+ return "operation.copyElementProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the nested operation to use for processing this element
+ */
+ protected CModelOperation getNestedOperation(ICElement element) {
+ //ICElement dest = getDestinationParent(element);
+ switch (element.getElementType()) {
+ //case ICElement.C_INCLUDE:
+ // return new CreateIncludeOperation(element, dest);
+ //case ICElement.C_FUNCTION_DECLARATION :
+ // return new CreateFunctionDeclarationOperation(element, dest);
+ //case ICElement.C_FUNCTION :
+ // return new CreateFunctionOperation(element, dest);
+ //case ICElement.C_STRUCTURE :
+ // return new CreateStructureOperation(element, dest, fForce);
+ //case ICElement.C_METHOD :
+ // return new CreateMethodOperation(element, dest, fForce);
+ //case ICElement.C_FIELD :
+ // return new CreateFieldOperation(element, dest, fForce);
+ //case ICElement.C_VARIABLE:
+ // return new CreateVariableOperation(element, dest);
+ default :
+ return null;
+ }
+ }
+
+ /**
+ * Copy/move the element from the source to destination, renaming
+ * the elements as specified, honoring the collision policy.
+ *
+ * @exception CModelException if the operation is unable to
+ * be completed
+ */
+ protected void processElement(ICElement element) throws CModelException {
+ CModelOperation op = getNestedOperation(element);
+ if (op == null) {
+ return;
+ }
+ boolean isInTUOperation = op instanceof CreateElementInTUOperation;
+ if (isInTUOperation) {
+ CreateElementInTUOperation inTUop = (CreateElementInTUOperation)op;
+ ICElement sibling = (ICElement) fInsertBeforeElements.get(element);
+ if (sibling != null) {
+ (inTUop).setRelativePosition(sibling, CreateElementInTUOperation.INSERT_BEFORE);
+ } else if (isRename()) {
+ ICElement anchor = resolveRenameAnchor(element);
+ if (anchor != null) {
+ inTUop.setRelativePosition(anchor, CreateElementInTUOperation.INSERT_AFTER); // insert after so that the anchor is found before when deleted below
+ }
+ }
+ String newName = getNewNameFor(element);
+ if (newName != null) {
+ inTUop.setAlteredName(newName);
+ }
+ }
+ executeNestedOperation(op, 1);
+
+ //if (isInTUOperation && isMove()) {
+ // DeleteElementsOperation deleteOp = new DeleteElementsOperation(new ICElement[] { element }, fForce);
+ // executeNestedOperation(deleteOp, 1);
+ //}
+ }
+
+ /**
+ * Returns the anchor used for positioning in the destination for
+ * the element being renamed. For renaming, if no anchor has
+ * explicitly been provided, the element is anchored in the same position.
+ */
+ private ICElement resolveRenameAnchor(ICElement element) throws CModelException {
+ IParent parent = (IParent) element.getParent();
+ ICElement[] children = parent.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ ICElement child = children[i];
+ if (child.equals(element)) {
+ return child;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Possible failures:
+ *
+ * - NO_ELEMENTS_TO_PROCESS - no elements supplied to the operation
+ *
- INDEX_OUT_OF_BOUNDS - the number of renamings supplied to the operation
+ * does not match the number of elements that were supplied.
+ *
+ */
+ protected ICModelStatus verify() {
+ ICModelStatus status = super.verify();
+ if (!status.isOK()) {
+ return status;
+ }
+ if (fRenamingsList != null && fRenamingsList.length != fElementsToProcess.length) {
+ return new CModelStatus(ICModelStatusConstants.INDEX_OUT_OF_BOUNDS);
+ }
+ return CModelStatus.VERIFIED_OK;
+ }
+
+ /**
+ * @see MultiOperation
+ *
+ * Possible failure codes:
+ *
+ *
+ * - ELEMENT_DOES_NOT_EXIST -
element
or its specified destination is
+ * is null
or does not exist. If a null
element is
+ * supplied, no element is provided in the status, otherwise, the non-existant element
+ * is supplied in the status.
+ * - INVALID_ELEMENT_TYPES -
element
is not contained within a compilation unit.
+ * This operation only operates on elements contained within compilation units.
+ * - READ_ONLY -
element
is read only.
+ * - INVALID_DESTINATION - The destination parent specified for
element
+ * is of an incompatible type. The destination for a package declaration or import declaration must
+ * be a compilation unit; the destination for a type must be a type or compilation
+ * unit; the destinaion for any type member (other than a type) must be a type. When
+ * this error occurs, the element provided in the operation status is the element
.
+ * - INVALID_NAME - the new name for
element
does not have valid syntax.
+ * In this case the element and name are provided in the status.
+
+ *
+ */
+ protected void verify(ICElement element) throws CModelException {
+ if (element == null || !element.exists())
+ error(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST, element);
+
+ if (element.getElementType() < ICElement.C_UNIT)
+ error(ICModelStatusConstants.INVALID_ELEMENT_TYPES, element);
+
+ if (element.isReadOnly())
+ error(ICModelStatusConstants.READ_ONLY, element);
+
+ ICElement dest = getDestinationParent(element);
+ verifyDestination(element, dest);
+ verifySibling(element, dest);
+ if (fRenamingsList != null) {
+ verifyRenaming(element);
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CopyResourceElementsOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CopyResourceElementsOperation.java
new file mode 100644
index 00000000000..dc88e9d5499
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CopyResourceElementsOperation.java
@@ -0,0 +1,250 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICElementDelta;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * This operation copies/moves/renames a collection of resources from their current
+ * container to a new container, optionally renaming the
+ * elements.
+ * Notes:
+ * - If there is already an resource with the same name in
+ * the new container, the operation either overwrites or aborts,
+ * depending on the collision policy setting. The default setting is
+ * abort.
+ *
+ *
- The collection of elements being copied must all share the
+ * same type of container.
+ *
+ *
- This operation can be used to copy and rename elements within
+ * the same container.
+ *
+ *
- This operation only copies translation units.
+ *
+ *
+ */
+public class CopyResourceElementsOperation extends MultiOperation {
+
+ /**
+ * The list of new resources created during this operation.
+ */
+ protected ArrayList fCreatedElements;
+
+ /**
+ * Table specifying deltas for elements being
+ * copied/moved/renamed. Keyed by elements' project(s), and
+ * values are the corresponding deltas.
+ */
+ protected Map fDeltasPerProject= new HashMap(1);
+
+ public CopyResourceElementsOperation(ICElement[] src, ICElement[] dst, boolean force) {
+ super(src, dst, force);
+ }
+
+ /**
+ * Returns the CElementDelta
for cProject
,
+ * creating it and putting it in fDeltasPerProject
if
+ * it does not exist yet.
+ */
+ private CElementDelta getDeltaFor(ICProject cProject) {
+ CElementDelta delta = (CElementDelta) fDeltasPerProject.get(cProject);
+ if (delta == null) {
+ delta = new CElementDelta(cProject);
+ fDeltasPerProject.put(cProject, delta);
+ }
+ return delta;
+ }
+
+ /**
+ * @see MultiOperation
+ */
+ protected String getMainTaskName() {
+ return "operation.copyResourceProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * Sets the deltas to register the changes resulting from this operation
+ * for this source element and its destination.
+ * If the operation is a cross project operation
+ * - On a copy, the delta should be rooted in the dest project
+ *
- On a move, two deltas are generated
+ * - one rooted in the source project
+ *
- one rooted in the destination project
+ * If the operation is rooted in a single project, the delta is rooted in that project
+ *
+ */
+ protected void prepareDeltas(ICElement sourceElement, ICElement destinationElement) {
+ ICProject destProject = destinationElement.getCProject();
+ if (isMove()) {
+ ICProject sourceProject = sourceElement.getCProject();
+ getDeltaFor(sourceProject).movedFrom(sourceElement, destinationElement);
+ getDeltaFor(destProject).movedTo(destinationElement, sourceElement);
+ } else {
+ getDeltaFor(destProject).added(destinationElement);
+ }
+ }
+
+ /**
+ * Process all of the changed deltas generated by this operation.
+ */
+ protected void processDeltas() {
+ for (Iterator deltas = this.fDeltasPerProject.values().iterator(); deltas.hasNext();){
+ addDelta((ICElementDelta) deltas.next());
+ }
+ }
+
+ /**
+ * Copies/moves a compilation unit with the name newName
+ * to the destination package.
+ * The package statement in the compilation unit is updated if necessary.
+ * The main type of the compilation unit is renamed if necessary.
+ *
+ * @exception JavaModelException if the operation is unable to
+ * complete
+ */
+ private void processResource(ICElement source, ICElement dest) throws CModelException {
+ String newName = getNewNameFor(source);
+ String destName = (newName != null) ? newName : source.getElementName();
+
+ // copy resource
+ IFile sourceResource = (IFile)source.getCorrespondingResource();
+ // can be an IFolder or an IProject
+ IContainer destFolder = (IContainer)dest.getCorrespondingResource();
+ IFile destFile = destFolder.getFile(new Path(destName));
+ if (!destFile.equals(sourceResource)) {
+ try {
+ if (destFile.exists()) {
+ if (fForce) {
+ // we can remove it
+ deleteResource(destFile, false);
+ } else {
+ // abort
+ throw new CModelException(new CModelStatus(ICModelStatusConstants.NAME_COLLISION));
+ }
+ }
+ if (this.isMove()) {
+ sourceResource.move(destFile.getFullPath(), fForce, true, getSubProgressMonitor(1));
+ } else {
+ sourceResource.copy(destFile.getFullPath(), fForce, getSubProgressMonitor(1));
+ }
+ this.hasModifiedResource = true;
+ } catch (CModelException e) {
+ throw e;
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+
+ // update new resource content
+
+ // register the correct change deltas
+ ICElement cdest = CModelManager.getDefault().create(destFile);
+ prepareDeltas(source, cdest);
+ fCreatedElements.add(cdest);
+ //if (newName != null) {
+ //the main type has been renamed
+ //String oldName = source.getElementName();
+ //oldName = oldName.substring(0, oldName.length() - 5);
+ //String nName = newName;
+ //nName = nName.substring(0, nName.length() - 5);
+ //prepareDeltas(source.getType(oldName), cdest.getType(nName));
+ //}
+ } else {
+ if (!fForce) {
+ throw new CModelException(new CModelStatus(ICModelStatusConstants.NAME_COLLISION));
+ }
+ // update new resource content
+ // in case we do a saveas on the same resource we have to simply update the contents
+ // see http://dev.eclipse.org/bugs/show_bug.cgi?id=9351
+ }
+ }
+
+ /**
+ * @see MultiOperation
+ * This method delegates to processResource
or
+ * processPackageFragmentResource
, depending on the type of
+ * element
.
+ */
+ protected void processElement(ICElement element) throws CModelException {
+ ICElement dest = getDestinationParent(element);
+ if (element.getCorrespondingResource() != null) {
+ processResource(element, dest);
+ //fCreatedElements.add(dest.getCompilationUnit(element.getElementName()));
+ } else {
+ throw new CModelException(new CModelStatus(ICModelStatusConstants.INVALID_ELEMENT_TYPES, element));
+ }
+ }
+
+ /**
+ * @see MultiOperation
+ * Overridden to allow special processing of CElementDelta
s
+ * and fResultElements
.
+ */
+ protected void processElements() throws CModelException {
+ fCreatedElements = new ArrayList(fElementsToProcess.length);
+ try {
+ super.processElements();
+ } catch (CModelException cme) {
+ throw cme;
+ } finally {
+ fResultElements = new ICElement[fCreatedElements.size()];
+ fCreatedElements.toArray(fResultElements);
+ processDeltas();
+ }
+ }
+
+ /**
+ * Possible failures:
+ *
+ * - NO_ELEMENTS_TO_PROCESS - no elements supplied to the operation
+ *
- INDEX_OUT_OF_BOUNDS - the number of renamings supplied to the operation
+ * does not match the number of elements that were supplied.
+ *
+ */
+ protected ICModelStatus verify() {
+ ICModelStatus status = super.verify();
+ if (!status.isOK()) {
+ return status;
+ }
+
+ if (fRenamingsList != null && fRenamingsList.length != fElementsToProcess.length) {
+ return new CModelStatus(ICModelStatusConstants.INDEX_OUT_OF_BOUNDS);
+ }
+ return CModelStatus.VERIFIED_OK;
+ }
+
+ /**
+ * @see MultiOperation
+ */
+ protected void verify(ICElement element) throws CModelException {
+ if (element == null || !element.exists())
+ error(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST, element);
+
+ if (element.isReadOnly() && (isRename() || isMove()))
+ error(ICModelStatusConstants.READ_ONLY, element);
+
+ CElement dest = (CElement) getDestinationParent(element);
+ verifyDestination(element, dest);
+ if (fRenamings != null) {
+ verifyRenaming(element);
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateElementInTUOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateElementInTUOperation.java
new file mode 100644
index 00000000000..ccb695df1d1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateElementInTUOperation.java
@@ -0,0 +1,415 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ISourceReference;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * This abstract class implements behavior common to CreateElementInCUOperations
.
+ * To create a compilation unit, or an element contained in a compilation unit, the
+ * source code for the entire compilation unit is updated and saved.
+ *
+ *
The element being created can be positioned relative to an existing
+ * element in the compilation unit via the methods #createAfter
+ * and #createBefore
. By default, the new element is positioned
+ * as the last child of its parent element.
+ *
+ */
+public abstract class CreateElementInTUOperation extends CModelOperation {
+
+ /**
+ * A constant meaning to position the new element
+ * as the last child of its parent element.
+ */
+ protected static final int INSERT_LAST = 1;
+
+ /**
+ * A constant meaning to position the new element
+ * after the element defined by fAnchorElement
.
+ */
+ protected static final int INSERT_AFTER = 2;
+
+ /**
+ * A constant meaning to position the new element
+ * before the element defined by fAnchorElement
.
+ */
+ protected static final int INSERT_BEFORE = 3;
+
+ /**
+ * One of the position constants, describing where
+ * to position the newly created element.
+ */
+ protected int fInsertionPolicy = INSERT_LAST;
+
+ /**
+ * The element that is being created.
+ */
+ protected ISourceReference fCreatedElement = null;;
+
+ /**
+ * The element that the newly created element is
+ * positioned relative to, as described by
+ * fInsertPosition
, or null
+ * if the newly created element will be positioned
+ * last.
+ */
+ protected ICElement fAnchorElement = null;
+
+ /**
+ * A flag indicating whether creation of a new element occurred.
+ * A request for creating a duplicate element would request in this
+ * flag being set to false
. Ensures that no deltas are generated
+ * when creation does not occur.
+ */
+ protected boolean fCreationOccurred = true;
+
+ /**
+ * The position of the element that is being created.
+ */
+ protected int fInsertionPosition = -1;
+
+ /**
+ * The number of characters the new element replaces,
+ * or 0 if the new element is inserted,
+ * or -1 if the new element is append to the end of the CU.
+ */
+ protected int fReplacementLength = -1;
+
+ /**
+ * Constructs an operation that creates a C Language Element with
+ * the specified parent, contained within a translation unit.
+ */
+ public CreateElementInTUOperation(ICElement parentElement) {
+ super(null, new ICElement[]{parentElement});
+ initializeDefaultPosition();
+ }
+
+ /**
+ * Only allow cancelling if this operation is not nested.
+ */
+ protected void checkCanceled() {
+ if (!fNested) {
+ super.checkCanceled();
+ }
+ }
+
+ /**
+ * Instructs this operation to position the new element after
+ * the given sibling, or to add the new element as the last child
+ * of its parent if null
.
+ */
+ public void createAfter(ICElement sibling) {
+ setRelativePosition(sibling, INSERT_AFTER);
+ }
+
+ /**
+ * Instructs this operation to position the new element before
+ * the given sibling, or to add the new element as the last child
+ * of its parent if null
.
+ */
+ public void createBefore(ICElement sibling) {
+ setRelativePosition(sibling, INSERT_BEFORE);
+ }
+
+ /**
+ * Execute the operation - generate new source for the compilation unit
+ * and save the results.
+ *
+ * @exception CModelException if the operation is unable to complete
+ */
+ protected void executeOperation() throws CModelException {
+ beginTask(getMainTaskName(), getMainAmountOfWork());
+ CElementDelta delta = newCElementDelta();
+ ITranslationUnit unit = getTranslationUnit();
+ insertElement();
+ if (fCreationOccurred) {
+ //a change has really occurred
+ IFile file = (IFile)unit.getCorrespondingResource();
+ StringBuffer buffer = getContent(file);
+ switch (fReplacementLength) {
+ case -1 :
+ // element is append at the end
+ buffer.append(fCreatedElement.getSource());
+ break;
+
+ case 0 :
+ // element is inserted
+ buffer.insert(fInsertionPosition, fCreatedElement.getSource());
+ break;
+
+ default :
+ // element is replacing the previous one
+ buffer.replace(fInsertionPosition, fReplacementLength, fCreatedElement.getSource());
+ }
+ save(buffer, file);
+ worked(1);
+ fResultElements = generateResultHandles();
+ //if (!isWorkingCopy) { // if unit is working copy, then save will have already fired the delta
+ if (unit.getParent().exists()) {
+ for (int i = 0; i < fResultElements.length; i++) {
+ delta.added(fResultElements[i]);
+ }
+ addDelta(delta);
+ } // else unit is created outside classpath
+ // non-java resource delta will be notified by delta processor
+ //}
+ }
+ done();
+ }
+
+ /**
+ * Creates and returns the handle for the element this operation created.
+ */
+ protected abstract ICElement generateResultHandle();
+
+ /**
+ * Creates and returns the handles for the elements this operation created.
+ */
+ protected ICElement[] generateResultHandles() throws CModelException {
+ return new ICElement[]{generateResultHandle()};
+ }
+
+ /**
+ * Returns the compilation unit in which the new element is being created.
+ */
+ protected ITranslationUnit getTranslationUnit() {
+ return ((ISourceReference)getParentElement()).getTranslationUnit();
+ }
+
+ /**
+ * Returns the amount of work for the main task of this operation for
+ * progress reporting.
+ * @see executeOperation()
+ */
+ protected int getMainAmountOfWork(){
+ return 2;
+ }
+
+ /**
+ * Returns the name of the main task of this operation for
+ * progress reporting.
+ * @see executeOperation()
+ */
+ protected abstract String getMainTaskName();
+
+ /**
+ * Returns the elements created by this operation.
+ */
+ public ICElement[] getResultElements() {
+ return fResultElements;
+ }
+
+ /**
+ * Sets the default position in which to create the new type
+ * member. By default, the new element is positioned as the
+ * last child of the parent element in which it is created.
+ * Operations that require a different default position must
+ * override this method.
+ */
+ protected void initializeDefaultPosition() {
+ }
+
+ /**
+ * Inserts the given child into the given JDOM,
+ * based on the position settings of this operation.
+ *
+ * @see createAfter(IJavaElement)
+ * @see createBefore(IJavaElement);
+ */
+ protected void insertElement() throws CModelException {
+ if (fInsertionPolicy != INSERT_LAST) {
+ ISourceRange range = ((ISourceReference)fAnchorElement).getSourceRange();
+ switch (fInsertionPolicy) {
+ case INSERT_AFTER:
+ fReplacementLength = 0;
+ fInsertionPosition = range.getStartPos() + range.getLength();
+ break;
+
+ case INSERT_BEFORE:
+ fReplacementLength = 0;
+ fInsertionPosition = range.getStartPos();
+
+ default:
+ fReplacementLength = range.getStartPos() + range.getLength();
+ fInsertionPosition = range.getStartPos();
+ break;
+ }
+ return;
+ }
+ //add as the last element of the parent
+ fReplacementLength = -1;
+ }
+
+ /**
+ * Sets the name of the DOMNode
that will be used to
+ * create this new element.
+ * Used by the CopyElementsOperation
for renaming.
+ * Only used for CreateTypeMemberOperation
+ */
+ protected void setAlteredName(String newName) {
+ }
+
+ /**
+ * Instructs this operation to position the new element relative
+ * to the given sibling, or to add the new element as the last child
+ * of its parent if null
. The position
+ * must be one of the position constants.
+ */
+ protected void setRelativePosition(ICElement sibling, int policy) throws IllegalArgumentException {
+ if (sibling == null) {
+ fAnchorElement = null;
+ fInsertionPolicy = INSERT_LAST;
+ } else {
+ fAnchorElement = sibling;
+ fInsertionPolicy = policy;
+ }
+ }
+
+ /**
+ * Possible failures:
+ * - NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is
+ *
null
.
+ * - INVALID_NAME - no name, a name was null or not a valid
+ * import declaration name.
+ *
- INVALID_SIBLING - the sibling provided for positioning is not valid.
+ *
+ * @see ICModelStatus
+ * @see CNamingConventions
+ */
+ public ICModelStatus verify() {
+ if (getParentElement() == null) {
+ return new CModelStatus(ICModelStatusConstants.NO_ELEMENTS_TO_PROCESS);
+ }
+ if (fAnchorElement != null) {
+ ICElement domPresentParent = fAnchorElement.getParent();
+ //if (domPresentParent.getElementType() == ICElement.IMPORT_CONTAINER) {
+ // domPresentParent = domPresentParent.getParent();
+ //}
+ if (!domPresentParent.equals(getParentElement())) {
+ return new CModelStatus(ICModelStatusConstants.INVALID_SIBLING, fAnchorElement);
+ }
+ }
+ return CModelStatus.VERIFIED_OK;
+ }
+
+
+ StringBuffer getContent(IFile file) throws CModelException {
+ InputStream stream = null;
+ try {
+ stream = new BufferedInputStream(file.getContents(true));
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ try {
+ char [] b = getInputStreamAsCharArray(stream, -1, null);
+ return new StringBuffer(b.length).append(b);
+ } catch (IOException e) {
+ throw new CModelException(e, ICModelStatusConstants.IO_EXCEPTION);
+ } finally {
+ try {
+ if (stream != null)
+ stream.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ /**
+ * Returns the given input stream's contents as a character array.
+ * If a length is specified (ie. if length != -1), only length chars
+ * are returned. Otherwise all chars in the stream are returned.
+ * Note this doesn't close the stream.
+ * @throws IOException if a problem occured reading the stream.
+ */
+ public static char[] getInputStreamAsCharArray(InputStream stream, int length, String encoding)
+ throws IOException {
+ InputStreamReader reader = null;
+ reader = encoding == null
+ ? new InputStreamReader(stream)
+ : new InputStreamReader(stream, encoding);
+ char[] contents;
+ if (length == -1) {
+ contents = new char[0];
+ int contentsLength = 0;
+ int charsRead = -1;
+ do {
+ int available = stream.available();
+
+ // resize contents if needed
+ if (contentsLength + available > contents.length) {
+ System.arraycopy(
+ contents,
+ 0,
+ contents = new char[contentsLength + available],
+ 0,
+ contentsLength);
+ }
+
+ // read as many chars as possible
+ charsRead = reader.read(contents, contentsLength, available);
+
+ if (charsRead > 0) {
+ // remember length of contents
+ contentsLength += charsRead;
+ }
+ } while (charsRead > 0);
+
+ // resize contents if necessary
+ if (contentsLength < contents.length) {
+ System.arraycopy(
+ contents,
+ 0,
+ contents = new char[contentsLength],
+ 0,
+ contentsLength);
+ }
+ } else {
+ contents = new char[length];
+ int len = 0;
+ int readSize = 0;
+ while ((readSize != -1) && (len != length)) {
+ // See PR 1FMS89U
+ // We record first the read size. In this case len is the actual read size.
+ len += readSize;
+ readSize = reader.read(contents, len, length - len);
+ }
+ // See PR 1FMS89U
+ // Now we need to resize in case the default encoding used more than one byte for each
+ // character
+ if (len != length)
+ System.arraycopy(contents, 0, (contents = new char[len]), 0, len);
+ }
+
+ return contents;
+ }
+
+ void save (StringBuffer buffer, IFile file) throws CModelException {
+ byte[] bytes = buffer.toString().getBytes();
+ ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+ // use a platform operation to update the resource contents
+ try {
+ boolean force = true;
+ file.setContents(stream, force, true, null); // record history
+ } catch (CoreException e) {
+ throw new CModelException(e);
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateFieldOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateFieldOperation.java
new file mode 100644
index 00000000000..cae08069224
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateFieldOperation.java
@@ -0,0 +1,74 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.core.model.ICModelStatus;
+/**
+ * This operation creates a field declaration in a type.
+ *
+ *
Required Attributes:
+ * - Containing Type
+ *
- The source code for the declaration. No verification of the source is
+ * performed.
+ *
+ */
+public class CreateFieldOperation extends CreateMemberOperation {
+ /**
+ * When executed, this operation will create a field with the given name
+ * in the given type with the specified source.
+ *
+ * By default the new field is positioned after the last existing field
+ * declaration, or as the first member in the type if there are no
+ * field declarations.
+ */
+ public CreateFieldOperation(IStructure parentElement, String source, boolean force) {
+ super(parentElement, source, force);
+ }
+
+ /**
+ * @see CreateElementInCUOperation#getMainTaskName
+ */
+ public String getMainTaskName(){
+ return "operation.createFieldProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * By default the new field is positioned after the last existing field
+ * declaration, or as the first member in the type if there are no
+ * field declarations.
+ */
+ protected void initializeDefaultPosition() {
+ IStructure parentElement = getStructure();
+ //try {
+ ICElement[] elements = parentElement.getFields();
+ if (elements != null && elements.length > 0) {
+ createAfter(elements[elements.length - 1]);
+ } else {
+ elements = parentElement.getChildren();
+ if (elements != null && elements.length > 0) {
+ createBefore(elements[0]);
+ }
+ }
+ //} catch (CModelException e) {
+ //}
+ }
+
+ /**
+ * @see CreateElementInCUOperation#generateResultHandle
+ */
+ protected ICElement generateResultHandle() {
+ return getStructure().getField(fSource);
+ }
+
+ /**
+ * @see CreateTypeMemberOperation#verifyNameCollision
+ */
+ protected ICModelStatus verifyNameCollision() {
+ return CModelStatus.VERIFIED_OK;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateFunctionDeclarationOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateFunctionDeclarationOperation.java
new file mode 100644
index 00000000000..d00f25c0167
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateFunctionDeclarationOperation.java
@@ -0,0 +1,96 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IInclude;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ *
This operation adds an include declaration to an existing translation unit.
+ * If the translation unit already includes the specified include declaration,
+ * the include is not generated (it does not generate duplicates).
+ *
+ *
Required Attributes:
+ * - Translation unit
+ *
- Include name - the name of the include to add to the
+ * translation unit. For example:
"stdio.h"
+ *
+ */
+public class CreateFunctionDeclarationOperation extends CreateElementInTUOperation {
+
+ /**
+ * The name of the include to be created.
+ */
+ protected String fFunction;
+
+ /**
+ * When executed, this operation will add an include to the given translation unit.
+ */
+ public CreateFunctionDeclarationOperation(String function, ITranslationUnit parentElement) {
+ super(parentElement);
+ fFunction = function;
+ }
+
+ /**
+ * @see CreateElementInCUOperation#generateResultHandle
+ */
+ protected ICElement generateResultHandle() {
+ try {
+ return getTranslationUnit().getElement(fFunction);
+ } catch (CModelException e) {
+ }
+ return null;
+ }
+
+ /**
+ * @see CreateElementInCUOperation#getMainTaskName
+ */
+ public String getMainTaskName(){
+ return "operation.createIncludeProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * Sets the correct position for the new include:
+ * - after the last include
+ *
- if no include, before the first type
+ *
- if no type, after the package statement
+ *
- and if no package statement - first thing in the CU
+ */
+ protected void initializeDefaultPosition() {
+ try {
+ ITranslationUnit tu = getTranslationUnit();
+ IInclude[] includes = tu.getIncludes();
+ if (includes.length > 0) {
+ createAfter(includes[includes.length - 1]);
+ return;
+ }
+ } catch (CModelException npe) {
+ }
+ }
+
+ /**
+ * Possible failures:
+ * - NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is
+ *
null
.
+ * - INVALID_NAME - not a valid include declaration name.
+ *
+ * @see ICModelStatus
+ * @see CNamingConventions
+ */
+ public ICModelStatus verify() {
+ ICModelStatus status = super.verify();
+ if (!status.isOK()) {
+ return status;
+ }
+ //if (CConventions.validateInclude(fIncludeName).getSeverity() == IStatus.ERROR) {
+ // return new CModelStatus(ICModelStatusConstants.INVALID_NAME, fIncludeName);
+ //}
+ return CModelStatus.VERIFIED_OK;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateIncludeOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateIncludeOperation.java
new file mode 100644
index 00000000000..e845adc9b92
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateIncludeOperation.java
@@ -0,0 +1,92 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IInclude;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * This operation adds an include declaration to an existing translation unit.
+ * If the translation unit already includes the specified include declaration,
+ * the include is not generated (it does not generate duplicates).
+ *
+ *
Required Attributes:
+ * - Translation unit
+ *
- Include name - the name of the include to add to the
+ * translation unit. For example:
"stdio.h"
+ *
+ */
+public class CreateIncludeOperation extends CreateElementInTUOperation {
+
+ /**
+ * The name of the include to be created.
+ */
+ protected String fIncludeName;
+
+ /**
+ * When executed, this operation will add an include to the given translation unit.
+ */
+ public CreateIncludeOperation(String includeName, ITranslationUnit parentElement) {
+ super(parentElement);
+ fIncludeName = includeName;
+ }
+
+ /**
+ * @see CreateElementInCUOperation#generateResultHandle
+ */
+ protected ICElement generateResultHandle() {
+ return getTranslationUnit().getInclude(fIncludeName);
+ }
+
+ /**
+ * @see CreateElementInCUOperation#getMainTaskName
+ */
+ public String getMainTaskName(){
+ return "operation.createIncludeProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * Sets the correct position for the new include:
+ * - after the last include
+ *
- if no include, before the first type
+ *
- if no type, after the package statement
+ *
- and if no package statement - first thing in the CU
+ */
+ protected void initializeDefaultPosition() {
+ try {
+ ITranslationUnit cu = getTranslationUnit();
+ IInclude[] includes = cu.getIncludes();
+ if (includes.length > 0) {
+ createAfter(includes[includes.length - 1]);
+ return;
+ }
+ } catch (CModelException npe) {
+ }
+ }
+
+ /**
+ * Possible failures:
+ * - NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is
+ *
null
.
+ * - INVALID_NAME - not a valid include declaration name.
+ *
+ * @see ICModelStatus
+ * @see CNamingConventions
+ */
+ public ICModelStatus verify() {
+ ICModelStatus status = super.verify();
+ if (!status.isOK()) {
+ return status;
+ }
+ //if (CConventions.validateInclude(fIncludeName).getSeverity() == IStatus.ERROR) {
+ // return new CModelStatus(ICModelStatusConstants.INVALID_NAME, fIncludeName);
+ //}
+ return CModelStatus.VERIFIED_OK;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateMemberOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateMemberOperation.java
new file mode 100644
index 00000000000..ffe3e1538b0
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateMemberOperation.java
@@ -0,0 +1,91 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+
+/**
+ * Implements functionality common to
+ * operations that create type members.
+ */
+public abstract class CreateMemberOperation extends CreateElementInTUOperation {
+ /**
+ * The source code for the new member.
+ */
+ protected String fSource = null;
+
+ /**
+ * The name of the DOMNode
that may be used to
+ * create this new element.
+ * Used by the CopyElementsOperation
for renaming
+ */
+ protected String fAlteredName;
+
+ /**
+ * When executed, this operation will create a type member
+ * in the given parent element with the specified source.
+ */
+ public CreateMemberOperation(ICElement parentElement, String source, boolean force) {
+ super(parentElement);
+ fSource= source;
+ fForce= force;
+ }
+
+ /**
+ * Returns the IType the member is to be created in.
+ */
+ protected IStructure getStructure() {
+ return (IStructure)getParentElement();
+ }
+
+ /**
+ * Sets the name of the DOMNode
that will be used to
+ * create this new element.
+ * Used by the CopyElementsOperation
for renaming
+ */
+ protected void setAlteredName(String newName) {
+ fAlteredName = newName;
+ }
+
+ /**
+ * Possible failures:
+ * - NO_ELEMENTS_TO_PROCESS - the parent element supplied to the operation is
+ *
null
.
+ * - INVALID_CONTENTS - The source is
null
or has serious syntax errors.
+ * - NAME_COLLISION - A name collision occurred in the destination
+ *
+ */
+ public ICModelStatus verify() {
+ ICModelStatus status = super.verify();
+ if (!status.isOK()) {
+ return status;
+ }
+ if (fSource == null) {
+ return new CModelStatus(ICModelStatusConstants.INVALID_CONTENTS);
+ }
+ if (!fForce) {
+ //check for name collisions
+ //if (node == null) {
+ // return new CModelStatus(ICModelStatusConstants.INVALID_CONTENTS);
+ // }
+ //} catch (CModelException jme) {
+ //}
+ return verifyNameCollision();
+ }
+
+ return CModelStatus.VERIFIED_OK;
+ }
+
+ /**
+ * Verify for a name collision in the destination container.
+ */
+ protected ICModelStatus verifyNameCollision() {
+ return CModelStatus.VERIFIED_OK;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateMethodOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateMethodOperation.java
new file mode 100644
index 00000000000..0704e206400
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateMethodOperation.java
@@ -0,0 +1,52 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.core.model.ICModelStatus;
+
+/**
+ * This operation creates an instance method.
+ *
+ *
Required Attributes:
+ * - Containing type
+ *
- The source code for the method. No verification of the source is
+ * performed.
+ *
+ */
+public class CreateMethodOperation extends CreateMemberOperation {
+ protected String[] fParameterTypes;
+
+ /**
+ * When executed, this operation will create a method
+ * in the given type with the specified source.
+ */
+ public CreateMethodOperation(IStructure parentElement, String source, boolean force) {
+ super(parentElement, source, force);
+ }
+
+ /**
+ * @see CreateElementInCUOperation#generateResultHandle
+ */
+ protected ICElement generateResultHandle() {
+ return getStructure().getMethod(fSource);
+ }
+
+ /**
+ * @see CreateElementInCUOperation#getMainTaskName
+ */
+ public String getMainTaskName(){
+ return "operation.createMethodProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see CreateTypeMemberOperation#verifyNameCollision
+ */
+ protected ICModelStatus verifyNameCollision() {
+ return CModelStatus.VERIFIED_OK;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeleteResourceElementsOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeleteResourceElementsOperation.java
new file mode 100644
index 00000000000..28ddb5cffef
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeleteResourceElementsOperation.java
@@ -0,0 +1,49 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * This operation deletes a collection of resources and all of their children.
+ * It does not delete resources which do not belong to the C Model
+ * (eg GIF files).
+ */
+public class DeleteResourceElementsOperation extends MultiOperation {
+ /**
+ * When executed, this operation will delete the given elements. The elements
+ * to delete cannot be null
or empty, and must have a corresponding
+ * resource.
+ */
+ protected DeleteResourceElementsOperation(ICElement[] elementsToProcess, boolean force) {
+ super(elementsToProcess, force);
+ }
+
+ /**
+ * @see MultiOperation
+ */
+ protected String getMainTaskName() {
+ return "operation.deleteResourceProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see MultiOperation. This method delegate to deleteResource
or
+ * deletePackageFragment
depending on the type of element
.
+ */
+ protected void processElement(ICElement element) throws CModelException {
+ deleteResource(element.getCorrespondingResource(), fForce);
+ }
+
+ /**
+ * @see MultiOperation
+ */
+ protected void verify(ICElement element) throws CModelException {
+ if (element == null || !element.exists())
+ error(CModelStatus.ELEMENT_DOES_NOT_EXIST, element);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
new file mode 100644
index 00000000000..8e336fcb61c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
@@ -0,0 +1,388 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICElementDelta;
+import org.eclipse.cdt.core.model.ICRoot;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+
+/**
+ * This class is used by CModelManager
to convert
+ * IResourceDelta
s into ICElementDelta
s.
+ * It also does some processing on the CElement
s involved
+ * (e.g. closing them or updating classpaths).
+ */
+public class DeltaProcessor {
+
+ /**
+ * The CElementDelta
corresponding to the IResourceDelta
being translated.
+ */
+ protected CElementDelta fCurrentDelta;
+
+ /* The C element that was last created (see createElement(IResource).
+ * This is used as a stack of C elements (using getParent() to pop it, and
+ * using the various get*(...) to push it. */
+ ICElement currentElement;
+
+ static final ICElementDelta[] NO_DELTA = new ICElementDelta[0];
+
+ public static boolean VERBOSE = false;
+
+ // Hold on the element bein renamed.
+ ICElement movedFromElement = null;
+
+ /**
+ * Generic processing for elements with changed contents:
+ * - The element is closed such that any subsequent accesses will re-open
+ * the element reflecting its new structure.
+ *
- An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
+ *
+ */
+ protected void contentChanged(ICElement element, IResourceDelta delta) {
+ fCurrentDelta.changed(element, ICElementDelta.F_CONTENT);
+ }
+
+ /**
+ * Creates the create corresponding to this resource.
+ * Returns null if none was found.
+ */
+ protected ICElement createElement(IResource resource) {
+ if (resource == null)
+ return null;
+ return CModelManager.getDefault().create(resource);
+ }
+
+ /**
+ * Creates the create corresponding to this resource.
+ * Returns null if none was found.
+ */
+ protected ICElement createElement(IPath path) {
+ return CModelManager.getDefault().create(path);
+ }
+
+ /**
+ * Release the Element from the CModel hastable.
+ * Returns null if none was found.
+ */
+ protected void releaseCElement(ICElement celement) {
+ CModelManager.getDefault().releaseCElement(celement);
+ }
+
+ /**
+ * Release the Resource.
+ * Returns null if none was found.
+ */
+ protected void releaseCElement(IResource resource) {
+ CModelManager.getDefault().releaseCElement(resource);
+ }
+
+ /**
+ * get the CElement from the hashtable, if it exist without
+ * creating it.
+ * Returns null if none was found.
+ */
+ protected ICElement getElement(IResource res) {
+ return CModelManager.getDefault().getCElement(res);
+ }
+
+ protected ICElement getElement(IPath path) {
+ return CModelManager.getDefault().getCElement(path);
+ }
+
+ /**
+ * Processing for an element that has been added:
+ * - If the element is a project, do nothing, and do not process
+ * children, as when a project is created it does not yet have any
+ * natures - specifically a java nature.
+ *
- If the elemet is not a project, process it as added (see
+ *
basicElementAdded
.
+ *
+ */
+ protected void elementAdded(ICElement element, IResourceDelta delta) {
+
+ if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) {
+ //ICElement movedFromElement = createElement(delta.getMovedFromPath());
+ if (movedFromElement == null)
+ movedFromElement = getElement(delta.getMovedFromPath());
+ fCurrentDelta.movedTo(element, movedFromElement);
+ movedFromElement = null;
+ } else {
+ fCurrentDelta.added(element);
+ }
+ }
+
+ /**
+ * Processing for the closing of an element - there are two cases:
+ * - when a project is closed (in the platform sense), the
+ * CRoot reports this as if the CProject has been removed.
+ *
- otherwise, the CRoot reports this
+ * as a the element being closed (CHANGED + F_CLOSED).
+ *
+ * In both cases, the children of the element are not processed. When
+ * a resource is closed, the platform reports all children as removed. This
+ * would effectively delete the classpath if we processed children.
+ */
+ protected void elementClosed(ICElement element, IResourceDelta delta) {
+
+ if (element.getElementType() == ICElement.C_PROJECT) {
+ // treat project closing as removal
+ elementRemoved(element, delta);
+ } else {
+ fCurrentDelta.closed(element);
+ }
+ }
+
+ /**
+ * Processing for the opening of an element - there are two cases:
+ * - when a project is opened (in the platform sense), the
+ * CRoot reports this as if the CProject has been added.
+ *
- otherwise, the CRoot reports this
+ * as a the element being opened (CHANGED + F_CLOSED).
+ *
+ */
+ protected void elementOpened(ICElement element, IResourceDelta delta) {
+
+ if (element.getElementType() == ICElement.C_PROJECT) {
+ // treat project opening as addition
+ if (hasCNature(delta.getResource())) {
+ elementAdded(element, delta);
+ }
+ } else {
+ fCurrentDelta.opened(element);
+ }
+ }
+
+ /**
+ * Generic processing for a removed element:
+ * - Close the element, removing its structure from the cache
+ *
- Remove the element from its parent's cache of children
+ *
- Add a REMOVED entry in the delta
+ *
+ */
+ protected void elementRemoved(ICElement element, IResourceDelta delta) {
+ if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
+ IPath movedToPath = delta.getMovedToPath();
+ // create the moved to element
+ ICElement movedToElement = createElement(movedToPath);
+ if (movedToElement == null) {
+ // moved outside
+ fCurrentDelta.removed(element);
+ } else {
+ movedFromElement = element;
+ fCurrentDelta.movedFrom(element, movedToElement);
+ }
+ } else {
+ fCurrentDelta.removed(element);
+ }
+ releaseCElement(element);
+ }
+
+ /**
+ * Filters the generated CElementDelta
s to remove those
+ * which should not be fired (because they don't represent a real change
+ * in the C Model).
+ */
+ protected ICElementDelta[] filterRealDeltas(ICElementDelta[] deltas) {
+
+ int length = deltas.length;
+ ICElementDelta[] realDeltas = null;
+ int index = 0;
+ for (int i = 0; i < length; i++) {
+ CElementDelta delta = (CElementDelta)deltas[i];
+ if (delta == null) {
+ continue;
+ }
+ if (delta.getAffectedChildren().length > 0
+ || delta.getKind() == ICElementDelta.ADDED
+ || delta.getKind() == ICElementDelta.REMOVED
+ || (delta.getFlags() & ICElementDelta.F_CLOSED) != 0
+ || (delta.getFlags() & ICElementDelta.F_OPENED) != 0
+ || delta.resourceDeltasCounter > 0) {
+
+ if (realDeltas == null) {
+ realDeltas = new ICElementDelta[length];
+ }
+ realDeltas[index++] = delta;
+ }
+ }
+ if (index > 0) {
+ ICElementDelta[] result = new ICElementDelta[index];
+ System.arraycopy(realDeltas, 0, result, 0, index);
+ return result;
+ } else {
+ return NO_DELTA;
+ }
+ }
+
+ /**
+ * Returns true if the given resource is contained in an open project
+ * with a java nature, otherwise false.
+ */
+ protected boolean hasCNature(IResource resource) {
+ // ensure the project has a C nature (if open)
+ IProject project = resource.getProject();
+ if (project.isOpen()) {
+ return CoreModel.getDefault().hasCNature(project);
+ }
+ return false;
+ }
+
+
+ private CModelException newInvalidElementType() {
+ return new CModelException(new CModelStatus(ICModelStatusConstants.INVALID_ELEMENT_TYPES));
+ }
+
+ /**
+ * Converts a IResourceDelta
rooted in a Workspace
into
+ * the corresponding set of ICElementDelta
, rooted in the
+ * relevant CRoot
s.
+ */
+ public ICElementDelta[] processResourceDelta(IResourceDelta changes) {
+
+ try {
+ ICElement root = (ICRoot)CModelManager.getDefault().getCRoot();
+ currentElement = null;
+
+/*
+ try {
+ changes.accept(new IResourceDeltaVisitor() {
+ public boolean visit(IResourceDelta delta) {
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED :
+ // handle added resource
+ System.out.print("ADDED ");
+ break;
+ case IResourceDelta.REMOVED :
+ // handle removed resource
+ System.out.print("REMOVED ");
+ break;
+ case IResourceDelta.CHANGED :
+ // handle changed resource
+ System.out.print("CHANGED ");
+ break;
+ }
+ System.out.println(delta.getResource());
+ return true;
+ }
+ });
+ } catch (CoreException e) {
+ }
+*/
+ // get the workspace delta, and start processing there.
+ IResourceDelta[] deltas = changes.getAffectedChildren();
+ ICElementDelta[] translatedDeltas = new CElementDelta[deltas.length];
+ for (int i = 0; i < deltas.length; i++) {
+ IResourceDelta delta = deltas[i];
+ fCurrentDelta = new CElementDelta(root);
+ traverseDelta(delta); // traverse delta
+ translatedDeltas[i] = fCurrentDelta;
+ }
+ return filterRealDeltas(translatedDeltas);
+ } finally {
+ }
+ }
+
+ /**
+ * Converts an IResourceDelta
and its children into
+ * the corresponding ICElementDelta
s.
+ * Return whether the delta corresponds to a resource on the classpath.
+ * If it is not a resource on the classpath, it will be added as a non-java
+ * resource by the sender of this method.
+ */
+ protected void traverseDelta(IResourceDelta delta) {
+ try {
+ if (!updateCurrentDeltaAndIndex(delta)) {
+ fCurrentDelta.addResourceDelta(delta);
+ }
+ } catch (CModelException e) {
+ }
+ IResourceDelta [] children = delta.getAffectedChildren();
+ for (int i = 0; i < children.length; i++) {
+ traverseDelta(children[i]);
+ }
+ }
+
+ /*
+ * Update the current delta (ie. add/remove/change the given element) and update the
+ * correponding index.
+ * Returns whether the children of the given delta must be processed.
+ * @throws a CModelException if the delta doesn't correspond to a c element of the given type.
+ */
+ private boolean updateCurrentDeltaAndIndex(IResourceDelta delta) throws CModelException {
+
+ ICElement element = null;
+ IResource resource = delta.getResource();
+
+ boolean isProcess = false;
+
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED :
+ element = createElement(resource);
+ if (element == null)
+ throw newInvalidElementType();
+ updateIndexAddResource(element, delta);
+ elementAdded(element, delta);
+ isProcess = true;
+ break;
+
+ case IResourceDelta.REMOVED :
+ element = getElement(resource);
+ if (element != null) {
+ updateIndexRemoveResource(element, delta);
+ elementRemoved(element, delta);
+ isProcess = true;
+ } else {
+ releaseCElement(resource);
+ }
+ break;
+
+ case IResourceDelta.CHANGED :
+ element = createElement(resource);
+ if (element == null)
+ throw newInvalidElementType();
+ int flags = delta.getFlags();
+ if ((flags & IResourceDelta.CONTENT) != 0) {
+ // content has changed
+ contentChanged(element, delta);
+ updateIndexAddResource(element, delta);
+ } else if ((flags & IResourceDelta.OPEN) != 0) {
+ // project has been opened or closed
+ IProject res = (IProject)resource;
+ if (res.isOpen()) {
+ elementOpened(element, delta);
+ updateIndexAddResource(element, delta);
+ } else {
+ elementClosed(element, delta);
+ updateIndexRemoveResource(element, delta);
+ }
+ // when a project is open/closed don't process children
+ } else if ((flags & IResourceDelta.DESCRIPTION) != 0) {
+ elementAdded(element, delta);
+ } // else if ((flags * IResourceDelta.MARKERS) != 0) {}
+ // else if ((flags * IResourceDelta.TYPE) != 0) {}
+ // else if ((flags * IResourceDelta.SYNC) != 0) {}
+ isProcess = true;
+ break;
+ }
+ return isProcess;
+ }
+
+ protected void updateIndexAddResource(ICElement element, IResourceDelta delta) {
+ //CModelManager.getDefault().getIndexManager().addResource(delta.getResource());
+ }
+
+ protected void updateIndexRemoveResource(ICElement element, IResourceDelta delta) {
+ //CModelManager.getDefault().getIndexManager().removeResource(delta.getResource());
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ElfRunner.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ElfRunner.java
new file mode 100644
index 00000000000..9d2fdc928e7
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ElfRunner.java
@@ -0,0 +1,99 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IArchive;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICRoot;
+
+public class ElfRunner implements Runnable {
+ ArchiveContainer clib;
+ BinaryContainer cbin;
+ CProject cproject;
+
+ public ElfRunner(CProject cprj) {
+ cproject = cprj;
+ cbin = (BinaryContainer)cprj.getBinaryContainer();
+ clib = (ArchiveContainer)cprj.getArchiveContainer();
+ }
+
+ public void run() {
+ cproject.setRunElf(true);
+ clib.removeChildren();
+ cbin.removeChildren();
+ try {
+ cproject.getProject().accept(new Visitor(this));
+ } catch (CoreException e) {
+ //e.printStackTrace();
+ }
+ fireEvents(cbin);
+ fireEvents(clib);
+ }
+
+ public void fireEvents(Parent container) {
+ // Fired the event.
+ ICElement[] children = container.getChildren();
+ if (children.length > 0) {
+ CModelManager factory = CModelManager.getDefault();
+ ICElement root = (ICRoot)factory.getCRoot();
+ CElementDelta cdelta = new CElementDelta(root);
+ cdelta.added(cproject);
+ cdelta.added(container);
+ for (int i = 0; i < children.length; i++) {
+ cdelta.added(children[i]);
+ }
+ factory.registerCModelDelta(cdelta);
+ factory.fire();
+ }
+ }
+
+ void addChildIfElf(CoreModel factory, IFile file) {
+ // Attempt to speed things up by rejecting up front
+ // Things we know should not be Elf/Binary files.
+ if (!factory.isTranslationUnit(file)) {
+ if (factory.isBinary(file)) {
+ ICElement celement = factory.create(file);
+ if (celement != null) {
+ if (celement instanceof IBinary) {
+ IBinary bin = (IBinary)celement;
+ if (bin.isExecutable() || bin.isSharedLib()) {
+ cbin.addChild(bin);
+ }
+ }
+ }
+ } else if (factory.isArchive(file)) {
+ ICElement celement = factory.create(file);
+ if (celement instanceof IArchive) {
+ clib.addChild(celement);
+ }
+ }
+ }
+ }
+
+ class Visitor implements IResourceVisitor {
+ CoreModel factory = CoreModel.getDefault();
+ ElfRunner runner;
+
+ public Visitor (ElfRunner r) {
+ runner = r;
+ }
+
+ public boolean visit(IResource res) throws CoreException {
+ if (res instanceof IFile) {
+ runner.addChildIfElf(factory, (IFile)res);
+ return false;
+ }
+ return true;
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java
new file mode 100644
index 00000000000..8ed88891b6e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java
@@ -0,0 +1,74 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IField;
+
+public class Field extends SourceManipulation implements IField {
+
+ public Field(ICElement parent, String name) {
+ super(parent, name, CElement.C_FIELD);
+ }
+
+ public boolean isMutable() throws CModelException {
+ return false;
+ }
+
+ /*
+ * @IVariable
+ */
+ public String getType() {
+ return "";
+ }
+
+ /*
+ * @IVariable
+ */
+ public String getInitializer() {
+ return "";
+ }
+
+ /**
+ * Returns true if the member as class scope.
+ * For example static methods in C++ have class scope
+ *
+ * @see IMember
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public boolean hasClassScope() throws CModelException {
+ return false;
+ }
+
+ /**
+ * Returns whether this method/field is declared constant.
+ *
+ * @see IMember
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public boolean isConst() throws CModelException {
+ return false;
+ }
+
+ /**
+ * Returns the access Control of the member. The access qualifier
+ * can be examine using the AccessControl class.
+ *
+ * @see IMember
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public int getAccessControl() throws CModelException {
+ return 0;
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new SourceManipulationInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Function.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Function.java
new file mode 100644
index 00000000000..64dffe6a9e5
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Function.java
@@ -0,0 +1,49 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IFunction;
+
+public class Function extends SourceManipulation implements IFunction {
+
+ public Function(ICElement parent, String name) {
+ super(parent, name, CElement.C_FUNCTION);
+ }
+
+ public String[] getExceptions() throws CModelException {
+ return new String[] {};
+ }
+
+ public int getNumberOfParameters() {
+ return 0;
+ }
+
+ public String getParameterInitializer(int pos) {
+ return "";
+ }
+
+ public String[] getParameterTypes() {
+ return new String[0];
+ }
+
+ public String getReturnType() throws CModelException {
+ return "";
+ }
+
+ public int getAccessControl() throws CModelException {
+ return getFunctionInfo().getAccessControl();
+ }
+
+ public FunctionInfo getFunctionInfo() {
+ return (FunctionInfo)getElementInfo();
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new FunctionInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java
new file mode 100644
index 00000000000..123013ba0f8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java
@@ -0,0 +1,45 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IFunctionDeclaration;
+
+public class FunctionDeclaration extends SourceManipulation implements IFunctionDeclaration {
+
+ public FunctionDeclaration(ICElement parent, String name) {
+ super(parent, name, CElement.C_FUNCTION_DECLARATION);
+ }
+
+ public String[] getExceptions() throws CModelException {
+ return new String[] {};
+ }
+
+ public int getNumberOfParameters() {
+ return 0;
+ }
+
+ public String getParameterInitializer(int pos) {
+ return "";
+ }
+
+ public String[] getParameterTypes() {
+ return new String[0];
+ }
+
+ public String getReturnType() throws CModelException {
+ return "";
+ }
+
+ public int getAccessControl() throws CModelException {
+ return 0;
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new SourceManipulationInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java
new file mode 100644
index 00000000000..73a4e69f8ea
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java
@@ -0,0 +1,24 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+class FunctionInfo extends SourceManipulationInfo {
+
+ protected int flags;
+
+ protected FunctionInfo (CElement element) {
+ super(element);
+ flags = 0;
+ }
+
+ protected int getAccessControl() {
+ return flags;
+ }
+
+ protected void setAccessControl(int flags) {
+ this.flags = flags;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IConstants.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IConstants.java
new file mode 100644
index 00000000000..b9d20660da9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IConstants.java
@@ -0,0 +1,39 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * This interface defines constants for use by the builder / compiler interface.
+ */
+public interface IConstants {
+
+ /*
+ * Modifiers
+ */
+ int AccPublic = 0x0001;
+ int AccPrivate = 0x0002;
+ int AccProtected = 0x0004;
+ int AccStatic = 0x0008;
+ int AccExtern = 0x0010;
+ int AccInline = 0x0020;
+ int AccVolatile = 0x0040;
+ int AccRegister = 0x0080;
+ int AccExplicit = 0x0100;
+ int AccExport = 0x0200;
+ int AccAbstract = 0x0400;
+ int AccMutable = 0x0800;
+
+ /*
+ * Other VM flags.
+ */
+ int AccAuto = 0x0020;
+
+ /**
+ * Extra flags for types and members.
+ */
+ int AccVirtual = 0x20000;
+ int AccTypename = 0x100000;
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java
new file mode 100644
index 00000000000..39952fc68e6
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java
@@ -0,0 +1,28 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IInclude;
+
+public class Include extends SourceManipulation implements IInclude {
+
+ public Include(ICElement parent, String name) {
+ super(parent, name, CElement.C_INCLUDE);
+ }
+
+ public String getIncludeName() {
+ return "";
+ }
+
+ public boolean isStandard() {
+ return true;
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new SourceManipulationInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Macro.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Macro.java
new file mode 100644
index 00000000000..7c5ca6fae54
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Macro.java
@@ -0,0 +1,28 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IMacro;
+
+public class Macro extends SourceManipulation implements IMacro {
+
+ public Macro(ICElement parent, String name) {
+ super(parent, name, CElement.C_MACRO);
+ }
+
+ public String getIdentifierList() {
+ return "";
+ }
+
+ public String getTokenSequence() {
+ return "";
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new SourceManipulationInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Method.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Method.java
new file mode 100644
index 00000000000..61f09dc93a1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Method.java
@@ -0,0 +1,124 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IMethod;
+
+public class Method extends SourceManipulation implements IMethod {
+
+ public Method(ICElement parent, String name) {
+ super(parent, name, CElement.C_METHOD);
+ }
+
+ /**
+ * @see IMethod
+ */
+ public boolean isConstructor() throws CModelException {
+ return getElementName().equals(getParent().getElementName());
+ }
+
+ /**
+ * @see IMethod
+ */
+ public boolean isDestructor() throws CModelException {
+ return getElementName().startsWith("~");
+ }
+
+ /**
+ * @see IMethod
+ */
+ public boolean isOperator() throws CModelException {
+ return getElementName().startsWith("operator");
+ }
+
+ /**
+ * @see IMethod
+ */
+ public boolean isAbstract() throws CModelException {
+ return false;
+ }
+
+ /**
+ * @see IMethod
+ */
+ public boolean isVirtual() throws CModelException {
+ return false;
+ }
+
+ /**
+ * @see IMethod
+ */
+ public boolean isFriend() throws CModelException {
+ return false;
+ }
+
+ /**
+ * @see IMethod
+ */
+ public String[] getExceptions() {
+ return new String[0];
+ }
+
+ /**
+ * @see IMethod
+ */
+ public int getNumberOfParameters() {
+ return 0;
+ }
+
+ public String getParameterInitializer(int pos) {
+ return "";
+ }
+
+ public String[] getParameterTypes() {
+ return new String[0];
+ }
+
+ public String getReturnType() throws CModelException {
+ return "";
+ }
+
+ /**
+ * Returns true if the member as class scope.
+ * For example static methods in C++ have class scope
+ *
+ * @see IMember
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public boolean hasClassScope() throws CModelException {
+ return false;
+ }
+
+ /**
+ * Returns whether this method/field is declared constant.
+ *
+ * @see IMember
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public boolean isConst() throws CModelException {
+ return false;
+ }
+
+ /**
+ * Returns the access Control of the member. The access qualifier
+ * can be examine using the AccessControl class.
+ *
+ * @see IMember
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ */
+ public int getAccessControl() throws CModelException {
+ return 0;
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new SourceManipulationInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ModelBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ModelBuilder.java
new file mode 100644
index 00000000000..fe00f7d662b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ModelBuilder.java
@@ -0,0 +1,183 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.internal.parser.IStructurizerCallback;
+
+public class ModelBuilder implements IStructurizerCallback {
+
+ private TranslationUnit fCurrFile;
+ private CElement fCurrElement;
+
+ public ModelBuilder(TranslationUnit file) {
+ fCurrFile = file;
+ fCurrElement = file;
+ }
+
+ private final int fixLength(int startPos, int endPos) {
+ if (endPos < startPos) {
+ return 0;
+ } else {
+ return endPos - startPos + 1;
+ }
+ }
+
+ public void includeDecl(String name, int startPos, int endPos, int startLine, int endLine) {
+ Include elem= new Include(fCurrFile, name);
+ elem.setPos(startPos, fixLength(startPos, endPos));
+ elem.setIdPos(startPos, fixLength(startPos, endPos));
+ elem.setLines(startLine, endLine);
+
+ fCurrFile.addChild(elem);
+ }
+
+ public void defineDecl(String name, int startPos, int endPos, int startLine, int endLine) {
+ Macro elem= new Macro(fCurrFile, name);
+ elem.setPos(startPos, fixLength(startPos, endPos));
+ elem.setIdPos(startPos, fixLength(startPos, endPos));
+ elem.setLines(startLine, endLine);
+ fCurrFile.addChild(elem);
+ }
+
+ public void functionDeclBegin(String name, int nameStartPos, int nameEndPos,
+ int declStartPos, int startPos, int type, int modifiers) {
+ //if (!assertCurrElement( new int[] { CElement.C_FILE, CElement.C_STRUCTURE, CElement.C_UNION, CElement.C_CLASS})) {
+ // return;
+ //}
+
+ CElement elem;
+ if (fCurrElement instanceof IStructure) {
+ elem = new Method(fCurrElement, name);
+ } else {
+ if(type == ICElement.C_FUNCTION_DECLARATION) {
+ elem = new FunctionDeclaration(fCurrElement, name);
+ } else {
+ elem= new Function(fCurrElement, name);
+ }
+ }
+ elem.setPos(declStartPos, 0);
+ elem.setIdPos(nameStartPos, fixLength(nameStartPos, nameEndPos));
+ elem.setLines(startPos, -1);
+
+ fCurrElement.addChild(elem);
+ fCurrElement= elem;
+ }
+
+ public void functionDeclEnd(int declEndPos, int endLine, boolean prototype) {
+ //if (!assertCurrElement( new int[] { CElement.C_FUNCTION })) {
+ // return;
+ //}
+ if(prototype == true && fCurrElement.getParent() instanceof Parent) {
+ // Need to delete the current function and create a new object
+ CElement elem, oldElem = fCurrElement;
+ elem = new FunctionDeclaration(fCurrElement.getParent(), fCurrElement.getElementName());
+ elem.setPos(oldElem.getStartPos(), 0);
+ elem.setIdPos(oldElem.getIdStartPos(), oldElem.getIdLength());
+ elem.setLines(oldElem.getStartLine(), -1);
+ ((Parent)fCurrElement.getParent()).addChild(elem);
+ ((Parent)fCurrElement.getParent()).removeChild(oldElem);
+ fCurrElement = elem;
+ }
+ int declStartPos= fCurrElement.getStartPos();
+ fCurrElement.setPos(declStartPos, fixLength(declStartPos, declEndPos));
+ int startLine = fCurrElement.getStartLine();
+ fCurrElement.setLines(startLine, endLine);
+ fCurrElement= (CElement)fCurrElement.getParent();
+ }
+
+ public void fieldDecl(String name, int nameStartPos, int nameEndPos, int declStartPos,
+ int declEndPos, int startLine, int endLine, int modifiers) {
+
+ CElement elem;
+ if (fCurrElement instanceof IStructure) {
+ elem = new Field(fCurrElement, name);
+ } else {
+ elem = new Variable(fCurrElement, name);
+ }
+//System.out.println(elem.toDebugString() + " --> " + fCurrElement.toDebugString());
+ elem.setPos(declStartPos, fixLength(declStartPos, declEndPos));
+ elem.setIdPos(nameStartPos, fixLength(nameStartPos, nameEndPos));
+ elem.setLines(startLine, endLine);
+
+ fCurrElement.addChild(elem);
+ }
+
+ public void structDeclBegin(String name, int kind, int nameStartPos, int nameEndPos,
+ int declStartPos, int startLine, int modifiers) {
+ //if (!assertCurrElement( new int[] { CElement.C_FILE, CElement.C_STRUCTURE, CElement.C_UNION, CElement.C_CLASS })) {
+ // return;
+ //}
+
+ if(isAnonymousStructure(name)) {
+ name = new String("[anonymous]");
+ }
+
+ Structure elem= new Structure(fCurrElement, kind, name);
+ elem.setPos(declStartPos, 0);
+ elem.setIdPos(nameStartPos, fixLength(nameStartPos, nameEndPos));
+ elem.setLines(startLine, -1);
+
+ fCurrElement.addChild(elem);
+ fCurrElement= elem;
+//System.out.println(elem.toDebugString() + " --> " + fCurrElement.toDebugString());
+ }
+
+
+ public void structDeclEnd(int declEndPos, int endLine) {
+ //assertCurrElement( new int[] { CElement.C_STRUCTURE, CElement.C_UNION, CElement.C_CLASS });
+ int declStartPos= fCurrElement.getStartPos();
+ fCurrElement.setPos(declStartPos, fixLength(declStartPos, declEndPos));
+ int startLine= fCurrElement.getStartLine();
+ fCurrElement.setLines(startLine, endLine);
+ fCurrElement= (CElement)fCurrElement.getParent();
+ }
+
+ public void superDecl(String name) {
+ //assertCurrElement( new int[] { CElement.C_STRUCTURE, CElement.C_UNION, CElement.C_CLASS });
+ if (fCurrElement instanceof IStructure) {
+ ((Structure)fCurrElement).addSuperClass(name);
+ }
+ }
+
+ public void reportError(Throwable throwable) {
+ // System.out.println("ModelBuilder: error " + throwable.getMessage());
+ }
+
+ private boolean assertCurrElement(int[] acceptedTypes) {
+ boolean isOk= false;
+ int currType= fCurrElement.getElementType();
+ for (int i= 0; i < acceptedTypes.length; i++) {
+ if (currType == acceptedTypes[i]) {
+ isOk= true;
+ }
+ }
+
+ if (!isOk) {
+ StringBuffer buf= new StringBuffer();
+ buf.append("ModelBuilder: type check failed, is: ");
+ buf.append(CElement.getTypeString(currType));
+ buf.append(", should be [ ");
+ for (int i= 0; i < acceptedTypes.length; i++) {
+ buf.append(CElement.getTypeString(acceptedTypes[i]));
+ buf.append(" ");
+ }
+ buf.append("]");
+
+ //CPlugin.getPlugin().logErrorStatus(buf.toString(), null);
+ }
+ return isOk;
+ }
+
+ private boolean isAnonymousStructure(String name) {
+ if (Character.isJavaIdentifierStart(name.charAt(0))) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MoveResourceElementsOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MoveResourceElementsOperation.java
new file mode 100644
index 00000000000..8152f58e0e0
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MoveResourceElementsOperation.java
@@ -0,0 +1,40 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.cdt.core.model.ICElement;
+
+/**
+ * This operation moves resources (package fragments and compilation units) from their current
+ * container to a specified destination container, optionally renaming the
+ * elements.
+ * A move resource operation is equivalent to a copy resource operation, where
+ * the source resources are deleted after the copy.
+ * This operation can be used for reorganizing resources within the same container.
+ *
+ * @see CopyResourceElementsOperation
+ */
+public class MoveResourceElementsOperation extends CopyResourceElementsOperation {
+ /**
+ * When executed, this operation will move the given elements to the given containers.
+ */
+ public MoveResourceElementsOperation(ICElement[] elementsToMove, ICElement[] destContainers, boolean force) {
+ super(elementsToMove, destContainers, force);
+ }
+
+ /**
+ * @see MultiOperation
+ */
+ protected String getMainTaskName() {
+ return "operation.moveResourceProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see CopyResourceElementsOperation#isMove()
+ */
+ protected boolean isMove() {
+ return true;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MultiOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MultiOperation.java
new file mode 100644
index 00000000000..4ae5aaec649
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MultiOperation.java
@@ -0,0 +1,297 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICElementDelta;
+import org.eclipse.cdt.core.model.ICModelStatus;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * This class is used to perform operations on multiple ICElement
.
+ * It is responible for running each operation in turn, collecting
+ * the errors and merging the corresponding CElementDelta
s.
+ *
+ * If several errors occured, they are collected in a multi-status
+ * CModelStatus
. Otherwise, a simple CModelStatus
+ * is thrown.
+ */
+public abstract class MultiOperation extends CModelOperation {
+ /**
+ * The list of renamings supplied to the operation
+ */
+ protected String[] fRenamingsList= null;
+
+ /**
+ * Table specifying the new parent for elements being
+ * copied/moved/renamed.
+ * Keyed by elements being processed, and
+ * values are the corresponding destination parent.
+ */
+ protected Map fParentElements;
+
+ /**
+ * Table specifying insertion positions for elements being
+ * copied/moved/renamed. Keyed by elements being processed, and
+ * values are the corresponding insertion point.
+ * @see processElements(IProgressMonitor)
+ */
+ protected Map fInsertBeforeElements= new HashMap(1);
+
+ /**
+ * This table presents the data in fRenamingList
in a more
+ * convenient way.
+ */
+ protected Map fRenamings;
+
+ /**
+ * Creates a new MultiOperation
.
+ */
+ protected MultiOperation(ICElement[] elementsToProcess, ICElement[] parentElements, boolean force) {
+ super(elementsToProcess, parentElements, force);
+ fParentElements = new HashMap(elementsToProcess.length);
+ if (elementsToProcess.length == parentElements.length) {
+ for (int i = 0; i < elementsToProcess.length; i++) {
+ fParentElements.put(elementsToProcess[i], parentElements[i]);
+ }
+ } else { //same destination for all elements to be moved/copied/renamed
+ for (int i = 0; i < elementsToProcess.length; i++) {
+ fParentElements.put(elementsToProcess[i], parentElements[0]);
+ }
+ }
+ }
+
+ /**
+ * Creates a new MultiOperation
on elementsToProcess
.
+ */
+ protected MultiOperation(ICElement[] elementsToProcess, boolean force) {
+ super(elementsToProcess, force);
+ }
+
+ /**
+ * Convenience method to create a CModelException
+ * embending a CModelStatus
.
+ */
+ protected void error(int code, ICElement element) throws CModelException {
+ throw new CModelException(new CModelStatus(code, element));
+ }
+
+ /**
+ * Executes the operation.
+ *
+ * @exception CModelException if one or several errors occured during the operation.
+ * If multiple errors occured, the corresponding CModelStatus
is a
+ * multi-status. Otherwise, it is a simple one.
+ */
+ protected void executeOperation() throws CModelException {
+ try {
+ processElements();
+ } catch (CModelException cme) {
+ throw cme;
+ } finally {
+ mergeDeltas();
+ }
+ }
+
+ /**
+ * Returns the parent of the element being copied/moved/renamed.
+ */
+ protected ICElement getDestinationParent(ICElement child) {
+ return (ICElement)fParentElements.get(child);
+ }
+
+ /**
+ * Returns the name to be used by the progress monitor.
+ */
+ protected abstract String getMainTaskName();
+
+ /**
+ * Returns the new name for element
, or null
+ * if there are no renamings specified.
+ */
+ protected String getNewNameFor(ICElement element) {
+ if (fRenamings != null)
+ return (String) fRenamings.get(element);
+ else
+ return null;
+ }
+
+ /**
+ * Sets up the renamings hashtable - keys are the elements and
+ * values are the new name.
+ */
+ private void initializeRenamings() {
+ if (fRenamingsList != null && fRenamingsList.length == fElementsToProcess.length) {
+ fRenamings = new HashMap(fRenamingsList.length);
+ for (int i = 0; i < fRenamingsList.length; i++) {
+ if (fRenamingsList[i] != null) {
+ fRenamings.put(fElementsToProcess[i], fRenamingsList[i]);
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns true
if this operation represents a move or rename, false
+ * if this operation represents a copy.
+ * Note: a rename is just a move within the same parent with a name change.
+ */
+ protected boolean isMove() {
+ return false;
+ }
+
+ /**
+ * Returns true
if this operation represents a rename, false
+ * if this operation represents a copy or move.
+ */
+ protected boolean isRename() {
+ return false;
+ }
+
+ /**
+ * Process all of the changed deltas generated by these operations.
+ */
+ protected void mergeDeltas() {
+ if (fDeltas != null) {
+ CElementDelta rootDelta = newCElementDelta();
+ boolean insertedTree = false;
+ for (int i = 0; i < fDeltas.length; i++) {
+ ICElementDelta delta = fDeltas[i];
+ ICElementDelta[] children = delta.getAffectedChildren();
+ for (int j = 0; j < children.length; j++) {
+ CElementDelta projectDelta = (CElementDelta) children[j];
+ rootDelta.insertDeltaTree(projectDelta.getElement(), projectDelta);
+ insertedTree = true;
+ }
+ }
+ if (insertedTree)
+ fDeltas = new ICElementDelta[] {rootDelta};
+ else
+ fDeltas = null;
+ }
+ }
+
+ /**
+ * Subclasses must implement this method to process a given ICElement
.
+ */
+ protected abstract void processElement(ICElement element) throws CModelException;
+
+ /**
+ * Processes all the ICElement
s in turn, collecting errors
+ * and updating the progress monitor.
+ *
+ * @exception CModelException if one or several operation(s) was unable to
+ * be completed.
+ */
+ protected void processElements() throws CModelException {
+ beginTask(getMainTaskName(), fElementsToProcess.length);
+ ICModelStatus[] errors = new ICModelStatus[3];
+ int errorsCounter = 0;
+ for (int i = 0; i < fElementsToProcess.length; i++) {
+ try {
+ verify(fElementsToProcess[i]);
+ processElement(fElementsToProcess[i]);
+ } catch (CModelException jme) {
+ if (errorsCounter == errors.length) {
+ // resize
+ System.arraycopy(errors, 0, (errors = new ICModelStatus[errorsCounter*2]), 0, errorsCounter);
+ }
+ errors[errorsCounter++] = jme.getCModelStatus();
+ } finally {
+ worked(1);
+ }
+ }
+ done();
+ if (errorsCounter == 1) {
+ throw new CModelException(errors[0]);
+ } else if (errorsCounter > 1) {
+ if (errorsCounter != errors.length) {
+ // resize
+ System.arraycopy(errors, 0, (errors = new ICModelStatus[errorsCounter]), 0, errorsCounter);
+ }
+ throw new CModelException(CModelStatus.newMultiStatus(errors));
+ }
+ }
+
+ /**
+ * Sets the insertion position in the new container for the modified element. The element
+ * being modified will be inserted before the specified new sibling. The given sibling
+ * must be a child of the destination container specified for the modified element.
+ * The default is null
, which indicates that the element is to be
+ * inserted at the end of the container.
+ */
+ public void setInsertBefore(ICElement modifiedElement, ICElement newSibling) {
+ fInsertBeforeElements.put(modifiedElement, newSibling);
+ }
+
+ /**
+ * Sets the new names to use for each element being copied. The renamings
+ * correspond to the elements being processed, and the number of
+ * renamings must match the number of elements being processed.
+ * A null
entry in the list indicates that an element
+ * is not to be renamed.
+ *
+ *
Note that some renamings may not be used. If both a parent
+ * and a child have been selected for copy/move, only the parent
+ * is changed. Therefore, if a new name is specified for the child,
+ * the child's name will not be changed.
+ */
+ public void setRenamings(String[] renamings) {
+ fRenamingsList = renamings;
+ initializeRenamings();
+ }
+
+ /**
+ * This method is called for each ICElement
before
+ * processElement
. It should check that this element
+ * can be processed.
+ */
+ protected abstract void verify(ICElement element) throws CModelException;
+
+ /**
+ * Verifies that the destination
specified for the element
is valid for the types of the
+ * element
and destination
.
+ */
+ protected void verifyDestination(ICElement element, ICElement destination) throws CModelException {
+ if (destination == null || !destination.exists())
+ error(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST, destination);
+
+ }
+
+ /**
+ * Verify that the new name specified for element
is
+ * valid for that type of C element.
+ */
+ protected void verifyRenaming(ICElement element) throws CModelException {
+ String newName = getNewNameFor(element);
+ boolean isValid = true;
+ // Validate the name here.
+ if (newName.indexOf(' ') != -1) {
+ isValid = false;
+ }
+
+ if (!isValid) {
+ throw new CModelException(new CModelStatus(ICModelStatusConstants.INVALID_NAME, element, newName));
+ }
+ }
+
+ /**
+ * Verifies that the positioning sibling specified for the element
is exists and
+ * its parent is the destination container of this element
.
+ */
+ protected void verifySibling(ICElement element, ICElement destination) throws CModelException {
+ ICElement insertBeforeElement = (ICElement) fInsertBeforeElements.get(element);
+ if (insertBeforeElement != null) {
+ if (!insertBeforeElement.exists() || !insertBeforeElement.getParent().equals(destination)) {
+ error(ICModelStatusConstants.INVALID_SIBLING, insertBeforeElement);
+ }
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java
new file mode 100644
index 00000000000..95f4fb7c7b6
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java
@@ -0,0 +1,98 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IParent;
+import org.eclipse.cdt.core.model.CModelException;
+
+public abstract class Parent extends CElement implements IParent {
+
+ protected IResource resource;
+
+ public Parent (ICElement parent, IPath path, int type) {
+ // Check if the file is under the workspace.
+ this (parent, ResourcesPlugin.getWorkspace().getRoot().getFileForLocation (path),
+ path.lastSegment(), type);
+ }
+
+ public Parent (ICElement parent, String name, int type) {
+ this (parent, null, name, type);
+ }
+
+ public Parent (ICElement parent, IResource resource, String name, int type) {
+ super (parent, name, type);
+ this.resource = resource;
+ }
+
+ // members
+
+ /**
+ * Adds a child to the current element.
+ * Implementations override this method to support children
+ */
+ protected void addChild(ICElement member) {
+ getElementInfo().addChild(member);
+ }
+
+ /**
+ * Removes a child to the current element.
+ * Implementations override this method to support children
+ */
+ protected void removeChild(ICElement member) {
+ getElementInfo().removeChild(member);
+ }
+
+ protected void removeChildren () {
+ getElementInfo().removeChildren();
+ }
+
+ /**
+ * Gets the children of this element.
+ * Returns null if the element does not support children
+ * Implementations override this method to support children
+ */
+ public ICElement[] getChildren() {
+ return getElementInfo().getChildren();
+ }
+
+ public boolean hasChildren () {
+ return getElementInfo().hasChildren();
+ }
+
+ public void setUnderlyingResource(IResource res) {
+ resource = res;
+ }
+
+ public IResource getUnderlyingResource() throws CModelException {
+ if (resource == null) {
+ ICElement p = getParent();
+ if (p != null) {
+ return p.getUnderlyingResource();
+ }
+ }
+ return resource;
+ }
+
+ public IResource getCorrespondingResource() throws CModelException {
+ return null;
+ }
+
+ protected void setChanged () {
+ getElementInfo().setChanged();
+ }
+
+ protected boolean hasChanged () {
+ return getElementInfo().hasChanged();
+ }
+
+ protected abstract CElementInfo createElementInfo ();
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/RenameResourceElementsOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/RenameResourceElementsOperation.java
new file mode 100644
index 00000000000..6c4da177eff
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/RenameResourceElementsOperation.java
@@ -0,0 +1,52 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * This operation renames resources (Package fragments and compilation units).
+ *
+ *
Notes:
+ * - When a compilation unit is renamed, its main type and the constructors of the
+ * main type are renamed.
+ *
+ */
+public class RenameResourceElementsOperation extends MoveResourceElementsOperation {
+ /**
+ * When executed, this operation will rename the specified elements with the given names in the
+ * corresponding destinations.
+ */
+ public RenameResourceElementsOperation(ICElement[] elements, ICElement[] destinations, String[] newNames, boolean force) {
+ //a rename is a move to the same parent with a new name specified
+ //these elements are from different parents
+ super(elements, destinations, force);
+ setRenamings(newNames);
+ }
+
+ /**
+ * @see MultiOperation
+ */
+ protected String getMainTaskName() {
+ return "operation.renameResourceProgress"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see CopyResourceElementsOperation#isRename()
+ */
+ protected boolean isRename() {
+ return true;
+ }
+
+ /**
+ * @see MultiOperation
+ */
+ protected void verify(ICElement element) throws CModelException {
+ super.verify(element);
+ verifyRenaming(element);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java
new file mode 100644
index 00000000000..f63247e63b4
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java
@@ -0,0 +1,136 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.ISourceManipulation;
+import org.eclipse.cdt.core.model.ISourceReference;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * Abstract class for C elements which implement ISourceReference.
+ */
+
+public class SourceManipulation extends Parent implements ISourceManipulation, ISourceReference {
+
+ public SourceManipulation(ICElement parent, String name, int type) {
+ super(parent, name, type);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void copy(ICElement container, ICElement sibling, String rename, boolean force,
+ IProgressMonitor monitor) throws CModelException {
+ if (container == null) {
+ throw new IllegalArgumentException("operation.nullContainer"); //$NON-NLS-1$
+ }
+ ICElement[] elements= new ICElement[] {this};
+ ICElement[] containers= new ICElement[] {container};
+ ICElement[] siblings= null;
+ if (sibling != null) {
+ siblings= new ICElement[] {sibling};
+ }
+ String[] renamings= null;
+ if (rename != null) {
+ renamings= new String[] {rename};
+ }
+ getCRoot().copy(elements, containers, siblings, renamings, force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void delete(boolean force, IProgressMonitor monitor) throws CModelException {
+ ICElement[] elements = new ICElement[] {this};
+ getCRoot().delete(elements, force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void move(ICElement container, ICElement sibling, String rename, boolean force,
+ IProgressMonitor monitor) throws CModelException {
+ if (container == null) {
+ throw new IllegalArgumentException("operation.nullContainer"); //$NON-NLS-1$
+ }
+ ICElement[] elements= new ICElement[] {this};
+ ICElement[] containers= new ICElement[] {container};
+ ICElement[] siblings= null;
+ if (sibling != null) {
+ siblings= new ICElement[] {sibling};
+ }
+ String[] renamings= null;
+ if (rename != null) {
+ renamings= new String[] {rename};
+ }
+ getCRoot().move(elements, containers, siblings, renamings, force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void rename(String name, boolean force, IProgressMonitor monitor) throws CModelException {
+ if (name == null) {
+ throw new IllegalArgumentException("element.nullName"); //$NON-NLS-1$
+ }
+ ICElement[] elements= new ICElement[] {this};
+ ICElement[] dests= new ICElement[] {this.getParent()};
+ String[] renamings= new String[] {name};
+ getCRoot().rename(elements, dests, renamings, force, monitor);
+ }
+
+ /**
+ * @see IMember
+ */
+ public ITranslationUnit getTranslationUnit() {
+ return getSourceManipulationInfo().getTranslationUnit();
+ }
+
+ /**
+ * Elements within compilation units and class files have no
+ * corresponding resource.
+ *
+ * @see ICElement
+ */
+ public IResource getCorrespondingResource() throws CModelException {
+ return null;
+ }
+
+ /**
+ * @see ISourceReference
+ */
+ public String getSource() throws CModelException {
+ return getSourceManipulationInfo().getSource();
+ }
+
+ /**
+ * @see ISourceReference
+ */
+ public ISourceRange getSourceRange() throws CModelException {
+ return getSourceManipulationInfo().getSourceRange();
+ }
+
+ /**
+ * @see ICElement
+ */
+ public IResource getUnderlyingResource() throws CModelException {
+ return getParent().getUnderlyingResource();
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new SourceManipulationInfo(this);
+ }
+
+ protected SourceManipulationInfo getSourceManipulationInfo() {
+ return (SourceManipulationInfo)getElementInfo();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulationInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulationInfo.java
new file mode 100644
index 00000000000..64a4d30f72c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulationInfo.java
@@ -0,0 +1,131 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ICModelStatusConstants;
+import org.eclipse.cdt.core.model.CModelException;
+
+/**
+ * Element info for ISourceReference elements.
+ */
+/* package */
+class SourceManipulationInfo extends CElementInfo {
+
+ protected SourceManipulationInfo(CElement element) {
+ super(element);
+ setIsStructureKnown(true);
+ }
+
+ protected ISourceRange getSourceRange() {
+ return new SourceRange(getElement().getStartPos(),
+ getElement().getLength(),
+ getElement().getIdStartPos(),
+ getElement().getIdLength(),
+ getElement().getStartLine(),
+ getElement().getEndLine());
+ }
+
+ /**
+ * @see ISourceReference
+ */
+ public String getSource() throws CModelException {
+ ITranslationUnit tu = getTranslationUnit();
+ if (tu != null) {
+ try {
+ IFile file = ((CFile)tu).getFile();
+ StringBuffer buffer = Util.getContent(file);
+ return buffer.substring(getElement().getStartPos(),
+ getElement().getStartPos() + getElement().getLength());
+ } catch (IOException e) {
+ throw new CModelException(e, ICModelStatusConstants.IO_EXCEPTION);
+ }
+ }
+ return "";
+ }
+
+ /**
+ * @see IMember
+ */
+ public ITranslationUnit getTranslationUnit() {
+ ICElement celem = getElement();
+ for (; celem != null; celem = celem.getParent()) {
+ if (celem instanceof ITranslationUnit)
+ return (ITranslationUnit)celem;
+ }
+ return null;
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void copy(ICElement container, ICElement sibling, String rename, boolean force,
+ IProgressMonitor monitor) throws CModelException {
+ if (container == null) {
+ throw new IllegalArgumentException("operation.nullContainer"); //$NON-NLS-1$
+ }
+ ICElement[] elements= new ICElement[] {getElement()};
+ ICElement[] containers= new ICElement[] {container};
+ ICElement[] siblings= null;
+ if (sibling != null) {
+ siblings= new ICElement[] {sibling};
+ }
+ String[] renamings= null;
+ if (rename != null) {
+ renamings= new String[] {rename};
+ }
+ getElement().getCRoot().copy(elements, containers, siblings, renamings, force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void delete(boolean force, IProgressMonitor monitor) throws CModelException {
+ ICElement[] elements = new ICElement[] {getElement()};
+ getElement().getCRoot().delete(elements, force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void move(ICElement container, ICElement sibling, String rename, boolean force,
+ IProgressMonitor monitor) throws CModelException {
+ if (container == null) {
+ throw new IllegalArgumentException("operation.nullContainer"); //$NON-NLS-1$
+ }
+ ICElement[] elements= new ICElement[] {getElement()};
+ ICElement[] containers= new ICElement[] {container};
+ ICElement[] siblings= null;
+ if (sibling != null) {
+ siblings= new ICElement[] {sibling};
+ }
+ String[] renamings= null;
+ if (rename != null) {
+ renamings= new String[] {rename};
+ }
+ getElement().getCRoot().move(elements, containers, siblings, renamings, force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void rename(String name, boolean force, IProgressMonitor monitor) throws CModelException {
+ if (name == null) {
+ throw new IllegalArgumentException("element.nullName"); //$NON-NLS-1$
+ }
+ ICElement[] elements= new ICElement[] {getElement()};
+ ICElement[] dests= new ICElement[] {getElement().getParent()};
+ String[] renamings= new String[] {name};
+ getElement().getCRoot().rename(elements, dests, renamings, force, monitor);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceRange.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceRange.java
new file mode 100644
index 00000000000..775f6f3d882
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceRange.java
@@ -0,0 +1,91 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ISourceRange;
+
+/**
+ * @see ISourceRange
+ */
+class SourceRange implements ISourceRange {
+
+ protected int startPos, length;
+ protected int idStartPos, idLength;
+ protected int startLine, endLine;
+
+ protected SourceRange(int startPos, int length) {
+ this.startPos = startPos;
+ this.length = length;
+ idStartPos = 0;
+ idLength = 0;
+ startLine = 0;
+ endLine = 0;
+ }
+
+ protected SourceRange(int startPos, int length, int idStartPos, int idLength) {
+ this.startPos = startPos;
+ this.length = length;
+ this.idStartPos = idStartPos;
+ this.idLength = idLength;
+ }
+
+ protected SourceRange(int startPos, int length, int idStartPos, int idLength,
+ int startLine, int endLine) {
+ this.startPos = startPos;
+ this.length = length;
+ this.idStartPos = idStartPos;
+ this.idLength = idLength;
+ this.startLine = startLine;
+ this.endLine = endLine;
+ }
+ /**
+ * @see ISourceRange
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /**
+ * @see ISourceRange
+ */
+ public int getStartPos() {
+ return startPos;
+ }
+
+ /**
+ */
+ public int getIdStartPos() {
+ return idStartPos;
+ }
+
+ public int getIdLength() {
+ return idLength;
+ }
+
+ public int getStartLine() {
+ return startLine;
+ }
+
+ public int getEndLine() {
+ return endLine;
+ }
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[offset="); //$NON-NLS-1$
+ buffer.append(this.startPos);
+ buffer.append(", length="); //$NON-NLS-1$
+ buffer.append(this.length);
+ buffer.append("]"); //$NON-NLS-1$
+
+ buffer.append("[IdOffset="); //$NON-NLS-1$
+ buffer.append(this.idStartPos);
+ buffer.append(", idLength="); //$NON-NLS-1$
+ buffer.append(this.idLength);
+ buffer.append("]"); //$NON-NLS-1$
+ return buffer.toString();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java
new file mode 100644
index 00000000000..0fcaba3179f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java
@@ -0,0 +1,104 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.core.model.IMethod;
+import org.eclipse.cdt.core.model.IField;
+
+public class Structure extends SourceManipulation implements IStructure {
+
+ String [] baseTypes;
+
+ public Structure(ICElement parent, int kind, String name) {
+ super(parent, name, kind);
+ baseTypes = new String[0];
+ }
+
+ public IField[] getFields() {
+ return new IField[0];
+ }
+
+ public IField getField(String name) {
+ return null;
+ }
+
+ public IMethod[] getMethods() {
+ return new IMethod[0];
+ }
+
+ public IMethod getMethod(String name) {
+ return null;
+ }
+
+ public boolean isUnion() {
+ return getElementType() == ICElement.C_UNION;
+ }
+
+ public boolean isClass() {
+ return getElementType() == ICElement.C_CLASS;
+ }
+
+ public boolean isStruct() {
+ return getElementType() == ICElement.C_STRUCT;
+ }
+
+ public boolean isAbstract() {
+ return false;
+ }
+
+ public int getAccessControl() throws CModelException {
+ return 0;
+ }
+
+ /**
+ * Return the inherited structures.
+ * @IInheritance
+ */
+ public IStructure [] getBaseTypes() throws CModelException {
+ return new IStructure[0];
+ }
+
+ /**
+ * Return the access control for each inherited structure.
+ * @IInheritance
+ */
+ public int getAccessControl(int pos) throws CModelException {
+ return 0;
+ }
+
+ /**
+ * @see IVariable
+ */
+ public String getType() {
+ if (isClass())
+ return "class";
+ if (isUnion())
+ return "union";
+ return "struct";
+ }
+
+ /**
+ * @see IVariable
+ */
+ public String getInitializer() {
+ return "";
+ }
+
+ public void addSuperClass(String name) {
+ String[] newBase = new String[baseTypes.length + 1];
+ System.arraycopy(baseTypes, 0, newBase, 0, baseTypes.length);
+ newBase[baseTypes.length] = name;
+ baseTypes = newBase;
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new SourceManipulationInfo(this);
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
new file mode 100644
index 00000000000..f3e9481fd1f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
@@ -0,0 +1,183 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IInclude;
+import org.eclipse.cdt.core.model.IUsing;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.ISourceReference;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.CModelException;
+
+
+/**
+ */
+public class TranslationUnit extends CFile implements ITranslationUnit {
+
+ SourceManipulationInfo sourceManipulationInfo = null;
+
+ public TranslationUnit(ICElement parent, IFile file) {
+ super(parent, file);
+ }
+
+ public TranslationUnit(ICElement parent, IPath path) {
+ super(parent, path);
+ }
+
+ public ITranslationUnit getTranslationUnit () {
+ return this;
+ }
+
+ public IInclude createInclude(String name, ICElement sibling, IProgressMonitor monitor)
+ throws CModelException {
+ return null;
+ }
+
+ public IUsing createUsing(String name, IProgressMonitor monitor) throws CModelException {
+ return null;
+ }
+
+ public ICElement getElementAtLine(int line) throws CModelException {
+ ICElement[] celements = getChildren();
+ for (int i = 0; i < celements.length; i++) {
+ ISourceRange range = ((ISourceReference)celements[i]).getSourceRange();
+ int startLine = range.getStartLine();
+ int endLine = range.getEndLine();
+ if (line >= startLine && line <= endLine) {
+ return celements[i];
+ }
+ }
+ return null;
+ }
+
+ public ICElement getElement(String name ) {
+ ICElement[] celements = getChildren();
+ for (int i = 0; i < celements.length; i++) {
+ if (name.equals(celements[i].getElementName())) {
+ return celements[i];
+ }
+ }
+ return null;
+ }
+
+ public IInclude getInclude(String name) {
+ ICElement[] celements = getChildren();
+ for (int i = 0; i < celements.length; i++) {
+ if (celements[i].getElementType() == ICElement.C_INCLUDE) {
+ if (name.equals(celements[i].getElementName())) {
+ return (IInclude)celements[i];
+ }
+ }
+ }
+ return null;
+ }
+
+ public IInclude[] getIncludes() throws CModelException {
+ ICElement[] celements = getChildren();
+ ArrayList aList = new ArrayList();
+ for (int i = 0; i < celements.length; i++) {
+ if (celements[i].getElementType() == ICElement.C_INCLUDE) {
+ aList.add(celements[i]);
+ }
+ }
+ return (IInclude[])aList.toArray(new IInclude[0]);
+ }
+
+ public IUsing getUsing(String name) {
+ ICElement[] celements = getChildren();
+ for (int i = 0; i < celements.length; i++) {
+ if (celements[i].getElementType() == ICElement.C_USING) {
+ if (name.equals(celements[i].getElementName())) {
+ return (IUsing)celements[i];
+ }
+ }
+ }
+ return null;
+ }
+
+ public IUsing[] getUsings() throws CModelException {
+ ICElement[] celements = getChildren();
+ ArrayList aList = new ArrayList();
+ for (int i = 0; i < celements.length; i++) {
+ if (celements[i].getElementType() == ICElement.C_USING) {
+ aList.add(celements[i]);
+ }
+ }
+ return (IUsing[])aList.toArray(new IUsing[0]);
+ }
+
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void copy(ICElement container, ICElement sibling, String rename, boolean force,
+ IProgressMonitor monitor) throws CModelException {
+ getSourceManipulationInfo().copy(container, sibling, rename, force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void delete(boolean force, IProgressMonitor monitor) throws CModelException {
+ getSourceManipulationInfo().delete(force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void move(ICElement container, ICElement sibling, String rename, boolean force,
+ IProgressMonitor monitor) throws CModelException {
+ getSourceManipulationInfo().move(container, sibling, rename, force, monitor);
+ }
+
+ /**
+ * @see ISourceManipulation
+ */
+ public void rename(String name, boolean force, IProgressMonitor monitor)
+ throws CModelException {
+ getSourceManipulationInfo().rename(name, force, monitor);
+ }
+
+ /**
+ * @see ISourceReference
+ */
+ public String getSource() throws CModelException {
+ return getSourceManipulationInfo().getSource();
+ }
+
+ /**
+ * @see ISourceReference
+ */
+ public ISourceRange getSourceRange() throws CModelException {
+ return getSourceManipulationInfo().getSourceRange();
+ }
+
+ protected TranslationUnitInfo getTranslationUnitInfo() {
+ return (TranslationUnitInfo)getElementInfo();
+ }
+
+ protected SourceManipulationInfo getSourceManipulationInfo() {
+ if (sourceManipulationInfo == null) {
+ sourceManipulationInfo = new SourceManipulationInfo(this);
+ }
+ return sourceManipulationInfo;
+ }
+ protected void parse(InputStream in) {
+ getTranslationUnitInfo().parse(in);
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new TranslationUnitInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnitInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnitInfo.java
new file mode 100644
index 00000000000..3847d6cf809
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnitInfo.java
@@ -0,0 +1,81 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.cdt.internal.parser.CStructurizer;
+
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ICElement;
+
+class TranslationUnitInfo extends CFileInfo {
+
+ /**
+ * The length of this compilation unit's source code String
+ */
+ protected int fSourceLength;
+
+ /**
+ * Timestamp of original resource at the time this element
+ * was opened or last updated.
+ */
+ protected long fTimestamp;
+
+ protected TranslationUnitInfo (CElement element) {
+ super(element);
+ }
+
+ protected boolean hasChildren() {
+ return true;
+ }
+
+ protected ICElement [] getChildren() {
+ if (hasChanged()) {
+ InputStream in = null;
+ try {
+ IResource res = getElement().getUnderlyingResource();
+ if (res != null && res.getType() == IResource.FILE) {
+ in = ((IFile)res).getContents();
+ parse(in);
+ }
+ } catch (CoreException e) {
+ //e.printStackTrace();
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ }
+ return super.getChildren();
+ }
+
+ protected void parse(InputStream in) {
+ try {
+ removeChildren();
+ ModelBuilder modelBuilder= new ModelBuilder((TranslationUnit)getElement());
+ CStructurizer.getCStructurizer().parse(modelBuilder, in);
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ }
+
+ /* Overide the SourceManipulation for the range. */
+ protected ISourceRange getSourceRange() {
+ IPath location = ((TranslationUnit)getElement()).getLocation();
+ return new SourceRange(0, (int)location.toFile().length());
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Util.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Util.java
new file mode 100644
index 00000000000..89f9c8fb8a7
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Util.java
@@ -0,0 +1,117 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+
+public class Util {
+
+ private Util() {
+ }
+
+ public static StringBuffer getContent(IFile file) throws IOException {
+ InputStream stream = null;
+ try {
+ stream = new BufferedInputStream(file.getContents(true));
+ } catch (CoreException e) {
+ throw new IOException(e.getMessage());
+ }
+ try {
+ char [] b = getInputStreamAsCharArray(stream, -1, null);
+ return new StringBuffer(b.length).append(b);
+ } finally {
+ try {
+ if (stream != null)
+ stream.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ /**
+ * Returns the given input stream's contents as a character array.
+ * If a length is specified (ie. if length != -1), only length chars
+ * are returned. Otherwise all chars in the stream are returned.
+ * Note this doesn't close the stream.
+ * @throws IOException if a problem occured reading the stream.
+ */
+ public static char[] getInputStreamAsCharArray(InputStream stream, int length, String encoding)
+ throws IOException {
+ InputStreamReader reader = null;
+ reader = encoding == null
+ ? new InputStreamReader(stream)
+ : new InputStreamReader(stream, encoding);
+ char[] contents;
+ if (length == -1) {
+ contents = new char[0];
+ int contentsLength = 0;
+ int charsRead = -1;
+ do {
+ int available = stream.available();
+
+ // resize contents if needed
+ if (contentsLength + available > contents.length) {
+ System.arraycopy(
+ contents,
+ 0,
+ contents = new char[contentsLength + available],
+ 0,
+ contentsLength);
+ }
+
+ // read as many chars as possible
+ charsRead = reader.read(contents, contentsLength, available);
+
+ if (charsRead > 0) {
+ // remember length of contents
+ contentsLength += charsRead;
+ }
+ } while (charsRead > 0);
+
+ // resize contents if necessary
+ if (contentsLength < contents.length) {
+ System.arraycopy(
+ contents,
+ 0,
+ contents = new char[contentsLength],
+ 0,
+ contentsLength);
+ }
+ } else {
+ contents = new char[length];
+ int len = 0;
+ int readSize = 0;
+ while ((readSize != -1) && (len != length)) {
+ // See PR 1FMS89U
+ // We record first the read size. In this case len is the actual read size.
+ len += readSize;
+ readSize = reader.read(contents, len, length - len);
+ }
+ // See PR 1FMS89U
+ // Now we need to resize in case the default encoding used more than one byte for each
+ // character
+ if (len != length)
+ System.arraycopy(contents, 0, (contents = new char[len]), 0, len);
+ }
+
+ return contents;
+ }
+
+ public static void save (StringBuffer buffer, IFile file) throws CoreException {
+ byte[] bytes = buffer.toString().getBytes();
+ ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+ // use a platform operation to update the resource contents
+ boolean force = true;
+ file.setContents(stream, force, true, null); // record history
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Variable.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Variable.java
new file mode 100644
index 00000000000..13b870457e8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Variable.java
@@ -0,0 +1,36 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IVariable;
+
+public class Variable extends SourceManipulation implements IVariable {
+
+ public Variable(ICElement parent, String name) {
+ super(parent, name, CElement.C_VARIABLE);
+ }
+
+ public String getType() {
+ return "";
+ }
+
+ public String getInitializer() {
+ return "";
+ }
+
+ public int getAccessControl() {
+ return getVariableInfo().getAccessControl();
+ }
+
+ protected VariableInfo getVariableInfo() {
+ return (VariableInfo)getElementInfo();
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new VariableInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
new file mode 100644
index 00000000000..bc3fb29c075
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
@@ -0,0 +1,28 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IVariableDeclaration;
+
+public class VariableDeclaration extends SourceManipulation implements IVariableDeclaration {
+
+ public VariableDeclaration(ICElement parent, String name) {
+ super(parent, name, CElement.C_VARIABLE_DECLARATION);
+ }
+
+ public String getType() {
+ return "";
+ }
+
+ public int getAccesControl() {
+ return 0;
+ }
+
+ protected CElementInfo createElementInfo () {
+ return new SourceManipulationInfo(this);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java
new file mode 100644
index 00000000000..14ebea22877
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java
@@ -0,0 +1,24 @@
+package org.eclipse.cdt.internal.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+class VariableInfo extends SourceManipulationInfo {
+
+ protected int flags;
+
+ protected VariableInfo (CElement element) {
+ super(element);
+ flags = 0;
+ }
+
+ protected int getAccessControl() {
+ return flags;
+ }
+
+ protected void setAccessControl(int flags) {
+ this.flags = flags;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/plugin.properties b/core/org.eclipse.cdt.core/plugin.properties
new file mode 100644
index 00000000000..6a5e3be2c8b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/plugin.properties
@@ -0,0 +1,12 @@
+#########################################
+# (c) Copyright IBM Corp. 2000, 2001.
+# All Rights Reserved.
+#########################################
+
+pluginName=C Development Tools Core
+
+cnature.name=C Nature
+ccnature.name=C++ Nature
+CProblemMarker.name=C Problem
+CBuildCommand.name=C Builder Command
+
diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml
new file mode 100644
index 00000000000..a3938f93df8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/plugin.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/BuildInfoFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/BuildInfoFactory.java
new file mode 100644
index 00000000000..571bed230af
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/BuildInfoFactory.java
@@ -0,0 +1,169 @@
+package org.eclipse.cdt.core;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.QualifiedName;
+
+import org.eclipse.cdt.core.resources.IBuildInfo;
+import org.eclipse.cdt.core.resources.IPropertyStore;
+import org.eclipse.cdt.internal.CCorePlugin;
+
+public class BuildInfoFactory {
+ public static final String LOCATION = "buildLocation";
+ public static final String FULL_ARGUMENTS = "buildFullArguments";
+ public static final String INCREMENTAL_ARGUMENTS = "buildIncrementalArguments";
+ public static final String STOP_ON_ERROR = "stopOnError";
+ public static final String CLEAR_CONSOLE = "clearConsole";
+ public static final String DEFAULT_BUILD_CMD = "useDefaultBuildCmd";
+
+ public static abstract class Store implements IBuildInfo {
+ public String getBuildLocation() {
+ if ( isDefaultBuildCmd() ) {
+ Plugin plugin = CCorePlugin.getDefaultPlugin();
+ if (plugin != null) {
+ IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint("CBuildCommand");
+ if (extension != null) {
+ IExtension[] extensions = extension.getExtensions();
+ for(int i = 0; i < extensions.length; i++){
+ IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
+ for(int j = 0; j < configElements.length; j++){
+ String command = configElements[j].getAttribute("command"); //$NON-NLS-1$
+ if (command != null)
+ return command;
+ }
+ }
+ }
+ }
+ return "make";
+ }
+ return getString(LOCATION);
+ }
+
+ public String getFullBuildArguments() {
+ return getString(FULL_ARGUMENTS);
+ }
+
+ public String getIncrementalBuildArguments() {
+ return getString(INCREMENTAL_ARGUMENTS);
+ }
+
+ public boolean isStopOnError() {
+ return getBoolean(STOP_ON_ERROR);
+ }
+
+ public void setBuildLocation(String location) {
+ putValue(LOCATION, location);
+ }
+
+ public void setFullBuildArguments(String arguments) {
+ putValue(FULL_ARGUMENTS, arguments);
+ }
+
+ public void setIncrementalBuildArguments(String arguments) {
+ putValue(INCREMENTAL_ARGUMENTS, arguments);
+ }
+
+ public void setStopOnError(boolean on) {
+ putValue(STOP_ON_ERROR, new Boolean(on).toString());
+ }
+
+ public boolean isDefaultBuildCmd() {
+ if ( getString(DEFAULT_BUILD_CMD) == null ) { // if no property then default to true
+ return true;
+ }
+ return getBoolean(DEFAULT_BUILD_CMD);
+ }
+
+ public void setUseDefaultBuildCmd(boolean on) {
+ putValue(DEFAULT_BUILD_CMD, new Boolean(on).toString());
+ }
+
+ public boolean isClearBuildConsole() {
+ return getBoolean(CLEAR_CONSOLE);
+ }
+
+ public boolean getBoolean(String property) {
+ return Boolean.valueOf(getString(property)).booleanValue();
+ }
+
+ public void putValue(String name, String value) {
+ }
+
+ public String getString(String property) {
+ return null;
+ }
+
+ }
+
+ public static class Preference extends Store {
+ IPropertyStore prefs;
+
+ public Preference() {
+ prefs = CCorePlugin.getDefault().getPropertyStore();
+ }
+
+ public void putValue(String name, String value) {
+ prefs.putValue(name, value);
+ }
+
+ public String getString(String property) {
+ return prefs.getString(property);
+ }
+
+ public void setDefault(String name, String def) {
+ prefs.setDefault(name, def);
+ }
+ }
+
+ public static class Property extends Store {
+ private IResource resource;
+
+ public Property(IResource resource) {
+ this.resource = resource;
+ }
+
+ public void putValue(String name, String value) {
+ QualifiedName qName = new QualifiedName(CCorePlugin.PLUGIN_ID, name);
+ try {
+ resource.setPersistentProperty(qName, value);
+ } catch (CoreException e) {
+ }
+ }
+
+ public String getString(String property) {
+ QualifiedName qName = new QualifiedName(CCorePlugin.PLUGIN_ID, property);
+ try {
+ return resource.getPersistentProperty(qName);
+ } catch (CoreException e) {
+ }
+ return null;
+ }
+
+ public void setDefault(String name, String def) {
+ }
+
+ public boolean isClearBuildConsole() {
+ return (new Preference()).isClearBuildConsole();
+ }
+ }
+
+ public static IBuildInfo create() {
+ return new BuildInfoFactory.Preference();
+ }
+
+ public static IBuildInfo create(IProject project) {
+ return new BuildInfoFactory.Property(project);
+ }
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java
new file mode 100644
index 00000000000..2ec9216ce35
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java
@@ -0,0 +1,24 @@
+package org.eclipse.cdt.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.cdt.internal.CCorePlugin;
+import org.eclipse.cdt.core.*;
+
+
+public class CCProjectNature extends CProjectNature {
+
+ public static final String CC_NATURE_ID= CCorePlugin.PLUGIN_ID + ".ccnature";
+
+ public static void addCCNature(IProject project, IProgressMonitor mon) throws CoreException {
+ addNature(project, CC_NATURE_ID, mon);
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java
new file mode 100644
index 00000000000..e687a7c404c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java
@@ -0,0 +1,280 @@
+package org.eclipse.cdt.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Plugin;
+
+import org.eclipse.cdt.core.resources.IBuildInfo;
+import org.eclipse.cdt.internal.CCorePlugin;
+import org.eclipse.cdt.core.*;
+
+
+
+public class CProjectNature implements IProjectNature {
+
+ public static final String BUILDER_NAME= "cbuilder";
+ public static final String BUILDER_ID= CCorePlugin.PLUGIN_ID + "." + BUILDER_NAME;
+ public static final String C_NATURE_ID= CCorePlugin.PLUGIN_ID + ".cnature";
+
+ private IProject fProject;
+ private IBuildInfo fBuildInfo;
+
+ public CProjectNature() {
+ }
+
+ public CProjectNature(IProject project) {
+ setProject(project);
+ }
+
+ public static void addCNature(IProject project, IProgressMonitor mon) throws CoreException {
+ addNature(project, C_NATURE_ID, mon);
+ }
+
+ /**
+ * Utility method for adding a nature to a project.
+ *
+ * @param proj the project to add the nature
+ * @param natureId the id of the nature to assign to the project
+ * @param monitor a progress monitor to indicate the duration of the operation, or
+ * null
if progress reporting is not required.
+ *
+ */
+ public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
+ IProjectDescription description = project.getDescription();
+ String[] prevNatures= description.getNatureIds();
+ for (int i= 0; i < prevNatures.length; i++) {
+ if (natureId.equals(prevNatures[i]))
+ return;
+ }
+ String[] newNatures= new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+ newNatures[prevNatures.length]= natureId;
+ description.setNatureIds(newNatures);
+ project.setDescription(description, monitor);
+ }
+
+
+ /**
+ * Sets the path of the build command executable.
+ */
+ public void setBuildCommand(IPath locationPath, IProgressMonitor monitor) throws CoreException {
+ String newLocation= locationPath.toString();
+ String oldLocation= fBuildInfo.getBuildLocation();
+ if (!newLocation.equals(oldLocation)) {
+ fBuildInfo.setBuildLocation(newLocation);
+ }
+ }
+
+ /**
+ * Gets the path of the build command executable.
+ */
+ public IPath getBuildCommand() throws CoreException {
+ String buildLocation= fBuildInfo.getBuildLocation();
+ return new Path(buildLocation);
+ }
+
+ /**
+ * Sets the arguments for the full build.
+ */
+ public void setFullBuildArguments(String arguments, IProgressMonitor monitor) throws CoreException {
+ String oldArguments= fBuildInfo.getFullBuildArguments();
+ if (!arguments.equals(oldArguments)) {
+ fBuildInfo.setFullBuildArguments(arguments);
+ }
+ }
+
+ /**
+ * Gets the arguments for the full build
+ */
+ public String getFullBuildArguments() throws CoreException {
+ String buildArguments= fBuildInfo.getFullBuildArguments();
+ if (buildArguments == null) {
+ buildArguments= "";
+ }
+ return buildArguments;
+ }
+
+ /**
+ * Sets the arguments for the incremental build.
+ */
+ public void setIncrBuildArguments(String arguments, IProgressMonitor monitor) throws CoreException {
+ String oldArguments= fBuildInfo.getIncrementalBuildArguments();
+ if (!arguments.equals(oldArguments)) {
+ fBuildInfo.setIncrementalBuildArguments(arguments);
+ }
+ }
+
+ /**
+ * Gets the arguments for the incremental build
+ */
+ public String getIncrBuildArguments() throws CoreException {
+ String buildArguments= fBuildInfo.getIncrementalBuildArguments();
+ if (buildArguments == null) {
+ buildArguments= "";
+ }
+ return buildArguments;
+ }
+
+ /**
+ * Sets Stop on Error
+ */
+ public void setStopOnError(boolean on) throws CoreException {
+ boolean oldArgument= fBuildInfo.isStopOnError();
+ if (on != oldArgument) {
+ fBuildInfo.setStopOnError(on);
+ }
+ }
+
+ public void setBuildCommandOverride(boolean on) throws CoreException {
+ boolean oldArgument= fBuildInfo.isDefaultBuildCmd();
+ if (on != oldArgument) {
+ fBuildInfo.setUseDefaultBuildCmd(on);
+ }
+ }
+
+ /**
+ * Gets Stop on Error
+ */
+ public boolean isStopOnError() throws CoreException {
+ return fBuildInfo.isStopOnError();
+ }
+
+ public boolean isDefaultBuildCmd() throws CoreException {
+ return fBuildInfo.isDefaultBuildCmd();
+ }
+
+ public static boolean hasCBuildSpec(IProject project) {
+ boolean found= false;
+ try {
+ IProjectDescription description = project.getDescription();
+ ICommand[] commands= description.getBuildSpec();
+ for (int i= 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(BUILDER_ID)) {
+ found= true;
+ break;
+ }
+ }
+ } catch (CoreException e) {
+ }
+ return found;
+ }
+
+ public void addCBuildSpec(IProgressMonitor mon) throws CoreException {
+ addToBuildSpec(getBuilderID(), mon);
+ }
+
+ public static void addCBuildSpec(IProject project, IProgressMonitor mon) throws CoreException {
+ addToBuildSpec(project, getBuilderID(), mon);
+ }
+
+ public void addToBuildSpec(String builderID, IProgressMonitor mon) throws CoreException {
+ addToBuildSpec(getProject(), builderID, mon);
+ }
+
+ /**
+ * Adds a builder to the build spec for the given project.
+ */
+ public static void addToBuildSpec(IProject project, String builderID, IProgressMonitor mon) throws CoreException {
+ IProjectDescription description= project.getDescription();
+ ICommand[] commands= description.getBuildSpec();
+ boolean found= false;
+ for (int i= 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(builderID)) {
+ found= true;
+ break;
+ }
+ }
+ if (!found) {
+ ICommand command= description.newCommand();
+ command.setBuilderName(builderID);
+ ICommand[] newCommands= new ICommand[commands.length + 1];
+ // Add it before other builders. See 1FWJK7I: ITPJCORE:WIN2000
+ System.arraycopy(commands, 0, newCommands, 1, commands.length);
+ newCommands[0]= command;
+ description.setBuildSpec(newCommands);
+ project.setDescription(description, mon);
+ }
+ }
+
+ public void removeCBuildSpec(IProgressMonitor mon) throws CoreException {
+ removeFromBuildSpec(getBuilderID(), mon);
+ }
+
+ /**
+ * Removes the given builder from the build spec for the given project.
+ */
+ public void removeFromBuildSpec(String builderID, IProgressMonitor mon) throws CoreException {
+ IProjectDescription description= getProject().getDescription();
+ ICommand[] commands= description.getBuildSpec();
+ for (int i= 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(builderID)) {
+ ICommand[] newCommands= new ICommand[commands.length - 1];
+ System.arraycopy(commands, 0, newCommands, 0, i);
+ System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
+ description.setBuildSpec(newCommands);
+ return;
+ }
+ }
+ getProject().setDescription(description, mon);
+ }
+
+ /**
+ * Get the correct builderID
+ */
+ public static String getBuilderID() {
+ Plugin plugin = (Plugin)CCorePlugin.getDefault();
+ IPluginDescriptor descriptor = plugin.getDescriptor();
+ if (descriptor.getExtension(BUILDER_NAME) != null) {
+ return descriptor.getUniqueIdentifier() + "." + BUILDER_NAME;
+ }
+ return BUILDER_ID;
+ }
+
+ /**
+ * @see IProjectNature#configure
+ */
+ public void configure() throws CoreException {
+ addToBuildSpec(getBuilderID(), null);
+ IBuildInfo info = BuildInfoFactory.create();
+ fBuildInfo.setBuildLocation(info.getBuildLocation());
+ fBuildInfo.setFullBuildArguments("");
+ fBuildInfo.setIncrementalBuildArguments("");
+ }
+
+ /**
+ * @see IProjectNature#deconfigure
+ */
+ public void deconfigure() throws CoreException {
+ removeFromBuildSpec(getBuilderID(), null);
+ fBuildInfo.setBuildLocation(null);
+ fBuildInfo.setFullBuildArguments(null);
+ fBuildInfo.setIncrementalBuildArguments(null);
+ }
+
+ /**
+ * @see IProjectNature#getProject
+ */
+ public IProject getProject() {
+ return fProject;
+ }
+
+ /**
+ * @see IProjectNature#setProject
+ */
+ public void setProject(IProject project) {
+ fProject= project;
+ fBuildInfo = BuildInfoFactory.create(fProject);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java
new file mode 100644
index 00000000000..12322b76dfa
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java
@@ -0,0 +1,167 @@
+package org.eclipse.cdt.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import java.util.Properties;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.cdt.utils.spawner.EnvironmentReader;
+import org.eclipse.cdt.utils.spawner.ProcessFactory;
+import org.eclipse.cdt.internal.core.*;
+
+
+public class CommandLauncher {
+
+ public final static int COMMAND_CANCELED= 1;
+ public final static int ILLEGAL_COMMAND= -1;
+ public final static int OK= 0;
+
+ protected Process fProcess;
+ protected boolean fShowCommand;
+ protected String[] fCommandArgs;
+
+ protected String fErrorMessage;
+
+ /**
+ * The number of milliseconds to pause
+ * between polling.
+ */
+ protected static final long DELAY = 50L;
+
+ /**
+ * Creates a new launcher
+ * Fills in stderr and stdout output to the given streams.
+ * Streams can be set to null
, if output not required
+ */
+ public CommandLauncher() {
+ fProcess= null;
+ fShowCommand= false;
+ }
+
+ /**
+ * Sets if the command should be printed out first before executing
+ */
+ public void showCommand(boolean show) {
+ fShowCommand= show;
+ }
+
+ public String getErrorMessage() {
+ return fErrorMessage;
+ }
+
+ public String[] getCommandArgs() {
+ return fCommandArgs;
+ }
+
+ public Properties getEnvironment() {
+ return EnvironmentReader.getEnvVars();
+ }
+
+ /**
+ * Constructs a command array that will be passed to the process
+ */
+ protected String[] constructCommandArray(String command, String[] commandArgs) {
+ String[] args = new String[1 + commandArgs.length];
+ args[0] = command;
+ System.arraycopy(commandArgs, 0, args, 1, commandArgs.length);
+ return args;
+ }
+
+ /**
+ * Execute a command
+ */
+ public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory) {
+ try {
+ // add platform specific arguments (shell invocation)
+ fCommandArgs= constructCommandArray(commandPath.toOSString(), args);
+ fProcess= ProcessFactory.getFactory().exec(fCommandArgs, env, changeToDirectory.toFile());
+ fErrorMessage= "";
+ } catch (IOException e) {
+ fErrorMessage= e.getMessage();
+ fProcess= null;
+ }
+ return fProcess;
+ }
+
+ /**
+ * Reads output form the process to the streams.
+ */
+ public int waitAndRead(OutputStream out, OutputStream err) {
+ if (fShowCommand) {
+ printCommandLine(fCommandArgs, out);
+ }
+
+ if (fProcess == null) {
+ return ILLEGAL_COMMAND;
+ }
+
+ ProcessClosure closure= new ProcessClosure(fProcess, out, err);
+ closure.runBlocking(); // a blocking call
+ return OK;
+ }
+
+ /**
+ * Reads output form the process to the streams. A progress monitor is polled to
+ * test if the cancel button has been pressed.
+ * Destroys the process if the monitor becomes canceled
+ * override to implement a different way to read the process inputs
+ */
+ public int waitAndRead(OutputStream out, OutputStream err, IProgressMonitor monitor) {
+ if (fShowCommand) {
+ printCommandLine(fCommandArgs, out);
+ }
+
+ if (fProcess == null) {
+ return ILLEGAL_COMMAND;
+ }
+
+ ProcessClosure closure= new ProcessClosure(fProcess, out, err);
+ closure.runNonBlocking();
+ while (!monitor.isCanceled() && closure.isAlive()) {
+ try {
+ Thread.sleep(DELAY);
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ int state = OK;
+
+ // Operation canceled by the user, terminate abnormally.
+ if (monitor.isCanceled()) {
+ closure.terminate();
+ state = COMMAND_CANCELED;
+ }
+
+ try {
+ fProcess.waitFor();
+ } catch (InterruptedException e) {
+ //System.err.println("Closure exception " +e);
+ //e.printStackTrace();
+ }
+
+ return state;
+ }
+
+ protected void printCommandLine(String[] commandArgs, OutputStream os) {
+ if (os != null) {
+ StringBuffer buf= new StringBuffer();
+ for (int i= 0; i < commandArgs.length; i++) {
+ buf.append(commandArgs[i]);
+ buf.append(' ');
+ }
+ buf.append('\n');
+ try {
+ os.write(buf.toString().getBytes());
+ os.flush();
+ } catch (IOException e) {
+ // ignore;
+ }
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ConsoleOutputStream.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ConsoleOutputStream.java
new file mode 100644
index 00000000000..d54770c55b4
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ConsoleOutputStream.java
@@ -0,0 +1,73 @@
+package org.eclipse.cdt.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+
+/**
+ * Output stream which storing the console output
+ */
+public class ConsoleOutputStream extends OutputStream {
+
+ protected StringBuffer fBuffer;
+
+ protected StringBuffer fContent;
+
+ protected int pos;
+
+ public ConsoleOutputStream() {
+ fBuffer= new StringBuffer(256);
+ fContent= new StringBuffer();
+ pos = 0;
+ }
+
+ /**
+ * @see OutputStream#flush
+ */
+ public synchronized void flush() throws IOException {
+ final String content= fBuffer.toString();
+ fBuffer.setLength(0);
+ fContent.append(content);
+ }
+
+ public String getContent(int len) {
+ String s = null;
+ try {
+ s = fContent.substring (len);
+ } catch (StringIndexOutOfBoundsException e) {
+ s = "";
+ }
+ return s;
+ }
+
+ public String getContent() {
+ // return fContent.toString();
+ if (pos >= fContent.length())
+ pos = 0;
+ String s = getContent(pos);
+ pos += s.length();
+ return s;
+ }
+
+ public void clear() {
+ fBuffer.setLength (0);
+ fContent.setLength (0);
+ pos = 0;
+ }
+
+ /**
+ * Implements buffered output at the lowest level
+ * @see OutputStream#write
+ */
+ public synchronized void write(int c) throws IOException {
+ fBuffer.append((char) c);
+ if (fBuffer.length() > 250) {
+ flush();
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java
new file mode 100644
index 00000000000..1c8e6bbee12
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java
@@ -0,0 +1,50 @@
+package org.eclipse.cdt.core.resources;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+
+import org.eclipse.cdt.core.model.ICModelMarker;
+import org.eclipse.cdt.internal.CCorePlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IMarker;
+
+public abstract class ACBuilder extends IncrementalProjectBuilder {
+
+ /**
+ * Constructor for ACBuilder
+ */
+ public ACBuilder() {
+ super();
+ }
+
+ /*
+ * callback from Output Parser
+ */
+ //public void addMarker(IFile file, int lineNumber, String errorDesc, int severity) {
+ public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
+ try {
+ IMarker marker= file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
+ marker.setAttribute(IMarker.LOCATION, lineNumber);
+ marker.setAttribute(IMarker.MESSAGE, errorDesc);
+ marker.setAttribute(IMarker.SEVERITY, severity);
+ marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
+ marker.setAttribute(IMarker.CHAR_START, -1);
+ marker.setAttribute(IMarker.CHAR_END, -1);
+ if(errorVar != null) {
+ marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, errorVar);
+ }
+ } catch (CoreException e) {
+ CCorePlugin.log(e.getStatus());
+ }
+
+ }
+
+ public abstract IPath getWorkingDirectory();
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IBuildInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IBuildInfo.java
new file mode 100644
index 00000000000..4c3c1f49c6a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IBuildInfo.java
@@ -0,0 +1,25 @@
+package org.eclipse.cdt.core.resources;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+public interface IBuildInfo {
+
+ String getBuildLocation();
+ String getFullBuildArguments();
+ String getIncrementalBuildArguments();
+ boolean isStopOnError();
+
+ void setBuildLocation(String location);
+ void setFullBuildArguments(String arguments);
+ void setIncrementalBuildArguments(String arguments);
+ void setStopOnError(boolean on);
+
+ boolean isClearBuildConsole();
+
+ boolean isDefaultBuildCmd();
+ void setUseDefaultBuildCmd(boolean on);
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ICPlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ICPlugin.java
new file mode 100644
index 00000000000..29599c55896
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ICPlugin.java
@@ -0,0 +1,15 @@
+package org.eclipse.cdt.core.resources;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IAdaptable;
+
+public interface ICPlugin extends IAdaptable {
+ IMessageDialog getMessageDialog();
+ IPropertyStore getPropertyStore();
+ IConsole getConsole();
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IConsole.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IConsole.java
new file mode 100644
index 00000000000..7355b0e271d
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IConsole.java
@@ -0,0 +1,15 @@
+package org.eclipse.cdt.core.resources;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.ConsoleOutputStream;
+
+
+public interface IConsole {
+ void clear();
+ ConsoleOutputStream getOutputStream();
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IMessageDialog.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IMessageDialog.java
new file mode 100644
index 00000000000..18513b26e04
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IMessageDialog.java
@@ -0,0 +1,12 @@
+package org.eclipse.cdt.core.resources;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+public interface IMessageDialog {
+ void openError(String title, String message);
+
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPropertyStore.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPropertyStore.java
new file mode 100644
index 00000000000..13fdaf516cc
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/IPropertyStore.java
@@ -0,0 +1,24 @@
+package org.eclipse.cdt.core.resources;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+public interface IPropertyStore {
+ public static final boolean BOOLEAN_DEFAULT_DEFAULT = false;
+ public static final double DOUBLE_DEFAULT_DEFAULT = 0.0;
+ public static final float FLOAT_DEFAULT_DEFAULT = 0.0f;
+ public static final int INT_DEFAULT_DEFAULT = 0;
+ public static final long LONG_DEFAULT_DEFAULT = 0L;
+ public static final String STRING_DEFAULT_DEFAULT = new String();
+
+ public static final String TRUE = "true";
+ public static final String FALSE = "false";
+
+ String getString(String name);
+ void setDefault(String name, String def);
+ void putValue(String name, String value);
+
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/MakeUtil.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/MakeUtil.java
new file mode 100644
index 00000000000..be855aa1c18
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/MakeUtil.java
@@ -0,0 +1,171 @@
+package org.eclipse.cdt.core.resources;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+
+public class MakeUtil {
+
+ final static String MAKE_GOALS = "goals";
+ final static String MAKE_DIR = "buildir";
+ final static String MAKE_CONSOLE_MODE = "consoleMode";
+ final static String TARGET_ID = "org.eclipse.cdt.make";
+
+ public static String [] decodeTargets (String property) {
+ BufferedReader reader= new BufferedReader(new StringReader(property));
+ ArrayList l= new ArrayList(5);
+ try {
+ String line= reader.readLine();
+ while (line != null && !"".equals(line)) {
+ l.add(line);
+ line = reader.readLine();
+ }
+ } catch (IOException e) {
+ // this should not happen, we're reading from a string.
+ }
+ String[]result = new String[l.size ()];
+ return (String[])l.toArray(result);
+ }
+
+ public static String encodeTargets(String[] targets) {
+ StringBuffer buf = new StringBuffer();
+ for (int i= 0; i < targets.length; i++) {
+ if (targets[i] != null) {
+ buf.append(targets[i]);
+ buf.append("\n");
+ }
+ }
+ return (buf.length () == 0) ? null : buf.toString();
+ }
+
+ public static QualifiedName getQualifiedNameTarget () {
+ return new QualifiedName(TARGET_ID, MAKE_GOALS);
+ }
+
+ public static QualifiedName getQualifiedNameDir () {
+ return new QualifiedName(TARGET_ID, MAKE_DIR);
+ }
+
+ public static QualifiedName getQualifiedNameConsoleMode () {
+ return new QualifiedName(TARGET_ID, MAKE_CONSOLE_MODE);
+ }
+
+
+ public static String getSessionTarget(IResource resource) {
+ try {
+ String property = (String)resource.getSessionProperty(getQualifiedNameTarget());
+ if (property != null)
+ return property;
+ } catch (CoreException e) {
+ }
+ return new String();
+ }
+
+ public static void setSessionTarget(IResource resource, String target) {
+ try {
+ resource.setSessionProperty(getQualifiedNameTarget(), target);
+ } catch (CoreException e) {
+ }
+ }
+
+ public static void removeSessionTarget(IResource resource) {
+ setSessionTarget (resource, null);
+ }
+
+ public static String getSessionBuildDir(IResource resource) {
+ try {
+ String dir = (String)resource.getSessionProperty(getQualifiedNameDir());
+ if (dir != null)
+ return dir;
+ } catch (CoreException e) {
+ }
+ return new String ();
+ }
+
+ public static void setSessionBuildDir(IResource resource, String dir) {
+ try {
+ resource.setSessionProperty(getQualifiedNameDir(), dir);
+ } catch (CoreException e) {
+ }
+ }
+
+ public static void removeSessionBuildDir(IResource resource) {
+ setSessionBuildDir (resource, null);
+ }
+
+ public static String[] getPersistentTargets(IResource resource) {
+ try {
+ String property = resource.getPersistentProperty(getQualifiedNameTarget());
+ if (property != null)
+ return decodeTargets (property);
+ } catch (CoreException e) {
+ }
+ return new String[0];
+ }
+
+ public static void setPersistentTargets(IResource resource, String[] targets) {
+ String property= null;
+ if (targets != null)
+ property = encodeTargets(targets);
+ //System.out.println ("PROPERTY " + property);
+ try {
+ resource.setPersistentProperty(getQualifiedNameTarget(), property);
+ } catch (CoreException e) {
+ }
+ }
+
+ public static void setSessionConsoleMode(IResource resource, boolean mode) {
+ try {
+ resource.setSessionProperty(getQualifiedNameConsoleMode(),
+ new Boolean(mode));
+ } catch (CoreException e) {
+ }
+ }
+
+ public static boolean getSessionConsoleMode(IResource resource) {
+ try {
+ Boolean b = (Boolean)resource.getSessionProperty(getQualifiedNameConsoleMode());
+ if(null != b)
+ return b.booleanValue();
+ } catch (CoreException e) {
+ }
+ return true; // Clean console before session
+ }
+
+ public static void addPersistentTarget(IResource resource, String target) {
+ String[] targets = MakeUtil.getPersistentTargets (resource);
+ for (int i = 0; i < targets.length; i++) {
+ if (targets[i].equals (target)) {
+ return;
+ }
+ }
+ String[] newTargets = new String[targets.length + 1];
+ System.arraycopy (targets, 0, newTargets, 0, targets.length);
+ newTargets[targets.length] = target;
+ MakeUtil.setPersistentTargets (resource, newTargets);
+ }
+
+ public static void removePersistentTarget (IResource resource, String target) {
+ String[] targets = MakeUtil.getPersistentTargets (resource);
+ String[] newTargets = new String[targets.length];
+ for (int i = 0; i < targets.length; i++) {
+ if (! targets[i].equals (target)) {
+ newTargets[i] = targets[i];
+ }
+ }
+ MakeUtil.setPersistentTargets (resource, newTargets);
+ }
+
+ private MakeUtil() {
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/AbstractPlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/AbstractPlugin.java
new file mode 100644
index 00000000000..754f0d65650
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/AbstractPlugin.java
@@ -0,0 +1,247 @@
+package org.eclipse.cdt.internal;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.resources.*;
+import org.eclipse.core.runtime.*;
+import java.net.*;
+import java.io.*;
+import java.util.*;
+
+/**
+ * Abstract base class for plug-ins that integrate with the Eclipse platform UI.
+ *
+ * Subclasses obtain the following capabilities:
+ *
+ *
+ * Preferences
+ *
+ * - Preferences are read the first time
getPreferenceStore
is
+ * called.
+ * - Preferences are found in the file whose name is given by the constant
+ *
FN_PREF_STORE
. A preference file is looked for in the plug-in's
+ * read/write state area.
+ * - Subclasses should reimplement
initializeDefaultPreferences
+ * to set up any default values for preferences. These are the values
+ * typically used if the user presses the Default button in a preference
+ * dialog.
+ * - The plug-in's install directory is checked for a file whose name is given by
+ *
FN_DEFAULT_PREFERENCES
.
+ * This allows a plug-in to ship with a read-only copy of a preference file
+ * containing default values for certain settings different from the
+ * hard-wired default ones (perhaps as a result of localizing, or for a
+ * common configuration).
+ * - Plug-in code can call
savePreferenceStore
to cause
+ * non-default settings to be saved back to the file in the plug-in's
+ * read/write state area.
+ * - Preferences are also saved automatically on plug-in shutdown.
+ *
+ * Dialogs
+ *
+ * - Dialog store are read the first time
getDialogSettings
is
+ * called.
+ * - The dialog store allows the plug-in to "record" important choices made
+ * by the user in a wizard or dialog, so that the next time the
+ * wizard/dialog is used the widgets can be defaulted to better values. A
+ * wizard could also use it to record the last 5 values a user entered into
+ * an editable combo - to show "recent values".
+ * - The dialog store is found in the file whose name is given by the
+ * constant
FN_DIALOG_STORE
. A dialog store file is first
+ * looked for in the plug-in's read/write state area; if not found there,
+ * the plug-in's install directory is checked.
+ * This allows a plug-in to ship with a read-only copy of a dialog store
+ * file containing initial values for certain settings.
+ * - Plug-in code can call
saveDialogSettings
to cause settings to
+ * be saved in the plug-in's read/write state area. A plug-in may opt to do
+ * this each time a wizard or dialog is closed to ensure the latest
+ * information is always safe on disk.
+ * - Dialog settings are also saved automatically on plug-in shutdown.
+ *
+ * Images
+ *
+ * - A typical UI plug-in will have some images that are used very frequently
+ * and so need to be cached and shared. The plug-in's image registry
+ * provides a central place for a plug-in to store its common images.
+ * Images managed by the registry are created lazily as needed, and will be
+ * automatically disposed of when the plug-in shuts down. Note that the
+ * number of registry images should be kept to a minimum since many OSs
+ * have severe limits on the number of images that can be in memory at once.
+ *
+ *
+ * For easy access to your plug-in object, use the singleton pattern. Declare a
+ * static variable in your plug-in class for the singleton. Store the first
+ * (and only) instance of the plug-in class in the singleton when it is created.
+ * Then access the singleton when needed through a static getDefault
+ * method.
+ *
+ */
+public abstract class AbstractPlugin extends Plugin
+{
+ /**
+ * The name of the preference storage file (value
+ * "pref_store.ini"
).
+ */
+ private static final String FN_PREF_STORE= "pref_store.ini";//$NON-NLS-1$
+ /**
+ * The name of the default preference settings file (value
+ * "preferences.ini"
).
+ */
+ private static final String FN_DEFAULT_PREFERENCES= "preferences.ini";//$NON-NLS-1$
+
+ /**
+ * Storage for preferences; null
if not yet initialized.
+ */
+ private PreferenceStore preferenceStore = null;
+
+/**
+ * Creates an abstract plug-in runtime object for the given plug-in descriptor.
+ *
+ * Note that instances of plug-in runtime classes are automatically created
+ * by the platform in the course of plug-in activation.
+ *
+ *
+ * @param descriptor the plug-in descriptor
+ */
+public AbstractPlugin(IPluginDescriptor descriptor) {
+ super(descriptor);
+}
+
+/**
+ * Returns the preference store for this UI plug-in.
+ * This preference store is used to hold persistent settings for this plug-in in
+ * the context of a workbench. Some of these settings will be user controlled,
+ * whereas others may be internal setting that are never exposed to the user.
+ *
+ * If an error occurs reading the preference store, an empty preference store is
+ * quietly created, initialized with defaults, and returned.
+ *
+ *
+ * Subclasses should reimplement initializeDefaultPreferences
if
+ * they have custom graphic images to load.
+ *
+ *
+ * @return the preference store
+ */
+public IPropertyStore getPreferenceStore() {
+ if (preferenceStore == null) {
+ loadPreferenceStore();
+ initializeDefaultPreferences(preferenceStore);
+ initializePluginPreferences(preferenceStore);
+ }
+ return preferenceStore;
+}
+
+
+/**
+ * Initializes a preference store with default preference values
+ * for this plug-in.
+ *
+ * This method is called after the preference store is initially loaded
+ * (default values are never stored in preference stores).
+ *
+ * The default implementation of this method does nothing.
+ * Subclasses should reimplement this method if the plug-in has any preferences.
+ *
+ *
+ * @param store the preference store to fill
+ */
+protected void initializeDefaultPreferences(IPropertyStore store) {
+}
+
+/**
+ * Sets default preferences defined in the plugin directory.
+ * If there are no default preferences defined, or some other
+ * problem occurs, we fail silently.
+ */
+private void initializePluginPreferences(IPropertyStore store) {
+ URL baseURL = getDescriptor().getInstallURL();
+
+ URL iniURL= null;
+ try {
+ iniURL = new URL(baseURL, FN_DEFAULT_PREFERENCES);
+ } catch (MalformedURLException e) {
+ return;
+ }
+
+ Properties ini = new Properties();
+ InputStream is = null;
+ try {
+ is = iniURL.openStream();
+ ini.load(is);
+ }
+ catch (IOException e) {
+ // Cannot read ini file;
+ return;
+ }
+ finally {
+ try {
+ if (is != null)
+ is.close();
+ } catch (IOException e) {}
+ }
+
+ Enumeration enum = ini.propertyNames();
+ while (enum.hasMoreElements()) {
+ String key = (String)enum.nextElement();
+ store.setDefault(key, ini.getProperty(key));
+ }
+}
+
+/**
+ * Loads the preference store for this plug-in.
+ * The default implementation looks for a standard named file in the
+ * plug-in's read/write state area. If no file is found or a problem
+ * occurs, a new empty preference store is silently created.
+ *
+ * This framework method may be overridden, although this is typically
+ * unnecessary.
+ *
+ */
+protected void loadPreferenceStore() {
+ String readWritePath = getStateLocation().append(FN_PREF_STORE).toOSString();
+ preferenceStore = new PreferenceStore(readWritePath);
+ try {
+ preferenceStore.load();
+ }
+ catch (IOException e) {
+ // Load failed, perhaps because the file does not yet exist.
+ // At any rate we just return and leave the store empty.
+ }
+ return;
+}
+
+/**
+ * Saves this plug-in's preference store.
+ * Any problems which arise are silently ignored.
+ */
+protected void savePreferenceStore() {
+ if (preferenceStore == null) {
+ return;
+ }
+ try {
+ preferenceStore.save(); // the store knows its filename - no need to pass it
+ }
+ catch (IOException e) {
+ }
+}
+
+/**
+ * The AbstractPlugin
implementation of this Plugin
+ * method saves this plug-in's preference and dialog stores and shuts down
+ * its image registry (if they are in use). Subclasses may extend this method,
+ * but must send super first.
+ */
+public void shutdown() throws CoreException {
+ super.shutdown();
+ savePreferenceStore();
+ preferenceStore = null;
+}
+
+public Object getAdapter(Class adapter) {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+}
+
+}
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/CCorePlugin.java
new file mode 100644
index 00000000000..503f961b35a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/CCorePlugin.java
@@ -0,0 +1,184 @@
+package org.eclipse.cdt.internal;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.cdt.core.resources.ICPlugin;
+import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.core.resources.IMessageDialog;
+import org.eclipse.cdt.core.resources.IPropertyStore;
+import org.eclipse.cdt.core.ConsoleOutputStream;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.index.IndexModel;
+
+
+public class CCorePlugin extends AbstractPlugin implements ICPlugin {
+
+ public static final String PLUGIN_ID= "org.eclipse.cdt.core";
+ public static final String BUILDER_ID= PLUGIN_ID + ".cbuilder";
+
+ private static CCorePlugin fgCPlugin;
+ private static ResourceBundle fgResourceBundle;
+
+ // -------- static methods --------
+
+ static {
+ try {
+ fgResourceBundle= ResourceBundle.getBundle("org.eclipse.cdt.internal.CCorePluginResources");
+ } catch (MissingResourceException x) {
+ fgResourceBundle= null;
+ }
+ }
+
+ public static String getResourceString(String key) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";
+ } catch (NullPointerException e) {
+ return "#" + key + "#";
+ }
+ }
+
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ public static String getFormattedString(String key, String arg) {
+ return MessageFormat.format(getResourceString(key), new String[] { arg });
+ }
+
+ public static String getFormattedString(String key, String[] args) {
+ return MessageFormat.format(getResourceString(key), args);
+ }
+
+ public static ResourceBundle getResourceBundle() {
+ return fgResourceBundle;
+ }
+
+ public static Plugin getDefaultPlugin() {
+ return fgCPlugin;
+ }
+
+ public static ICPlugin getDefault() {
+ ICPlugin plugin;
+ if ((plugin = (ICPlugin)fgCPlugin.getAdapter(ICPlugin.class)) != null) {
+ return plugin;
+ }
+ return fgCPlugin;
+ }
+
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e));
+ }
+
+ public static void log(IStatus status) {
+ ((Plugin)getDefault()).getLog().log(status);
+ }
+
+ public IPropertyStore getPropertyStore() {
+ return getPreferenceStore();
+ }
+
+ // ------ CPlugin
+
+ public IMessageDialog getMessageDialog() {
+ return new IMessageDialog() {
+ public void openError(String title, String msg) {
+ System.err.println(title +": " +msg);
+ }
+ };
+ }
+
+ private IConsole fConsoleDocument;
+
+ public CCorePlugin(IPluginDescriptor descriptor) {
+ super(descriptor);
+ fgCPlugin= this;
+/*
+ fModel = new ACDebugModel() {
+ public Object createPresentation() {
+ return null;
+ }
+
+ public String getIdentifier() {
+ return PLUGIN_ID;
+ }
+
+ public IMarker createBreakpoint( final IResource resource,
+ final Map attributes,
+ final String markerType ) throws CoreException {
+ return null;
+ }
+ };
+*/
+ fConsoleDocument= new IConsole() {
+ public void clear() {
+ }
+
+ public ConsoleOutputStream getOutputStream() {
+ return new ConsoleOutputStream();
+ }
+ };
+ }
+
+
+ /**
+ * @see Plugin#shutdown
+ */
+ public void shutdown() throws CoreException {
+ super.shutdown();
+ }
+
+ /**
+ * @see Plugin#startup
+ */
+ public void startup() throws CoreException {
+ super.startup();
+
+ // Fired up the model.
+ getCoreModel();
+ // Fired up the indexer. It should delay itself for 10 seconds
+ getIndexModel();
+ }
+
+ /**
+ * @see AbstractPlugin#initializeDefaultPreferences
+ */
+ protected void initializeDefaultPreferences(IPropertyStore store) {
+ super.initializeDefaultPreferences(store);
+ }
+
+ public IConsole getConsole() {
+ return fConsoleDocument;
+ }
+
+ public CoreModel getCoreModel() {
+ return CoreModel.getDefault();
+ }
+
+ public IndexModel getIndexModel() {
+ return IndexModel.getDefault();
+ }
+
+/*
+ public ACDebugModel getDebugModel() {
+ return fModel;
+ }
+*/
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/CCorePluginResources.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/CCorePluginResources.properties
new file mode 100644
index 00000000000..862be897e77
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/CCorePluginResources.properties
@@ -0,0 +1,10 @@
+################################################
+#
+# (c) Copyright QNX Software Systems Ltd. 2002.
+# All Rights Reserved.
+#
+################################################
+
+CApplicationLauncher.error.title=Error Launching Application
+CApplicationLauncher.error.message=Unable to Launch Application
+
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/PreferenceStore.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/PreferenceStore.java
new file mode 100644
index 00000000000..02af2b15c4e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/PreferenceStore.java
@@ -0,0 +1,504 @@
+package org.eclipse.cdt.internal;
+
/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.*;
+import java.util.*;
+import org.eclipse.cdt.core.resources.*;
+//import org.eclipse.jface.util.*;
+
+/**
+ * A concrete preference store implementation based on an internal
+ * java.util.Properties
object, with support for
+ * persisting the non-default preference values to files or streams.
+ *
+ * This class was not designed to be subclassed.
+ *
+ *
+ * @see IPreferenceStore
+ */
+public class PreferenceStore implements IPropertyStore {
+
+
+ /**
+ * The mapping from preference name to
+ * preference value (represented as strings).
+ */
+ private Properties properties;
+
+ /**
+ * The mapping from preference name to
+ * default preference value (represented as strings);
+ * null
if none.
+ */
+ private Properties defaultProperties;
+
+ /**
+ * Indicates whether a value as been changed by setToDefault
+ * or setValue
; initially true
.
+ */
+ private boolean dirty = true;
+
+ /**
+ * The file name used by the load
method to load a property
+ * file. This filename is used to save the properties file when save
+ * is called.
+ */
+ private String filename;
+/**
+ * Creates an empty preference store.
+ *
+ * Use the methods load(InputStream)
and
+ * save(InputStream)
to load and store this
+ * preference store.
+ *
+ * @see #load(java.io.InputStream)
+ * @see #store(java.io.InputStream)
+ */
+public PreferenceStore() {
+ defaultProperties = new Properties();
+ properties = new Properties(defaultProperties);
+}
+/**
+ * Creates an empty preference store that loads from and saves to the
+ * a file.
+ *
+ * Use the methods load()
and save()
to load and store this
+ * preference store.
+ *
+ *
+ * @param filename the file name
+ * @see #load()
+ * @see #store()
+ */
+public PreferenceStore(String filename) {
+ this();
+ this.filename = filename;
+}
+
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public boolean contains(String name) {
+ return (properties.containsKey(name) || defaultProperties.containsKey(name));
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public boolean getBoolean(String name) {
+ return getBoolean(properties, name);
+}
+/**
+ * Helper function: gets boolean for a given name.
+ */
+private boolean getBoolean(Properties p, String name) {
+ String value = p != null ? p.getProperty(name) : null;
+ if (value == null)
+ return BOOLEAN_DEFAULT_DEFAULT;
+ if (value.equals(IPropertyStore.TRUE))
+ return true;
+ return false;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public boolean getDefaultBoolean(String name) {
+ return getBoolean(defaultProperties, name);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public double getDefaultDouble(String name) {
+ return getDouble(defaultProperties, name);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public float getDefaultFloat(String name) {
+ return getFloat(defaultProperties, name);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public int getDefaultInt(String name) {
+ return getInt(defaultProperties, name);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public long getDefaultLong(String name) {
+ return getLong(defaultProperties, name);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public String getDefaultString(String name) {
+ return getString(defaultProperties, name);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public double getDouble(String name) {
+ return getDouble(properties, name);
+}
+/**
+ * Helper function: gets double for a given name.
+ */
+private double getDouble(Properties p, String name) {
+ String value = p != null ? p.getProperty(name) : null;
+ if (value == null)
+ return DOUBLE_DEFAULT_DEFAULT;
+ double ival = DOUBLE_DEFAULT_DEFAULT;
+ try {
+ ival = new Double(value).doubleValue();
+ } catch (NumberFormatException e) {
+ }
+ return ival;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public float getFloat(String name) {
+ return getFloat(properties, name);
+}
+/**
+ * Helper function: gets float for a given name.
+ */
+private float getFloat(Properties p, String name) {
+ String value = p != null ? p.getProperty(name) : null;
+ if (value == null)
+ return FLOAT_DEFAULT_DEFAULT;
+ float ival = FLOAT_DEFAULT_DEFAULT;
+ try {
+ ival = new Float(value).floatValue();
+ } catch (NumberFormatException e) {
+ }
+ return ival;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public int getInt(String name) {
+ return getInt(properties, name);
+}
+/**
+ * Helper function: gets int for a given name.
+ */
+private int getInt(Properties p, String name) {
+ String value = p != null ? p.getProperty(name) : null;
+ if (value == null)
+ return INT_DEFAULT_DEFAULT;
+ int ival = 0;
+ try {
+ ival = Integer.parseInt(value);
+ } catch (NumberFormatException e) {
+ }
+ return ival;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public long getLong(String name) {
+ return getLong(properties, name);
+}
+/**
+ * Helper function: gets long for a given name.
+ */
+private long getLong(Properties p, String name) {
+ String value = p != null ? p.getProperty(name) : null;
+ if (value == null)
+ return LONG_DEFAULT_DEFAULT;
+ long ival = LONG_DEFAULT_DEFAULT;
+ try {
+ ival = Long.parseLong(value);
+ } catch (NumberFormatException e) {
+ }
+ return ival;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public String getString(String name) {
+ return getString(properties, name);
+}
+/**
+ * Helper function: gets string for a given name.
+ */
+private String getString(Properties p, String name) {
+ String value = p != null ? p.getProperty(name) : null;
+ if (value == null)
+ return STRING_DEFAULT_DEFAULT;
+ return value;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public boolean isDefault(String name) {
+ return (!properties.containsKey(name) && defaultProperties.containsKey(name));
+}
+/**
+ * Prints the contents of this preference store to the given print stream.
+ *
+ * @param out the print stream
+ */
+public void list(PrintStream out) {
+ properties.list(out);
+}
+/**
+ * Prints the contents of this preference store to the given print writer.
+ *
+ * @param out the print writer
+ */
+public void list(PrintWriter out) {
+ properties.list(out);
+}
+/**
+ * Loads this preference store from the file established in the constructor
+ * PreferenceStore(java.lang.String)
(or by setFileName
).
+ * Default preference values are not affected.
+ *
+ * @exception java.io.IOException if there is a problem loading this store
+ */
+public void load() throws IOException {
+ if (filename == null)
+ throw new IOException("File name not specified");//$NON-NLS-1$
+ FileInputStream in = new FileInputStream(filename);
+ load(in);
+ in.close();
+}
+/**
+ * Loads this preference store from the given input stream. Default preference
+ * values are not affected.
+ *
+ * @param in the input stream
+ * @exception java.io.IOException if there is a problem loading this store
+ */
+public void load(InputStream in) throws IOException {
+ properties.load(in);
+ dirty = false;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public boolean needsSaving() {
+ return dirty;
+}
+/**
+ * Returns an enumeration of all preferences known to this store which
+ * have current values other than their default value.
+ *
+ * @return an array of preference names
+ */
+public String[] preferenceNames() {
+ ArrayList list = new ArrayList();
+ Enumeration enum = properties.propertyNames();
+ while (enum.hasMoreElements()) {
+ list.add(enum.nextElement());
+ }
+ return (String[])list.toArray(new String[list.size()]);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void putValue(String name, String value) {
+ setValue(properties, name, value);
+}
+
+/**
+ * Saves the non-default-valued preferences known to this preference
+ * store to the file from which they were originally loaded.
+ *
+ * @exception java.io.IOException if there is a problem saving this store
+ */
+public void save() throws IOException {
+ if (filename == null)
+ throw new IOException("File name not specified");//$NON-NLS-1$
+ FileOutputStream out = null;
+ try {
+ out = new FileOutputStream(filename);
+ save(out, null);
+ } finally {
+ if (out != null)
+ out.close();
+ }
+}
+/**
+ * Saves this preference store to the given output stream. The
+ * given string is inserted as header information.
+ *
+ * @param out the output stream
+ * @param header the header
+ * @exception java.io.IOException if there is a problem saving this store
+ */
+public void save(OutputStream out, String header) throws IOException {
+ properties.store(out, header);
+ dirty = false;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setDefault(String name, double value) {
+ setValue(defaultProperties, name, value);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setDefault(String name, float value) {
+ setValue(defaultProperties, name, value);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setDefault(String name, int value) {
+ setValue(defaultProperties, name, value);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setDefault(String name, long value) {
+ setValue(defaultProperties, name, value);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setDefault(String name, String value) {
+ setValue(defaultProperties, name, value);
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setDefault(String name, boolean value) {
+ setValue(defaultProperties, name, value);
+}
+/**
+ * Sets the name of the file used when loading and storing this preference store.
+ *
+ * Afterward, the methods load()
and save()
can be used
+ * to load and store this preference store.
+ *
+ *
+ * @param filename the file name
+ * @see #load()
+ * @see #store()
+ */
+public void setFilename(String name) {
+ filename = name;
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setToDefault(String name) {
+ // do nothing ... since we have not defined a
+ // firePropertyChangeEvent. Without it,
+ // this method does nothing anyway ... so
+ // why do all this work?
+
+// Object oldValue = properties.get(name);
+// properties.remove(name);
+// dirty = true;
+// Object newValue = null;
+// if (defaultProperties != null){
+// newValue = defaultProperties.get(name);
+// }
+// firePropertyChangeEvent(name, oldValue, newValue);
+
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setValue(String name, double value) {
+ double oldValue = getDouble(name);
+ if (oldValue != value) {
+ setValue(properties, name, value);
+ dirty = true;
+ }
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setValue(String name, float value) {
+ float oldValue = getFloat(name);
+ if (oldValue != value) {
+ setValue(properties, name, value);
+ dirty = true;
+ }
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setValue(String name, int value) {
+ int oldValue = getInt(name);
+ if (oldValue != value) {
+ setValue(properties, name, value);
+ dirty = true;
+ }
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setValue(String name, long value) {
+ long oldValue = getLong(name);
+ if (oldValue != value) {
+ setValue(properties, name, value);
+ dirty = true;
+ }
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setValue(String name, String value) {
+ String oldValue = getString(name);
+ if (oldValue == null || !oldValue.equals(value)) {
+ setValue(properties, name, value);
+ dirty = true;
+ }
+}
+/* (non-Javadoc)
+ * Method declared on IPreferenceStore.
+ */
+public void setValue(String name, boolean value) {
+ boolean oldValue = getBoolean(name);
+ if (oldValue != value) {
+ setValue(properties, name, value);
+ dirty = true;
+ }
+}
+/**
+ * Helper method: sets string for a given name.
+ */
+private void setValue(Properties p, String name, double value) {
+ p.put(name, Double.toString(value));
+}
+/**
+ * Helper method: sets string for a given name.
+ */
+private void setValue(Properties p, String name, float value) {
+ p.put(name, Float.toString(value));
+}
+/**
+ * Helper method: sets string for a given name.
+ */
+private void setValue(Properties p, String name, int value) {
+ p.put(name, Integer.toString(value));
+}
+/**
+ * Helper method: sets string for a given name.
+ */
+private void setValue(Properties p, String name, long value) {
+ p.put(name, Long.toString(value));
+}
+/**
+ * Helper method: sets string for a given name.
+ */
+private void setValue(Properties p, String name, String value) {
+ p.put(name, value);
+}
+/**
+ * Helper method: sets string for a given name.
+ */
+private void setValue(Properties p, String name, boolean value) {
+ p.put(name, value == true ? IPropertyStore.TRUE : IPropertyStore.FALSE);
+}
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/ResourcePropertyStore.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/ResourcePropertyStore.java
new file mode 100644
index 00000000000..621c4190f80
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/ResourcePropertyStore.java
@@ -0,0 +1,43 @@
+package org.eclipse.cdt.internal;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.resources.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.CoreException;
+
+public class ResourcePropertyStore implements IPropertyStore {
+ private IResource resource;
+ private String pluginID;
+
+ public ResourcePropertyStore(IResource resource, String pluginID) {
+ this.resource = resource;
+ this.pluginID = pluginID;
+ }
+
+ public String getString(String name) {
+ QualifiedName qName = new QualifiedName(pluginID, name);
+ try {
+ return resource.getPersistentProperty(qName);
+ } catch (CoreException e) {
+ }
+ return null;
+ }
+
+ public void setDefault(String name, String def) {
+ }
+
+ public void putValue(String name, String value) {
+ QualifiedName qName = new QualifiedName(pluginID, name);
+ try {
+ resource.setPersistentProperty(qName, value);
+ } catch (CoreException e) {
+ }
+ }
+
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CBuilder.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CBuilder.java
new file mode 100644
index 00000000000..b5e2414d5d0
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CBuilder.java
@@ -0,0 +1,245 @@
+package org.eclipse.cdt.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+
+import org.eclipse.cdt.core.model.ICModelMarker;
+import org.eclipse.cdt.core.resources.ACBuilder;
+import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.core.resources.IPropertyStore;
+import org.eclipse.cdt.internal.CCorePlugin;
+import org.eclipse.cdt.internal.errorparsers.ErrorParserManager;
+import org.eclipse.cdt.core.*;
+import org.eclipse.cdt.core.resources.*;
+
+
+
+public class CBuilder extends ACBuilder {
+
+ private static final String BUILD_ERROR= "CBuilder.build_error";
+
+ private IPropertyStore fPreferenceStore;
+ private ErrorParserManager fErrorParserManager;
+
+ public CBuilder() {
+ fPreferenceStore= CCorePlugin.getDefault().getPropertyStore();
+ fErrorParserManager= new ErrorParserManager(this);
+ }
+
+ public IPath getWorkingDirectory() {
+ IProject currProject= getProject();
+ IPath workingDirectory = new Path(MakeUtil.getSessionBuildDir((IResource)currProject));
+ if (workingDirectory.isEmpty())
+ workingDirectory = currProject.getLocation();
+ return workingDirectory;
+ }
+
+ /**
+ * @see IncrementalProjectBuilder#build
+ */
+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
+ IResourceDelta delta= getDelta(getProject());
+ boolean isFullBuild= (kind == IncrementalProjectBuilder.FULL_BUILD) || (delta == null);
+ if (isFullBuild) {
+ invokeMake(true, monitor);
+ } else {
+ IResource res= delta.getResource();
+ //if (res != null && delta.getKind() != 0) {
+ if (res != null) {
+ IProject currProject= getProject();
+ if (currProject.equals(res.getProject())) {
+ invokeMake(false, monitor);
+ }
+ }
+ }
+ return null;
+ }
+
+
+ private void invokeMake(boolean fullBuild, IProgressMonitor monitor) {
+ IProject currProject= getProject();
+ SubProgressMonitor subMonitor = null;
+
+ if (monitor == null) {
+ monitor= new NullProgressMonitor();
+ }
+ monitor.beginTask("Invoking the C Builder: " + currProject.getName(), IProgressMonitor.UNKNOWN);
+
+ try {
+ CProjectNature nature= (CProjectNature)currProject.getNature(CProjectNature.C_NATURE_ID);
+ IPath makepath= nature.getBuildCommand();
+ if (!makepath.isEmpty()) {
+ // clear console if requested
+ IConsole console = CCorePlugin.getDefault().getConsole();
+ if (BuildInfoFactory.create().isClearBuildConsole()
+ && MakeUtil.getSessionConsoleMode(currProject)) {
+ console.clear();
+ }
+
+ ConsoleOutputStream cos = console.getOutputStream();
+
+ // remove all markers for this project
+ removeAllMarkers(currProject);
+
+ IPath workingDirectory= getWorkingDirectory();
+ String[] userArgs= parseArguments(fullBuild, nature.getIncrBuildArguments());
+
+ // Before launching give visual cues via the monitor
+ subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
+ subMonitor.subTask("Invoking Command: " + makepath.toString());
+
+ String errMsg = null;
+ CommandLauncher launcher = new CommandLauncher();
+ // Print the command for visual interaction.
+ launcher.showCommand(true);
+
+ // Set the environmennt, some scripts may need the CWD var to be set.
+ Properties props = launcher.getEnvironment();
+ props.put("CWD", workingDirectory.toOSString());
+ props.put("PWD", workingDirectory.toOSString());
+ String[] env= null;
+ ArrayList envList = new ArrayList();
+ Enumeration names = props.propertyNames();
+ if (names != null) {
+ while (names.hasMoreElements()) {
+ String key = (String)names.nextElement();
+ envList.add(key +"=" +props.getProperty(key));
+ }
+ env = (String []) envList.toArray(new String [envList.size()]);
+ }
+
+ launcher.execute(makepath, userArgs, env, workingDirectory);
+ if (launcher.waitAndRead(cos, cos, subMonitor) != CommandLauncher.OK)
+ errMsg = launcher.getErrorMessage();
+
+ monitor.setCanceled(false);
+
+ subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
+ subMonitor.subTask("Refresh From Local");
+
+ try {
+ currProject.refreshLocal(IResource.DEPTH_INFINITE, subMonitor);
+ } catch (CoreException e) {
+ }
+
+ subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
+ subMonitor.subTask("Parsing");
+ cos.flush();
+ fErrorParserManager.parse(cos.getContent());
+
+ if (errMsg != null) {
+ String errorDesc= CCorePlugin.getFormattedString(BUILD_ERROR, makepath.toString());
+ StringBuffer buf= new StringBuffer(errorDesc);
+ buf.append(System.getProperty("line.separator", "\n"));
+ buf.append("(");
+ buf.append(errMsg);
+ buf.append(")");
+ cos.write(buf.toString().getBytes());
+ cos.flush();
+ }
+ subMonitor.done();
+ }
+ } catch (Exception e) {
+ CCorePlugin.log(e);
+ }
+ monitor.done();
+ }
+
+ private String[] parseArguments(boolean fullBuild, String override_args) {
+ ArrayList list= new ArrayList();
+ IProject currProject = getProject();
+ try {
+ CProjectNature nature= (CProjectNature)currProject.getNature(CProjectNature.C_NATURE_ID);
+ if (nature.isDefaultBuildCmd()) {
+ if (!nature.isStopOnError()) {
+ list.add("-k");
+ }
+ } else {
+ String[] ovrd_args = makeArray(nature.getFullBuildArguments());
+ list.addAll(Arrays.asList(ovrd_args));
+ }
+ } catch (CoreException e) {
+ }
+
+ String sessionTarget = MakeUtil.getSessionTarget((IResource) currProject);
+ String[] targets = makeArray(sessionTarget);
+ for (int i = 0; i < targets.length; i++) {
+ list.add(targets[i]);
+ }
+
+ // Lets try this: if FULL_BUILD; we run "clean all"
+ if (fullBuild && targets.length == 0) {
+ list.add("clean");
+ list.add("all");
+ }
+
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+
+ // Turn the string into an array.
+ String[] makeArray(String string) {
+ string.trim();
+ char []array = string.toCharArray();
+ ArrayList aList = new ArrayList();
+ StringBuffer buffer = new StringBuffer();
+ boolean inComment = false;
+ for (int i = 0; i < array.length; i++) {
+ char c = array[i];
+ if (array[i] == '"' || array[i] == '\'') {
+ if (i > 0 && array[i - 1] == '\\') {
+ inComment = false;
+ } else {
+ inComment = !inComment;
+ }
+ }
+ if (c == ' ' && !inComment) {
+ aList.add(buffer.toString());
+ buffer = new StringBuffer();
+ } else {
+ buffer.append(c);
+ }
+ }
+ if (buffer.length() > 0)
+ aList.add(buffer.toString());
+ return (String[])aList.toArray(new String[aList.size()]);
+ }
+
+ //private void clearConsole(final IDocument doc) {
+ // Display.getDefault().syncExec(new Runnable() {
+ // public void run() {
+ // doc.set("");
+ // }
+ // });
+ //}
+
+ private void removeAllMarkers(IProject currProject) throws CoreException {
+ IWorkspace workspace= currProject.getWorkspace();
+
+ // remove all markers
+ IMarker[] markers= currProject.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
+ if (markers != null) {
+ workspace.deleteMarkers(markers);
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CommonMkInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CommonMkInfo.java
new file mode 100644
index 00000000000..bae4aa2b03b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CommonMkInfo.java
@@ -0,0 +1,233 @@
+package org.eclipse.cdt.internal.core;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.io.File;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.DataOutputStream;
+import java.io.OutputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.util.StringTokenizer;
+import java.util.Properties;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.cdt.utils.spawner.EnvironmentReader;
+import org.eclipse.cdt.utils.spawner.ProcessFactory;
+
+public class CommonMkInfo {
+
+ public final static String COMMON_MK = "common.mk";
+
+ IPath dir;
+ long modification;
+ IPath[] includePaths = new IPath[0];
+ IPath[] libs = new IPath[0];
+ IPath[] libPaths = new IPath[0];
+
+ public CommonMkInfo(IPath dir) {
+ this.dir = dir;
+ modification = 0;
+ }
+
+ public CommonMkInfo () {
+ dir = new Path("");
+ String def = EnvironmentReader.getEnvVar("QNX_TARGET");
+ if (def != null) {
+ IPath defaultPath = new Path(def);
+ includePaths = new IPath[] {defaultPath.append("/usr/include")};
+ libPaths = new IPath[] {defaultPath.append("/usr/lib"),
+ defaultPath.append("/x86/usr/lib")};
+ }
+ libs = new IPath[] {new Path("libc.so")};
+ }
+
+ public IPath[] getIncludePaths() {
+ parse();
+ return includePaths;
+ }
+
+ public IPath[] getLibs() {
+ boolean hasLibC = false;
+ parse();
+ for (int i = 0; i < libs.length; i++) {
+ String name = libs[i].toOSString();
+ if (!(name.indexOf(IPath.SEPARATOR) != -1
+ || name.indexOf(IPath.DEVICE_SEPARATOR) != -1
+ || name.indexOf('.') != -1)) {
+ if (!name.startsWith("lib")) {
+ libs[i] = new Path("lib" + name + ".so");
+ }
+ }
+ if (libs[i].toOSString().equals("libc.so"))
+ hasLibC = true;
+ }
+ if (!hasLibC) {
+ IPath[] newlibs = new IPath[libs.length + 1];
+ int i = 0;;
+ for (; i < libs.length; i++) {
+ newlibs[i] = libs[i];
+ }
+ newlibs[i] = new Path("libc.so");
+ libs = newlibs;
+ }
+ return libs;
+ }
+
+ public IPath[] getLibPaths() {
+ parse();
+ return libPaths;
+ }
+
+ public boolean hasChanged() {
+ File prj = new File(dir.toOSString());
+ File common = new File(prj, COMMON_MK);
+ if (!prj.exists() || prj.isFile() || !common.exists())
+ return false;
+ long modif = common.lastModified();
+ return (modif > modification);
+ }
+
+ void parse() {
+ File makefile = null;
+ try {
+ if (hasChanged()) {
+ File prj = new File(dir.toOSString());
+ File common = new File(prj, COMMON_MK);
+ modification = common.lastModified();
+ makefile = File.createTempFile("QMakefile", null, prj);
+ OutputStream fout = new FileOutputStream(makefile);
+ DataOutputStream out = new DataOutputStream(fout);
+
+ out.writeBytes("LIST=OS CPU VARIANT\n");
+ out.writeBytes("include common.mk\n");
+ out.writeBytes("\n");
+
+ out.writeBytes("LIBS:\n");
+ out.writeBytes("\t@echo $(LIBS)\n");
+ out.writeBytes("\n");
+
+ out.writeBytes("INCVPATH:\n");
+ out.writeBytes("\t@echo $(INCVPATH)\n");
+ out.writeBytes("\n");
+
+ out.writeBytes("SRCVPATH:\n");
+ out.writeBytes("\t@echo $(SRCVPATH)\n");
+ out.writeBytes("\n");
+
+ out.writeBytes("LIBVPATH:\n");
+ out.writeBytes("\t@echo $(LIBVPATH)\n");
+ out.writeBytes("\n");
+
+ out.flush();
+ out.close();
+
+ // FIXME: Use the proper os and CPU
+ Properties envp = EnvironmentReader.getEnvVars();
+ envp.setProperty("OS", "nto");
+ envp.setProperty("CPU", "x86");
+ IPath[] incVPath = spawn("INCVPATH", envp, makefile, prj);
+ parseIncVPath(incVPath);
+ IPath[] libNames = spawn("LIBS", envp, makefile, prj);
+ parseLibs(libNames);
+ IPath[] libVPath = spawn("LIBVPATH", envp, makefile, prj);
+ parseLibVPath(libVPath);
+ }
+ } catch (IllegalArgumentException e) {
+ } catch (IOException e) {
+ } finally {
+ try {
+ if (makefile != null)
+ makefile.delete();
+ } catch (SecurityException e) {
+ }
+ }
+ }
+
+ IPath[] spawn (String target, Properties envp, File makefile, File dir) {
+ // FIXME: Use the proper MakeCommand from the builder.
+ String[] args = new String[] {"make", "-f", makefile.getName(), target};
+ BufferedReader stdout = null;
+ Process make = null;
+ StringBuffer buffer = new StringBuffer();
+
+ try {
+ ArrayList envList = new ArrayList();
+
+ // Turn the environment Property to an Array.
+ Enumeration names = envp.propertyNames();
+ if (names != null) {
+ while (names.hasMoreElements()) {
+ String key = (String) names.nextElement();
+ envList.add(key + "=" + envp.getProperty(key));
+ }
+ }
+
+ String[] env = (String[]) envList.toArray(new String[envList.size()]);
+ make = ProcessFactory.getFactory().exec(args, env, dir);
+ stdout = new BufferedReader(new InputStreamReader(make.getInputStream()));
+ String s;
+ while ((s = stdout.readLine ()) != null) {
+ buffer.append(s);
+ }
+ stdout.close();
+ } catch (SecurityException e) {
+ } catch (IndexOutOfBoundsException e) {
+ } catch (NullPointerException e) {
+ } catch (IOException e) {
+ } finally {
+ if (make != null) {
+ make.destroy();
+ }
+ }
+
+ // FIXME: This not quite right some of the include may contains
+ // things like double quotes with spaces.
+ StringTokenizer st = new StringTokenizer(buffer.toString());
+ IPath[] p = new IPath[st.countTokens()];
+
+ for(int i = 0; st.hasMoreTokens(); i++) {
+ p[i] = new Path((String)st.nextToken());
+ }
+
+ return p;
+ }
+
+ void parseLibVPath(IPath[] array) {
+ ArrayList list = new ArrayList(array.length);
+ for (int i = 0; i < array.length; i++) {
+ if (array[i].toString().charAt(0) != '-') {
+ list.add (array[i]);
+ }
+ }
+ libPaths = (IPath[])list.toArray(new IPath[list.size()]);
+ }
+
+ void parseIncVPath(IPath[] array){
+ ArrayList list = new ArrayList(array.length);
+ for (int i = 0; i < array.length; i++) {
+ if (array[i].toString().charAt(0) != '-') {
+ list.add (array[i]);
+ }
+ }
+ includePaths = (IPath[])list.toArray(new IPath[list.size()]);
+ }
+
+ void parseLibs(IPath[] array){
+ ArrayList list = new ArrayList(array.length);
+ for (int i = 0; i < array.length; i++) {
+ if (array[i].toString().charAt(0) != '-') {
+ list.add (array[i]);
+ }
+ }
+ libs = (IPath[])list.toArray(new IPath[list.size()]);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/FileStorage.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/FileStorage.java
new file mode 100644
index 00000000000..ad0ca76ed3b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/FileStorage.java
@@ -0,0 +1,78 @@
+package org.eclipse.cdt.internal.core;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.IStatus;
+
+import org.eclipse.cdt.internal.CCorePlugin;
+
+/**
+ *
+ * @see IStorage
+ */
+public class FileStorage extends PlatformObject implements IStorage {
+ IPath path;
+ InputStream in = null;
+
+ public InputStream getContents() throws CoreException {
+ if (in == null) {
+ try {
+ return new FileInputStream(path.toFile());
+ } catch (FileNotFoundException e) {
+ throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
+ IStatus.ERROR, e.toString(), e));
+ }
+ } else {
+ return in;
+ }
+ }
+
+ /**
+ * @see IStorage#getFullPath
+ */
+ public IPath getFullPath() {
+ return this.path;
+ }
+
+ /**
+ * @see IStorage#getName
+ */
+ public String getName() {
+ return this.path.lastSegment();
+ }
+
+ /**
+ * @see IStorage#isReadOnly()
+ */
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ public FileStorage(IPath path){
+ this.path = path;
+ }
+
+ public FileStorage(InputStream in, IPath path){
+ this.path = path;
+ this.in = in;
+ }
+
+ /**
+ * @see IStorage#isReadOnly()
+ */
+ public String toString() {
+ return path.toOSString();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ProcessClosure.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ProcessClosure.java
new file mode 100644
index 00000000000..4f3d9374c69
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ProcessClosure.java
@@ -0,0 +1,188 @@
+package org.eclipse.cdt.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+
+/**
+ * Bundled state of a launched process including the threads linking the process in/output
+ * to console documents.
+ */
+public class ProcessClosure {
+
+ /**
+ * Thread which continuously reads from a input stream and pushes the read data
+ * to an output stream which is immediately flushed afterwards.
+ */
+ protected static class ReaderThread extends Thread {
+
+ private InputStream fInputStream;
+ private OutputStream fOutputStream;
+ private boolean fFinished = false;
+
+ /*
+ * outputStream can be null
+ */
+ public ReaderThread(ThreadGroup group, String name, InputStream in, OutputStream out) {
+ super(group, name);
+ fOutputStream= out;
+ fInputStream= in;
+ setDaemon(true);
+ }
+
+ public void run() {
+ try {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(fInputStream));
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fOutputStream));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ char[] array = line.toCharArray();
+ writer.write(array, 0, array.length);
+ writer.newLine();
+ writer.flush();
+ }
+ } catch (IOException x) {
+ // ignore
+ } finally {
+ try {
+ fInputStream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ try {
+ fOutputStream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ complete();
+ }
+ }
+
+ public synchronized boolean finished() {
+ return fFinished;
+ }
+
+ public synchronized void waitFor() {
+ while (!fFinished) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+
+ public synchronized void complete() {
+ fFinished = true;
+ notify();
+ }
+ }
+
+ protected static int fCounter= 0;
+
+ protected Process fProcess;
+
+ protected OutputStream fOutput;
+ protected OutputStream fError;
+
+ protected ReaderThread fOutputReader;
+ protected ReaderThread fErrorReader;
+
+ /**
+ * Creates a process closure and connects the launched process with
+ * a console document.
+ * @param outputStream prcess stdout is written to this stream. Can be null
, if
+ * not interested in reading the output
+ * @param errorStream prcess stderr is written to this stream. Can be null
, if
+ * not interested in reading the output
+ */
+ public ProcessClosure(Process process, OutputStream outputStream, OutputStream errorStream) {
+ fProcess= process;
+ fOutput= outputStream;
+ fError= errorStream;
+ }
+
+ /**
+ * Live links the launched process with the configured in/out streams using
+ * reader threads.
+ */
+ public void runNonBlocking() {
+ ThreadGroup group= new ThreadGroup("CBuilder" + fCounter++);
+
+ InputStream stdin= fProcess.getInputStream();
+ InputStream stderr= fProcess.getErrorStream();
+
+ fOutputReader= new ReaderThread(group, "OutputReader", stdin, fOutput);
+ fErrorReader= new ReaderThread(group, "ErrorReader", stderr, fError);
+
+ fOutputReader.start();
+ fErrorReader.start();
+ }
+
+ public void runBlocking() {
+ runNonBlocking();
+
+ boolean finished = false;
+ while (!finished) {
+ try {
+ fProcess.waitFor();
+ } catch (InterruptedException e) {
+ //System.err.println("Closure exception " +e);
+ }
+ try {
+ fProcess.exitValue();
+ finished = true;
+ } catch (IllegalThreadStateException e) {
+ //System.err.println("Closure exception " +e);
+ }
+ }
+
+ // @@@FIXME: Windows 2000 is screwed; double-check using output threads
+ if (!fOutputReader.finished()) {
+ fOutputReader.waitFor();
+ }
+
+ if (!fErrorReader.finished()) {
+ fErrorReader.waitFor();
+ }
+
+ // it seems that thread termination and stream closing is working without
+ // any help
+ fProcess= null;
+ fOutputReader= null;
+ fErrorReader= null;
+ }
+
+
+ public boolean isAlive() {
+ if (fProcess != null) {
+ if (fOutputReader.isAlive() && fErrorReader.isAlive()) {
+ return true;
+ } else {
+ fProcess= null;
+ fOutputReader= null;
+ fErrorReader= null;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Forces the termination the launched process
+ */
+ public void terminate() {
+ if (fProcess != null) {
+ fProcess.destroy();
+ fProcess= null;
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorParserManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorParserManager.java
new file mode 100644
index 00000000000..cbd8ea4d43a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorParserManager.java
@@ -0,0 +1,274 @@
+package org.eclipse.cdt.internal.errorparsers;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.cdt.core.resources.ACBuilder;
+import org.eclipse.cdt.internal.CCorePlugin;
+public class ErrorParserManager {
+
+ private static String PREF_ERROR_PARSER= "errorOutputParser";
+
+ private ACBuilder fBuilder;
+ private Map fFilesInProject;
+ private List fNameConflicts;
+
+ private ArrayList fErrorParsers;
+
+ private Vector fDirectoryStack;
+ private IPath fBaseDirectory;
+
+ private String previousLine;
+
+ static String SEPARATOR = System.getProperty("file.separator");
+
+
+ public ErrorParserManager(ACBuilder builder) {
+ fBuilder= builder;
+ fFilesInProject= new HashMap();
+ fNameConflicts= new ArrayList();
+
+ fErrorParsers= new ArrayList();
+ fDirectoryStack = new Vector();
+ fBaseDirectory = null;
+ readPreferences();
+ }
+
+ public IPath getWorkingDirectory() {
+ if (fDirectoryStack.size() != 0) {
+ return (IPath)fDirectoryStack.lastElement();
+ }
+ return new Path("");
+ }
+
+ public void pushDirectory(IPath dir) {
+ if (dir != null) {
+ IPath pwd = null;
+ if (fBaseDirectory.isPrefixOf(dir)) {
+ int segments = fBaseDirectory.matchingFirstSegments(dir);
+ pwd = dir.removeFirstSegments(segments);
+ } else {
+ pwd = dir;
+ }
+ fDirectoryStack.addElement(pwd);
+ }
+ }
+
+ public IPath popDirectory() {
+ int i = fDirectoryStack.size();
+ IPath dir = (IPath)fDirectoryStack.lastElement();
+ if (i != 0) {
+ fDirectoryStack.removeElementAt(i-1);
+ }
+ return dir;
+ }
+
+ public int getDirectoryLevel() {
+ return fDirectoryStack.size();
+ }
+
+ protected void addParser(IErrorParser parser) {
+ fErrorParsers.add(parser);
+ }
+
+ private void readPreferences() {
+ fErrorParsers.clear();
+ String parserNames= CCorePlugin.getDefault().getPropertyStore().getString(PREF_ERROR_PARSER);
+ if (parserNames != null && parserNames.length() > 0) {
+ StringTokenizer tok= new StringTokenizer(parserNames, ";");
+ while (tok.hasMoreElements()) {
+ String clName= tok.nextToken();
+ try {
+ IErrorParser parser= (IErrorParser)getClass().forName(clName).newInstance();
+ fErrorParsers.add(parser);
+ } catch (ClassNotFoundException e) {
+ // not found
+ CCorePlugin.log(e);
+ } catch (InstantiationException e) {
+ CCorePlugin.log(e);
+ } catch (IllegalAccessException e) {
+ CCorePlugin.log(e);
+ } catch (ClassCastException e) {
+ CCorePlugin.log(e);
+ }
+ }
+ }
+ if (fErrorParsers.size() == 0) {
+ initErrorParsersArray(fErrorParsers);
+ }
+ savePreferences();
+ }
+
+ private void initErrorParsersArray(List errorParsers) {
+ errorParsers.add(new VCErrorParser());
+ errorParsers.add(new GCCErrorParser());
+ errorParsers.add (new GLDErrorParser ());
+ errorParsers.add (new GASErrorParser ());
+ errorParsers.add (new MakeErrorParser ());
+ }
+
+
+ private void savePreferences() {
+ StringBuffer buf= new StringBuffer();
+ for (int i= 0; i < fErrorParsers.size(); i++) {
+ buf.append(fErrorParsers.get(i).getClass().getName());
+ buf.append(';');
+ }
+ CCorePlugin.getDefault().getPropertyStore().putValue(PREF_ERROR_PARSER, buf.toString());
+ }
+
+ protected void collectFiles(IContainer parent, List result) {
+ try {
+ IResource[] resources= parent.members();
+ for (int i= 0; i < resources.length; i++) {
+ IResource resource= resources[i];
+ if (resource instanceof IFile) {
+ result.add(resource);
+ } else if (resource instanceof IContainer) {
+ collectFiles((IContainer)resource, result);
+ }
+ }
+ } catch (CoreException e) {
+ CCorePlugin.log(e.getStatus());
+ }
+ }
+
+ /**
+ * Parses the input and try to generate error or warning markers
+ */
+ public void parse(String output) {
+ // prepare file lists
+ fFilesInProject.clear();
+ fNameConflicts.clear();
+
+ List collectedFiles= new ArrayList();
+ fBaseDirectory = fBuilder.getProject().getLocation();
+ collectFiles(fBuilder.getProject(), collectedFiles);
+
+ for (int i= 0; i < collectedFiles.size(); i++) {
+ IFile curr= (IFile)collectedFiles.get(i);
+ Object existing= fFilesInProject.put(curr.getName(), curr);
+ if (existing != null) {
+ fNameConflicts.add(curr.getName());
+ }
+ }
+
+ BufferedReader rd= new BufferedReader(new StringReader(output));
+ try {
+ String line= rd.readLine();
+ while (line != null) {
+ processLine(line);
+ previousLine = line;
+ line= rd.readLine();
+ }
+ } catch (IOException e) {
+ CCorePlugin.log(e);
+ } finally {
+ try { rd.close(); } catch (IOException e) {}
+ }
+
+ fFilesInProject.clear();
+ fNameConflicts.clear();
+ fDirectoryStack.removeAllElements();
+ fBaseDirectory = null;
+ }
+
+ private void processLine(String line) {
+ int top= fErrorParsers.size()-1;
+ int i= top;
+ do {
+ IErrorParser curr= (IErrorParser)fErrorParsers.get(i);
+ if (curr.processLine(line, this)) {
+ if (i != top) {
+ // move to top
+ Object used= fErrorParsers.remove(i);
+ fErrorParsers.add(used);
+ savePreferences();
+ }
+ return;
+ }
+ i--;
+ } while (i >= 0);
+ }
+
+ /**
+ * Called by the error parsers.
+ */
+ public IFile findFileName(String fileName) {
+ IPath path= new Path(fileName);
+ return (IFile)fFilesInProject.get(path.lastSegment());
+ }
+
+
+ /**
+ * Called by the error parsers.
+ */
+ public boolean isConflictingName(String fileName) {
+ IPath path= new Path(fileName);
+ return fNameConflicts.contains(path.lastSegment());
+ }
+
+ /**
+ * Called by the error parsers.
+ */
+ public IFile findFilePath(String filePath) {
+ IPath path = null;
+ IPath fp = new Path(filePath);
+ if (fp.isAbsolute()) {
+ if (fBaseDirectory.isPrefixOf(fp)) {
+ int segments = fBaseDirectory.matchingFirstSegments(fp);
+ path = fp.removeFirstSegments(segments);
+ } else {
+ path = fp;
+ }
+ } else {
+ path = (IPath)getWorkingDirectory().append(filePath);
+ }
+ return (IFile)fBuilder.getProject().getFile(path);
+ }
+
+ /**
+ * Called by the error parsers.
+ */
+ public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName) {
+ if (file == null) {
+ fBuilder.addMarker (fBuilder.getProject(), lineNumber, desc, severity, varName);
+ } else {
+ fBuilder.addMarker(file, lineNumber, desc, severity, varName);
+ }
+ }
+
+ /**
+ * Called by the error parsers. Return the previous line, save in the working buffer.
+ */
+ public String getPreviousLine() {
+ return new String ((previousLine) == null ? "" : previousLine);
+ }
+
+ /**
+ * Called by the error parsers. Overload in Makebuilder.
+ */
+ public IPath getBuildCommand() {
+ return new Path("");
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java
new file mode 100644
index 00000000000..6c1af416591
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java
@@ -0,0 +1,54 @@
+package org.eclipse.cdt.internal.errorparsers;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+
+public class GASErrorParser implements IErrorParser {
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+ // cc -c x.c
+ // Only when the previous line sasys Assembler
+ // /tmp/cc8EXnKk.s: Assembler messages:
+ // /tmp/cc8EXnKk.s:46: Error: no such 386 instruction: `b'
+ try {
+ String previous = eoParser.getPreviousLine();
+ String fileName = "";
+ IFile file = null;
+ int num = 0;
+ int severity = IMarker.SEVERITY_ERROR;
+ String desc = line;
+ if (previous != null && previous.startsWith("Assembler")) {
+ if (! line.startsWith("FATAL")) {
+ int firstColon= line.indexOf(':');
+ if (firstColon != -1) {
+ fileName = line.substring(0, firstColon);
+ desc = line.substring(firstColon + 1);
+ int secondColon= line.indexOf(':', firstColon + 1);
+ if (secondColon != -1) {
+ String lineNumber = line.substring(firstColon + 1, secondColon);
+ try {
+ num = Integer.parseInt(lineNumber);
+ } catch (NumberFormatException e) {
+ }
+ if (num != 0) {
+ desc = line.substring(secondColon + 2);
+ }
+ }
+ file = eoParser.findFilePath(fileName);
+ }
+ }
+ if (file == null) {
+ desc = fileName + " " + desc;
+ }
+ eoParser.generateMarker(file, num, desc, severity, null);
+ }
+ } catch (IndexOutOfBoundsException e) {
+ }
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
new file mode 100644
index 00000000000..1112df7d664
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
@@ -0,0 +1,137 @@
+package org.eclipse.cdt.internal.errorparsers;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+
+public class GCCErrorParser implements IErrorParser {
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+ // gcc: "filename:linenumber: error_desc"
+ int firstColon = line.indexOf(':');
+
+ /* Guard against drive in Windows platform. */
+ if (firstColon == 1) {
+ try {
+ String os = System.getProperty("os.name");
+ if (os != null && os.startsWith("Win")) {
+ try {
+ if (Character.isLetter(line.charAt(0))) {
+ firstColon = line.indexOf(':', 2);
+ }
+ } catch (StringIndexOutOfBoundsException e) {
+ }
+ }
+ } catch (SecurityException e) {
+ }
+ }
+
+ if (firstColon != -1) {
+ try {
+ int secondColon= line.indexOf(':', firstColon + 1);
+ if (secondColon != -1) {
+ String fileName = line.substring(0, firstColon);
+ String lineNumber = line.substring(firstColon + 1, secondColon);
+ String varName = null;
+ String desc = line.substring(secondColon + 2);
+ int severity = IMarker.SEVERITY_ERROR;
+ int num = 0;
+
+ try {
+ num = Integer.parseInt(lineNumber);
+ } catch (NumberFormatException e) {
+ }
+
+ if (num == 0) {
+ // Maybe a bad option error or cc1(plus) error
+ if (fileName.startsWith("cc") || fileName.startsWith("gcc")
+ || fileName.startsWith("qcc") || fileName.startsWith("QCC")) {
+ // do nothing;
+ if(line.indexOf("caught signal") != -1) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ IFile file = eoParser.findFilePath(fileName);
+
+ if (file != null) {
+ // gnu c: filename:no: (Each undeclared identifier is reported
+ // only once. filename:no: for each function it appears in.)
+ if (desc.startsWith ("(Each undeclared")) {
+ // Do nothing.
+ return false;
+ } else {
+ String previous = eoParser.getPreviousLine();
+ if (desc.endsWith(")")
+ && previous.indexOf("(Each undeclared") >= 0 ) {
+ // Do nothing.
+ return false;
+ }
+ }
+ /* See if we can get a var name
+ * Look for:
+ * 'foo' undeclared
+ * 'foo' defined but not used
+ * conflicting types for 'foo'
+ *
+ */
+ int s;
+ if((s = desc.indexOf("\' undeclared")) != -1) {
+ int p = desc.indexOf("`");
+ if(p != -1) {
+ varName = desc.substring(p+1, s);
+ System.out.println("undex varName "+ varName);
+ }
+ } else if((s = desc.indexOf("\' defined but not used")) != -1) {
+ int p = desc.indexOf("`");
+ if(p != -1) {
+ varName = desc.substring(p+1, s);
+ System.out.println("unused varName "+ varName);
+ }
+ } else if((s = desc.indexOf("conflicting types for `")) != -1) {
+ int p = desc.indexOf("\'", s);
+ if(p != -1) {
+ varName = desc.substring(desc.indexOf("`") + 1, p);
+ System.out.println("confl varName "+ varName);
+ }
+ } else if((s = desc.indexOf("previous declaration of `")) != -1) {
+ int p = desc.indexOf("\'", s);
+ if(p != -1) {
+ varName = desc.substring(desc.indexOf("`") + 1, p);
+ System.out.println("prev varName "+ varName);
+ }
+ }
+ } else {
+ // Parse the entire project.
+ file = eoParser.findFileName(fileName);
+ if (file != null) {
+ // If there is a conflict set the error on the project.
+ if (eoParser.isConflictingName(fileName)) {
+ desc = "*" + desc;
+ file = null;
+ }
+ }
+
+ // Display the fileName.
+ if (file == null) {
+ desc = fileName + ": " + desc;
+ }
+ }
+ if (desc.startsWith("warning") || desc.startsWith("Warning")) {
+ severity = IMarker.SEVERITY_WARNING;
+ }
+ eoParser.generateMarker(file, num, desc, severity, varName);
+ }
+ } catch (StringIndexOutOfBoundsException e) {
+ } catch (NumberFormatException e) {
+ }
+ }
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java
new file mode 100644
index 00000000000..2db11fa181e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java
@@ -0,0 +1,57 @@
+package org.eclipse.cdt.internal.errorparsers;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+
+public class GLDErrorParser implements IErrorParser {
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+ // binutils linker error:
+ // 1- an error when trying to link
+ // tempfile: In function `function':
+ // tempfile(.text+0xhex): undefined reference to `symbol'
+ // 2-
+ // Something went wrong check if it is "ld" the linkeer bay cheching
+ // the last letter for "ld"
+ int firstColon= line.indexOf(':');
+ if (firstColon != -1) {
+ String buf= line.substring(0, firstColon);
+ String desc= line.substring(firstColon + 1);
+ int firstPara= buf.indexOf('(');
+ int secondPara= buf.indexOf(')');
+ if (firstPara >= 0 && secondPara >= 0) {
+ String fileName = buf.substring(0, firstPara);
+ String previous = eoParser.getPreviousLine();
+ if (previous == null)
+ previous = "";
+ int colon = previous.indexOf(':');
+ if (colon != -1) {
+ previous = previous.substring(colon + 1);
+ }
+
+ desc = "*" + previous + " " + desc;
+ // Since we do not have any way to know the name of the C file
+ // where the undefined reference is refering we set the error
+ // on the project.
+ IFile file = eoParser.findFilePath(fileName);
+ if (file == null) {
+ desc = fileName + " " + desc;
+ }
+ eoParser.generateMarker(file, 0, desc, IMarker.SEVERITY_ERROR, null);
+ } else if (buf.endsWith("ld")){
+ String fileName = line.substring(0, firstColon);
+ IFile file = eoParser.findFilePath(fileName);
+ if (file == null) {
+ desc = fileName + " " + desc;
+ }
+ eoParser.generateMarker(file, 0, desc, IMarker.SEVERITY_ERROR, null);
+ }
+ }
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/IErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/IErrorParser.java
new file mode 100644
index 00000000000..903aeec01c1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/IErrorParser.java
@@ -0,0 +1,15 @@
+package org.eclipse.cdt.internal.errorparsers;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+public interface IErrorParser {
+ /**
+ * Finds error or warnings on the given line
+ */
+ boolean processLine(String line, ErrorParserManager eoParser);
+
+}
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java
new file mode 100644
index 00000000000..15b12c397c9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java
@@ -0,0 +1,60 @@
+package org.eclipse.cdt.internal.errorparsers;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.Path;
+
+public class MakeErrorParser implements IErrorParser {
+
+ public MakeErrorParser() {
+ }
+
+ static int getDirectoryLevel(String line) {
+ int s = line.indexOf('[');
+ if (s != -1) {
+ int e = line.indexOf(']');
+ String number = line.substring(s + 1, e);
+ int num= Integer.parseInt(number);
+ return num;
+ }
+ return 0;
+ }
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+ // make\[[0-9]*\]: error_desc
+ int firstColon= line.indexOf(':');
+ if (firstColon != -1 && line.startsWith("make")) {
+ boolean enter = false;
+ String msg= line.substring(firstColon + 1);
+ if ((enter = msg.startsWith(" Entering directory")) ||
+ (msg.startsWith(" Leaving directory"))) {
+ int s = msg.indexOf('`');
+ int e = msg.indexOf('\'');
+ if (s != -1 && e != -1) {
+ String dir = msg.substring(s+1, e);
+ if (enter) {
+ /* Sometimes make screws up the output, so
+ * "leave" events can't be seen. Double-check level
+ * here.
+ */
+ int level = getDirectoryLevel(line);
+ int parseLevel = eoParser.getDirectoryLevel();
+ if (level <= parseLevel) {
+ for ( ; level <= parseLevel; level++) {
+ eoParser.popDirectory();
+ }
+ }
+ eoParser.pushDirectory(new Path(dir));
+ } else {
+ eoParser.popDirectory();
+ /* Could check to see if they match */
+ }
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java
new file mode 100644
index 00000000000..40c16aadb2a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java
@@ -0,0 +1,52 @@
+package org.eclipse.cdt.internal.errorparsers;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.File;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+
+public class VCErrorParser implements IErrorParser {
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+ // msdev: filname(linenumber) : error/warning error_desc
+ int firstColon= line.indexOf(':');
+ if (firstColon != -1) {
+ String firstPart= line.substring(0, firstColon);
+ StringTokenizer tok= new StringTokenizer(firstPart, "()");
+ if (tok.hasMoreTokens()) {
+ String fileName= tok.nextToken();
+ if (tok.hasMoreTokens()) {
+ String lineNumber= tok.nextToken();
+ try {
+ int num= Integer.parseInt(lineNumber);
+ int i= fileName.lastIndexOf(File.separatorChar);
+ if (i != -1) {
+ fileName= fileName.substring(i + 1);
+ }
+ IFile file= eoParser.findFileName(fileName);
+ if (file != null || eoParser.isConflictingName(fileName)) {
+ String desc= line.substring(firstColon + 1).trim();
+ if (file == null) {
+ desc= "*" + desc;
+ }
+ int severity= IMarker.SEVERITY_ERROR;
+ if (desc.startsWith("warning")) {
+ severity= IMarker.SEVERITY_WARNING;
+ }
+ eoParser.generateMarker(file, num, desc, severity, null);
+ return true;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java
new file mode 100644
index 00000000000..0e9022d85ba
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CCodeFormatter.java
@@ -0,0 +1,24 @@
+package org.eclipse.cdt.internal.formatter;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+public class CCodeFormatter {
+ //public FormatterOptions options;
+
+ public CCodeFormatter() {
+ }
+
+// CCodeFormatter(FormatterOptions options) {
+// }
+
+ public String formatSourceString(String content) {
+ return content;
+ }
+
+
+}
+
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/ASCII_CharStream.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/ASCII_CharStream.java
new file mode 100644
index 00000000000..d844e6171c4
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/ASCII_CharStream.java
@@ -0,0 +1,414 @@
+/* Generated By:JavaCC: Do not edit this line. ASCII_CharStream.java Version 0.7pre6 */
+package org.eclipse.cdt.internal.parser;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/* fixed ASCII_CharStream: tab is counting only one character for column */
+
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+public final class ASCII_CharStream {
+ public static final boolean staticFlag= true;
+ static int bufsize;
+ static int available;
+ static int tokenBegin;
+ static public int bufpos= -1;
+ static private int bufline[];
+ static private int bufcolumn[];
+
+
+ static private int column= 0;
+ static private int line= 1;
+
+
+ static private boolean prevCharIsCR= false;
+ static private boolean prevCharIsLF= false;
+
+
+ static private java.io.Reader inputStream;
+
+
+ static private char[] buffer;
+ static private int maxNextCharInd= 0;
+ static private int inBuf= 0;
+
+
+ static private final void ExpandBuff(boolean wrapAround) {
+ char[] newbuffer= new char[bufsize + 2048];
+ int newbufline[]= new int[bufsize + 2048];
+ int newbufcolumn[]= new int[bufsize + 2048];
+
+
+ try {
+ if (wrapAround) {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
+ buffer= newbuffer;
+
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline= newbufline;
+
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn= newbufcolumn;
+
+
+ maxNextCharInd= (bufpos += (bufsize - tokenBegin));
+ } else {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer= newbuffer;
+
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline= newbufline;
+
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn= newbufcolumn;
+
+
+ maxNextCharInd= (bufpos -= tokenBegin);
+ }
+ } catch (Throwable t) {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available= bufsize;
+ tokenBegin= 0;
+ }
+
+
+ static private final void FillBuff() throws java.io.IOException {
+ if (maxNextCharInd == available) {
+ if (available == bufsize) {
+ if (tokenBegin > 2048) {
+ bufpos= maxNextCharInd= 0;
+ available= tokenBegin;
+ } else
+ if (tokenBegin < 0)
+ bufpos= maxNextCharInd= 0;
+ else
+ ExpandBuff(false);
+ } else
+ if (available > tokenBegin)
+ available= bufsize;
+ else
+ if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available= tokenBegin;
+ }
+
+
+ int i;
+ try {
+ if ((i= inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) {
+ inputStream.close();
+ throw new java.io.IOException();
+ } else {
+ maxNextCharInd += i;
+ }
+ return;
+ } catch (java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin= bufpos;
+ throw e;
+ }
+ }
+
+
+ static public final char BeginToken() throws java.io.IOException {
+ tokenBegin= -1;
+ char c= readChar();
+ tokenBegin= bufpos;
+
+
+ return c;
+ }
+
+
+ static private final void UpdateLineColumn(char c) {
+ column++;
+
+
+ if (prevCharIsLF) {
+ prevCharIsLF= false;
+ line += (column= 1);
+ } else
+ if (prevCharIsCR) {
+ prevCharIsCR= false;
+ if (c == '\n') {
+ prevCharIsLF= true;
+ } else
+ line += (column= 1);
+ }
+
+
+ switch (c) {
+ case '\r' :
+ prevCharIsCR= true;
+ break;
+ case '\n' :
+ prevCharIsLF= true;
+ break;
+ default :
+ break;
+ }
+
+
+ bufline[bufpos]= line;
+ bufcolumn[bufpos]= column;
+ }
+
+
+ static public final char readChar() throws java.io.IOException {
+ if (inBuf > 0) {
+ --inBuf;
+ return (char) ((char) 0xff & buffer[(bufpos == bufsize - 1) ? (bufpos= 0) : ++bufpos]);
+ }
+
+
+ if (++bufpos >= maxNextCharInd) {
+ FillBuff();
+ }
+
+
+ char c= (char) ((char) 0xff & buffer[bufpos]);
+
+ // Remove '\' line continuations
+ if(c == '\\') {
+ int pos = bufpos+1;
+ if((bufpos+1) >= maxNextCharInd) {
+ // Safe to do so here, we already have the character
+ FillBuff();
+ pos = bufpos;
+ }
+ char n = (char) ((char) 0xff & buffer[pos]);
+ if((n == '\n') || (n == '\r')) {
+ UpdateLineColumn(n);
+ // We eat the \\\n combo.
+ bufpos++;
+ if(n == '\r') {
+ while((c = readChar()) == '\n');
+ }
+ } else {
+ UpdateLineColumn(c);
+ }
+ } else {
+ UpdateLineColumn(c);
+ }
+ return (c);
+ }
+
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+
+ static public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+
+ static public final int getLine() {
+ return bufline[bufpos];
+ }
+
+
+ static public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+
+ static public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+
+ static public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+
+ static public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+
+ static public final void backup(int amount) {
+
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+
+ public ASCII_CharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) {
+ if (inputStream != null)
+ throw new Error(
+ "\n ERROR: Second call to the constructor of a static ASCII_CharStream. You must\n"
+ + " either use ReInit() or set the JavaCC option STATIC to false\n"
+ + " during the generation of this class.");
+ inputStream= dstream;
+ line= startline;
+ column= startcolumn - 1;
+
+
+ available= bufsize= buffersize;
+ buffer= new char[buffersize];
+ bufline= new int[buffersize];
+ bufcolumn= new int[buffersize];
+ }
+
+
+ public ASCII_CharStream(java.io.Reader dstream, int startline, int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+
+ static public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) {
+ inputStream= dstream;
+ line= startline;
+ column= startcolumn - 1;
+
+
+ if (buffer == null || buffersize != buffer.length) {
+ available= bufsize= buffersize;
+ buffer= new char[buffersize];
+ bufline= new int[buffersize];
+ bufcolumn= new int[buffersize];
+ }
+ prevCharIsLF= prevCharIsCR= false;
+ tokenBegin= inBuf= maxNextCharInd= 0;
+ bufpos= -1;
+ }
+
+
+ static public void ReInit(java.io.Reader dstream, int startline, int startcolumn) {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+
+ public ASCII_CharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+
+ public ASCII_CharStream(java.io.InputStream dstream, int startline, int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+
+ static public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+
+ static public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+
+ static public final String GetImage() {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1);
+ }
+
+
+ static public final char[] GetSuffix(int len) {
+ char[] ret= new char[len];
+
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+
+ return ret;
+ }
+
+
+ static public void Done() {
+ buffer= null;
+ bufline= null;
+ bufcolumn= null;
+ }
+
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.
+ */
+ static public void adjustBeginLineColumn(int newLine, int newCol) {
+ int start= tokenBegin;
+ int len;
+
+
+ if (bufpos >= tokenBegin) {
+ len= bufpos - tokenBegin + inBuf + 1;
+ } else {
+ len= bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+
+ int i= 0, j= 0, k= 0;
+ int nextColDiff= 0, columnDiff= 0;
+
+
+ while (i < len && bufline[j= start % bufsize] == bufline[k= ++start % bufsize]) {
+ bufline[j]= newLine;
+ nextColDiff= columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j]= newCol + columnDiff;
+ columnDiff= nextColDiff;
+ i++;
+ }
+
+
+ if (i < len) {
+ bufline[j]= newLine++;
+ bufcolumn[j]= newCol + columnDiff;
+
+
+ while (i++ < len) {
+ if (bufline[j= start % bufsize] != bufline[++start % bufsize])
+ bufline[j]= newLine++;
+ else
+ bufline[j]= newLine;
+ }
+ }
+
+
+ line= bufline[j];
+ column= bufcolumn[j];
+ }
+
+
+}
+
+
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/CStructurizer.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/CStructurizer.java
new file mode 100644
index 00000000000..260c9b3276e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/CStructurizer.java
@@ -0,0 +1,46 @@
+package org.eclipse.cdt.internal.parser;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.cdt.internal.parser.generated.CPPParser;
+import org.eclipse.cdt.internal.parser.generated.ParseException;
+import org.eclipse.cdt.internal.parser.generated.TokenMgrError;
+
+
+public class CStructurizer {
+
+ private static CStructurizer fgStructurizerSingelton= new CStructurizer();
+
+ public static CStructurizer getCStructurizer() {
+ return fgStructurizerSingelton;
+ }
+
+ private CPPParser fParser;
+ private CStructurizer() {
+ }
+
+ public synchronized void parse(IStructurizerCallback callback, InputStream inputStream) throws IOException {
+ LinePositionInputStream lpiStream= new LinePositionInputStream(inputStream);
+ try {
+ ParserCallback cb= new ParserCallback(lpiStream, callback);
+ if (fParser == null) {
+ fParser= new CPPParser(lpiStream);
+ } else {
+ fParser.ReInit(lpiStream);
+ }
+ fParser.setParserCallback(cb);
+
+ fParser.translation_unit();
+ } catch (TokenMgrError error) {
+ callback.reportError(error);
+ } catch (ParseException e) {
+ callback.reportError(e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/IStructurizerCallback.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/IStructurizerCallback.java
new file mode 100644
index 00000000000..f5d540eddf4
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/IStructurizerCallback.java
@@ -0,0 +1,26 @@
+package org.eclipse.cdt.internal.parser;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+public interface IStructurizerCallback {
+
+ void includeDecl(String name, int startPos, int endPos, int startLine, int endLine);
+
+ void defineDecl(String name, int startPos, int endPos, int startLine, int endLine);
+
+ void functionDeclBegin(String name, int nameStartPos, int nameEndPos, int declStartPos, int startLine, int kind, int modifiers);
+ void functionDeclEnd(int declEndPos, int endLine, boolean prototype);
+
+ void fieldDecl(String name, int nameStartPos, int nameEndPos, int declStartPos, int declEndPos, int startLine, int endLine, int modifiers);
+
+ void structDeclBegin(String name, int kind, int nameStartPos, int nameEndPos, int declStartPos, int startLine, int modifiers);
+ void structDeclEnd(int declEndPos, int endLine);
+
+ void superDecl(String name);
+
+ void reportError(Throwable throwable);
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/LinePositionInputStream.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/LinePositionInputStream.java
new file mode 100644
index 00000000000..df2747f5910
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/LinePositionInputStream.java
@@ -0,0 +1,66 @@
+package org.eclipse.cdt.internal.parser;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * An input stream that only observes the stream and remembers the position of new
+ * lines
+ */
+public class LinePositionInputStream extends InputStream {
+
+ private List fLinePositions;
+ private InputStream fInputStream;
+
+ private boolean fRRead;
+ private boolean fAddLine;
+
+ private int fCurrPosition;
+
+ public LinePositionInputStream(InputStream inputStream) throws IOException {
+ fInputStream= inputStream;
+ fLinePositions= new ArrayList(30);
+ fAddLine= true;
+ fRRead= false;
+ fCurrPosition= 0;
+ }
+
+ public int read() throws IOException {
+ int ch= fInputStream.read();
+ if (fRRead && ch == '\n') {
+ fRRead= false;
+ } else {
+ if (fAddLine) {
+ fLinePositions.add(new Integer(fCurrPosition));
+ fAddLine= false;
+ }
+
+ if (ch == '\n' || ch == '\r') {
+ fAddLine= true;
+ fRRead= (ch == '\r');
+ } else {
+ fRRead= false;
+ }
+ }
+ fCurrPosition++;
+ return ch;
+ }
+
+ public int getPosition(int line, int col) {
+ line--;
+ col--;
+ if (line < fLinePositions.size()) {
+ Integer lineStart= (Integer)fLinePositions.get(line);
+ return lineStart.intValue() + col;
+ }
+ return -1;
+ }
+}
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/ParserCallback.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/ParserCallback.java
new file mode 100644
index 00000000000..19248c9072c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/ParserCallback.java
@@ -0,0 +1,135 @@
+package org.eclipse.cdt.internal.parser;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.internal.parser.generated.Token;
+
+public final class ParserCallback {
+
+ public final static int K_CLASS= ICElement.C_CLASS;
+ public final static int K_STRUCT= ICElement.C_STRUCT;
+ public final static int K_UNION= ICElement.C_UNION;
+ public final static int K_FUNCTION= ICElement.C_FUNCTION;
+ public final static int K_DECL= ICElement.C_FUNCTION_DECLARATION;
+ public final static int K_CTOR= ICElement.C_CLASS_CTOR;
+ public final static int K_DTOR= ICElement.C_CLASS_DTOR;
+ public final static int K_STATIC= ICElement.C_STORAGE_STATIC;
+ public final static int K_EXTERN= ICElement.C_STORAGE_EXTERN;
+
+ private LinePositionInputStream fLinePositions;
+ private IStructurizerCallback fCallback;
+ private int fStorage;
+
+ public ParserCallback(LinePositionInputStream lpiStream, IStructurizerCallback callback) {
+ fLinePositions= lpiStream;
+ fCallback= callback;
+ }
+
+ public void functionDeclBegin(Token nameToken, Token firstToken, int kind) {
+ int declStart= fLinePositions.getPosition(firstToken.beginLine, firstToken.beginColumn);
+ int nameStart= fLinePositions.getPosition(nameToken.beginLine, nameToken.beginColumn);
+ int nameEnd= fLinePositions.getPosition(nameToken.endLine, nameToken.endColumn);
+
+ fCallback.functionDeclBegin(nameToken.image, nameStart, nameEnd, declStart,
+ firstToken.beginLine, kind, fStorage);
+ fStorage = 0;
+ }
+
+ public void functionDeclEnd(Token lastToken) {
+ int declEnd= fLinePositions.getPosition(lastToken.endLine, lastToken.endColumn);
+ boolean prototype = ";".equals(lastToken.image);
+
+ fCallback.functionDeclEnd(declEnd, lastToken.endLine, prototype);
+ }
+
+ public void structDeclBegin(Token nameToken, int kind, Token firstToken) {
+ int declStart= fLinePositions.getPosition(firstToken.beginLine, firstToken.beginColumn);
+ int nameStart= fLinePositions.getPosition(nameToken.beginLine, nameToken.beginColumn);
+ int nameEnd= fLinePositions.getPosition(nameToken.endLine, nameToken.endColumn);
+
+ fCallback.structDeclBegin(nameToken.image, kind, nameStart, nameEnd, declStart, firstToken.beginLine, fStorage);
+ fStorage = 0;
+ }
+
+ public void structDeclEnd(Token lastToken) {
+ int declEnd= fLinePositions.getPosition(lastToken.endLine, lastToken.endColumn);
+
+ fCallback.structDeclEnd(declEnd, lastToken.endLine);
+ }
+
+ public void fieldDecl(Token nameToken, Token firstToken, Token lastToken) {
+ int declStart= fLinePositions.getPosition(firstToken.beginLine, firstToken.beginColumn);
+ int declEnd= fLinePositions.getPosition(lastToken.endLine, lastToken.endColumn);
+ int nameStart= fLinePositions.getPosition(nameToken.beginLine, nameToken.beginColumn);
+ int nameEnd= fLinePositions.getPosition(nameToken.endLine, nameToken.endColumn);
+
+ fCallback.fieldDecl(nameToken.image, nameStart, nameEnd, declStart, declEnd,
+ firstToken.beginLine, lastToken.endLine, fStorage);
+ fStorage = 0;
+ }
+
+ public void superDecl(String name) {
+ fCallback.superDecl(name);
+ }
+
+ public void includeDecl(String name, int line, int column) {
+ int start= fLinePositions.getPosition(line, column);
+ int end= fLinePositions.getPosition(line, column + name.length()) - 1;
+ fCallback.includeDecl(name, start, end, line, line);
+ }
+
+ public void defineDecl(String name, int line, int column) {
+ int start= fLinePositions.getPosition(line, column);
+ int end= fLinePositions.getPosition(line, column + name.length()) - 1;
+ fCallback.defineDecl(name, start, end, line, line);
+ }
+
+ public void storageSpecifier(int kind) {
+ fStorage |= kind;
+ }
+
+ public boolean isStorageClassSpecifier(Token token) {
+ String str= token.image;
+ if (str != null) {
+ if ("JNIEXPORT".equals(str)) {
+ return true;
+ }
+ if (str.startsWith("__declspec")) {
+ return true;
+ }
+ if ("JNICALL".equals(str)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean overreadBlocks() {
+ return true;
+ }
+
+ // ---- util functions -----
+ public static Token createToken(String name, Token positions) {
+ Token res= new Token();
+ res.image= name;
+ res.beginColumn= positions.beginColumn;
+ res.beginLine= positions.beginLine;
+ res.endColumn= positions.endColumn;
+ res.endLine= positions.endLine;
+ return res;
+ }
+
+ public static Token createToken(String name, Token positionBegin, Token positionEnd) {
+ Token res= new Token();
+ res.image= name;
+ res.beginColumn= positionBegin.beginColumn;
+ res.beginLine= positionBegin.beginLine;
+ res.endColumn= positionEnd.endColumn;
+ res.endLine= positionEnd.endLine;
+ return res;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/RunParserGenerator.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/RunParserGenerator.java
new file mode 100644
index 00000000000..699d2bf8527
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/RunParserGenerator.java
@@ -0,0 +1,39 @@
+package org.eclipse.cdt.internal.parser;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * generates the parser from the CPLUSPLUS.jj file. after running, import the sources
+ * from the given temporary output directory
+ * needs javacc in the class path (www.metamata.com)
+ * version used for this release 1.2
+ */
+public class RunParserGenerator {
+
+ private static final String tempOutputDir="c:\\temp\\jccout";
+
+
+ public static void main(String[] args) {
+ /* URL url= (new RunParserGenerator()).getClass().getResource("/com/ibm/cdt/parser/generated/CPLUSPLUS.jj");
+ File file= new File(url.getFile());
+
+ String[] arguments= new String[] {
+ "-OUTPUT_DIRECTORY=" + tempOutputDir,
+ file.getPath()
+ };
+ try {
+ System.out.println("start javacc...");
+ COM.sun.labs.javacc.Main.main(arguments);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println("javacc finished..."); */
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParser.java
new file mode 100644
index 00000000000..4534f05a2b5
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParser.java
@@ -0,0 +1,10090 @@
+/* Generated By:JavaCC: Do not edit this line. CPPParser.java */
+package org.eclipse.cdt.internal.parser.generated;
+
+import org.eclipse.cdt.internal.parser.ParserCallback;
+
+// redirect to a fixed class
+import org.eclipse.cdt.internal.parser.ASCII_CharStream;
+
+public final class CPPParser implements CPPParserConstants {
+
+ private static String vers = "0.1";
+ private static String id = "C++ Parser";
+
+ static ParserCallback fgCallback;
+
+ public static void setParserCallback(ParserCallback cb) {
+ fgCallback= cb;
+ }
+
+
+ /*
+ * Methods used in semantics predicates.
+ */
+ /**
+ * Reads a fully qualified name (since it is used during lookahead, we
+ * cannot use token. We have to explicitly use getToken).
+ */
+ static String getFullyScopedName()
+ {
+ Token t = getToken(1);
+
+ if (t.kind != ID && t.kind != SCOPE)
+ return null;
+
+ StringBuffer s = new StringBuffer();
+
+ int i;
+ if (t.kind != SCOPE)
+ {
+ s.append(t.image);
+ t = getToken(2);
+ i = 3;
+ }
+ else
+ i = 2;
+
+ while (t.kind == SCOPE)
+ {
+ s.append(t.image);
+ s.append((t = getToken(i++)).image);
+ t = getToken(i++);
+ }
+
+ return s.toString();
+ }
+
+ static boolean isNotNull(Object obj) {
+ return obj != null;
+ }
+
+
+ static void skipToClosedBracket() {
+ int count= 1;
+ Token t;
+ do {
+ t= getNextToken();
+ if (t.kind == LCURLYBRACE) {
+ count++;
+ } else if (t.kind == RCURLYBRACE) {
+ count--;
+ }
+ } while (t.kind != EOF && count != 0);
+ }
+
+ static void synchronize(int kind) {
+ if (getToken(0).kind == kind) {
+ return;
+ }
+ Token t;
+ do {
+ t= getNextToken();
+ } while (t.kind != EOF && t.kind != kind);
+ }
+
+ /**
+ * This method first tries to read a sequence of tokens of the form
+ * ("::")? ("::" )*
+ * and if it succeeds then asks the symbol table manager if this is
+ * the name of a constructor.
+ */
+ static boolean isCtor()
+ {
+ return getFullyScopedName() != null;
+ }
+
+ static final public void translation_unit() throws ParseException {
+ label_1:
+ while (true) {
+ if (jj_2_1(2)) {
+ ;
+ } else {
+ break label_1;
+ }
+ external_declaration();
+ }
+ jj_consume_token(0);
+ }
+
+ static final public void external_declaration() throws ParseException {
+ boolean isTypedef = false;
+ Token firstToken= getToken(1);
+ String name;
+ try {
+ if (jj_2_5(2147483647)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case TEMPLATE:
+ template_head();
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ ;
+ }
+ declaration(false, null);
+ } else if (jj_2_6(2147483647)) {
+ enum_specifier();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ case SCOPE:
+ case AMPERSAND:
+ case STAR:
+ case TILDE:
+ case OPERATOR:
+ case ID:
+ init_declarator_list(false, false, firstToken);
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } else if (jj_2_7(2147483647)) {
+ dtor_definition(firstToken);
+ } else if (jj_2_8(2147483647)) {
+ ctor_definition(firstToken);
+ } else if (jj_2_9(2147483647)) {
+ function_definition(firstToken);
+ } else if (jj_2_10(2147483647)) {
+ conversion_function_decl_or_def(firstToken);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case TEMPLATE:
+ template_head();
+ if (jj_2_2(2147483647)) {
+ ctor_definition(firstToken);
+ } else if (jj_2_3(2147483647)) {
+ function_definition(firstToken);
+ } else if (jj_2_4(1)) {
+ isTypedef = declaration_specifiers();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ case SCOPE:
+ case AMPERSAND:
+ case STAR:
+ case TILDE:
+ case OPERATOR:
+ case ID:
+ init_declarator_list(isTypedef, false, firstToken);
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ if (jj_2_11(1)) {
+ declaration(true, firstToken);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ } catch (ParseException e) {
+ synchronize(SEMICOLON);
+ }
+ }
+
+ static final public void function_definition(Token firstToken) throws ParseException {
+ boolean isTypedef;
+ if (jj_2_12(3)) {
+ isTypedef = declaration_specifiers();
+ function_declarator(isTypedef, firstToken);
+ func_decl_def();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SCOPE:
+ case AMPERSAND:
+ case STAR:
+ case OPERATOR:
+ case ID:
+ function_declarator(false, firstToken);
+ func_decl_def();
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ fgCallback.functionDeclEnd(getToken(0));
+ }
+
+ static final public void func_decl_def() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ case LCURLYBRACE:
+ compound_statement();
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void linkage_specification(Token firstToken) throws ParseException {
+ jj_consume_token(EXTERN);
+ jj_consume_token(STRING);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LCURLYBRACE:
+ jj_consume_token(LCURLYBRACE);
+ label_2:
+ while (true) {
+ if (jj_2_13(1)) {
+ ;
+ } else {
+ break label_2;
+ }
+ external_declaration();
+ }
+ jj_consume_token(RCURLYBRACE);
+ if (jj_2_14(2147483647)) {
+ jj_consume_token(SEMICOLON);
+ } else {
+ ;
+ }
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ if (jj_2_15(1)) {
+ declaration(false, firstToken);
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+ static final public void declaration(boolean report, Token firstToken) throws ParseException {
+ boolean isTypedef = false;
+ if (jj_2_16(2)) {
+ isTypedef = declaration_specifiers();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ case SCOPE:
+ case AMPERSAND:
+ case STAR:
+ case TILDE:
+ case OPERATOR:
+ case ID:
+ init_declarator_list(isTypedef, report, firstToken);
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case EXTERN:
+ linkage_specification(firstToken);
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+/**
+ * Very temporary. Just returns true if it sees a typedef. Finally, we will
+ * need a structure that stores all the attributes.
+ */
+ static final public boolean type_modifiers() throws ParseException {
+ boolean isTypedef = false;
+ if (jj_2_17(1)) {
+ isTypedef = storage_class_specifier();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CONST:
+ case VOLATILE:
+ type_qualifier();
+ break;
+ case INLINE:
+ jj_consume_token(INLINE);
+ break;
+ case VIRTUAL:
+ jj_consume_token(VIRTUAL);
+ break;
+ case FRIEND:
+ jj_consume_token(FRIEND);
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ {if (true) return isTypedef;}
+ throw new Error("Missing return statement in function");
+ }
+
+ /*
+boolean declaration_specifiers() :
+{
+ Token t;
+ boolean isTypedef = false, tmp;
+}
+{
+ (
+
+ ( LOOKAHEAD(2)
+ (
+ LOOKAHEAD(builtin_type_specifier()) builtin_type_specifier()
+ |
+ LOOKAHEAD(type_modifiers()) tmp = type_modifiers() { isTypedef |= tmp; }
+ )
+
+
+ )*
+
+ (
+ class_specifier()
+ |
+ enum_specifier()
+ |
+ qualified_type()
+ )
+
+ ( LOOKAHEAD(2)
+ (
+ LOOKAHEAD(builtin_type_specifier()) builtin_type_specifier()
+ |
+ LOOKAHEAD(type_modifiers()) tmp = type_modifiers() { isTypedef |= tmp; }
+ // |
+ //
+ )
+
+ )*
+
+ )
+ { return isTypedef; }
+}
+ */
+
+
+/**
+ * Very temporary. Just returns true if it sees a typedef. Finally, we will
+ * need a structure that stores all the attributes.
+ */
+ static final public boolean declaration_specifiers() throws ParseException {
+ Token t;
+ boolean isTypedef = false, tmp;
+ if (jj_2_32(1)) {
+ label_3:
+ while (true) {
+ tmp = type_modifiers();
+ isTypedef |= tmp;
+ if (jj_2_18(2147483647)) {
+ ;
+ } else {
+ break label_3;
+ }
+ }
+ if (jj_2_26(2)) {
+ if (jj_2_24(2147483647)) {
+ builtin_type_specifier();
+ label_4:
+ while (true) {
+ if (jj_2_19(2)) {
+ ;
+ } else {
+ break label_4;
+ }
+ if (jj_2_20(2147483647)) {
+ builtin_type_specifier();
+ } else if (jj_2_21(2147483647)) {
+ tmp = type_modifiers();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ isTypedef |= tmp;
+ }
+ } else if (jj_2_25(1)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRUCT:
+ case CLASS:
+ case UNION:
+ class_specifier();
+ break;
+ case ENUM:
+ enum_specifier();
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ if (jj_2_22(1)) {
+ qualified_type();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ label_5:
+ while (true) {
+ if (jj_2_23(2)) {
+ ;
+ } else {
+ break label_5;
+ }
+ tmp = type_modifiers();
+ isTypedef |= tmp;
+ }
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } else {
+ ;
+ }
+ } else if (jj_2_33(2147483647)) {
+ builtin_type_specifier();
+ label_6:
+ while (true) {
+ if (jj_2_27(2)) {
+ ;
+ } else {
+ break label_6;
+ }
+ if (jj_2_28(2147483647)) {
+ builtin_type_specifier();
+ } else if (jj_2_29(1)) {
+ tmp = type_modifiers();
+ isTypedef |= tmp;
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } else if (jj_2_34(1)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRUCT:
+ case CLASS:
+ case UNION:
+ class_specifier();
+ break;
+ case ENUM:
+ enum_specifier();
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ if (jj_2_30(1)) {
+ qualified_type();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ label_7:
+ while (true) {
+ if (jj_2_31(2)) {
+ ;
+ } else {
+ break label_7;
+ }
+ tmp = type_modifiers();
+ isTypedef |= tmp;
+ }
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return isTypedef;}
+ throw new Error("Missing return statement in function");
+ }
+
+/*
+void type_specifier() :
+{}
+{
+ simple_type_specifier()
+ |
+ class_specifier()
+ |
+ enum_specifier()
+}
+*/
+ static final public void simple_type_specifier() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CHAR:
+ case DOUBLE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case SHORT:
+ case SIGNED:
+ case UNSIGNED:
+ case VOID:
+ builtin_type_specifier();
+ break;
+ default:
+ jj_la1[13] = jj_gen;
+ if (jj_2_35(1)) {
+ qualified_type();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+ static final public void scope_override_lookahead() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SCOPE:
+ jj_consume_token(SCOPE);
+ break;
+ case ID:
+ jj_consume_token(ID);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LESSTHAN:
+ jj_consume_token(LESSTHAN);
+ template_argument_list();
+ jj_consume_token(GREATERTHAN);
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ ;
+ }
+ jj_consume_token(SCOPE);
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public String scope_override() throws ParseException {
+ String name = "";
+ Token t;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SCOPE:
+ jj_consume_token(SCOPE);
+ name += "::";
+ label_8:
+ while (true) {
+ if (jj_2_36(2)) {
+ ;
+ } else {
+ break label_8;
+ }
+ t = jj_consume_token(ID);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LESSTHAN:
+ jj_consume_token(LESSTHAN);
+ template_argument_list();
+ jj_consume_token(GREATERTHAN);
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ ;
+ }
+ jj_consume_token(SCOPE);
+ name += t.image + "::";
+ }
+ break;
+ case ID:
+ label_9:
+ while (true) {
+ t = jj_consume_token(ID);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LESSTHAN:
+ jj_consume_token(LESSTHAN);
+ template_argument_list();
+ jj_consume_token(GREATERTHAN);
+ break;
+ default:
+ jj_la1[17] = jj_gen;
+ ;
+ }
+ jj_consume_token(SCOPE);
+ name += t.image + "::";
+ if (jj_2_37(2)) {
+ ;
+ } else {
+ break label_9;
+ }
+ }
+ break;
+ default:
+ jj_la1[18] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return name;}
+ throw new Error("Missing return statement in function");
+ }
+
+ static final public Token qualified_id() throws ParseException {
+ String name = "";
+ String scopeName= "";
+ Token t;
+ Token beginToken= getToken(1);
+ if (jj_2_38(2147483647)) {
+ scopeName = scope_override();
+ } else {
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ID:
+ t = jj_consume_token(ID);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LESSTHAN:
+ jj_consume_token(LESSTHAN);
+ template_argument_list();
+ jj_consume_token(GREATERTHAN);
+ break;
+ default:
+ jj_la1[19] = jj_gen;
+ ;
+ }
+ {if (true) return ParserCallback.createToken(scopeName + t.image, beginToken, t);}
+ break;
+ case OPERATOR:
+ jj_consume_token(OPERATOR);
+ name = optor();
+ {if (true) return ParserCallback.createToken(scopeName + "operator" + name, beginToken, getToken(0));}
+ break;
+ default:
+ jj_la1[20] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ static final public void ptr_to_member() throws ParseException {
+ scope_override();
+ jj_consume_token(STAR);
+ }
+
+ static final public void qualified_type() throws ParseException {
+ if (isNotNull(getFullyScopedName())) {
+
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ qualified_id();
+ }
+
+ static final public void type_qualifier() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CONST:
+ jj_consume_token(CONST);
+ break;
+ case VOLATILE:
+ jj_consume_token(VOLATILE);
+ break;
+ default:
+ jj_la1[21] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/**
+ * Very temporary. Just returns true if it sees a typedef. Finally, we will
+ * need a structure that stores all the attributes.
+ */
+ static final public boolean storage_class_specifier() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case AUTO:
+ case REGISTER:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case AUTO:
+ jj_consume_token(AUTO);
+ break;
+ case REGISTER:
+ jj_consume_token(REGISTER);
+ break;
+ default:
+ jj_la1[22] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return false;}
+ break;
+ case STATIC:
+ jj_consume_token(STATIC);
+ fgCallback.storageSpecifier(ParserCallback.K_STATIC); {if (true) return false;}
+ break;
+ case EXTERN:
+ jj_consume_token(EXTERN);
+ fgCallback.storageSpecifier(ParserCallback.K_EXTERN); {if (true) return false;}
+ break;
+ case TYPEDEF:
+ jj_consume_token(TYPEDEF);
+ {if (true) return true;}
+ break;
+ default:
+ jj_la1[23] = jj_gen;
+ if (fgCallback.isStorageClassSpecifier(getToken(1))) {
+ jj_consume_token(ID);
+ {if (true) return false;}
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ static final public void builtin_type_specifier() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VOID:
+ jj_consume_token(VOID);
+ break;
+ case CHAR:
+ jj_consume_token(CHAR);
+ break;
+ case SHORT:
+ jj_consume_token(SHORT);
+ break;
+ case INT:
+ jj_consume_token(INT);
+ break;
+ case LONG:
+ jj_consume_token(LONG);
+ break;
+ case FLOAT:
+ jj_consume_token(FLOAT);
+ break;
+ case DOUBLE:
+ jj_consume_token(DOUBLE);
+ break;
+ case SIGNED:
+ jj_consume_token(SIGNED);
+ break;
+ case UNSIGNED:
+ jj_consume_token(UNSIGNED);
+ break;
+ default:
+ jj_la1[24] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void init_declarator_list(boolean isTypedef, boolean report, Token firstToken) throws ParseException {
+ init_declarator(isTypedef, report, firstToken);
+ label_10:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[25] = jj_gen;
+ break label_10;
+ }
+ jj_consume_token(COMMA);
+ init_declarator(isTypedef, report, firstToken);
+ }
+ }
+
+ static final public void init_declarator(boolean isTypedef, boolean report, Token firstToken) throws ParseException {
+ Token nameToken;
+ nameToken = declarator();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ case ASSIGNEQUAL:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ASSIGNEQUAL:
+ jj_consume_token(ASSIGNEQUAL);
+ initializer();
+ break;
+ case LPARENTHESIS:
+ jj_consume_token(LPARENTHESIS);
+ expression_list();
+ jj_consume_token(RPARENTHESIS);
+ break;
+ default:
+ jj_la1[26] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[27] = jj_gen;
+ ;
+ }
+ if (report && firstToken != null) {
+ fgCallback.fieldDecl(nameToken, firstToken, getToken(0));
+ }
+ }
+
+// used only in lookaheads
+ static final public void class_head() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRUCT:
+ jj_consume_token(STRUCT);
+ break;
+ case UNION:
+ jj_consume_token(UNION);
+ break;
+ case CLASS:
+ jj_consume_token(CLASS);
+ break;
+ default:
+ jj_la1[28] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ID:
+ jj_consume_token(ID);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ base_clause();
+ break;
+ default:
+ jj_la1[29] = jj_gen;
+ ;
+ }
+ break;
+ default:
+ jj_la1[30] = jj_gen;
+ ;
+ }
+ }
+
+ static final public void class_specifier() throws ParseException {
+ Token t, u;
+ Token firstToken= getToken(1);
+ int kind;
+ try {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRUCT:
+ jj_consume_token(STRUCT);
+ kind= ParserCallback.K_STRUCT;
+ break;
+ case UNION:
+ jj_consume_token(UNION);
+ kind= ParserCallback.K_UNION;
+ break;
+ case CLASS:
+ jj_consume_token(CLASS);
+ kind= ParserCallback.K_CLASS;
+ break;
+ default:
+ jj_la1[31] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LCURLYBRACE:
+ jj_consume_token(LCURLYBRACE);
+ fgCallback.structDeclBegin(getToken(0), kind, firstToken);
+ label_11:
+ while (true) {
+ if (jj_2_39(1)) {
+ ;
+ } else {
+ break label_11;
+ }
+ member_declaration();
+ }
+ u = jj_consume_token(RCURLYBRACE);
+ fgCallback.structDeclEnd(u);
+ break;
+ default:
+ jj_la1[33] = jj_gen;
+ if (jj_2_42(2)) {
+ t = jj_consume_token(ID);
+ fgCallback.structDeclBegin(t, kind, firstToken);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ base_clause();
+ break;
+ default:
+ jj_la1[32] = jj_gen;
+ ;
+ }
+ jj_consume_token(LCURLYBRACE);
+ label_12:
+ while (true) {
+ if (jj_2_40(1)) {
+ ;
+ } else {
+ break label_12;
+ }
+ member_declaration();
+ }
+ u = jj_consume_token(RCURLYBRACE);
+ fgCallback.structDeclEnd(u);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ID:
+ t = jj_consume_token(ID);
+ if (jj_2_41(2)) {
+ jj_consume_token(LESSTHAN);
+ template_argument_list();
+ jj_consume_token(GREATERTHAN);
+ } else {
+ ;
+ }
+ break;
+ default:
+ jj_la1[34] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ } catch (ParseException e) {
+ synchronize(SEMICOLON);
+ }
+ }
+
+ static final public void base_clause() throws ParseException {
+ jj_consume_token(COLON);
+ base_specifier();
+ label_13:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[35] = jj_gen;
+ break label_13;
+ }
+ jj_consume_token(COMMA);
+ base_specifier();
+ }
+ }
+
+ static final public void base_specifier() throws ParseException {
+ Token t;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case VIRTUAL:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VIRTUAL:
+ jj_consume_token(VIRTUAL);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ access_specifier();
+ break;
+ default:
+ jj_la1[36] = jj_gen;
+ ;
+ }
+ break;
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ access_specifier();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VIRTUAL:
+ jj_consume_token(VIRTUAL);
+ break;
+ default:
+ jj_la1[37] = jj_gen;
+ ;
+ }
+ break;
+ default:
+ jj_la1[38] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[39] = jj_gen;
+ ;
+ }
+ if (jj_2_43(2147483647)) {
+ scope_override();
+ } else {
+ ;
+ }
+ t = jj_consume_token(ID);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LESSTHAN:
+ jj_consume_token(LESSTHAN);
+ template_argument_list();
+ jj_consume_token(GREATERTHAN);
+ break;
+ default:
+ jj_la1[40] = jj_gen;
+ ;
+ }
+ fgCallback.superDecl(t.image);
+ }
+
+ static final public void access_specifier() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PUBLIC:
+ jj_consume_token(PUBLIC);
+ break;
+ case PROTECTED:
+ jj_consume_token(PROTECTED);
+ break;
+ case PRIVATE:
+ jj_consume_token(PRIVATE);
+ break;
+ default:
+ jj_la1[41] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void member_declaration() throws ParseException {
+ boolean isTypedef = false;
+ Token firstToken= getToken(1);
+ Token t;
+ String name;
+ try {
+ if (jj_2_44(2147483647)) {
+ declaration(true, firstToken);
+ } else if (jj_2_45(2147483647)) {
+ enum_specifier();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ case SCOPE:
+ case AMPERSAND:
+ case STAR:
+ case TILDE:
+ case OPERATOR:
+ case ID:
+ member_declarator_list(false, firstToken);
+ break;
+ default:
+ jj_la1[42] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } else if (jj_2_46(2147483647)) {
+ conversion_function_decl_or_def(firstToken);
+ } else if (jj_2_47(2147483647)) {
+ dtor_definition(firstToken);
+ } else if (jj_2_48(2147483647)) {
+ dtor_ctor_decl_spec();
+ simple_dtor_declarator(firstToken, "", null);
+ t = jj_consume_token(SEMICOLON);
+ fgCallback.functionDeclEnd(t);
+ } else if (jj_2_49(2147483647)) {
+ ctor_definition(firstToken);
+ } else if (jj_2_50(2147483647)) {
+ dtor_ctor_decl_spec();
+ ctor_declarator(firstToken);
+ t = jj_consume_token(SEMICOLON);
+ fgCallback.functionDeclEnd(t);
+ } else if (jj_2_51(2147483647)) {
+ function_definition(firstToken);
+ } else if (jj_2_52(2147483647)) {
+ isTypedef = declaration_specifiers();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ case SCOPE:
+ case AMPERSAND:
+ case STAR:
+ case TILDE:
+ case OPERATOR:
+ case ID:
+ member_declarator_list(isTypedef, firstToken);
+ break;
+ default:
+ jj_la1[43] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } else if (jj_2_53(2147483647)) {
+ function_declarator(false, firstToken);
+ t = jj_consume_token(SEMICOLON);
+ fgCallback.functionDeclEnd(t);
+ } else if (jj_2_54(3)) {
+ qualified_id();
+ jj_consume_token(SEMICOLON);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ access_specifier();
+ jj_consume_token(COLON);
+ break;
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ default:
+ jj_la1[44] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (ParseException e) {
+ synchronize(SEMICOLON);
+ }
+ }
+
+ static final public void member_declarator_list(boolean isTypedef, Token firstToken) throws ParseException {
+ member_declarator(isTypedef, firstToken);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ASSIGNEQUAL:
+ jj_consume_token(ASSIGNEQUAL);
+ jj_consume_token(OCTALINT);
+ break;
+ default:
+ jj_la1[45] = jj_gen;
+ ;
+ }
+ label_14:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[46] = jj_gen;
+ break label_14;
+ }
+ jj_consume_token(COMMA);
+ member_declarator(isTypedef, firstToken);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ASSIGNEQUAL:
+ jj_consume_token(ASSIGNEQUAL);
+ jj_consume_token(OCTALINT);
+ break;
+ default:
+ jj_la1[47] = jj_gen;
+ ;
+ }
+ }
+ }
+
+ static final public void member_declarator(boolean isTypedef, Token firstToken) throws ParseException {
+ Token nameToken;
+ nameToken = declarator();
+ fgCallback.fieldDecl(nameToken, firstToken, getToken(0));
+ }
+
+ static final public void conversion_function_decl_or_def(Token firstToken) throws ParseException {
+ String name = null;
+ StringBuffer buf= new StringBuffer();
+ Token t;
+ Token nameStart= getToken(1);
+ if (jj_2_55(2147483647)) {
+ name = scope_override();
+ buf.append(name);
+ } else {
+ ;
+ }
+ t = jj_consume_token(OPERATOR);
+ declaration_specifiers();
+ // reconstruct the name
+ Token s= getToken(1);
+ while (t != s) {
+ buf.append(t.image);
+ buf.append(' ');
+ t= t.next;
+ }
+ Token nameToken= ParserCallback.createToken(buf.toString(), nameStart, s);
+ fgCallback.functionDeclBegin(nameToken, firstToken, ParserCallback.K_FUNCTION);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case AMPERSAND:
+ case STAR:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STAR:
+ jj_consume_token(STAR);
+ break;
+ case AMPERSAND:
+ jj_consume_token(AMPERSAND);
+ break;
+ default:
+ jj_la1[48] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[49] = jj_gen;
+ ;
+ }
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_56(1)) {
+ parameter_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ if (jj_2_57(2)) {
+ type_qualifier();
+ } else {
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case THROW:
+ exception_spec();
+ break;
+ default:
+ jj_la1[50] = jj_gen;
+ ;
+ }
+ func_decl_def();
+ fgCallback.functionDeclEnd(getToken(0));
+ }
+
+ static final public void enum_specifier() throws ParseException {
+ Token t;
+ jj_consume_token(ENUM);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LCURLYBRACE:
+ jj_consume_token(LCURLYBRACE);
+ enumerator_list();
+ jj_consume_token(RCURLYBRACE);
+ break;
+ case ID:
+ t = jj_consume_token(ID);
+ if (jj_2_58(2)) {
+ jj_consume_token(LCURLYBRACE);
+ enumerator_list();
+ jj_consume_token(RCURLYBRACE);
+ } else {
+ ;
+ }
+ break;
+ default:
+ jj_la1[51] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void enumerator_list() throws ParseException {
+ enumerator();
+ label_15:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[52] = jj_gen;
+ break label_15;
+ }
+ jj_consume_token(COMMA);
+ enumerator();
+ }
+ }
+
+ static final public void enumerator() throws ParseException {
+ jj_consume_token(ID);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ASSIGNEQUAL:
+ jj_consume_token(ASSIGNEQUAL);
+ constant_expression();
+ break;
+ default:
+ jj_la1[53] = jj_gen;
+ ;
+ }
+ }
+
+ static final public void ptr_operator() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case AMPERSAND:
+ jj_consume_token(AMPERSAND);
+ cv_qualifier_seq();
+ break;
+ case STAR:
+ jj_consume_token(STAR);
+ cv_qualifier_seq();
+ break;
+ case SCOPE:
+ case ID:
+ ptr_to_member();
+ cv_qualifier_seq();
+ break;
+ default:
+ jj_la1[54] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void cv_qualifier_seq() throws ParseException {
+ if (jj_2_61(2)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CONST:
+ jj_consume_token(CONST);
+ if (jj_2_59(2)) {
+ jj_consume_token(VOLATILE);
+ } else {
+ ;
+ }
+ break;
+ case VOLATILE:
+ jj_consume_token(VOLATILE);
+ if (jj_2_60(2)) {
+ jj_consume_token(CONST);
+ } else {
+ ;
+ }
+ break;
+ default:
+ jj_la1[55] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } else {
+ ;
+ }
+ }
+
+ static final public Token declarator() throws ParseException {
+ Token nameToken;
+ if (jj_2_62(2147483647)) {
+ ptr_operator();
+ nameToken = declarator();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ case SCOPE:
+ case TILDE:
+ case OPERATOR:
+ case ID:
+ nameToken = direct_declarator();
+ break;
+ default:
+ jj_la1[56] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ {if (true) return nameToken;}
+ throw new Error("Missing return statement in function");
+ }
+
+ static final public Token direct_declarator() throws ParseException {
+ Token t;
+ if (jj_2_66(2)) {
+ jj_consume_token(TILDE);
+ t = jj_consume_token(ID);
+ if (jj_2_63(2)) {
+ declarator_suffixes();
+ } else {
+ ;
+ }
+ {if (true) return ParserCallback.createToken("~" + t.image, t);}
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ jj_consume_token(LPARENTHESIS);
+ t = declarator();
+ jj_consume_token(RPARENTHESIS);
+ if (jj_2_64(2)) {
+ declarator_suffixes();
+ } else {
+ ;
+ }
+ {if (true) return t;}
+ break;
+ case SCOPE:
+ case OPERATOR:
+ case ID:
+ t = qualified_id();
+ if (jj_2_65(2)) {
+ declarator_suffixes();
+ } else {
+ ;
+ }
+ {if (true) return t;}
+ break;
+ default:
+ jj_la1[57] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ static final public void declarator_suffixes() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LSQUAREBRACKET:
+ label_16:
+ while (true) {
+ jj_consume_token(LSQUAREBRACKET);
+ if (jj_2_67(1)) {
+ constant_expression();
+ } else {
+ ;
+ }
+ jj_consume_token(RSQUAREBRACKET);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LSQUAREBRACKET:
+ ;
+ break;
+ default:
+ jj_la1[58] = jj_gen;
+ break label_16;
+ }
+ }
+ break;
+ case LPARENTHESIS:
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_68(1)) {
+ parameter_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ if (jj_2_69(2)) {
+ type_qualifier();
+ } else {
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case THROW:
+ exception_spec();
+ break;
+ default:
+ jj_la1[59] = jj_gen;
+ ;
+ }
+ break;
+ default:
+ jj_la1[60] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/**
+ * Used only for lookahead.
+ */
+ static final public void function_declarator_lookahead() throws ParseException {
+ label_17:
+ while (true) {
+ if (jj_2_70(2)) {
+ ;
+ } else {
+ break label_17;
+ }
+ ptr_operator();
+ }
+ qualified_id();
+ jj_consume_token(LPARENTHESIS);
+ }
+
+// needs closing of function
+ static final public void function_declarator(boolean isTypedef, Token firstToken) throws ParseException {
+ if (jj_2_71(2147483647)) {
+ ptr_operator();
+ function_declarator(isTypedef, firstToken);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SCOPE:
+ case OPERATOR:
+ case ID:
+ function_direct_declarator(isTypedef, firstToken);
+ break;
+ default:
+ jj_la1[61] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+// needs closing of function
+ static final public void function_direct_declarator(boolean isTypedef, Token firstToken) throws ParseException {
+ Token nameToken;
+ nameToken = qualified_id();
+ fgCallback.functionDeclBegin(nameToken, firstToken, ParserCallback.K_FUNCTION);
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_72(1)) {
+ parameter_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ if (jj_2_73(2)) {
+ type_qualifier();
+ } else {
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case THROW:
+ exception_spec();
+ break;
+ default:
+ jj_la1[62] = jj_gen;
+ ;
+ }
+ if (jj_2_74(2147483647)) {
+ jj_consume_token(ASSIGNEQUAL);
+ jj_consume_token(OCTALINT);
+ } else {
+ ;
+ }
+ }
+
+ static final public void dtor_ctor_decl_spec() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INLINE:
+ case VIRTUAL:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VIRTUAL:
+ jj_consume_token(VIRTUAL);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INLINE:
+ jj_consume_token(INLINE);
+ break;
+ default:
+ jj_la1[63] = jj_gen;
+ ;
+ }
+ break;
+ case INLINE:
+ jj_consume_token(INLINE);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VIRTUAL:
+ jj_consume_token(VIRTUAL);
+ break;
+ default:
+ jj_la1[64] = jj_gen;
+ ;
+ }
+ break;
+ default:
+ jj_la1[65] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[66] = jj_gen;
+ ;
+ }
+ }
+
+ static final public void dtor_definition(Token firstToken) throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case TEMPLATE:
+ template_head();
+ break;
+ default:
+ jj_la1[67] = jj_gen;
+ ;
+ }
+ dtor_ctor_decl_spec();
+ dtor_declarator(firstToken);
+ compound_statement();
+ }
+
+ static final public void ctor_definition(Token firstToken) throws ParseException {
+ dtor_ctor_decl_spec();
+ ctor_declarator(firstToken);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case THROW:
+ exception_spec();
+ break;
+ default:
+ jj_la1[68] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ case LCURLYBRACE:
+ case COLON:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ ctor_initializer();
+ break;
+ default:
+ jj_la1[69] = jj_gen;
+ ;
+ }
+ compound_statement();
+ break;
+ default:
+ jj_la1[70] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ fgCallback.functionDeclEnd(getToken(0));
+ }
+
+ static final public void ctor_declarator_lookahead() throws ParseException {
+ if (isCtor()) {
+
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ qualified_id();
+ jj_consume_token(LPARENTHESIS);
+ }
+
+// starts function, must be closed by caller
+ static final public void ctor_declarator(Token firstToken) throws ParseException {
+ Token nameToken;
+ if (isCtor()) {
+
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ nameToken = qualified_id();
+ fgCallback.functionDeclBegin(nameToken, firstToken, ParserCallback.K_CTOR);
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_75(2)) {
+ parameter_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ if (jj_2_76(2)) {
+ exception_spec();
+ } else {
+ ;
+ }
+ }
+
+ static final public void ctor_initializer() throws ParseException {
+ jj_consume_token(COLON);
+ superclass_init();
+ label_18:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[71] = jj_gen;
+ break label_18;
+ }
+ jj_consume_token(COMMA);
+ superclass_init();
+ }
+ }
+
+ static final public void superclass_init() throws ParseException {
+ qualified_id();
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_77(1)) {
+ expression_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ }
+
+ static final public void dtor_declarator(Token firstToken) throws ParseException {
+ Token firstNameToken= getToken(1);
+ String name= "";
+ if (jj_2_78(2147483647)) {
+ name = scope_override();
+ } else {
+ ;
+ }
+ simple_dtor_declarator(firstToken, name, firstNameToken);
+ fgCallback.functionDeclEnd(getToken(0));
+ }
+
+// starts funct begin, must be closed by caller
+ static final public void simple_dtor_declarator(Token firstToken, String name, Token firstNameToken) throws ParseException {
+ Token t;
+ jj_consume_token(TILDE);
+ if (isCtor()) {
+
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ t = jj_consume_token(ID);
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_79(1)) {
+ parameter_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ if (firstToken != null) { // can be null in lookaheads
+ if (firstNameToken == null) {
+ firstNameToken= t;
+ }
+ Token nameToken= ParserCallback.createToken(name + "~" + t.image, firstNameToken, t);
+ fgCallback.functionDeclBegin(nameToken, firstToken, ParserCallback.K_DTOR);
+ }
+ }
+
+ static final public void parameter_list() throws ParseException {
+ if (jj_2_81(1)) {
+ parameter_declaration_list();
+ if (jj_2_80(2)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ break;
+ default:
+ jj_la1[72] = jj_gen;
+ ;
+ }
+ jj_consume_token(ELLIPSIS);
+ } else {
+ ;
+ }
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ELLIPSIS:
+ jj_consume_token(ELLIPSIS);
+ break;
+ default:
+ jj_la1[73] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+ static final public void parameter_declaration_list() throws ParseException {
+ parameter_declaration();
+ label_19:
+ while (true) {
+ if (jj_2_82(2)) {
+ ;
+ } else {
+ break label_19;
+ }
+ jj_consume_token(COMMA);
+ parameter_declaration();
+ }
+ }
+
+ static final public void parameter_declaration() throws ParseException {
+ declaration_specifiers();
+ if (jj_2_83(2147483647)) {
+ declarator();
+ } else {
+ abstract_declarator();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ASSIGNEQUAL:
+ jj_consume_token(ASSIGNEQUAL);
+ assignment_expression();
+ break;
+ default:
+ jj_la1[74] = jj_gen;
+ ;
+ }
+ }
+
+ static final public void initializer() throws ParseException {
+ if (jj_2_84(3)) {
+ jj_consume_token(LCURLYBRACE);
+ initializer();
+ label_20:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[75] = jj_gen;
+ break label_20;
+ }
+ jj_consume_token(COMMA);
+ initializer();
+ }
+ jj_consume_token(RCURLYBRACE);
+ } else if (jj_2_85(1)) {
+ assignment_expression();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void type_name() throws ParseException {
+ declaration_specifiers();
+ abstract_declarator();
+ }
+
+ static final public void abstract_declarator() throws ParseException {
+ if (jj_2_87(2)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LPARENTHESIS:
+ jj_consume_token(LPARENTHESIS);
+ abstract_declarator();
+ jj_consume_token(RPARENTHESIS);
+ label_21:
+ while (true) {
+ abstract_declarator_suffix();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LSQUAREBRACKET:
+ case LPARENTHESIS:
+ ;
+ break;
+ default:
+ jj_la1[76] = jj_gen;
+ break label_21;
+ }
+ }
+ break;
+ case LSQUAREBRACKET:
+ label_22:
+ while (true) {
+ jj_consume_token(LSQUAREBRACKET);
+ if (jj_2_86(1)) {
+ constant_expression();
+ } else {
+ ;
+ }
+ jj_consume_token(RSQUAREBRACKET);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LSQUAREBRACKET:
+ ;
+ break;
+ default:
+ jj_la1[77] = jj_gen;
+ break label_22;
+ }
+ }
+ break;
+ case SCOPE:
+ case AMPERSAND:
+ case STAR:
+ case ID:
+ ptr_operator();
+ abstract_declarator();
+ break;
+ default:
+ jj_la1[78] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } else {
+ ;
+ }
+ }
+
+ static final public void abstract_declarator_suffix() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LSQUAREBRACKET:
+ jj_consume_token(LSQUAREBRACKET);
+ if (jj_2_88(1)) {
+ constant_expression();
+ } else {
+ ;
+ }
+ jj_consume_token(RSQUAREBRACKET);
+ break;
+ case LPARENTHESIS:
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_89(1)) {
+ parameter_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ break;
+ default:
+ jj_la1[79] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void template_head() throws ParseException {
+ jj_consume_token(TEMPLATE);
+ jj_consume_token(LESSTHAN);
+ template_parameter_list();
+ jj_consume_token(GREATERTHAN);
+ }
+
+ static final public void template_parameter_list() throws ParseException {
+ template_parameter();
+ label_23:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[80] = jj_gen;
+ break label_23;
+ }
+ jj_consume_token(COMMA);
+ template_parameter();
+ }
+ }
+
+ static final public void template_parameter() throws ParseException {
+ Token t;
+ if (jj_2_90(3)) {
+ jj_consume_token(CLASS);
+ t = jj_consume_token(ID);
+ } else if (jj_2_91(1)) {
+ parameter_declaration();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void template_id() throws ParseException {
+ jj_consume_token(ID);
+ jj_consume_token(LESSTHAN);
+ template_argument_list();
+ jj_consume_token(GREATERTHAN);
+ }
+
+ static final public void template_argument_list() throws ParseException {
+ template_argument();
+ label_24:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[81] = jj_gen;
+ break label_24;
+ }
+ jj_consume_token(COMMA);
+ template_argument();
+ }
+ }
+
+ static final public void template_argument() throws ParseException {
+ if (jj_2_92(3)) {
+ type_name();
+ } else if (jj_2_93(1)) {
+ shift_expression();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void statement_list() throws ParseException {
+ label_25:
+ while (true) {
+ statement();
+ if (jj_2_94(2147483647)) {
+ ;
+ } else {
+ break label_25;
+ }
+ }
+ }
+
+ static final public void statement() throws ParseException {
+ if (jj_2_95(2147483647)) {
+ declaration(false, null);
+ } else if (jj_2_96(2147483647)) {
+ expression();
+ jj_consume_token(SEMICOLON);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LCURLYBRACE:
+ compound_statement();
+ break;
+ case IF:
+ case SWITCH:
+ selection_statement();
+ break;
+ case BREAK:
+ case CONTINUE:
+ case GOTO:
+ case RETURN:
+ jump_statement();
+ break;
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ case TRY:
+ try_block();
+ break;
+ case THROW:
+ throw_statement();
+ break;
+ default:
+ jj_la1[82] = jj_gen;
+ if (jj_2_97(2)) {
+ labeled_statement();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DO:
+ case FOR:
+ case WHILE:
+ iteration_statement();
+ break;
+ default:
+ jj_la1[83] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ }
+
+ static final public void labeled_statement() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ID:
+ jj_consume_token(ID);
+ jj_consume_token(COLON);
+ statement();
+ break;
+ case CASE:
+ jj_consume_token(CASE);
+ constant_expression();
+ jj_consume_token(COLON);
+ statement();
+ break;
+ case _DEFAULT:
+ jj_consume_token(_DEFAULT);
+ jj_consume_token(COLON);
+ statement();
+ break;
+ default:
+ jj_la1[84] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void compound_statement() throws ParseException {
+ jj_consume_token(LCURLYBRACE);
+ if (fgCallback.overreadBlocks()) {
+ skipToClosedBracket();
+ } else if (jj_2_99(1)) {
+ try {
+ if (jj_2_98(1)) {
+ statement_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RCURLYBRACE);
+ } catch (ParseException e) {
+ synchronize(RCURLYBRACE);
+ }
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void selection_statement() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IF:
+ jj_consume_token(IF);
+ jj_consume_token(LPARENTHESIS);
+ expression();
+ jj_consume_token(RPARENTHESIS);
+ statement();
+ if (jj_2_100(2)) {
+ jj_consume_token(ELSE);
+ statement();
+ } else {
+ ;
+ }
+ break;
+ case SWITCH:
+ jj_consume_token(SWITCH);
+ jj_consume_token(LPARENTHESIS);
+ expression();
+ jj_consume_token(RPARENTHESIS);
+ statement();
+ break;
+ default:
+ jj_la1[85] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void iteration_statement() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case WHILE:
+ jj_consume_token(WHILE);
+ jj_consume_token(LPARENTHESIS);
+ expression();
+ jj_consume_token(RPARENTHESIS);
+ statement();
+ break;
+ case DO:
+ jj_consume_token(DO);
+ statement();
+ jj_consume_token(WHILE);
+ jj_consume_token(LPARENTHESIS);
+ expression();
+ jj_consume_token(RPARENTHESIS);
+ jj_consume_token(SEMICOLON);
+ break;
+ case FOR:
+ jj_consume_token(FOR);
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_101(3)) {
+ declaration(false, null);
+ } else if (jj_2_102(1)) {
+ expression();
+ jj_consume_token(SEMICOLON);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ default:
+ jj_la1[86] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ if (jj_2_103(1)) {
+ expression();
+ } else {
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ if (jj_2_104(1)) {
+ expression();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ statement();
+ break;
+ default:
+ jj_la1[87] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void jump_statement() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case GOTO:
+ jj_consume_token(GOTO);
+ jj_consume_token(ID);
+ jj_consume_token(SEMICOLON);
+ break;
+ case CONTINUE:
+ jj_consume_token(CONTINUE);
+ jj_consume_token(SEMICOLON);
+ break;
+ case BREAK:
+ jj_consume_token(BREAK);
+ jj_consume_token(SEMICOLON);
+ break;
+ case RETURN:
+ jj_consume_token(RETURN);
+ if (jj_2_105(1)) {
+ expression();
+ } else {
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ break;
+ default:
+ jj_la1[88] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void try_block() throws ParseException {
+ jj_consume_token(TRY);
+ compound_statement();
+ label_26:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CATCH:
+ case FINALLY:
+ ;
+ break;
+ default:
+ jj_la1[89] = jj_gen;
+ break label_26;
+ }
+ handler();
+ }
+ }
+
+ static final public void handler() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CATCH:
+ jj_consume_token(CATCH);
+ jj_consume_token(LPARENTHESIS);
+ exception_declaration();
+ jj_consume_token(RPARENTHESIS);
+ compound_statement();
+ break;
+ case FINALLY:
+ jj_consume_token(FINALLY);
+ compound_statement();
+ break;
+ default:
+ jj_la1[90] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void exception_declaration() throws ParseException {
+ if (jj_2_106(1)) {
+ parameter_declaration_list();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ELLIPSIS:
+ jj_consume_token(ELLIPSIS);
+ break;
+ default:
+ jj_la1[91] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+ static final public void throw_statement() throws ParseException {
+ jj_consume_token(THROW);
+ if (jj_2_107(1)) {
+ assignment_expression();
+ } else {
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ }
+
+ static final public void expression() throws ParseException {
+ assignment_expression();
+ label_27:
+ while (true) {
+ if (jj_2_108(2)) {
+ ;
+ } else {
+ break label_27;
+ }
+ jj_consume_token(COMMA);
+ assignment_expression();
+ }
+ }
+
+ static final public void assignment_expression() throws ParseException {
+ conditional_expression();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ASSIGNEQUAL:
+ case TIMESEQUAL:
+ case DIVIDEEQUAL:
+ case MODEQUAL:
+ case PLUSEQUAL:
+ case MINUSEQUAL:
+ case SHIFTLEFTEQUAL:
+ case SHIFTRIGHTEQUAL:
+ case BITWISEANDEQUAL:
+ case BITWISEXOREQUAL:
+ case BITWISEOREQUAL:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ASSIGNEQUAL:
+ jj_consume_token(ASSIGNEQUAL);
+ break;
+ case TIMESEQUAL:
+ jj_consume_token(TIMESEQUAL);
+ break;
+ case DIVIDEEQUAL:
+ jj_consume_token(DIVIDEEQUAL);
+ break;
+ case MODEQUAL:
+ jj_consume_token(MODEQUAL);
+ break;
+ case PLUSEQUAL:
+ jj_consume_token(PLUSEQUAL);
+ break;
+ case MINUSEQUAL:
+ jj_consume_token(MINUSEQUAL);
+ break;
+ case SHIFTLEFTEQUAL:
+ jj_consume_token(SHIFTLEFTEQUAL);
+ break;
+ case SHIFTRIGHTEQUAL:
+ jj_consume_token(SHIFTRIGHTEQUAL);
+ break;
+ case BITWISEANDEQUAL:
+ jj_consume_token(BITWISEANDEQUAL);
+ break;
+ case BITWISEXOREQUAL:
+ jj_consume_token(BITWISEXOREQUAL);
+ break;
+ case BITWISEOREQUAL:
+ jj_consume_token(BITWISEOREQUAL);
+ break;
+ default:
+ jj_la1[92] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ assignment_expression();
+ break;
+ default:
+ jj_la1[93] = jj_gen;
+ ;
+ }
+ }
+
+ static final public void conditional_expression() throws ParseException {
+ logical_or_expression();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case QUESTIONMARK:
+ jj_consume_token(QUESTIONMARK);
+ conditional_expression();
+ jj_consume_token(COLON);
+ conditional_expression();
+ break;
+ default:
+ jj_la1[94] = jj_gen;
+ ;
+ }
+ }
+
+ static final public void constant_expression() throws ParseException {
+ conditional_expression();
+ }
+
+ static final public void logical_or_expression() throws ParseException {
+ logical_and_expression();
+ label_28:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case OR:
+ ;
+ break;
+ default:
+ jj_la1[95] = jj_gen;
+ break label_28;
+ }
+ jj_consume_token(OR);
+ logical_and_expression();
+ }
+ }
+
+ static final public void logical_and_expression() throws ParseException {
+ inclusive_or_expression();
+ label_29:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case AND:
+ ;
+ break;
+ default:
+ jj_la1[96] = jj_gen;
+ break label_29;
+ }
+ jj_consume_token(AND);
+ inclusive_or_expression();
+ }
+ }
+
+ static final public void inclusive_or_expression() throws ParseException {
+ exclusive_or_expression();
+ label_30:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case BITWISEOR:
+ ;
+ break;
+ default:
+ jj_la1[97] = jj_gen;
+ break label_30;
+ }
+ jj_consume_token(BITWISEOR);
+ exclusive_or_expression();
+ }
+ }
+
+ static final public void exclusive_or_expression() throws ParseException {
+ and_expression();
+ label_31:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case BITWISEXOR:
+ ;
+ break;
+ default:
+ jj_la1[98] = jj_gen;
+ break label_31;
+ }
+ jj_consume_token(BITWISEXOR);
+ and_expression();
+ }
+ }
+
+ static final public void and_expression() throws ParseException {
+ equality_expression();
+ label_32:
+ while (true) {
+ if (jj_2_109(2)) {
+ ;
+ } else {
+ break label_32;
+ }
+ jj_consume_token(AMPERSAND);
+ equality_expression();
+ }
+ }
+
+ static final public void equality_expression() throws ParseException {
+ relational_expression();
+ label_33:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case EQUAL:
+ case NOTEQUAL:
+ ;
+ break;
+ default:
+ jj_la1[99] = jj_gen;
+ break label_33;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case NOTEQUAL:
+ jj_consume_token(NOTEQUAL);
+ break;
+ case EQUAL:
+ jj_consume_token(EQUAL);
+ break;
+ default:
+ jj_la1[100] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ relational_expression();
+ }
+ }
+
+ static final public void relational_expression() throws ParseException {
+ shift_expression();
+ label_34:
+ while (true) {
+ if (jj_2_110(2)) {
+ ;
+ } else {
+ break label_34;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LESSTHAN:
+ jj_consume_token(LESSTHAN);
+ break;
+ case GREATERTHAN:
+ jj_consume_token(GREATERTHAN);
+ break;
+ case LESSTHANOREQUALTO:
+ jj_consume_token(LESSTHANOREQUALTO);
+ break;
+ case GREATERTHANOREQUALTO:
+ jj_consume_token(GREATERTHANOREQUALTO);
+ break;
+ default:
+ jj_la1[101] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ shift_expression();
+ }
+ }
+
+ static final public void shift_expression() throws ParseException {
+ additive_expression();
+ label_35:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SHIFTLEFT:
+ case SHIFTRIGHT:
+ ;
+ break;
+ default:
+ jj_la1[102] = jj_gen;
+ break label_35;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SHIFTLEFT:
+ jj_consume_token(SHIFTLEFT);
+ break;
+ case SHIFTRIGHT:
+ jj_consume_token(SHIFTRIGHT);
+ break;
+ default:
+ jj_la1[103] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ additive_expression();
+ }
+ }
+
+ static final public void additive_expression() throws ParseException {
+ multiplicative_expression();
+ label_36:
+ while (true) {
+ if (jj_2_111(2)) {
+ ;
+ } else {
+ break label_36;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ break;
+ case MINUS:
+ jj_consume_token(MINUS);
+ break;
+ default:
+ jj_la1[104] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ multiplicative_expression();
+ }
+ }
+
+ static final public void multiplicative_expression() throws ParseException {
+ pm_expression();
+ label_37:
+ while (true) {
+ if (jj_2_112(2)) {
+ ;
+ } else {
+ break label_37;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STAR:
+ jj_consume_token(STAR);
+ break;
+ case DIVIDE:
+ jj_consume_token(DIVIDE);
+ break;
+ case MOD:
+ jj_consume_token(MOD);
+ break;
+ default:
+ jj_la1[105] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ pm_expression();
+ }
+ }
+
+ static final public void pm_expression() throws ParseException {
+ cast_expression();
+ label_38:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOTSTAR:
+ case ARROWSTAR:
+ ;
+ break;
+ default:
+ jj_la1[106] = jj_gen;
+ break label_38;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOTSTAR:
+ jj_consume_token(DOTSTAR);
+ break;
+ case ARROWSTAR:
+ jj_consume_token(ARROWSTAR);
+ break;
+ default:
+ jj_la1[107] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ cast_expression();
+ }
+ }
+
+ static final public void cast_expression() throws ParseException {
+ if (jj_2_113(2147483647)) {
+ jj_consume_token(LPARENTHESIS);
+ type_name();
+ jj_consume_token(RPARENTHESIS);
+ cast_expression();
+ } else if (jj_2_114(1)) {
+ unary_expression();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void unary_expression() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUSPLUS:
+ jj_consume_token(PLUSPLUS);
+ unary_expression();
+ break;
+ case MINUSMINUS:
+ jj_consume_token(MINUSMINUS);
+ unary_expression();
+ break;
+ default:
+ jj_la1[108] = jj_gen;
+ if (jj_2_117(3)) {
+ unary_operator();
+ cast_expression();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SIZEOF:
+ jj_consume_token(SIZEOF);
+ if (jj_2_115(2147483647)) {
+ jj_consume_token(LPARENTHESIS);
+ type_name();
+ jj_consume_token(RPARENTHESIS);
+ } else if (jj_2_116(1)) {
+ unary_expression();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[109] = jj_gen;
+ if (jj_2_118(1)) {
+ postfix_expression();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ }
+
+ static final public void new_expression() throws ParseException {
+ if (jj_2_119(2147483647)) {
+ jj_consume_token(SCOPE);
+ } else {
+ ;
+ }
+ jj_consume_token(NEW);
+ if (jj_2_123(2147483647)) {
+ jj_consume_token(LPARENTHESIS);
+ type_name();
+ jj_consume_token(RPARENTHESIS);
+ } else if (jj_2_124(1)) {
+ if (jj_2_120(2147483647)) {
+ jj_consume_token(LPARENTHESIS);
+ expression_list();
+ jj_consume_token(RPARENTHESIS);
+ } else {
+ ;
+ }
+ if (jj_2_121(2147483647)) {
+ jj_consume_token(LPARENTHESIS);
+ type_name();
+ jj_consume_token(RPARENTHESIS);
+ } else if (jj_2_122(2147483647)) {
+ new_type_id();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ if (jj_2_125(2147483647)) {
+ new_initializer();
+ } else {
+ ;
+ }
+ }
+
+ static final public void new_type_id() throws ParseException {
+ declaration_specifiers();
+ if (jj_2_126(2147483647)) {
+ new_declarator();
+ } else {
+ ;
+ }
+ }
+
+ static final public void new_declarator() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LSQUAREBRACKET:
+ direct_new_declarator();
+ break;
+ case SCOPE:
+ case AMPERSAND:
+ case STAR:
+ case ID:
+ ptr_operator();
+ cv_qualifier_seq();
+ if (jj_2_127(2)) {
+ new_declarator();
+ } else {
+ ;
+ }
+ break;
+ default:
+ jj_la1[110] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void direct_new_declarator() throws ParseException {
+ label_39:
+ while (true) {
+ jj_consume_token(LSQUAREBRACKET);
+ expression();
+ jj_consume_token(RSQUAREBRACKET);
+ if (jj_2_128(2)) {
+ ;
+ } else {
+ break label_39;
+ }
+ }
+ }
+
+ static final public void new_initializer() throws ParseException {
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_129(1)) {
+ expression_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ }
+
+ static final public void delete_expression() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SCOPE:
+ jj_consume_token(SCOPE);
+ break;
+ default:
+ jj_la1[111] = jj_gen;
+ ;
+ }
+ jj_consume_token(DELETE);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LSQUAREBRACKET:
+ jj_consume_token(LSQUAREBRACKET);
+ jj_consume_token(RSQUAREBRACKET);
+ break;
+ default:
+ jj_la1[112] = jj_gen;
+ ;
+ }
+ cast_expression();
+ }
+
+ static final public void unary_operator() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case AMPERSAND:
+ jj_consume_token(AMPERSAND);
+ break;
+ case STAR:
+ jj_consume_token(STAR);
+ break;
+ case PLUS:
+ jj_consume_token(PLUS);
+ break;
+ case MINUS:
+ jj_consume_token(MINUS);
+ break;
+ case TILDE:
+ jj_consume_token(TILDE);
+ break;
+ case NOT:
+ jj_consume_token(NOT);
+ break;
+ default:
+ jj_la1[113] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void postfix_expression() throws ParseException {
+ if (jj_2_133(3)) {
+ primary_expression();
+ label_40:
+ while (true) {
+ if (jj_2_130(2)) {
+ ;
+ } else {
+ break label_40;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LSQUAREBRACKET:
+ jj_consume_token(LSQUAREBRACKET);
+ expression();
+ jj_consume_token(RSQUAREBRACKET);
+ break;
+ case LPARENTHESIS:
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_131(1)) {
+ expression_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ break;
+ case DOT:
+ jj_consume_token(DOT);
+ id_expression();
+ break;
+ case POINTERTO:
+ jj_consume_token(POINTERTO);
+ id_expression();
+ break;
+ case PLUSPLUS:
+ jj_consume_token(PLUSPLUS);
+ break;
+ case MINUSMINUS:
+ jj_consume_token(MINUSMINUS);
+ break;
+ default:
+ jj_la1[114] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } else if (jj_2_134(1)) {
+ simple_type_specifier();
+ jj_consume_token(LPARENTHESIS);
+ if (jj_2_132(1)) {
+ expression_list();
+ } else {
+ ;
+ }
+ jj_consume_token(RPARENTHESIS);
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void id_expression() throws ParseException {
+ if (jj_2_135(2147483647)) {
+ scope_override();
+ } else {
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ID:
+ jj_consume_token(ID);
+ break;
+ case OPERATOR:
+ jj_consume_token(OPERATOR);
+ optor();
+ break;
+ case TILDE:
+ jj_consume_token(TILDE);
+ jj_consume_token(ID);
+ break;
+ default:
+ jj_la1[115] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public void primary_expression() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case THIS:
+ jj_consume_token(THIS);
+ break;
+ case STRING:
+ label_41:
+ while (true) {
+ jj_consume_token(STRING);
+ if (jj_2_136(2)) {
+ ;
+ } else {
+ break label_41;
+ }
+ }
+ break;
+ case LPARENTHESIS:
+ jj_consume_token(LPARENTHESIS);
+ expression();
+ jj_consume_token(RPARENTHESIS);
+ break;
+ default:
+ jj_la1[116] = jj_gen;
+ if (jj_2_137(2147483647)) {
+ new_expression();
+ } else if (jj_2_138(2147483647)) {
+ delete_expression();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SCOPE:
+ case TILDE:
+ case OPERATOR:
+ case ID:
+ id_expression();
+ break;
+ case TRUETOK:
+ case FALSETOK:
+ case OCTALINT:
+ case OCTALLONG:
+ case UNSIGNED_OCTALINT:
+ case UNSIGNED_OCTALLONG:
+ case DECIMALINT:
+ case DECIMALLONG:
+ case UNSIGNED_DECIMALINT:
+ case UNSIGNED_DECIMALLONG:
+ case HEXADECIMALINT:
+ case HEXADECIMALLONG:
+ case UNSIGNED_HEXADECIMALINT:
+ case UNSIGNED_HEXADECIMALLONG:
+ case FLOATONE:
+ case FLOATTWO:
+ case CHARACTER:
+ constant();
+ break;
+ default:
+ jj_la1[117] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+
+ static final public void expression_list() throws ParseException {
+ assignment_expression();
+ label_42:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[118] = jj_gen;
+ break label_42;
+ }
+ jj_consume_token(COMMA);
+ assignment_expression();
+ }
+ }
+
+ static final public void constant() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case OCTALINT:
+ jj_consume_token(OCTALINT);
+ break;
+ case OCTALLONG:
+ jj_consume_token(OCTALLONG);
+ break;
+ case DECIMALINT:
+ jj_consume_token(DECIMALINT);
+ break;
+ case DECIMALLONG:
+ jj_consume_token(DECIMALLONG);
+ break;
+ case HEXADECIMALINT:
+ jj_consume_token(HEXADECIMALINT);
+ break;
+ case HEXADECIMALLONG:
+ jj_consume_token(HEXADECIMALLONG);
+ break;
+ case UNSIGNED_OCTALINT:
+ jj_consume_token(UNSIGNED_OCTALINT);
+ break;
+ case UNSIGNED_OCTALLONG:
+ jj_consume_token(UNSIGNED_OCTALLONG);
+ break;
+ case UNSIGNED_DECIMALINT:
+ jj_consume_token(UNSIGNED_DECIMALINT);
+ break;
+ case UNSIGNED_DECIMALLONG:
+ jj_consume_token(UNSIGNED_DECIMALLONG);
+ break;
+ case UNSIGNED_HEXADECIMALINT:
+ jj_consume_token(UNSIGNED_HEXADECIMALINT);
+ break;
+ case UNSIGNED_HEXADECIMALLONG:
+ jj_consume_token(UNSIGNED_HEXADECIMALLONG);
+ break;
+ case CHARACTER:
+ jj_consume_token(CHARACTER);
+ break;
+ case FLOATONE:
+ jj_consume_token(FLOATONE);
+ break;
+ case FLOATTWO:
+ jj_consume_token(FLOATTWO);
+ break;
+ case TRUETOK:
+ jj_consume_token(TRUETOK);
+ break;
+ case FALSETOK:
+ jj_consume_token(FALSETOK);
+ break;
+ default:
+ jj_la1[119] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ static final public String optor() throws ParseException {
+ String name= getToken(1).image;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case NEW:
+ jj_consume_token(NEW);
+ if (jj_2_139(2)) {
+ jj_consume_token(LSQUAREBRACKET);
+ jj_consume_token(RSQUAREBRACKET);
+ name += "[]";
+ } else {
+ ;
+ }
+ break;
+ case DELETE:
+ jj_consume_token(DELETE);
+ if (jj_2_140(2)) {
+ jj_consume_token(LSQUAREBRACKET);
+ jj_consume_token(RSQUAREBRACKET);
+ name += "[]";
+ } else {
+ ;
+ }
+ break;
+ case PLUS:
+ jj_consume_token(PLUS);
+ break;
+ case MINUS:
+ jj_consume_token(MINUS);
+ break;
+ case STAR:
+ jj_consume_token(STAR);
+ break;
+ case DIVIDE:
+ jj_consume_token(DIVIDE);
+ break;
+ case MOD:
+ jj_consume_token(MOD);
+ break;
+ case BITWISEXOR:
+ jj_consume_token(BITWISEXOR);
+ break;
+ case AMPERSAND:
+ jj_consume_token(AMPERSAND);
+ break;
+ case BITWISEOR:
+ jj_consume_token(BITWISEOR);
+ break;
+ case TILDE:
+ jj_consume_token(TILDE);
+ break;
+ case NOT:
+ jj_consume_token(NOT);
+ break;
+ case ASSIGNEQUAL:
+ jj_consume_token(ASSIGNEQUAL);
+ break;
+ case LESSTHAN:
+ jj_consume_token(LESSTHAN);
+ break;
+ case GREATERTHAN:
+ jj_consume_token(GREATERTHAN);
+ break;
+ case PLUSEQUAL:
+ jj_consume_token(PLUSEQUAL);
+ break;
+ case MINUSEQUAL:
+ jj_consume_token(MINUSEQUAL);
+ break;
+ case TIMESEQUAL:
+ jj_consume_token(TIMESEQUAL);
+ break;
+ case DIVIDEEQUAL:
+ jj_consume_token(DIVIDEEQUAL);
+ break;
+ case MODEQUAL:
+ jj_consume_token(MODEQUAL);
+ break;
+ case BITWISEXOREQUAL:
+ jj_consume_token(BITWISEXOREQUAL);
+ break;
+ case BITWISEANDEQUAL:
+ jj_consume_token(BITWISEANDEQUAL);
+ break;
+ case BITWISEOREQUAL:
+ jj_consume_token(BITWISEOREQUAL);
+ break;
+ case SHIFTLEFT:
+ jj_consume_token(SHIFTLEFT);
+ break;
+ case SHIFTRIGHT:
+ jj_consume_token(SHIFTRIGHT);
+ break;
+ case SHIFTRIGHTEQUAL:
+ jj_consume_token(SHIFTRIGHTEQUAL);
+ break;
+ case SHIFTLEFTEQUAL:
+ jj_consume_token(SHIFTLEFTEQUAL);
+ break;
+ case EQUAL:
+ jj_consume_token(EQUAL);
+ break;
+ case NOTEQUAL:
+ jj_consume_token(NOTEQUAL);
+ break;
+ case LESSTHANOREQUALTO:
+ jj_consume_token(LESSTHANOREQUALTO);
+ break;
+ case GREATERTHANOREQUALTO:
+ jj_consume_token(GREATERTHANOREQUALTO);
+ break;
+ case AND:
+ jj_consume_token(AND);
+ break;
+ case OR:
+ jj_consume_token(OR);
+ break;
+ case PLUSPLUS:
+ jj_consume_token(PLUSPLUS);
+ break;
+ case MINUSMINUS:
+ jj_consume_token(MINUSMINUS);
+ break;
+ case COMMA:
+ jj_consume_token(COMMA);
+ break;
+ case ARROWSTAR:
+ jj_consume_token(ARROWSTAR);
+ break;
+ case POINTERTO:
+ jj_consume_token(POINTERTO);
+ break;
+ case LPARENTHESIS:
+ jj_consume_token(LPARENTHESIS);
+ jj_consume_token(RPARENTHESIS);
+ name += ")";
+ break;
+ case LSQUAREBRACKET:
+ jj_consume_token(LSQUAREBRACKET);
+ jj_consume_token(RSQUAREBRACKET);
+ name += "]";
+ break;
+ default:
+ jj_la1[121] = jj_gen;
+ if (jj_2_142(1)) {
+ declaration_specifiers();
+ if (jj_2_141(2)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STAR:
+ jj_consume_token(STAR);
+ break;
+ case AMPERSAND:
+ jj_consume_token(AMPERSAND);
+ break;
+ default:
+ jj_la1[120] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } else {
+ ;
+ }
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ {if (true) return name;}
+ throw new Error("Missing return statement in function");
+ }
+
+ static final public void exception_spec() throws ParseException {
+ jj_consume_token(THROW);
+ jj_consume_token(LPARENTHESIS);
+ exception_list();
+ jj_consume_token(RPARENTHESIS);
+ }
+
+ static final public void exception_list() throws ParseException {
+ type_name();
+ label_43:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[122] = jj_gen;
+ break label_43;
+ }
+ jj_consume_token(COMMA);
+ type_name();
+ }
+ }
+
+ static final private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_1();
+ jj_save(0, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_2(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_2();
+ jj_save(1, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_3(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_3();
+ jj_save(2, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_4(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_4();
+ jj_save(3, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_5(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_5();
+ jj_save(4, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_6(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_6();
+ jj_save(5, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_7(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_7();
+ jj_save(6, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_8(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_8();
+ jj_save(7, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_9(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_9();
+ jj_save(8, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_10(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_10();
+ jj_save(9, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_11(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_11();
+ jj_save(10, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_12(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_12();
+ jj_save(11, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_13(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_13();
+ jj_save(12, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_14(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_14();
+ jj_save(13, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_15(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_15();
+ jj_save(14, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_16(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_16();
+ jj_save(15, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_17(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_17();
+ jj_save(16, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_18(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_18();
+ jj_save(17, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_19(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_19();
+ jj_save(18, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_20(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_20();
+ jj_save(19, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_21(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_21();
+ jj_save(20, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_22(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_22();
+ jj_save(21, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_23(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_23();
+ jj_save(22, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_24(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_24();
+ jj_save(23, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_25(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_25();
+ jj_save(24, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_26(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_26();
+ jj_save(25, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_27(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_27();
+ jj_save(26, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_28(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_28();
+ jj_save(27, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_29(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_29();
+ jj_save(28, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_30(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_30();
+ jj_save(29, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_31(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_31();
+ jj_save(30, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_32(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_32();
+ jj_save(31, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_33(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_33();
+ jj_save(32, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_34(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_34();
+ jj_save(33, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_35(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_35();
+ jj_save(34, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_36(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_36();
+ jj_save(35, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_37(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_37();
+ jj_save(36, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_38(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_38();
+ jj_save(37, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_39(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_39();
+ jj_save(38, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_40(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_40();
+ jj_save(39, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_41(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_41();
+ jj_save(40, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_42(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_42();
+ jj_save(41, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_43(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_43();
+ jj_save(42, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_44(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_44();
+ jj_save(43, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_45(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_45();
+ jj_save(44, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_46(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_46();
+ jj_save(45, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_47(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_47();
+ jj_save(46, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_48(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_48();
+ jj_save(47, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_49(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_49();
+ jj_save(48, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_50(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_50();
+ jj_save(49, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_51(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_51();
+ jj_save(50, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_52(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_52();
+ jj_save(51, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_53(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_53();
+ jj_save(52, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_54(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_54();
+ jj_save(53, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_55(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_55();
+ jj_save(54, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_56(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_56();
+ jj_save(55, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_57(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_57();
+ jj_save(56, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_58(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_58();
+ jj_save(57, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_59(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_59();
+ jj_save(58, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_60(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_60();
+ jj_save(59, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_61(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_61();
+ jj_save(60, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_62(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_62();
+ jj_save(61, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_63(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_63();
+ jj_save(62, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_64(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_64();
+ jj_save(63, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_65(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_65();
+ jj_save(64, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_66(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_66();
+ jj_save(65, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_67(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_67();
+ jj_save(66, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_68(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_68();
+ jj_save(67, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_69(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_69();
+ jj_save(68, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_70(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_70();
+ jj_save(69, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_71(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_71();
+ jj_save(70, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_72(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_72();
+ jj_save(71, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_73(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_73();
+ jj_save(72, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_74(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_74();
+ jj_save(73, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_75(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_75();
+ jj_save(74, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_76(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_76();
+ jj_save(75, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_77(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_77();
+ jj_save(76, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_78(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_78();
+ jj_save(77, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_79(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_79();
+ jj_save(78, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_80(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_80();
+ jj_save(79, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_81(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_81();
+ jj_save(80, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_82(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_82();
+ jj_save(81, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_83(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_83();
+ jj_save(82, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_84(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_84();
+ jj_save(83, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_85(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_85();
+ jj_save(84, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_86(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_86();
+ jj_save(85, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_87(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_87();
+ jj_save(86, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_88(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_88();
+ jj_save(87, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_89(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_89();
+ jj_save(88, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_90(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_90();
+ jj_save(89, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_91(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_91();
+ jj_save(90, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_92(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_92();
+ jj_save(91, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_93(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_93();
+ jj_save(92, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_94(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_94();
+ jj_save(93, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_95(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_95();
+ jj_save(94, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_96(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_96();
+ jj_save(95, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_97(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_97();
+ jj_save(96, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_98(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_98();
+ jj_save(97, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_99(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_99();
+ jj_save(98, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_100(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_100();
+ jj_save(99, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_101(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_101();
+ jj_save(100, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_102(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_102();
+ jj_save(101, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_103(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_103();
+ jj_save(102, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_104(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_104();
+ jj_save(103, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_105(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_105();
+ jj_save(104, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_106(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_106();
+ jj_save(105, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_107(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_107();
+ jj_save(106, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_108(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_108();
+ jj_save(107, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_109(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_109();
+ jj_save(108, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_110(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_110();
+ jj_save(109, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_111(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_111();
+ jj_save(110, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_112(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_112();
+ jj_save(111, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_113(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_113();
+ jj_save(112, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_114(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_114();
+ jj_save(113, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_115(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_115();
+ jj_save(114, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_116(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_116();
+ jj_save(115, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_117(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_117();
+ jj_save(116, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_118(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_118();
+ jj_save(117, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_119(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_119();
+ jj_save(118, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_120(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_120();
+ jj_save(119, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_121(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_121();
+ jj_save(120, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_122(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_122();
+ jj_save(121, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_123(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_123();
+ jj_save(122, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_124(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_124();
+ jj_save(123, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_125(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_125();
+ jj_save(124, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_126(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_126();
+ jj_save(125, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_127(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_127();
+ jj_save(126, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_128(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_128();
+ jj_save(127, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_129(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_129();
+ jj_save(128, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_130(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_130();
+ jj_save(129, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_131(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_131();
+ jj_save(130, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_132(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_132();
+ jj_save(131, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_133(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_133();
+ jj_save(132, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_134(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_134();
+ jj_save(133, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_135(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_135();
+ jj_save(134, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_136(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_136();
+ jj_save(135, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_137(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_137();
+ jj_save(136, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_138(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_138();
+ jj_save(137, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_139(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_139();
+ jj_save(138, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_140(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_140();
+ jj_save(139, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_141(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_141();
+ jj_save(140, xla);
+ return retval;
+ }
+
+ static final private boolean jj_2_142(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_142();
+ jj_save(141, xla);
+ return retval;
+ }
+
+ static final private boolean jj_3_109() {
+ if (jj_scan_token(AMPERSAND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_110()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_114() {
+ if (jj_scan_token(GREATERTHANOREQUALTO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_113() {
+ if (jj_scan_token(LESSTHANOREQUALTO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_112() {
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_111() {
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_441() {
+ if (jj_scan_token(BITWISEOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_428()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_432() {
+ if (jj_scan_token(AND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_414()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_454() {
+ if (jj_scan_token(BITWISEXOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_437()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_110() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_111()) {
+ jj_scanpos = xsp;
+ if (jj_3R_112()) {
+ jj_scanpos = xsp;
+ if (jj_3R_113()) {
+ jj_scanpos = xsp;
+ if (jj_3R_114()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_105()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_238() {
+ if (jj_3R_105()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_110()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_422() {
+ if (jj_scan_token(OR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_362()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_110() {
+ if (jj_3R_238()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_473()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_437() {
+ if (jj_3R_110()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_109()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_428() {
+ if (jj_3R_437()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_454()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_414() {
+ if (jj_3R_428()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_441()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_362() {
+ if (jj_3R_414()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_432()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_290() {
+ if (jj_3R_362()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_422()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_91() {
+ if (jj_3R_219()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_377() {
+ if (jj_scan_token(QUESTIONMARK)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_219()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_219()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_108() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_100()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_219() {
+ if (jj_3R_290()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_377()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_419() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_388() {
+ if (jj_scan_token(BITWISEOREQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_387() {
+ if (jj_scan_token(BITWISEXOREQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_386() {
+ if (jj_scan_token(BITWISEANDEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_385() {
+ if (jj_scan_token(SHIFTRIGHTEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_384() {
+ if (jj_scan_token(SHIFTLEFTEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_383() {
+ if (jj_scan_token(MINUSEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_382() {
+ if (jj_scan_token(PLUSEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_381() {
+ if (jj_scan_token(MODEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_380() {
+ if (jj_scan_token(DIVIDEEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_378() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_379() {
+ if (jj_scan_token(TIMESEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_298() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_378()) {
+ jj_scanpos = xsp;
+ if (jj_3R_379()) {
+ jj_scanpos = xsp;
+ if (jj_3R_380()) {
+ jj_scanpos = xsp;
+ if (jj_3R_381()) {
+ jj_scanpos = xsp;
+ if (jj_3R_382()) {
+ jj_scanpos = xsp;
+ if (jj_3R_383()) {
+ jj_scanpos = xsp;
+ if (jj_3R_384()) {
+ jj_scanpos = xsp;
+ if (jj_3R_385()) {
+ jj_scanpos = xsp;
+ if (jj_3R_386()) {
+ jj_scanpos = xsp;
+ if (jj_3R_387()) {
+ jj_scanpos = xsp;
+ if (jj_3R_388()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_100()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_100() {
+ if (jj_3R_219()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_298()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_102() {
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_107() {
+ if (jj_3R_100()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_372() {
+ if (jj_3R_418()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_107() {
+ if (jj_3R_100()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_108()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_296() {
+ if (jj_scan_token(THROW)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_107()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_450() {
+ if (jj_scan_token(ELLIPSIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_106() {
+ if (jj_3R_95()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_438() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_106()) {
+ jj_scanpos = xsp;
+ if (jj_3R_450()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_430() {
+ if (jj_scan_token(FINALLY)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_292()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_418() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_429()) {
+ jj_scanpos = xsp;
+ if (jj_3R_430()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_429() {
+ if (jj_scan_token(CATCH)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_438()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_292()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_105() {
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_104() {
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_295() {
+ if (jj_scan_token(TRY)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_292()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_372()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_371() {
+ if (jj_scan_token(RETURN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_105()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_101() {
+ if (jj_3R_57()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_370() {
+ if (jj_scan_token(BREAK)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_369() {
+ if (jj_scan_token(CONTINUE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_294() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_368()) {
+ jj_scanpos = xsp;
+ if (jj_3R_369()) {
+ jj_scanpos = xsp;
+ if (jj_3R_370()) {
+ jj_scanpos = xsp;
+ if (jj_3R_371()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_368() {
+ if (jj_scan_token(GOTO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_103() {
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_375() {
+ if (jj_scan_token(FOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_101()) {
+ jj_scanpos = xsp;
+ if (jj_3_102()) {
+ jj_scanpos = xsp;
+ if (jj_3R_419()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_103()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_104()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_374() {
+ if (jj_scan_token(DO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(WHILE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_297() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_373()) {
+ jj_scanpos = xsp;
+ if (jj_3R_374()) {
+ jj_scanpos = xsp;
+ if (jj_3R_375()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_373() {
+ if (jj_scan_token(WHILE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_100() {
+ if (jj_scan_token(ELSE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_367() {
+ if (jj_scan_token(SWITCH)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_293() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_366()) {
+ jj_scanpos = xsp;
+ if (jj_3R_367()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_366() {
+ if (jj_scan_token(IF)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_100()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_98() {
+ if (jj_3R_109()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_99() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_98()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_365() {
+ return false;
+ }
+
+ static final private boolean jj_3R_292() {
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ lookingAhead = true;
+ jj_semLA = fgCallback.overreadBlocks();
+ lookingAhead = false;
+ if (!jj_semLA || jj_3R_365()) {
+ jj_scanpos = xsp;
+ if (jj_3_99()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_236() {
+ if (jj_scan_token(_DEFAULT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_235() {
+ if (jj_scan_token(CASE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_91()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_108() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_234()) {
+ jj_scanpos = xsp;
+ if (jj_3R_235()) {
+ jj_scanpos = xsp;
+ if (jj_3R_236()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_234() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_233() {
+ if (jj_3R_297()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_97() {
+ if (jj_3R_108()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_232() {
+ if (jj_3R_296()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_96() {
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_231() {
+ if (jj_3R_295()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_230() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_95() {
+ if (jj_3R_57()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_229() {
+ if (jj_3R_294()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_228() {
+ if (jj_3R_293()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_227() {
+ if (jj_3R_292()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_94() {
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_226() {
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_106() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_225()) {
+ jj_scanpos = xsp;
+ if (jj_3R_226()) {
+ jj_scanpos = xsp;
+ if (jj_3R_227()) {
+ jj_scanpos = xsp;
+ if (jj_3R_228()) {
+ jj_scanpos = xsp;
+ if (jj_3R_229()) {
+ jj_scanpos = xsp;
+ if (jj_3R_230()) {
+ jj_scanpos = xsp;
+ if (jj_3R_231()) {
+ jj_scanpos = xsp;
+ if (jj_3R_232()) {
+ jj_scanpos = xsp;
+ if (jj_3_97()) {
+ jj_scanpos = xsp;
+ if (jj_3R_233()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_225() {
+ if (jj_3R_57()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_413() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_203()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_237() {
+ if (jj_3R_106()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_109() {
+ Token xsp;
+ if (jj_3R_237()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_237()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_93() {
+ if (jj_3R_105()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_92() {
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_203() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_92()) {
+ jj_scanpos = xsp;
+ if (jj_3_93()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_315() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_314()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_77() {
+ if (jj_3R_203()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_413()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_91() {
+ if (jj_3R_96()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_90() {
+ if (jj_scan_token(CLASS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_314() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_90()) {
+ jj_scanpos = xsp;
+ if (jj_3_91()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_270() {
+ if (jj_3R_314()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_315()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_160() {
+ if (jj_scan_token(TEMPLATE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_270()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_89() {
+ if (jj_3R_84()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_88() {
+ if (jj_3R_91()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_443() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_89()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_433() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_442()) {
+ jj_scanpos = xsp;
+ if (jj_3R_443()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_442() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_88()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_86() {
+ if (jj_3R_91()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_103() {
+ if (jj_3R_89()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_222()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_99() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_98()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_94() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_223() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_86()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_102() {
+ Token xsp;
+ if (jj_3R_223()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_223()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_423() {
+ if (jj_3R_433()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_101() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_222()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ if (jj_3R_423()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_423()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_87() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_101()) {
+ jj_scanpos = xsp;
+ if (jj_3R_102()) {
+ jj_scanpos = xsp;
+ if (jj_3R_103()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_222() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_87()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_104() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_222()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_82() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_96()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_80() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_94()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(ELLIPSIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_85() {
+ if (jj_3R_100()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_98() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_84()) {
+ jj_scanpos = xsp;
+ if (jj_3_85()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_83() {
+ if (jj_3R_97()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_84() {
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_98()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_99()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ if (jj_scan_token(RCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_79() {
+ if (jj_3R_84()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_417() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_100()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_416() {
+ if (jj_3R_222()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_415() {
+ if (jj_3R_97()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_96() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_415()) {
+ jj_scanpos = xsp;
+ if (jj_3R_416()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_417()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_95() {
+ if (jj_3R_96()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_82()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_210() {
+ if (jj_scan_token(ELLIPSIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_84() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_81()) {
+ jj_scanpos = xsp;
+ if (jj_3R_210()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_81() {
+ if (jj_3R_95()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_80()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_271() {
+ return false;
+ }
+
+ static final private boolean jj_3R_162() {
+ if (jj_scan_token(TILDE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ lookingAhead = true;
+ jj_semLA = isCtor();
+ lookingAhead = false;
+ if (!jj_semLA || jj_3R_271()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_79()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_77() {
+ if (jj_3R_93()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_78() {
+ if (jj_3R_75()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_488() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_487()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_161() {
+ if (jj_3R_163()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_54() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_161()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_162()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_487() {
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_77()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_479() {
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_487()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_488()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_75() {
+ if (jj_3R_84()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_76() {
+ if (jj_3R_92()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_318() {
+ return false;
+ }
+
+ static final private boolean jj_3R_152() {
+ return false;
+ }
+
+ static final private boolean jj_3R_283() {
+ Token xsp;
+ xsp = jj_scanpos;
+ lookingAhead = true;
+ jj_semLA = isCtor();
+ lookingAhead = false;
+ if (!jj_semLA || jj_3R_318()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_75()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_76()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_46() {
+ Token xsp;
+ xsp = jj_scanpos;
+ lookingAhead = true;
+ jj_semLA = isCtor();
+ lookingAhead = false;
+ if (!jj_semLA || jj_3R_152()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_468() {
+ if (jj_3R_479()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_461() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_468()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_292()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_460() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_459() {
+ if (jj_3R_92()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_264() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_283()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_459()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_460()) {
+ jj_scanpos = xsp;
+ if (jj_3R_461()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_313() {
+ if (jj_scan_token(VIRTUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_312() {
+ if (jj_scan_token(INLINE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_309() {
+ if (jj_3R_160()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_263() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_309()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_54()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_292()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_74() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_268() {
+ if (jj_scan_token(INLINE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_313()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_151() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_267()) {
+ jj_scanpos = xsp;
+ if (jj_3R_268()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_267() {
+ if (jj_scan_token(VIRTUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_312()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_45() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_151()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_72() {
+ if (jj_3R_84()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_486() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(OCTALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_485() {
+ if (jj_3R_92()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_73() {
+ if (jj_3R_85()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_275() {
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_72()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_73()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_485()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_486()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_71() {
+ if (jj_3R_89()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_166() {
+ if (jj_3R_275()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_165() {
+ if (jj_3R_89()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_58()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_58() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_165()) {
+ jj_scanpos = xsp;
+ if (jj_3R_166()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_70() {
+ if (jj_3R_89()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_48() {
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_70()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_64() {
+ if (jj_3R_90()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_65() {
+ if (jj_3R_90()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_68() {
+ if (jj_3R_84()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_67() {
+ if (jj_3R_91()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_449() {
+ if (jj_3R_92()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_69() {
+ if (jj_3R_85()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_218() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_68()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_69()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_449()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_289() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_67()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_90() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_217()) {
+ jj_scanpos = xsp;
+ if (jj_3R_218()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_217() {
+ Token xsp;
+ if (jj_3R_289()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_289()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_63() {
+ if (jj_3R_90()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_364() {
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_65()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_363() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_97()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_64()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_66() {
+ if (jj_scan_token(TILDE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_63()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_291() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_66()) {
+ jj_scanpos = xsp;
+ if (jj_3R_363()) {
+ jj_scanpos = xsp;
+ if (jj_3R_364()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_62() {
+ if (jj_3R_89()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_60() {
+ if (jj_scan_token(CONST)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_221() {
+ if (jj_3R_291()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_59() {
+ if (jj_scan_token(VOLATILE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_220() {
+ if (jj_3R_89()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_97()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_97() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_220()) {
+ jj_scanpos = xsp;
+ if (jj_3R_221()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_88() {
+ if (jj_scan_token(VOLATILE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_60()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_87() {
+ if (jj_scan_token(CONST)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_59()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_61() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_87()) {
+ jj_scanpos = xsp;
+ if (jj_3R_88()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_287() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_61()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_216() {
+ if (jj_3R_288()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_287()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_215() {
+ if (jj_scan_token(STAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_287()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_436() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_213()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_89() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_214()) {
+ jj_scanpos = xsp;
+ if (jj_3R_215()) {
+ jj_scanpos = xsp;
+ if (jj_3R_216()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_214() {
+ if (jj_scan_token(AMPERSAND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_287()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_448() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_91()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_213() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_448()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_58() {
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_86()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_86() {
+ if (jj_3R_213()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_436()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_56() {
+ if (jj_3R_84()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_308() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_58()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_307() {
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_86()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_188() {
+ if (jj_scan_token(ENUM)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_307()) {
+ jj_scanpos = xsp;
+ if (jj_3R_308()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_484() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(OCTALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_470() {
+ if (jj_scan_token(AMPERSAND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_476() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(OCTALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_463() {
+ if (jj_3R_92()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_57() {
+ if (jj_3R_85()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_462() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_469()) {
+ jj_scanpos = xsp;
+ if (jj_3R_470()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_469() {
+ if (jj_scan_token(STAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_55() {
+ if (jj_3R_75()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_311() {
+ if (jj_3R_163()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_266() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_311()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(OPERATOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_462()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_56()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3_57()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_463()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_464()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_475() {
+ if (jj_3R_97()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_477() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_475()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_484()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_466() {
+ if (jj_3R_475()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_476()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_477()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_202() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_53() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_201() {
+ if (jj_3R_284()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_54() {
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_52() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_458() {
+ if (jj_3R_466()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_82() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_51() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_82()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_48()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_200() {
+ if (jj_3R_58()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_206() {
+ if (jj_scan_token(VIRTUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_50() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_446() {
+ if (jj_scan_token(VIRTUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_199() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_458()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_49() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_198() {
+ if (jj_3R_265()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_81() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_205()) {
+ jj_scanpos = xsp;
+ if (jj_3R_206()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_205() {
+ if (jj_scan_token(INLINE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_48() {
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_81()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ if (jj_scan_token(TILDE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_80() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_197() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_283()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_47() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_54()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_196() {
+ if (jj_3R_264()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_46() {
+ if (jj_scan_token(OPERATOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_45() {
+ if (jj_scan_token(ENUM)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_80()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_79() {
+ if (jj_scan_token(TYPEDEF)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_195() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_162()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_321() {
+ if (jj_scan_token(PRIVATE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_44() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_79()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_51()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_435() {
+ if (jj_3R_284()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_446()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_194() {
+ if (jj_3R_263()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_457() {
+ if (jj_3R_466()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_193() {
+ if (jj_3R_266()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_192() {
+ if (jj_3R_188()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_457()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_191() {
+ if (jj_3R_57()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_320() {
+ if (jj_scan_token(PROTECTED)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_76() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_191()) {
+ jj_scanpos = xsp;
+ if (jj_3R_192()) {
+ jj_scanpos = xsp;
+ if (jj_3R_193()) {
+ jj_scanpos = xsp;
+ if (jj_3R_194()) {
+ jj_scanpos = xsp;
+ if (jj_3R_195()) {
+ jj_scanpos = xsp;
+ if (jj_3R_196()) {
+ jj_scanpos = xsp;
+ if (jj_3R_197()) {
+ jj_scanpos = xsp;
+ if (jj_3R_198()) {
+ jj_scanpos = xsp;
+ if (jj_3R_199()) {
+ jj_scanpos = xsp;
+ if (jj_3R_200()) {
+ jj_scanpos = xsp;
+ if (jj_3_54()) {
+ jj_scanpos = xsp;
+ if (jj_3R_201()) {
+ jj_scanpos = xsp;
+ if (jj_3R_202()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_412() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_411()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_43() {
+ if (jj_3R_75()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_427() {
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_77()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_445() {
+ if (jj_3R_284()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_284() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_319()) {
+ jj_scanpos = xsp;
+ if (jj_3R_320()) {
+ jj_scanpos = xsp;
+ if (jj_3R_321()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_319() {
+ if (jj_scan_token(PUBLIC)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_426() {
+ if (jj_3R_163()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_425() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_434()) {
+ jj_scanpos = xsp;
+ if (jj_3R_435()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_434() {
+ if (jj_scan_token(VIRTUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_445()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_411() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_425()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_426()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_427()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_204() {
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_411()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_412()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_41() {
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_77()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_317() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_41()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_40() {
+ if (jj_3R_76()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_78() {
+ if (jj_3R_204()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_42() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_78()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_40()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ if (jj_scan_token(RCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_39() {
+ if (jj_3R_76()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_158() {
+ if (jj_scan_token(CLASS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_281() {
+ if (jj_scan_token(CLASS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_316() {
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_39()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ if (jj_scan_token(RCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_280() {
+ if (jj_scan_token(UNION)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_279() {
+ if (jj_scan_token(STRUCT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_157() {
+ if (jj_scan_token(UNION)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_182() {
+ if (jj_scan_token(FLOAT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_187() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_279()) {
+ jj_scanpos = xsp;
+ if (jj_3R_280()) {
+ jj_scanpos = xsp;
+ if (jj_3R_281()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_316()) {
+ jj_scanpos = xsp;
+ if (jj_3_42()) {
+ jj_scanpos = xsp;
+ if (jj_3R_317()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_269() {
+ if (jj_3R_204()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_181() {
+ if (jj_scan_token(LONG)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_159() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_269()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_156() {
+ if (jj_scan_token(STRUCT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_51() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_156()) {
+ jj_scanpos = xsp;
+ if (jj_3R_157()) {
+ jj_scanpos = xsp;
+ if (jj_3R_158()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_159()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_180() {
+ if (jj_scan_token(INT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_185() {
+ if (jj_scan_token(UNSIGNED)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_440() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_93()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_431() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_439()) {
+ jj_scanpos = xsp;
+ if (jj_3R_440()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_439() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_98()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_179() {
+ if (jj_scan_token(SHORT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_276() {
+ if (jj_3R_97()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_431()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_184() {
+ if (jj_scan_token(SIGNED)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_178() {
+ if (jj_scan_token(CHAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_420() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_276()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_167() {
+ if (jj_3R_276()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_420()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_183() {
+ if (jj_scan_token(DOUBLE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_278() {
+ if (jj_scan_token(REGISTER)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_177() {
+ if (jj_scan_token(VOID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_64() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_177()) {
+ jj_scanpos = xsp;
+ if (jj_3R_178()) {
+ jj_scanpos = xsp;
+ if (jj_3R_179()) {
+ jj_scanpos = xsp;
+ if (jj_3R_180()) {
+ jj_scanpos = xsp;
+ if (jj_3R_181()) {
+ jj_scanpos = xsp;
+ if (jj_3R_182()) {
+ jj_scanpos = xsp;
+ if (jj_3R_183()) {
+ jj_scanpos = xsp;
+ if (jj_3R_184()) {
+ jj_scanpos = xsp;
+ if (jj_3R_185()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_172() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_171() {
+ if (jj_scan_token(TYPEDEF)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_170() {
+ if (jj_scan_token(EXTERN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_169() {
+ if (jj_scan_token(STATIC)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_277() {
+ if (jj_scan_token(AUTO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_212() {
+ if (jj_scan_token(VOLATILE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_168() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_277()) {
+ jj_scanpos = xsp;
+ if (jj_3R_278()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_60() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_168()) {
+ jj_scanpos = xsp;
+ if (jj_3R_169()) {
+ jj_scanpos = xsp;
+ if (jj_3R_170()) {
+ jj_scanpos = xsp;
+ if (jj_3R_171()) {
+ jj_scanpos = xsp;
+ lookingAhead = true;
+ jj_semLA = fgCallback.isStorageClassSpecifier(getToken(1));
+ lookingAhead = false;
+ if (!jj_semLA || jj_3R_172()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_186() {
+ return false;
+ }
+
+ static final private boolean jj_3R_85() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_211()) {
+ jj_scanpos = xsp;
+ if (jj_3R_212()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_211() {
+ if (jj_scan_token(CONST)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_65() {
+ Token xsp;
+ xsp = jj_scanpos;
+ lookingAhead = true;
+ jj_semLA = isNotNull(getFullyScopedName());
+ lookingAhead = false;
+ if (!jj_semLA || jj_3R_186()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_288() {
+ if (jj_3R_163()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(STAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_285() {
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_77()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_38() {
+ if (jj_3R_75()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_74() {
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_77()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_209() {
+ if (jj_scan_token(OPERATOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_286()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_73() {
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_77()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_208() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_285()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_207() {
+ if (jj_3R_163()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_83() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_207()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_208()) {
+ jj_scanpos = xsp;
+ if (jj_3R_209()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_37() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_74()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_273() {
+ Token xsp;
+ if (jj_3_37()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_37()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_36() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_73()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_272() {
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_36()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_163() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_272()) {
+ jj_scanpos = xsp;
+ if (jj_3R_273()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_282() {
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_77()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_190() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_282()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_75() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_189()) {
+ jj_scanpos = xsp;
+ if (jj_3R_190()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_189() {
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_35() {
+ if (jj_3R_65()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_261() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_138() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_261()) {
+ jj_scanpos = xsp;
+ if (jj_3_35()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_28() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_31() {
+ if (jj_3R_61()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_30() {
+ if (jj_3R_65()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_29() {
+ if (jj_3R_61()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_72() {
+ if (jj_3R_188()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_69() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_71() {
+ if (jj_3R_187()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_33() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_34() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_71()) {
+ jj_scanpos = xsp;
+ if (jj_3R_72()) {
+ jj_scanpos = xsp;
+ if (jj_3_30()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_31()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_27() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_69()) {
+ jj_scanpos = xsp;
+ if (jj_3_29()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_153() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_27()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_21() {
+ if (jj_3R_61()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_23() {
+ if (jj_3R_61()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_20() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_22() {
+ if (jj_3R_65()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_67() {
+ if (jj_3R_188()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_66() {
+ if (jj_3R_187()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_63() {
+ if (jj_3R_61()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_25() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_66()) {
+ jj_scanpos = xsp;
+ if (jj_3R_67()) {
+ jj_scanpos = xsp;
+ if (jj_3_22()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_23()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_24() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_62() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_19() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_62()) {
+ jj_scanpos = xsp;
+ if (jj_3R_63()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_68() {
+ if (jj_3R_64()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_19()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_18() {
+ if (jj_3R_61()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_26() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_68()) {
+ jj_scanpos = xsp;
+ if (jj_3_25()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_70() {
+ if (jj_3R_61()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_32() {
+ Token xsp;
+ if (jj_3R_70()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_70()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ xsp = jj_scanpos;
+ if (jj_3_26()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_49() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_32()) {
+ jj_scanpos = xsp;
+ if (jj_3R_153()) {
+ jj_scanpos = xsp;
+ if (jj_3_34()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_176() {
+ if (jj_scan_token(FRIEND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_175() {
+ if (jj_scan_token(VIRTUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_174() {
+ if (jj_scan_token(INLINE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_173() {
+ if (jj_3R_85()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_17() {
+ if (jj_3R_60()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_59() {
+ if (jj_3R_167()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_61() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_17()) {
+ jj_scanpos = xsp;
+ if (jj_3R_173()) {
+ jj_scanpos = xsp;
+ if (jj_3R_174()) {
+ jj_scanpos = xsp;
+ if (jj_3R_175()) {
+ jj_scanpos = xsp;
+ if (jj_3R_176()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_164() {
+ if (jj_3R_274()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_14() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_57() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_16()) {
+ jj_scanpos = xsp;
+ if (jj_3R_164()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_16() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_59()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_13() {
+ if (jj_3R_44()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_421() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_15() {
+ if (jj_3R_57()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_376() {
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_13()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ if (jj_scan_token(RCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_421()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_274() {
+ if (jj_scan_token(EXTERN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(STRING)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_376()) {
+ jj_scanpos = xsp;
+ if (jj_3_15()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_472() {
+ if (jj_3R_292()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_471() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_464() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_471()) {
+ jj_scanpos = xsp;
+ if (jj_3R_472()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_310() {
+ if (jj_3R_58()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_464()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_12() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_58()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_464()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_265() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_12()) {
+ jj_scanpos = xsp;
+ if (jj_3R_310()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_47() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_465() {
+ if (jj_3R_167()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_3() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_47()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_48()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_2() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_150() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_11() {
+ if (jj_3R_57()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_4() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_465()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_453() {
+ if (jj_3R_265()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_56() {
+ if (jj_3R_163()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_10() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_56()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(OPERATOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_452() {
+ if (jj_3R_264()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_55() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_451() {
+ if (jj_3R_167()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_155() {
+ if (jj_3R_160()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_9() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_55()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_48()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_52() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_149() {
+ if (jj_3R_160()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_452()) {
+ jj_scanpos = xsp;
+ if (jj_3R_453()) {
+ jj_scanpos = xsp;
+ if (jj_3_4()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_8() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_53() {
+ if (jj_3R_160()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_148() {
+ if (jj_3R_266()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_7() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_53()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_54()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_147() {
+ if (jj_3R_265()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_6() {
+ if (jj_scan_token(ENUM)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_52()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_154() {
+ if (jj_scan_token(TYPEDEF)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_50() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_154()) {
+ jj_scanpos = xsp;
+ if (jj_3R_155()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_5() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_50()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_51()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LCURLYBRACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_146() {
+ if (jj_3R_264()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_145() {
+ if (jj_3R_263()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_262() {
+ if (jj_3R_160()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_144() {
+ if (jj_3R_188()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_451()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SEMICOLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_143() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_262()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_57()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_44() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_143()) {
+ jj_scanpos = xsp;
+ if (jj_3R_144()) {
+ jj_scanpos = xsp;
+ if (jj_3R_145()) {
+ jj_scanpos = xsp;
+ if (jj_3R_146()) {
+ jj_scanpos = xsp;
+ if (jj_3R_147()) {
+ jj_scanpos = xsp;
+ if (jj_3R_148()) {
+ jj_scanpos = xsp;
+ if (jj_3R_149()) {
+ jj_scanpos = xsp;
+ if (jj_3_11()) {
+ jj_scanpos = xsp;
+ if (jj_3R_150()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_1() {
+ if (jj_3R_44()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_142() {
+ if (jj_scan_token(AMPERSAND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_141() {
+ if (jj_scan_token(STAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_478() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_141() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_141()) {
+ jj_scanpos = xsp;
+ if (jj_3R_142()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_467() {
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_478()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_92() {
+ if (jj_scan_token(THROW)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_467()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_142() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_141()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_361() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_360() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_359() {
+ if (jj_scan_token(POINTERTO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_358() {
+ if (jj_scan_token(ARROWSTAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_357() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_356() {
+ if (jj_scan_token(MINUSMINUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_355() {
+ if (jj_scan_token(PLUSPLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_354() {
+ if (jj_scan_token(OR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_353() {
+ if (jj_scan_token(AND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_352() {
+ if (jj_scan_token(GREATERTHANOREQUALTO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_351() {
+ if (jj_scan_token(LESSTHANOREQUALTO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_350() {
+ if (jj_scan_token(NOTEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_349() {
+ if (jj_scan_token(EQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_348() {
+ if (jj_scan_token(SHIFTLEFTEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_347() {
+ if (jj_scan_token(SHIFTRIGHTEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_346() {
+ if (jj_scan_token(SHIFTRIGHT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_345() {
+ if (jj_scan_token(SHIFTLEFT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_344() {
+ if (jj_scan_token(BITWISEOREQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_343() {
+ if (jj_scan_token(BITWISEANDEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_342() {
+ if (jj_scan_token(BITWISEXOREQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_341() {
+ if (jj_scan_token(MODEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_340() {
+ if (jj_scan_token(DIVIDEEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_339() {
+ if (jj_scan_token(TIMESEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_338() {
+ if (jj_scan_token(MINUSEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_337() {
+ if (jj_scan_token(PLUSEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_336() {
+ if (jj_scan_token(GREATERTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_335() {
+ if (jj_scan_token(LESSTHAN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_140() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_334() {
+ if (jj_scan_token(ASSIGNEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_333() {
+ if (jj_scan_token(NOT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_332() {
+ if (jj_scan_token(TILDE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_139() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_331() {
+ if (jj_scan_token(BITWISEOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_330() {
+ if (jj_scan_token(AMPERSAND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_329() {
+ if (jj_scan_token(BITWISEXOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_328() {
+ if (jj_scan_token(MOD)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_327() {
+ if (jj_scan_token(DIVIDE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_326() {
+ if (jj_scan_token(STAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_325() {
+ if (jj_scan_token(MINUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_324() {
+ if (jj_scan_token(PLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_322() {
+ if (jj_scan_token(NEW)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_139()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_323() {
+ if (jj_scan_token(DELETE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_140()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_286() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_322()) {
+ jj_scanpos = xsp;
+ if (jj_3R_323()) {
+ jj_scanpos = xsp;
+ if (jj_3R_324()) {
+ jj_scanpos = xsp;
+ if (jj_3R_325()) {
+ jj_scanpos = xsp;
+ if (jj_3R_326()) {
+ jj_scanpos = xsp;
+ if (jj_3R_327()) {
+ jj_scanpos = xsp;
+ if (jj_3R_328()) {
+ jj_scanpos = xsp;
+ if (jj_3R_329()) {
+ jj_scanpos = xsp;
+ if (jj_3R_330()) {
+ jj_scanpos = xsp;
+ if (jj_3R_331()) {
+ jj_scanpos = xsp;
+ if (jj_3R_332()) {
+ jj_scanpos = xsp;
+ if (jj_3R_333()) {
+ jj_scanpos = xsp;
+ if (jj_3R_334()) {
+ jj_scanpos = xsp;
+ if (jj_3R_335()) {
+ jj_scanpos = xsp;
+ if (jj_3R_336()) {
+ jj_scanpos = xsp;
+ if (jj_3R_337()) {
+ jj_scanpos = xsp;
+ if (jj_3R_338()) {
+ jj_scanpos = xsp;
+ if (jj_3R_339()) {
+ jj_scanpos = xsp;
+ if (jj_3R_340()) {
+ jj_scanpos = xsp;
+ if (jj_3R_341()) {
+ jj_scanpos = xsp;
+ if (jj_3R_342()) {
+ jj_scanpos = xsp;
+ if (jj_3R_343()) {
+ jj_scanpos = xsp;
+ if (jj_3R_344()) {
+ jj_scanpos = xsp;
+ if (jj_3R_345()) {
+ jj_scanpos = xsp;
+ if (jj_3R_346()) {
+ jj_scanpos = xsp;
+ if (jj_3R_347()) {
+ jj_scanpos = xsp;
+ if (jj_3R_348()) {
+ jj_scanpos = xsp;
+ if (jj_3R_349()) {
+ jj_scanpos = xsp;
+ if (jj_3R_350()) {
+ jj_scanpos = xsp;
+ if (jj_3R_351()) {
+ jj_scanpos = xsp;
+ if (jj_3R_352()) {
+ jj_scanpos = xsp;
+ if (jj_3R_353()) {
+ jj_scanpos = xsp;
+ if (jj_3R_354()) {
+ jj_scanpos = xsp;
+ if (jj_3R_355()) {
+ jj_scanpos = xsp;
+ if (jj_3R_356()) {
+ jj_scanpos = xsp;
+ if (jj_3R_357()) {
+ jj_scanpos = xsp;
+ if (jj_3R_358()) {
+ jj_scanpos = xsp;
+ if (jj_3R_359()) {
+ jj_scanpos = xsp;
+ if (jj_3R_360()) {
+ jj_scanpos = xsp;
+ if (jj_3R_361()) {
+ jj_scanpos = xsp;
+ if (jj_3_142()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_249() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_100()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_410() {
+ if (jj_scan_token(FALSETOK)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_409() {
+ if (jj_scan_token(TRUETOK)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_408() {
+ if (jj_scan_token(FLOATTWO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_407() {
+ if (jj_scan_token(FLOATONE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_406() {
+ if (jj_scan_token(CHARACTER)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_405() {
+ if (jj_scan_token(UNSIGNED_HEXADECIMALLONG)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_404() {
+ if (jj_scan_token(UNSIGNED_HEXADECIMALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_403() {
+ if (jj_scan_token(UNSIGNED_DECIMALLONG)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_402() {
+ if (jj_scan_token(UNSIGNED_DECIMALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_401() {
+ if (jj_scan_token(UNSIGNED_OCTALLONG)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_400() {
+ if (jj_scan_token(UNSIGNED_OCTALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_399() {
+ if (jj_scan_token(HEXADECIMALLONG)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_398() {
+ if (jj_scan_token(HEXADECIMALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_397() {
+ if (jj_scan_token(DECIMALLONG)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_396() {
+ if (jj_scan_token(DECIMALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_395() {
+ if (jj_scan_token(OCTALLONG)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_306() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_394()) {
+ jj_scanpos = xsp;
+ if (jj_3R_395()) {
+ jj_scanpos = xsp;
+ if (jj_3R_396()) {
+ jj_scanpos = xsp;
+ if (jj_3R_397()) {
+ jj_scanpos = xsp;
+ if (jj_3R_398()) {
+ jj_scanpos = xsp;
+ if (jj_3R_399()) {
+ jj_scanpos = xsp;
+ if (jj_3R_400()) {
+ jj_scanpos = xsp;
+ if (jj_3R_401()) {
+ jj_scanpos = xsp;
+ if (jj_3R_402()) {
+ jj_scanpos = xsp;
+ if (jj_3R_403()) {
+ jj_scanpos = xsp;
+ if (jj_3R_404()) {
+ jj_scanpos = xsp;
+ if (jj_3R_405()) {
+ jj_scanpos = xsp;
+ if (jj_3R_406()) {
+ jj_scanpos = xsp;
+ if (jj_3R_407()) {
+ jj_scanpos = xsp;
+ if (jj_3R_408()) {
+ jj_scanpos = xsp;
+ if (jj_3R_409()) {
+ jj_scanpos = xsp;
+ if (jj_3R_410()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_394() {
+ if (jj_scan_token(OCTALINT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_140() {
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_138() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_140()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(DELETE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_139() {
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_93() {
+ if (jj_3R_100()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_249()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_137() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_139()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(NEW)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_132() {
+ if (jj_3R_93()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_260() {
+ if (jj_3R_306()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_259() {
+ if (jj_3R_253()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_258() {
+ if (jj_3R_305()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_257() {
+ if (jj_3R_304()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_136() {
+ if (jj_scan_token(STRING)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_256() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_255() {
+ Token xsp;
+ if (jj_3_136()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_136()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_137() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_254()) {
+ jj_scanpos = xsp;
+ if (jj_3R_255()) {
+ jj_scanpos = xsp;
+ if (jj_3R_256()) {
+ jj_scanpos = xsp;
+ if (jj_3R_257()) {
+ jj_scanpos = xsp;
+ if (jj_3R_258()) {
+ jj_scanpos = xsp;
+ if (jj_3R_259()) {
+ jj_scanpos = xsp;
+ if (jj_3R_260()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_254() {
+ if (jj_scan_token(THIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_135() {
+ if (jj_3R_75()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_301() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_303() {
+ if (jj_scan_token(TILDE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_302() {
+ if (jj_scan_token(OPERATOR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_286()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_300() {
+ if (jj_3R_163()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_253() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_300()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_301()) {
+ jj_scanpos = xsp;
+ if (jj_3R_302()) {
+ jj_scanpos = xsp;
+ if (jj_3R_303()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_134() {
+ if (jj_3R_138()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_132()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_136() {
+ if (jj_scan_token(MINUSMINUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_135() {
+ if (jj_scan_token(PLUSPLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_131() {
+ if (jj_3R_93()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_134() {
+ if (jj_scan_token(POINTERTO)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_253()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_133() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_253()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_132() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_131()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_127() {
+ if (jj_3R_130()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_393() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_131() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_130() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_131()) {
+ jj_scanpos = xsp;
+ if (jj_3R_132()) {
+ jj_scanpos = xsp;
+ if (jj_3R_133()) {
+ jj_scanpos = xsp;
+ if (jj_3R_134()) {
+ jj_scanpos = xsp;
+ if (jj_3R_135()) {
+ jj_scanpos = xsp;
+ if (jj_3R_136()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_125() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_133()) {
+ jj_scanpos = xsp;
+ if (jj_3_134()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_133() {
+ if (jj_3R_137()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_130()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_247() {
+ if (jj_scan_token(NOT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_246() {
+ if (jj_scan_token(TILDE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_245() {
+ if (jj_scan_token(MINUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_244() {
+ if (jj_scan_token(PLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_243() {
+ if (jj_scan_token(STAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_123() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_242()) {
+ jj_scanpos = xsp;
+ if (jj_3R_243()) {
+ jj_scanpos = xsp;
+ if (jj_3R_244()) {
+ jj_scanpos = xsp;
+ if (jj_3R_245()) {
+ jj_scanpos = xsp;
+ if (jj_3R_246()) {
+ jj_scanpos = xsp;
+ if (jj_3R_247()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_242() {
+ if (jj_scan_token(AMPERSAND)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_392() {
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_129() {
+ if (jj_3R_93()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_305() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_392()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(DELETE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_393()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_124()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_129() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_129()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_128() {
+ if (jj_scan_token(LSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_107()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RSQUAREBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_299() {
+ Token xsp;
+ if (jj_3_128()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_128()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3_126() {
+ if (jj_3R_130()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_252() {
+ if (jj_3R_89()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_287()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_127()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_130() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_251()) {
+ jj_scanpos = xsp;
+ if (jj_3R_252()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_251() {
+ if (jj_3R_299()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_125() {
+ if (jj_3R_129()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_122() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_444() {
+ if (jj_3R_130()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_121() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_250() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_444()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_120() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_93()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_391() {
+ if (jj_3R_129()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_128() {
+ if (jj_3R_250()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_123() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_127() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_119() {
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_126() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_93()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_124() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_126()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_127()) {
+ jj_scanpos = xsp;
+ if (jj_3R_128()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_390() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_115() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_389() {
+ if (jj_scan_token(SCOPE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_304() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_389()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(NEW)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_390()) {
+ jj_scanpos = xsp;
+ if (jj_3_124()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ xsp = jj_scanpos;
+ if (jj_3R_391()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_118() {
+ if (jj_3R_125()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_116() {
+ if (jj_3R_122()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_483() {
+ if (jj_scan_token(ARROWSTAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_424() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_241() {
+ if (jj_scan_token(SIZEOF)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_424()) {
+ jj_scanpos = xsp;
+ if (jj_3_116()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_482() {
+ if (jj_scan_token(DOTSTAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_120() {
+ if (jj_scan_token(MOD)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_117() {
+ if (jj_3R_123()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_124()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_474() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_482()) {
+ jj_scanpos = xsp;
+ if (jj_3R_483()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_124()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_240() {
+ if (jj_scan_token(MINUSMINUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_122()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_113() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_122() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_239()) {
+ jj_scanpos = xsp;
+ if (jj_3R_240()) {
+ jj_scanpos = xsp;
+ if (jj_3_117()) {
+ jj_scanpos = xsp;
+ if (jj_3R_241()) {
+ jj_scanpos = xsp;
+ if (jj_3_118()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_239() {
+ if (jj_scan_token(PLUSPLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_122()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_119() {
+ if (jj_scan_token(DIVIDE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_456() {
+ if (jj_scan_token(SHIFTRIGHT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_114() {
+ if (jj_3R_122()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_118() {
+ if (jj_scan_token(STAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_116() {
+ if (jj_scan_token(MINUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_455() {
+ if (jj_scan_token(SHIFTLEFT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_124() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_248()) {
+ jj_scanpos = xsp;
+ if (jj_3_114()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_248() {
+ if (jj_scan_token(LPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_104()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(RPARENTHESIS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_124()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_447() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_455()) {
+ jj_scanpos = xsp;
+ if (jj_3R_456()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_224()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_115() {
+ if (jj_scan_token(PLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_121() {
+ if (jj_3R_124()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_474()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_481() {
+ if (jj_scan_token(EQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_112() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_118()) {
+ jj_scanpos = xsp;
+ if (jj_3R_119()) {
+ jj_scanpos = xsp;
+ if (jj_3R_120()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_121()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_117() {
+ if (jj_3R_121()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_112()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_480() {
+ if (jj_scan_token(NOTEQUAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3_111() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_115()) {
+ jj_scanpos = xsp;
+ if (jj_3R_116()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_117()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_224() {
+ if (jj_3R_117()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_111()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static final private boolean jj_3R_473() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_480()) {
+ jj_scanpos = xsp;
+ if (jj_3R_481()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_238()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ static final private boolean jj_3R_105() {
+ if (jj_3R_224()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_447()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ static private boolean jj_initialized_once = false;
+ static public CPPParserTokenManager token_source;
+ static ASCII_CharStream jj_input_stream;
+ static public Token token, jj_nt;
+ static private int jj_ntk;
+ static private Token jj_scanpos, jj_lastpos;
+ static private int jj_la;
+ static public boolean lookingAhead = false;
+ static private boolean jj_semLA;
+ static private int jj_gen;
+ static final private int[] jj_la1 = new int[123];
+ static final private int[] jj_la1_0 = {0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x40000000,0x40000000,0x40000000,0x40000000,0x0,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,};
+ static final private int[] jj_la1_1 = {0x0,0x800005,0x800005,0x0,0x10,0x800004,0x10,0x0,0x800005,0x0,0x0,0x0,0x0,0x0,0x4000000,0x4,0x4000000,0x4000000,0x4,0x4000000,0x0,0x0,0x0,0x0,0x0,0x20,0x101,0x101,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x4000000,0x0,0x800005,0x800005,0x10,0x100,0x20,0x100,0x800000,0x800000,0x0,0x0,0x20,0x100,0x800004,0x0,0x5,0x5,0x0,0x0,0x1,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x18,0x20,0x20,0x80,0x100,0x20,0x1,0x0,0x800005,0x1,0x20,0x20,0x10,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x80,0x7ff00,0x7ff00,0x40,0x80000,0x100000,0x200000,0x400000,0x3000000,0x3000000,0x3c000000,0xc0000000,0xc0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x800004,0x4,0x0,0x800000,0x1,0x0,0x1,0x4,0x20,0x0,0x800000,0xffffff21,0x20,};
+ static final private int[] jj_la1_2 = {0x0,0x84,0x84,0x0,0x0,0x4,0x0,0x0,0x84,0x4000000,0x40040000,0x2000000,0x2000000,0x10820000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000,0x2000,0x4002000,0x10820000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x84,0x84,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x0,0x0,0x0,0x4,0x40000,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x80084000,0x20400000,0x108000,0x0,0x0,0x20400000,0x80084000,0x8010000,0x8010000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x1c,0x1800,0x1800,0x60,0x0,0x4,0x0,0x0,0x187,0x660,0x80,0x0,0x80,0x0,0x0,0x4,0x2015ff,0x0,};
+ static final private int[] jj_la1_3 = {0x40000,0x10000000,0x10000000,0x40000,0x0,0x10000000,0x0,0x0,0x10000000,0x0,0x5000002,0x418000,0x418000,0x280180c,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x4000000,0x200,0x204200,0x280180c,0x0,0x0,0x0,0x418000,0x0,0x0,0x418000,0x0,0x0,0x0,0x0,0xe0,0x1000000,0x10000e0,0x10000e0,0x0,0xe0,0x10000000,0x10000000,0xe0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x4000000,0x10000000,0x10000000,0x0,0x80000000,0x0,0x10000000,0x80000000,0x2,0x1000000,0x1000002,0x1000002,0x40000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80120401,0x8000000,0x0,0x20001,0x0,0x8000000,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x10000000,0x80000,0x70000000,0x0,0x60000000,0x0,0x10,0x0,};
+ static final private int[] jj_la1_4 = {0x0,0x10000,0x10000,0x0,0x0,0x10000,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x10000,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x10000,0x0,0x10000,0x10000,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x10000,0x8000,0x17fff,0x0,0x7fff,0x0,0x0,0x0,};
+ static final private JJCalls[] jj_2_rtns = new JJCalls[142];
+ static private boolean jj_rescan = false;
+ static private int jj_gc = 0;
+
+ public CPPParser(java.io.InputStream stream) {
+ if (jj_initialized_once) {
+ System.out.println("ERROR: Second call to constructor of static parser. You must");
+ System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
+ System.out.println(" during parser generation.");
+ throw new Error();
+ }
+ jj_initialized_once = true;
+ jj_input_stream = new ASCII_CharStream(stream, 1, 1);
+ token_source = new CPPParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 123; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ static public void ReInit(java.io.InputStream stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 123; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public CPPParser(java.io.Reader stream) {
+ if (jj_initialized_once) {
+ System.out.println("ERROR: Second call to constructor of static parser. You must");
+ System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
+ System.out.println(" during parser generation.");
+ throw new Error();
+ }
+ jj_initialized_once = true;
+ jj_input_stream = new ASCII_CharStream(stream, 1, 1);
+ token_source = new CPPParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 123; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ static public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 123; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public CPPParser(CPPParserTokenManager tm) {
+ if (jj_initialized_once) {
+ System.out.println("ERROR: Second call to constructor of static parser. You must");
+ System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
+ System.out.println(" during parser generation.");
+ throw new Error();
+ }
+ jj_initialized_once = true;
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 123; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(CPPParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 123; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ static final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ static final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ return (jj_scanpos.kind != kind);
+ }
+
+ static final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ static final public Token getToken(int index) {
+ Token t = lookingAhead ? jj_scanpos : token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ static final private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ static private java.util.Vector jj_expentries = new java.util.Vector();
+ static private int[] jj_expentry;
+ static private int jj_kind = -1;
+ static private int[] jj_lasttokens = new int[100];
+ static private int jj_endpos;
+
+ static private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ boolean exists = false;
+ for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) {
+ int[] oldentry = (int[])(enum.nextElement());
+ if (oldentry.length == jj_expentry.length) {
+ exists = true;
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ exists = false;
+ break;
+ }
+ }
+ if (exists) break;
+ }
+ }
+ if (!exists) jj_expentries.addElement(jj_expentry);
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ static final public ParseException generateParseException() {
+ jj_expentries.removeAllElements();
+ boolean[] la1tokens = new boolean[145];
+ for (int i = 0; i < 145; i++) {
+ la1tokens[i] = false;
+ }
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 123; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1< jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ case 1: jj_3_2(); break;
+ case 2: jj_3_3(); break;
+ case 3: jj_3_4(); break;
+ case 4: jj_3_5(); break;
+ case 5: jj_3_6(); break;
+ case 6: jj_3_7(); break;
+ case 7: jj_3_8(); break;
+ case 8: jj_3_9(); break;
+ case 9: jj_3_10(); break;
+ case 10: jj_3_11(); break;
+ case 11: jj_3_12(); break;
+ case 12: jj_3_13(); break;
+ case 13: jj_3_14(); break;
+ case 14: jj_3_15(); break;
+ case 15: jj_3_16(); break;
+ case 16: jj_3_17(); break;
+ case 17: jj_3_18(); break;
+ case 18: jj_3_19(); break;
+ case 19: jj_3_20(); break;
+ case 20: jj_3_21(); break;
+ case 21: jj_3_22(); break;
+ case 22: jj_3_23(); break;
+ case 23: jj_3_24(); break;
+ case 24: jj_3_25(); break;
+ case 25: jj_3_26(); break;
+ case 26: jj_3_27(); break;
+ case 27: jj_3_28(); break;
+ case 28: jj_3_29(); break;
+ case 29: jj_3_30(); break;
+ case 30: jj_3_31(); break;
+ case 31: jj_3_32(); break;
+ case 32: jj_3_33(); break;
+ case 33: jj_3_34(); break;
+ case 34: jj_3_35(); break;
+ case 35: jj_3_36(); break;
+ case 36: jj_3_37(); break;
+ case 37: jj_3_38(); break;
+ case 38: jj_3_39(); break;
+ case 39: jj_3_40(); break;
+ case 40: jj_3_41(); break;
+ case 41: jj_3_42(); break;
+ case 42: jj_3_43(); break;
+ case 43: jj_3_44(); break;
+ case 44: jj_3_45(); break;
+ case 45: jj_3_46(); break;
+ case 46: jj_3_47(); break;
+ case 47: jj_3_48(); break;
+ case 48: jj_3_49(); break;
+ case 49: jj_3_50(); break;
+ case 50: jj_3_51(); break;
+ case 51: jj_3_52(); break;
+ case 52: jj_3_53(); break;
+ case 53: jj_3_54(); break;
+ case 54: jj_3_55(); break;
+ case 55: jj_3_56(); break;
+ case 56: jj_3_57(); break;
+ case 57: jj_3_58(); break;
+ case 58: jj_3_59(); break;
+ case 59: jj_3_60(); break;
+ case 60: jj_3_61(); break;
+ case 61: jj_3_62(); break;
+ case 62: jj_3_63(); break;
+ case 63: jj_3_64(); break;
+ case 64: jj_3_65(); break;
+ case 65: jj_3_66(); break;
+ case 66: jj_3_67(); break;
+ case 67: jj_3_68(); break;
+ case 68: jj_3_69(); break;
+ case 69: jj_3_70(); break;
+ case 70: jj_3_71(); break;
+ case 71: jj_3_72(); break;
+ case 72: jj_3_73(); break;
+ case 73: jj_3_74(); break;
+ case 74: jj_3_75(); break;
+ case 75: jj_3_76(); break;
+ case 76: jj_3_77(); break;
+ case 77: jj_3_78(); break;
+ case 78: jj_3_79(); break;
+ case 79: jj_3_80(); break;
+ case 80: jj_3_81(); break;
+ case 81: jj_3_82(); break;
+ case 82: jj_3_83(); break;
+ case 83: jj_3_84(); break;
+ case 84: jj_3_85(); break;
+ case 85: jj_3_86(); break;
+ case 86: jj_3_87(); break;
+ case 87: jj_3_88(); break;
+ case 88: jj_3_89(); break;
+ case 89: jj_3_90(); break;
+ case 90: jj_3_91(); break;
+ case 91: jj_3_92(); break;
+ case 92: jj_3_93(); break;
+ case 93: jj_3_94(); break;
+ case 94: jj_3_95(); break;
+ case 95: jj_3_96(); break;
+ case 96: jj_3_97(); break;
+ case 97: jj_3_98(); break;
+ case 98: jj_3_99(); break;
+ case 99: jj_3_100(); break;
+ case 100: jj_3_101(); break;
+ case 101: jj_3_102(); break;
+ case 102: jj_3_103(); break;
+ case 103: jj_3_104(); break;
+ case 104: jj_3_105(); break;
+ case 105: jj_3_106(); break;
+ case 106: jj_3_107(); break;
+ case 107: jj_3_108(); break;
+ case 108: jj_3_109(); break;
+ case 109: jj_3_110(); break;
+ case 110: jj_3_111(); break;
+ case 111: jj_3_112(); break;
+ case 112: jj_3_113(); break;
+ case 113: jj_3_114(); break;
+ case 114: jj_3_115(); break;
+ case 115: jj_3_116(); break;
+ case 116: jj_3_117(); break;
+ case 117: jj_3_118(); break;
+ case 118: jj_3_119(); break;
+ case 119: jj_3_120(); break;
+ case 120: jj_3_121(); break;
+ case 121: jj_3_122(); break;
+ case 122: jj_3_123(); break;
+ case 123: jj_3_124(); break;
+ case 124: jj_3_125(); break;
+ case 125: jj_3_126(); break;
+ case 126: jj_3_127(); break;
+ case 127: jj_3_128(); break;
+ case 128: jj_3_129(); break;
+ case 129: jj_3_130(); break;
+ case 130: jj_3_131(); break;
+ case 131: jj_3_132(); break;
+ case 132: jj_3_133(); break;
+ case 133: jj_3_134(); break;
+ case 134: jj_3_135(); break;
+ case 135: jj_3_136(); break;
+ case 136: jj_3_137(); break;
+ case 137: jj_3_138(); break;
+ case 138: jj_3_139(); break;
+ case 139: jj_3_140(); break;
+ case 140: jj_3_141(); break;
+ case 141: jj_3_142(); break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ }
+ jj_rescan = false;
+ }
+
+ static final private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) { p = p.next = new JJCalls(); break; }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParserConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParserConstants.java
new file mode 100644
index 00000000000..eeb0c3a8f6d
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParserConstants.java
@@ -0,0 +1,283 @@
+/* Generated By:JavaCC: Do not edit this line. CPPParserConstants.java */
+package org.eclipse.cdt.internal.parser.generated;
+
+public interface CPPParserConstants {
+
+ int EOF = 0;
+ int LCURLYBRACE = 28;
+ int RCURLYBRACE = 29;
+ int LSQUAREBRACKET = 30;
+ int RSQUAREBRACKET = 31;
+ int LPARENTHESIS = 32;
+ int RPARENTHESIS = 33;
+ int SCOPE = 34;
+ int COLON = 35;
+ int SEMICOLON = 36;
+ int COMMA = 37;
+ int QUESTIONMARK = 38;
+ int ELLIPSIS = 39;
+ int ASSIGNEQUAL = 40;
+ int TIMESEQUAL = 41;
+ int DIVIDEEQUAL = 42;
+ int MODEQUAL = 43;
+ int PLUSEQUAL = 44;
+ int MINUSEQUAL = 45;
+ int SHIFTLEFTEQUAL = 46;
+ int SHIFTRIGHTEQUAL = 47;
+ int BITWISEANDEQUAL = 48;
+ int BITWISEXOREQUAL = 49;
+ int BITWISEOREQUAL = 50;
+ int OR = 51;
+ int AND = 52;
+ int BITWISEOR = 53;
+ int BITWISEXOR = 54;
+ int AMPERSAND = 55;
+ int EQUAL = 56;
+ int NOTEQUAL = 57;
+ int LESSTHAN = 58;
+ int GREATERTHAN = 59;
+ int LESSTHANOREQUALTO = 60;
+ int GREATERTHANOREQUALTO = 61;
+ int SHIFTLEFT = 62;
+ int SHIFTRIGHT = 63;
+ int PLUS = 64;
+ int MINUS = 65;
+ int STAR = 66;
+ int DIVIDE = 67;
+ int MOD = 68;
+ int PLUSPLUS = 69;
+ int MINUSMINUS = 70;
+ int TILDE = 71;
+ int NOT = 72;
+ int DOT = 73;
+ int POINTERTO = 74;
+ int DOTSTAR = 75;
+ int ARROWSTAR = 76;
+ int AUTO = 77;
+ int BREAK = 78;
+ int CASE = 79;
+ int CATCH = 80;
+ int CHAR = 81;
+ int CONST = 82;
+ int CONTINUE = 83;
+ int _DEFAULT = 84;
+ int DELETE = 85;
+ int DO = 86;
+ int DOUBLE = 87;
+ int ELSE = 88;
+ int ENUM = 89;
+ int EXTERN = 90;
+ int FINALLY = 91;
+ int FLOAT = 92;
+ int FOR = 93;
+ int FRIEND = 94;
+ int GOTO = 95;
+ int IF = 96;
+ int INLINE = 97;
+ int INT = 98;
+ int LONG = 99;
+ int NEW = 100;
+ int PRIVATE = 101;
+ int PROTECTED = 102;
+ int PUBLIC = 103;
+ int REDECLARED = 104;
+ int REGISTER = 105;
+ int RETURN = 106;
+ int SHORT = 107;
+ int SIGNED = 108;
+ int SIZEOF = 109;
+ int STATIC = 110;
+ int STRUCT = 111;
+ int CLASS = 112;
+ int SWITCH = 113;
+ int TEMPLATE = 114;
+ int THIS = 115;
+ int TRY = 116;
+ int TYPEDEF = 117;
+ int UNION = 118;
+ int UNSIGNED = 119;
+ int VIRTUAL = 120;
+ int VOID = 121;
+ int VOLATILE = 122;
+ int WHILE = 123;
+ int OPERATOR = 124;
+ int TRUETOK = 125;
+ int FALSETOK = 126;
+ int THROW = 127;
+ int OCTALINT = 128;
+ int OCTALLONG = 129;
+ int UNSIGNED_OCTALINT = 130;
+ int UNSIGNED_OCTALLONG = 131;
+ int DECIMALINT = 132;
+ int DECIMALLONG = 133;
+ int UNSIGNED_DECIMALINT = 134;
+ int UNSIGNED_DECIMALLONG = 135;
+ int HEXADECIMALINT = 136;
+ int HEXADECIMALLONG = 137;
+ int UNSIGNED_HEXADECIMALINT = 138;
+ int UNSIGNED_HEXADECIMALLONG = 139;
+ int FLOATONE = 140;
+ int FLOATTWO = 141;
+ int CHARACTER = 142;
+ int STRING = 143;
+ int ID = 144;
+
+ int DEFAULT = 0;
+ int DEFINE_STMT = 1;
+ int INCLUDE_STMT = 2;
+ int LINE_NUMBER = 3;
+ int LINE_DIRECTIVE = 4;
+ int AFTER_LINE_DIRECTIVE = 5;
+ int IN_LINE_COMMENT = 6;
+ int IN_COMMENT = 7;
+ int PREPROCESSOR_OUTPUT = 8;
+
+ String[] tokenImage = {
+ "",
+ "\" \"",
+ "\"\\t\"",
+ "\"\\n\"",
+ "\"\\r\"",
+ "\"//\"",
+ "\"/*\"",
+ "",
+ "",
+ "",
+ "",
+ "\"#\"",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\"*/\"",
+ "",
+ "",
+ "",
+ "\"{\"",
+ "\"}\"",
+ "\"[\"",
+ "\"]\"",
+ "\"(\"",
+ "\")\"",
+ "\"::\"",
+ "\":\"",
+ "\";\"",
+ "\",\"",
+ "\"?\"",
+ "\"...\"",
+ "\"=\"",
+ "\"*=\"",
+ "\"/=\"",
+ "\"%=\"",
+ "\"+=\"",
+ "\"-=\"",
+ "\"<<=\"",
+ "\">>=\"",
+ "\"&=\"",
+ "\"^=\"",
+ "\"|=\"",
+ "\"||\"",
+ "\"&&\"",
+ "\"|\"",
+ "\"^\"",
+ "\"&\"",
+ "\"==\"",
+ "\"!=\"",
+ "\"<\"",
+ "\">\"",
+ "\"<=\"",
+ "\">=\"",
+ "\"<<\"",
+ "\">>\"",
+ "\"+\"",
+ "\"-\"",
+ "\"*\"",
+ "\"/\"",
+ "\"%\"",
+ "\"++\"",
+ "\"--\"",
+ "\"~\"",
+ "\"!\"",
+ "\".\"",
+ "\"->\"",
+ "\".*\"",
+ "\"->*\"",
+ "\"auto\"",
+ "\"break\"",
+ "\"case\"",
+ "\"catch\"",
+ "\"char\"",
+ "\"const\"",
+ "\"continue\"",
+ "\"default\"",
+ "\"delete\"",
+ "\"do\"",
+ "\"double\"",
+ "\"else\"",
+ "\"enum\"",
+ "\"extern\"",
+ "\"finally\"",
+ "\"float\"",
+ "\"for\"",
+ "\"friend\"",
+ "\"goto\"",
+ "\"if\"",
+ "\"inline\"",
+ "\"int\"",
+ "\"long\"",
+ "\"new\"",
+ "\"private\"",
+ "\"protected\"",
+ "\"public\"",
+ "\"redeclared\"",
+ "\"register\"",
+ "\"return\"",
+ "\"short\"",
+ "\"signed\"",
+ "\"sizeof\"",
+ "\"static\"",
+ "\"struct\"",
+ "\"class\"",
+ "\"switch\"",
+ "\"template\"",
+ "\"this\"",
+ "\"try\"",
+ "\"typedef\"",
+ "\"union\"",
+ "\"unsigned\"",
+ "\"virtual\"",
+ "\"void\"",
+ "\"volatile\"",
+ "\"while\"",
+ "\"operator\"",
+ "\"true\"",
+ "\"false\"",
+ "\"throw\"",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ };
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParserTokenManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParserTokenManager.java
new file mode 100644
index 00000000000..f22c7d204de
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/CPPParserTokenManager.java
@@ -0,0 +1,2354 @@
+/* Generated By:JavaCC: Do not edit this line. CPPParserTokenManager.java */
+package org.eclipse.cdt.internal.parser.generated;
+
+import org.eclipse.cdt.internal.parser.ParserCallback;
+// redirect to a fixed class
+import org.eclipse.cdt.internal.parser.ASCII_CharStream;
+
+public class CPPParserTokenManager implements CPPParserConstants
+{
+ static int beginLine;
+ static int beginCol;
+ static boolean lineDirective = false;
+
+ static void resetBeginLineCol()
+ {
+ }
+ public static java.io.PrintStream debugStream = System.out;
+ public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+static private final int jjMoveStringLiteralDfa0_1()
+{
+ return jjMoveNfa_1(1, 0);
+}
+static private final void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+static private final void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+static private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+static private final void jjCheckNAddStates(int start, int end)
+{
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+}
+static private final void jjCheckNAddStates(int start)
+{
+ jjCheckNAdd(jjnextStates[start]);
+ jjCheckNAdd(jjnextStates[start + 1]);
+}
+static final long[] jjbitVec0 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+static private final int jjMoveNfa_1(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 5;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ if ((0xfffffffeffffd9ffL & l) != 0L)
+ {
+ if (kind > 12)
+ kind = 12;
+ jjCheckNAdd(0);
+ }
+ else if ((0x2400L & l) != 0L)
+ {
+ if (kind > 14)
+ kind = 14;
+ }
+ else if ((0x100000200L & l) != 0L)
+ {
+ if (kind > 13)
+ kind = 13;
+ }
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 3;
+ break;
+ case 0:
+ if ((0xfffffffeffffd9ffL & l) == 0L)
+ break;
+ kind = 12;
+ jjCheckNAdd(0);
+ break;
+ case 2:
+ if ((0x2400L & l) != 0L && kind > 14)
+ kind = 14;
+ break;
+ case 3:
+ if (curChar == 10 && kind > 14)
+ kind = 14;
+ break;
+ case 4:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 3;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ case 0:
+ kind = 12;
+ jjCheckNAdd(0);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ case 0:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 12)
+ kind = 12;
+ jjCheckNAdd(0);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static private final int jjMoveStringLiteralDfa0_3()
+{
+ return jjMoveNfa_3(0, 0);
+}
+static private final int jjMoveNfa_3(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 1;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ kind = 18;
+ jjstateSet[jjnewStateCnt++] = 0;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static private final int jjMoveStringLiteralDfa0_4()
+{
+ return jjMoveNfa_4(0, 0);
+}
+static private final int jjMoveNfa_4(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 3;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0x2400L & l) != 0L)
+ {
+ if (kind > 19)
+ kind = 19;
+ }
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ case 1:
+ if (curChar == 10 && kind > 19)
+ kind = 19;
+ break;
+ case 2:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static private final int jjMoveStringLiteralDfa0_2()
+{
+ return jjMoveNfa_2(1, 0);
+}
+static private final int jjMoveNfa_2(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 5;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ if ((0xbffffffbffffdbffL & l) != 0L)
+ {
+ if (kind > 15)
+ kind = 15;
+ jjCheckNAdd(0);
+ }
+ else if ((0x2400L & l) != 0L)
+ {
+ if (kind > 17)
+ kind = 17;
+ }
+ else if ((0x4000000400000000L & l) != 0L)
+ {
+ if (kind > 16)
+ kind = 16;
+ }
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 3;
+ break;
+ case 0:
+ if ((0xbffffffbffffdbffL & l) == 0L)
+ break;
+ kind = 15;
+ jjCheckNAdd(0);
+ break;
+ case 2:
+ if ((0x2400L & l) != 0L && kind > 17)
+ kind = 17;
+ break;
+ case 3:
+ if (curChar == 10 && kind > 17)
+ kind = 17;
+ break;
+ case 4:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 3;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ case 0:
+ kind = 15;
+ jjCheckNAdd(0);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ case 0:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 15)
+ kind = 15;
+ jjCheckNAdd(0);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static private final int jjMoveStringLiteralDfa0_6()
+{
+ return jjMoveNfa_6(0, 0);
+}
+static private final int jjMoveNfa_6(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 3;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0x2400L & l) != 0L)
+ {
+ if (kind > 22)
+ kind = 22;
+ }
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ case 1:
+ if (curChar == 10 && kind > 22)
+ kind = 22;
+ break;
+ case 2:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+private static final int jjStopStringLiteralDfa_0(int pos, long active0, long active1, long active2)
+{
+ switch (pos)
+ {
+ case 0:
+ if ((active0 & 0x8000000000L) != 0L || (active1 & 0xa00L) != 0L)
+ return 1;
+ if ((active1 & 0xffffffffffffe000L) != 0L)
+ {
+ jjmatchedKind = 144;
+ return 33;
+ }
+ if ((active0 & 0x800L) != 0L)
+ return 109;
+ return -1;
+ case 1:
+ if ((active1 & 0xfffffffeff3fe000L) != 0L)
+ {
+ if (jjmatchedPos != 1)
+ {
+ jjmatchedKind = 144;
+ jjmatchedPos = 1;
+ }
+ return 33;
+ }
+ if ((active1 & 0x100c00000L) != 0L)
+ return 33;
+ return -1;
+ case 2:
+ if ((active1 & 0xffefffeadfbfe000L) != 0L)
+ {
+ jjmatchedKind = 144;
+ jjmatchedPos = 2;
+ return 33;
+ }
+ if ((active1 & 0x10001420000000L) != 0L)
+ return 33;
+ return -1;
+ case 3:
+ if ((active1 & 0x220800088302a000L) != 0L)
+ return 33;
+ if ((active1 & 0xdde7ffe25cbd4000L) != 0L)
+ {
+ jjmatchedKind = 144;
+ jjmatchedPos = 3;
+ return 33;
+ }
+ return -1;
+ case 4:
+ if ((active1 & 0xc841080010054000L) != 0L)
+ return 33;
+ if ((active1 & 0x15a6f7e24cb80000L) != 0L)
+ {
+ jjmatchedKind = 144;
+ jjmatchedPos = 4;
+ return 33;
+ }
+ return -1;
+ case 5:
+ if ((active1 & 0x15a4036008180000L) != 0L)
+ {
+ jjmatchedKind = 144;
+ jjmatchedPos = 5;
+ return 33;
+ }
+ if ((active1 & 0x2f48244a00000L) != 0L)
+ return 33;
+ return -1;
+ case 6:
+ if ((active1 & 0x120002008100000L) != 0L)
+ return 33;
+ if ((active1 & 0x1484034000080000L) != 0L)
+ {
+ jjmatchedKind = 144;
+ jjmatchedPos = 6;
+ return 33;
+ }
+ return -1;
+ case 7:
+ if ((active1 & 0x1484020000080000L) != 0L)
+ return 33;
+ if ((active1 & 0x14000000000L) != 0L)
+ {
+ jjmatchedKind = 144;
+ jjmatchedPos = 7;
+ return 33;
+ }
+ return -1;
+ case 8:
+ if ((active1 & 0x10000000000L) != 0L)
+ {
+ jjmatchedKind = 144;
+ jjmatchedPos = 8;
+ return 33;
+ }
+ if ((active1 & 0x4000000000L) != 0L)
+ return 33;
+ return -1;
+ default :
+ return -1;
+ }
+}
+private static final int jjStartNfa_0(int pos, long active0, long active1, long active2)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1, active2), pos + 1);
+}
+static private final int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+static private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+}
+static private final int jjMoveStringLiteralDfa0_0()
+{
+ switch(curChar)
+ {
+ case 33:
+ jjmatchedKind = 72;
+ return jjMoveStringLiteralDfa1_0(0x200000000000000L, 0x0L);
+ case 35:
+ return jjStartNfaWithStates_0(0, 11, 109);
+ case 37:
+ jjmatchedKind = 68;
+ return jjMoveStringLiteralDfa1_0(0x80000000000L, 0x0L);
+ case 38:
+ jjmatchedKind = 55;
+ return jjMoveStringLiteralDfa1_0(0x11000000000000L, 0x0L);
+ case 40:
+ return jjStopAtPos(0, 32);
+ case 41:
+ return jjStopAtPos(0, 33);
+ case 42:
+ jjmatchedKind = 66;
+ return jjMoveStringLiteralDfa1_0(0x20000000000L, 0x0L);
+ case 43:
+ jjmatchedKind = 64;
+ return jjMoveStringLiteralDfa1_0(0x100000000000L, 0x20L);
+ case 44:
+ return jjStopAtPos(0, 37);
+ case 45:
+ jjmatchedKind = 65;
+ return jjMoveStringLiteralDfa1_0(0x200000000000L, 0x1440L);
+ case 46:
+ jjmatchedKind = 73;
+ return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x800L);
+ case 47:
+ jjmatchedKind = 67;
+ return jjMoveStringLiteralDfa1_0(0x40000000060L, 0x0L);
+ case 58:
+ jjmatchedKind = 35;
+ return jjMoveStringLiteralDfa1_0(0x400000000L, 0x0L);
+ case 59:
+ return jjStopAtPos(0, 36);
+ case 60:
+ jjmatchedKind = 58;
+ return jjMoveStringLiteralDfa1_0(0x5000400000000000L, 0x0L);
+ case 61:
+ jjmatchedKind = 40;
+ return jjMoveStringLiteralDfa1_0(0x100000000000000L, 0x0L);
+ case 62:
+ jjmatchedKind = 59;
+ return jjMoveStringLiteralDfa1_0(0xa000800000000000L, 0x0L);
+ case 63:
+ return jjStopAtPos(0, 38);
+ case 91:
+ return jjStopAtPos(0, 30);
+ case 93:
+ return jjStopAtPos(0, 31);
+ case 94:
+ jjmatchedKind = 54;
+ return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0x0L);
+ case 97:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x2000L);
+ case 98:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x4000L);
+ case 99:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x10000000f8000L);
+ case 100:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0xf00000L);
+ case 101:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x7000000L);
+ case 102:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x4000000078000000L);
+ case 103:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x80000000L);
+ case 105:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x700000000L);
+ case 108:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x800000000L);
+ case 110:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x1000000000L);
+ case 111:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x1000000000000000L);
+ case 112:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0xe000000000L);
+ case 114:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x70000000000L);
+ case 115:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x2f80000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0xa03c000000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0xc0000000000000L);
+ case 118:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x700000000000000L);
+ case 119:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x800000000000000L);
+ case 123:
+ return jjStopAtPos(0, 28);
+ case 124:
+ jjmatchedKind = 53;
+ return jjMoveStringLiteralDfa1_0(0xc000000000000L, 0x0L);
+ case 125:
+ return jjStopAtPos(0, 29);
+ case 126:
+ return jjStopAtPos(0, 71);
+ default :
+ return jjMoveNfa_0(32, 0);
+ }
+}
+static private final int jjMoveStringLiteralDfa1_0(long active0, long active1)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0, active1, 0L);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 38:
+ if ((active0 & 0x10000000000000L) != 0L)
+ return jjStopAtPos(1, 52);
+ break;
+ case 42:
+ if ((active0 & 0x40L) != 0L)
+ return jjStopAtPos(1, 6);
+ else if ((active1 & 0x800L) != 0L)
+ return jjStopAtPos(1, 75);
+ break;
+ case 43:
+ if ((active1 & 0x20L) != 0L)
+ return jjStopAtPos(1, 69);
+ break;
+ case 45:
+ if ((active1 & 0x40L) != 0L)
+ return jjStopAtPos(1, 70);
+ break;
+ case 46:
+ return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0L);
+ case 47:
+ if ((active0 & 0x20L) != 0L)
+ return jjStopAtPos(1, 5);
+ break;
+ case 58:
+ if ((active0 & 0x400000000L) != 0L)
+ return jjStopAtPos(1, 34);
+ break;
+ case 60:
+ if ((active0 & 0x4000000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 1;
+ }
+ return jjMoveStringLiteralDfa2_0(active0, 0x400000000000L, active1, 0L);
+ case 61:
+ if ((active0 & 0x20000000000L) != 0L)
+ return jjStopAtPos(1, 41);
+ else if ((active0 & 0x40000000000L) != 0L)
+ return jjStopAtPos(1, 42);
+ else if ((active0 & 0x80000000000L) != 0L)
+ return jjStopAtPos(1, 43);
+ else if ((active0 & 0x100000000000L) != 0L)
+ return jjStopAtPos(1, 44);
+ else if ((active0 & 0x200000000000L) != 0L)
+ return jjStopAtPos(1, 45);
+ else if ((active0 & 0x1000000000000L) != 0L)
+ return jjStopAtPos(1, 48);
+ else if ((active0 & 0x2000000000000L) != 0L)
+ return jjStopAtPos(1, 49);
+ else if ((active0 & 0x4000000000000L) != 0L)
+ return jjStopAtPos(1, 50);
+ else if ((active0 & 0x100000000000000L) != 0L)
+ return jjStopAtPos(1, 56);
+ else if ((active0 & 0x200000000000000L) != 0L)
+ return jjStopAtPos(1, 57);
+ else if ((active0 & 0x1000000000000000L) != 0L)
+ return jjStopAtPos(1, 60);
+ else if ((active0 & 0x2000000000000000L) != 0L)
+ return jjStopAtPos(1, 61);
+ break;
+ case 62:
+ if ((active0 & 0x8000000000000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 1;
+ }
+ else if ((active1 & 0x400L) != 0L)
+ {
+ jjmatchedKind = 74;
+ jjmatchedPos = 1;
+ }
+ return jjMoveStringLiteralDfa2_0(active0, 0x800000000000L, active1, 0x1000L);
+ case 97:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x4000000000018000L);
+ case 101:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x4071000300000L);
+ case 102:
+ if ((active1 & 0x100000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 96, 33);
+ break;
+ case 104:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x8808080000020000L);
+ case 105:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x100300008000000L);
+ case 108:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1000011000000L);
+ case 110:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xc0000602000000L);
+ case 111:
+ if ((active1 & 0x400000L) != 0L)
+ {
+ jjmatchedKind = 86;
+ jjmatchedPos = 1;
+ }
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x6000008a08c0000L);
+ case 112:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1000000000000000L);
+ case 114:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2010006040004000L);
+ case 116:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xc00000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x8000002000L);
+ case 119:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2000000000000L);
+ case 120:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x4000000L);
+ case 121:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x20000000000000L);
+ case 124:
+ if ((active0 & 0x8000000000000L) != 0L)
+ return jjStopAtPos(1, 51);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0, active1, 0L);
+}
+static private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(0, old0, old1, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0, active1, 0L);
+ return 2;
+ }
+ switch(curChar)
+ {
+ case 42:
+ if ((active1 & 0x1000L) != 0L)
+ return jjStopAtPos(2, 76);
+ break;
+ case 46:
+ if ((active0 & 0x8000000000L) != 0L)
+ return jjStopAtPos(2, 39);
+ break;
+ case 61:
+ if ((active0 & 0x400000000000L) != 0L)
+ return jjStopAtPos(2, 46);
+ else if ((active0 & 0x800000000000L) != 0L)
+ return jjStopAtPos(2, 47);
+ break;
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x1400000020000L);
+ case 98:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8000000000L);
+ case 100:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x10000000000L);
+ case 101:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x1000000000004000L);
+ case 102:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x100000L);
+ case 103:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x120000000000L);
+ case 105:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0xa4a002040000000L);
+ case 108:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x4400000200200000L);
+ case 109:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x4000000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8080c0000L);
+ case 111:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x84010000000L);
+ case 112:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x20000000000000L);
+ case 114:
+ if ((active1 & 0x20000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 93, 33);
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8100800000000000L);
+ case 115:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x80000001008000L);
+ case 116:
+ if ((active1 & 0x400000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 98, 33);
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x40084012000L);
+ case 117:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2000000002800000L);
+ case 119:
+ if ((active1 & 0x1000000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 100, 33);
+ break;
+ case 121:
+ if ((active1 & 0x10000000000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 116, 33);
+ break;
+ case 122:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x200000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(1, active0, active1, 0L);
+}
+static private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(1, old0, old1, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, 0L, active1, 0L);
+ return 3;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa4_0(active1, 0x400000018104000L);
+ case 98:
+ return jjMoveStringLiteralDfa4_0(active1, 0x800000L);
+ case 99:
+ return jjMoveStringLiteralDfa4_0(active1, 0x10000L);
+ case 100:
+ if ((active1 & 0x200000000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 121, 33);
+ break;
+ case 101:
+ if ((active1 & 0x8000L) != 0L)
+ return jjStartNfaWithStates_0(3, 79, 33);
+ else if ((active1 & 0x1000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 88, 33);
+ else if ((active1 & 0x2000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 125, 33);
+ return jjMoveStringLiteralDfa4_0(active1, 0x20210044200000L);
+ case 103:
+ if ((active1 & 0x800000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 99, 33);
+ break;
+ case 105:
+ return jjMoveStringLiteralDfa4_0(active1, 0x80020200000000L);
+ case 108:
+ return jjMoveStringLiteralDfa4_0(active1, 0x800008000000000L);
+ case 109:
+ if ((active1 & 0x2000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 89, 33);
+ break;
+ case 110:
+ return jjMoveStringLiteralDfa4_0(active1, 0x100000000000L);
+ case 111:
+ if ((active1 & 0x2000L) != 0L)
+ return jjStartNfaWithStates_0(3, 77, 33);
+ else if ((active1 & 0x80000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 95, 33);
+ return jjMoveStringLiteralDfa4_0(active1, 0x8040000000000000L);
+ case 112:
+ return jjMoveStringLiteralDfa4_0(active1, 0x4000000000000L);
+ case 114:
+ if ((active1 & 0x20000L) != 0L)
+ return jjStartNfaWithStates_0(3, 81, 33);
+ return jjMoveStringLiteralDfa4_0(active1, 0x1000080000000000L);
+ case 115:
+ if ((active1 & 0x8000000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 115, 33);
+ return jjMoveStringLiteralDfa4_0(active1, 0x4001000000040000L);
+ case 116:
+ return jjMoveStringLiteralDfa4_0(active1, 0x102404000080000L);
+ case 117:
+ return jjMoveStringLiteralDfa4_0(active1, 0x840000000000L);
+ case 118:
+ return jjMoveStringLiteralDfa4_0(active1, 0x2000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(2, 0L, active1, 0L);
+}
+static private final int jjMoveStringLiteralDfa4_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(2, 0L, old1, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, 0L, active1, 0L);
+ return 4;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa5_0(active1, 0x1000002000000000L);
+ case 99:
+ return jjMoveStringLiteralDfa5_0(active1, 0x2810000000000L);
+ case 100:
+ return jjMoveStringLiteralDfa5_0(active1, 0x20000000000000L);
+ case 101:
+ if ((active1 & 0x800000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 123, 33);
+ else if ((active1 & 0x4000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 126, 33);
+ return jjMoveStringLiteralDfa5_0(active1, 0x104000000000L);
+ case 103:
+ return jjMoveStringLiteralDfa5_0(active1, 0x80000000000000L);
+ case 104:
+ if ((active1 & 0x10000L) != 0L)
+ return jjStartNfaWithStates_0(4, 80, 33);
+ break;
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active1, 0x408000080000L);
+ case 107:
+ if ((active1 & 0x4000L) != 0L)
+ return jjStartNfaWithStates_0(4, 78, 33);
+ break;
+ case 108:
+ return jjMoveStringLiteralDfa5_0(active1, 0x4000008800000L);
+ case 110:
+ if ((active1 & 0x40000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 118, 33);
+ return jjMoveStringLiteralDfa5_0(active1, 0x240000000L);
+ case 111:
+ return jjMoveStringLiteralDfa5_0(active1, 0x200000000000L);
+ case 114:
+ return jjMoveStringLiteralDfa5_0(active1, 0x40004000000L);
+ case 115:
+ if ((active1 & 0x1000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 112, 33);
+ return jjMoveStringLiteralDfa5_0(active1, 0x20000000000L);
+ case 116:
+ if ((active1 & 0x40000L) != 0L)
+ return jjStartNfaWithStates_0(4, 82, 33);
+ else if ((active1 & 0x10000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 92, 33);
+ else if ((active1 & 0x80000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 107, 33);
+ return jjMoveStringLiteralDfa5_0(active1, 0x400000000200000L);
+ case 117:
+ return jjMoveStringLiteralDfa5_0(active1, 0x100000000100000L);
+ case 119:
+ if ((active1 & 0x8000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 127, 33);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(3, 0L, active1, 0L);
+}
+static private final int jjMoveStringLiteralDfa5_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(3, 0L, old1, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, 0L, active1, 0L);
+ return 5;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa6_0(active1, 0x104000000000000L);
+ case 99:
+ if ((active1 & 0x8000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 103, 33);
+ else if ((active1 & 0x400000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 110, 33);
+ return jjMoveStringLiteralDfa6_0(active1, 0x4000000000L);
+ case 100:
+ if ((active1 & 0x40000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 94, 33);
+ else if ((active1 & 0x100000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 108, 33);
+ break;
+ case 101:
+ if ((active1 & 0x200000L) != 0L)
+ return jjStartNfaWithStates_0(5, 85, 33);
+ else if ((active1 & 0x800000L) != 0L)
+ return jjStartNfaWithStates_0(5, 87, 33);
+ else if ((active1 & 0x200000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 97, 33);
+ return jjMoveStringLiteralDfa6_0(active1, 0x20000000000000L);
+ case 102:
+ if ((active1 & 0x200000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 109, 33);
+ break;
+ case 104:
+ if ((active1 & 0x2000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 113, 33);
+ break;
+ case 105:
+ return jjMoveStringLiteralDfa6_0(active1, 0x400000000000000L);
+ case 108:
+ return jjMoveStringLiteralDfa6_0(active1, 0x10008100000L);
+ case 110:
+ if ((active1 & 0x4000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 90, 33);
+ else if ((active1 & 0x40000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 106, 33);
+ return jjMoveStringLiteralDfa6_0(active1, 0x80000000080000L);
+ case 116:
+ if ((active1 & 0x800000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 111, 33);
+ return jjMoveStringLiteralDfa6_0(active1, 0x1000022000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(4, 0L, active1, 0L);
+}
+static private final int jjMoveStringLiteralDfa6_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(4, 0L, old1, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, 0L, active1, 0L);
+ return 6;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa7_0(active1, 0x10000000000L);
+ case 101:
+ if ((active1 & 0x2000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 101, 33);
+ return jjMoveStringLiteralDfa7_0(active1, 0x80020000000000L);
+ case 102:
+ if ((active1 & 0x20000000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 117, 33);
+ break;
+ case 108:
+ if ((active1 & 0x100000000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 120, 33);
+ return jjMoveStringLiteralDfa7_0(active1, 0x400000000000000L);
+ case 111:
+ return jjMoveStringLiteralDfa7_0(active1, 0x1000000000000000L);
+ case 116:
+ if ((active1 & 0x100000L) != 0L)
+ return jjStartNfaWithStates_0(6, 84, 33);
+ return jjMoveStringLiteralDfa7_0(active1, 0x4004000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa7_0(active1, 0x80000L);
+ case 121:
+ if ((active1 & 0x8000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 91, 33);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(5, 0L, active1, 0L);
+}
+static private final int jjMoveStringLiteralDfa7_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(5, 0L, old1, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, 0L, active1, 0L);
+ return 7;
+ }
+ switch(curChar)
+ {
+ case 100:
+ if ((active1 & 0x80000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 119, 33);
+ break;
+ case 101:
+ if ((active1 & 0x80000L) != 0L)
+ return jjStartNfaWithStates_0(7, 83, 33);
+ else if ((active1 & 0x4000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 114, 33);
+ else if ((active1 & 0x400000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 122, 33);
+ return jjMoveStringLiteralDfa8_0(active1, 0x4000000000L);
+ case 114:
+ if ((active1 & 0x20000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 105, 33);
+ else if ((active1 & 0x1000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 124, 33);
+ return jjMoveStringLiteralDfa8_0(active1, 0x10000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(6, 0L, active1, 0L);
+}
+static private final int jjMoveStringLiteralDfa8_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(6, 0L, old1, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, 0L, active1, 0L);
+ return 8;
+ }
+ switch(curChar)
+ {
+ case 100:
+ if ((active1 & 0x4000000000L) != 0L)
+ return jjStartNfaWithStates_0(8, 102, 33);
+ break;
+ case 101:
+ return jjMoveStringLiteralDfa9_0(active1, 0x10000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(7, 0L, active1, 0L);
+}
+static private final int jjMoveStringLiteralDfa9_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(7, 0L, old1, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, 0L, active1, 0L);
+ return 9;
+ }
+ switch(curChar)
+ {
+ case 100:
+ if ((active1 & 0x10000000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 104, 33);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(8, 0L, active1, 0L);
+}
+static private final int jjMoveNfa_0(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 109;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 32:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 5);
+ else if (curChar == 35)
+ jjCheckNAddStates(6, 13);
+ else if (curChar == 34)
+ jjCheckNAddStates(14, 16);
+ else if (curChar == 39)
+ jjAddStates(17, 18);
+ else if (curChar == 46)
+ jjCheckNAdd(1);
+ if ((0x3fe000000000000L & l) != 0L)
+ {
+ if (kind > 132)
+ kind = 132;
+ jjCheckNAddStates(19, 26);
+ }
+ else if (curChar == 48)
+ jjAddStates(27, 30);
+ if (curChar == 48)
+ {
+ if (kind > 128)
+ kind = 128;
+ jjCheckNAddStates(31, 38);
+ }
+ break;
+ case 109:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 8)
+ kind = 8;
+ }
+ else if ((0x100000200L & l) != 0L)
+ jjCheckNAddTwoStates(53, 60);
+ if ((0x100000200L & l) != 0L)
+ jjCheckNAddTwoStates(42, 52);
+ if ((0x100000200L & l) != 0L)
+ jjCheckNAddTwoStates(40, 41);
+ if ((0x100000200L & l) != 0L)
+ jjCheckNAddTwoStates(35, 39);
+ break;
+ case 0:
+ if (curChar == 46)
+ jjCheckNAdd(1);
+ break;
+ case 1:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 140)
+ kind = 140;
+ jjCheckNAddStates(39, 41);
+ break;
+ case 3:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(4);
+ break;
+ case 4:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 140)
+ kind = 140;
+ jjCheckNAddTwoStates(4, 5);
+ break;
+ case 6:
+ if (curChar == 39)
+ jjAddStates(17, 18);
+ break;
+ case 7:
+ if ((0xffffff7fffffdbffL & l) != 0L)
+ jjCheckNAdd(8);
+ break;
+ case 8:
+ if (curChar == 39 && kind > 142)
+ kind = 142;
+ break;
+ case 10:
+ if ((0x8000008400000000L & l) != 0L)
+ jjCheckNAdd(8);
+ break;
+ case 11:
+ if (curChar == 48)
+ jjCheckNAddTwoStates(12, 8);
+ break;
+ case 12:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(12, 8);
+ break;
+ case 13:
+ if ((0x3fe000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(14, 8);
+ break;
+ case 14:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(14, 8);
+ break;
+ case 15:
+ if (curChar == 48)
+ jjAddStates(42, 43);
+ break;
+ case 17:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(17, 8);
+ break;
+ case 19:
+ if (curChar == 34)
+ jjCheckNAddStates(14, 16);
+ break;
+ case 20:
+ if ((0xfffffffbffffdbffL & l) != 0L)
+ jjCheckNAddStates(14, 16);
+ break;
+ case 22:
+ if ((0x8000008400000000L & l) != 0L)
+ jjCheckNAddStates(14, 16);
+ break;
+ case 23:
+ if (curChar == 34 && kind > 143)
+ kind = 143;
+ break;
+ case 24:
+ if (curChar == 48)
+ jjCheckNAddStates(44, 47);
+ break;
+ case 25:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddStates(44, 47);
+ break;
+ case 26:
+ if ((0x3fe000000000000L & l) != 0L)
+ jjCheckNAddStates(48, 51);
+ break;
+ case 27:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(48, 51);
+ break;
+ case 28:
+ if (curChar == 48)
+ jjAddStates(52, 53);
+ break;
+ case 30:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(54, 57);
+ break;
+ case 33:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 144)
+ kind = 144;
+ jjstateSet[jjnewStateCnt++] = 33;
+ break;
+ case 34:
+ if (curChar == 35)
+ jjCheckNAddStates(6, 13);
+ break;
+ case 35:
+ if ((0x100000200L & l) != 0L)
+ jjCheckNAddTwoStates(35, 39);
+ break;
+ case 40:
+ if ((0x100000200L & l) != 0L)
+ jjCheckNAddTwoStates(40, 41);
+ break;
+ case 41:
+ if ((0x3ff000000000000L & l) != 0L && kind > 8)
+ kind = 8;
+ break;
+ case 42:
+ if ((0x100000200L & l) != 0L)
+ jjCheckNAddTwoStates(42, 52);
+ break;
+ case 44:
+ if ((0x100000200L & l) != 0L)
+ jjAddStates(58, 59);
+ break;
+ case 45:
+ if ((0x1000000400000000L & l) == 0L)
+ break;
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(46);
+ break;
+ case 46:
+ if ((0x100000200L & l) == 0L)
+ break;
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(46);
+ break;
+ case 53:
+ if ((0x100000200L & l) != 0L)
+ jjCheckNAddTwoStates(53, 60);
+ break;
+ case 55:
+ if ((0x100000200L & l) == 0L)
+ break;
+ if (kind > 10)
+ kind = 10;
+ jjstateSet[jjnewStateCnt++] = 55;
+ break;
+ case 61:
+ if (curChar != 48)
+ break;
+ if (kind > 128)
+ kind = 128;
+ jjCheckNAddStates(31, 38);
+ break;
+ case 62:
+ if ((0xff000000000000L & l) == 0L)
+ break;
+ if (kind > 128)
+ kind = 128;
+ jjCheckNAdd(62);
+ break;
+ case 63:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(63, 64);
+ break;
+ case 65:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(65, 66);
+ break;
+ case 67:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddStates(60, 62);
+ break;
+ case 72:
+ if ((0x3fe000000000000L & l) == 0L)
+ break;
+ if (kind > 132)
+ kind = 132;
+ jjCheckNAddStates(19, 26);
+ break;
+ case 73:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 132)
+ kind = 132;
+ jjCheckNAdd(73);
+ break;
+ case 74:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(74, 75);
+ break;
+ case 76:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(76, 77);
+ break;
+ case 78:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(63, 65);
+ break;
+ case 83:
+ if (curChar == 48)
+ jjAddStates(27, 30);
+ break;
+ case 85:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 136)
+ kind = 136;
+ jjstateSet[jjnewStateCnt++] = 85;
+ break;
+ case 87:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 137)
+ kind = 137;
+ jjAddStates(66, 67);
+ break;
+ case 90:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjAddStates(68, 69);
+ break;
+ case 93:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjAddStates(70, 72);
+ break;
+ case 98:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 5);
+ break;
+ case 99:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(99, 100);
+ break;
+ case 100:
+ if (curChar != 46)
+ break;
+ if (kind > 140)
+ kind = 140;
+ jjCheckNAddStates(73, 75);
+ break;
+ case 101:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 140)
+ kind = 140;
+ jjCheckNAddStates(73, 75);
+ break;
+ case 102:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(102, 0);
+ break;
+ case 103:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(103, 104);
+ break;
+ case 105:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(106);
+ break;
+ case 106:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 141)
+ kind = 141;
+ jjCheckNAddTwoStates(106, 107);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 32:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ {
+ if (kind > 144)
+ kind = 144;
+ jjCheckNAdd(33);
+ }
+ if (curChar == 76)
+ jjAddStates(76, 77);
+ break;
+ case 109:
+ if (curChar == 100)
+ jjstateSet[jjnewStateCnt++] = 59;
+ else if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 51;
+ else if (curChar == 108)
+ jjstateSet[jjnewStateCnt++] = 38;
+ break;
+ case 2:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(78, 79);
+ break;
+ case 5:
+ if ((0x104000001040L & l) != 0L && kind > 140)
+ kind = 140;
+ break;
+ case 7:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAdd(8);
+ break;
+ case 9:
+ if (curChar == 92)
+ jjAddStates(80, 83);
+ break;
+ case 10:
+ if ((0x54404610000000L & l) != 0L)
+ jjCheckNAdd(8);
+ break;
+ case 16:
+ if (curChar == 120)
+ jjCheckNAdd(17);
+ break;
+ case 17:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(17, 8);
+ break;
+ case 18:
+ if (curChar == 88)
+ jjCheckNAdd(17);
+ break;
+ case 20:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(14, 16);
+ break;
+ case 21:
+ if (curChar == 92)
+ jjAddStates(84, 87);
+ break;
+ case 22:
+ if ((0x54404610000000L & l) != 0L)
+ jjCheckNAddStates(14, 16);
+ break;
+ case 29:
+ if (curChar == 120)
+ jjCheckNAdd(30);
+ break;
+ case 30:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(54, 57);
+ break;
+ case 31:
+ if (curChar == 88)
+ jjCheckNAdd(30);
+ break;
+ case 33:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 144)
+ kind = 144;
+ jjCheckNAdd(33);
+ break;
+ case 36:
+ if (curChar == 101 && kind > 7)
+ kind = 7;
+ break;
+ case 37:
+ if (curChar == 110)
+ jjstateSet[jjnewStateCnt++] = 36;
+ break;
+ case 38:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 37;
+ break;
+ case 39:
+ if (curChar == 108)
+ jjstateSet[jjnewStateCnt++] = 38;
+ break;
+ case 43:
+ if (curChar == 101)
+ jjAddStates(58, 59);
+ break;
+ case 47:
+ if (curChar == 100)
+ jjstateSet[jjnewStateCnt++] = 43;
+ break;
+ case 48:
+ if (curChar == 117)
+ jjstateSet[jjnewStateCnt++] = 47;
+ break;
+ case 49:
+ if (curChar == 108)
+ jjstateSet[jjnewStateCnt++] = 48;
+ break;
+ case 50:
+ if (curChar == 99)
+ jjstateSet[jjnewStateCnt++] = 49;
+ break;
+ case 51:
+ if (curChar == 110)
+ jjstateSet[jjnewStateCnt++] = 50;
+ break;
+ case 52:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 51;
+ break;
+ case 54:
+ if (curChar != 101)
+ break;
+ if (kind > 10)
+ kind = 10;
+ jjstateSet[jjnewStateCnt++] = 55;
+ break;
+ case 56:
+ if (curChar == 110)
+ jjstateSet[jjnewStateCnt++] = 54;
+ break;
+ case 57:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 56;
+ break;
+ case 58:
+ if (curChar == 102)
+ jjstateSet[jjnewStateCnt++] = 57;
+ break;
+ case 59:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 58;
+ break;
+ case 60:
+ if (curChar == 100)
+ jjstateSet[jjnewStateCnt++] = 59;
+ break;
+ case 64:
+ if ((0x100000001000L & l) != 0L && kind > 129)
+ kind = 129;
+ break;
+ case 66:
+ if ((0x20000000200000L & l) != 0L && kind > 130)
+ kind = 130;
+ break;
+ case 68:
+ if ((0x100000001000L & l) != 0L && kind > 131)
+ kind = 131;
+ break;
+ case 69:
+ if ((0x20000000200000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 68;
+ break;
+ case 70:
+ if ((0x20000000200000L & l) != 0L && kind > 131)
+ kind = 131;
+ break;
+ case 71:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 70;
+ break;
+ case 75:
+ if ((0x20100000201000L & l) != 0L && kind > 133)
+ kind = 133;
+ break;
+ case 77:
+ if ((0x20000000200000L & l) != 0L && kind > 134)
+ kind = 134;
+ break;
+ case 79:
+ if ((0x100000001000L & l) != 0L && kind > 135)
+ kind = 135;
+ break;
+ case 80:
+ if ((0x20000000200000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 79;
+ break;
+ case 81:
+ if ((0x20000000200000L & l) != 0L && kind > 135)
+ kind = 135;
+ break;
+ case 82:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 81;
+ break;
+ case 84:
+ if ((0x100000001000000L & l) != 0L)
+ jjCheckNAdd(85);
+ break;
+ case 85:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 136)
+ kind = 136;
+ jjCheckNAdd(85);
+ break;
+ case 86:
+ if ((0x100000001000000L & l) != 0L)
+ jjCheckNAdd(87);
+ break;
+ case 87:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 137)
+ kind = 137;
+ jjCheckNAddTwoStates(87, 88);
+ break;
+ case 88:
+ if ((0x20100000201000L & l) != 0L && kind > 137)
+ kind = 137;
+ break;
+ case 89:
+ if ((0x100000001000000L & l) != 0L)
+ jjCheckNAdd(90);
+ break;
+ case 90:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(90, 91);
+ break;
+ case 91:
+ if ((0x20000000200000L & l) != 0L && kind > 138)
+ kind = 138;
+ break;
+ case 92:
+ if ((0x100000001000000L & l) != 0L)
+ jjCheckNAdd(93);
+ break;
+ case 93:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(70, 72);
+ break;
+ case 94:
+ if ((0x100000001000L & l) != 0L && kind > 139)
+ kind = 139;
+ break;
+ case 95:
+ if ((0x20000000200000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 94;
+ break;
+ case 96:
+ if ((0x20000000200000L & l) != 0L && kind > 139)
+ kind = 139;
+ break;
+ case 97:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 96;
+ break;
+ case 104:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(88, 89);
+ break;
+ case 107:
+ if ((0x104000001040L & l) != 0L && kind > 141)
+ kind = 141;
+ break;
+ case 108:
+ if (curChar == 76)
+ jjAddStates(76, 77);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 7:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjstateSet[jjnewStateCnt++] = 8;
+ break;
+ case 20:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjAddStates(14, 16);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 109 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static private final int jjMoveStringLiteralDfa0_7()
+{
+ switch(curChar)
+ {
+ case 42:
+ return jjMoveStringLiteralDfa1_7(0x1000000L);
+ default :
+ return 1;
+ }
+}
+static private final int jjMoveStringLiteralDfa1_7(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 47:
+ if ((active0 & 0x1000000L) != 0L)
+ return jjStopAtPos(1, 24);
+ break;
+ default :
+ return 2;
+ }
+ return 2;
+}
+static private final int jjMoveStringLiteralDfa0_8()
+{
+ return jjMoveNfa_8(0, 0);
+}
+static private final int jjMoveNfa_8(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 3;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0x2400L & l) != 0L)
+ {
+ if (kind > 26)
+ kind = 26;
+ }
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ case 1:
+ if (curChar == 10 && kind > 26)
+ kind = 26;
+ break;
+ case 2:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static private final int jjMoveStringLiteralDfa0_5()
+{
+ return 1;
+}
+static final int[] jjnextStates = {
+ 99, 100, 102, 0, 103, 104, 35, 39, 40, 41, 42, 52, 53, 60, 20, 21,
+ 23, 7, 9, 73, 74, 75, 76, 77, 78, 80, 82, 84, 86, 89, 92, 62,
+ 63, 64, 65, 66, 67, 69, 71, 1, 2, 5, 16, 18, 20, 21, 25, 23,
+ 20, 21, 27, 23, 29, 31, 20, 21, 30, 23, 44, 45, 67, 69, 71, 78,
+ 80, 82, 87, 88, 90, 91, 93, 95, 97, 101, 2, 5, 6, 19, 3, 4,
+ 10, 11, 13, 15, 22, 24, 26, 28, 105, 106,
+};
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, "\173", "\175", "\133", "\135", "\50", "\51", "\72\72", "\72", "\73", "\54",
+"\77", "\56\56\56", "\75", "\52\75", "\57\75", "\45\75", "\53\75", "\55\75",
+"\74\74\75", "\76\76\75", "\46\75", "\136\75", "\174\75", "\174\174", "\46\46", "\174",
+"\136", "\46", "\75\75", "\41\75", "\74", "\76", "\74\75", "\76\75", "\74\74",
+"\76\76", "\53", "\55", "\52", "\57", "\45", "\53\53", "\55\55", "\176", "\41", "\56",
+"\55\76", "\56\52", "\55\76\52", "\141\165\164\157", "\142\162\145\141\153",
+"\143\141\163\145", "\143\141\164\143\150", "\143\150\141\162", "\143\157\156\163\164",
+"\143\157\156\164\151\156\165\145", "\144\145\146\141\165\154\164", "\144\145\154\145\164\145", "\144\157",
+"\144\157\165\142\154\145", "\145\154\163\145", "\145\156\165\155", "\145\170\164\145\162\156",
+"\146\151\156\141\154\154\171", "\146\154\157\141\164", "\146\157\162", "\146\162\151\145\156\144",
+"\147\157\164\157", "\151\146", "\151\156\154\151\156\145", "\151\156\164", "\154\157\156\147",
+"\156\145\167", "\160\162\151\166\141\164\145", "\160\162\157\164\145\143\164\145\144",
+"\160\165\142\154\151\143", "\162\145\144\145\143\154\141\162\145\144",
+"\162\145\147\151\163\164\145\162", "\162\145\164\165\162\156", "\163\150\157\162\164",
+"\163\151\147\156\145\144", "\163\151\172\145\157\146", "\163\164\141\164\151\143",
+"\163\164\162\165\143\164", "\143\154\141\163\163", "\163\167\151\164\143\150",
+"\164\145\155\160\154\141\164\145", "\164\150\151\163", "\164\162\171", "\164\171\160\145\144\145\146",
+"\165\156\151\157\156", "\165\156\163\151\147\156\145\144", "\166\151\162\164\165\141\154",
+"\166\157\151\144", "\166\157\154\141\164\151\154\145", "\167\150\151\154\145",
+"\157\160\145\162\141\164\157\162", "\164\162\165\145", "\146\141\154\163\145", "\164\150\162\157\167", null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, };
+public static final String[] lexStateNames = {
+ "DEFAULT",
+ "DEFINE_STMT",
+ "INCLUDE_STMT",
+ "LINE_NUMBER",
+ "LINE_DIRECTIVE",
+ "AFTER_LINE_DIRECTIVE",
+ "IN_LINE_COMMENT",
+ "IN_COMMENT",
+ "PREPROCESSOR_OUTPUT",
+};
+public static final int[] jjnewLexState = {
+ -1, -1, -1, -1, -1, 6, 7, 3, 3, 2, 1, 8, -1, 8, 0, -1, 8, 0, 4, 5, -1, 0, 0, -1, 0,
+ -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+};
+static final long[] jjtoToken = {
+ 0xfffffffff0000001L, 0xffffffffffffffffL, 0x1ffffL,
+};
+static final long[] jjtoSkip = {
+ 0x57ffffeL, 0x0L, 0x0L,
+};
+static final long[] jjtoMore = {
+ 0xa800000L, 0x0L, 0x0L,
+};
+static private ASCII_CharStream input_stream;
+static private final int[] jjrounds = new int[109];
+static private final int[] jjstateSet = new int[218];
+static StringBuffer image;
+static int jjimageLen;
+static int lengthOfMatch;
+static protected char curChar;
+public CPPParserTokenManager(ASCII_CharStream stream)
+{
+ if (input_stream != null)
+ throw new TokenMgrError("ERROR: Second call to constructor of static lexer. You must use ReInit() to initialize the static variables.", TokenMgrError.STATIC_LEXER_ERROR);
+ input_stream = stream;
+}
+public CPPParserTokenManager(ASCII_CharStream stream, int lexState)
+{
+ this(stream);
+ SwitchTo(lexState);
+}
+static public void ReInit(ASCII_CharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+static private final void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 109; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+static public void ReInit(ASCII_CharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+static public void SwitchTo(int lexState)
+{
+ if (lexState >= 9 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+static private final Token jjFillToken()
+{
+ Token t = Token.newToken(jjmatchedKind);
+ t.kind = jjmatchedKind;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ t.image = (im == null) ? input_stream.GetImage() : im;
+ t.beginLine = input_stream.getBeginLine();
+ t.beginColumn = input_stream.getBeginColumn();
+ t.endLine = input_stream.getEndLine();
+ t.endColumn = input_stream.getEndColumn();
+ return t;
+}
+
+static int curLexState = 0;
+static int defaultLexState = 0;
+static int jjnewStateCnt;
+static int jjround;
+static int jjmatchedPos;
+static int jjmatchedKind;
+
+public static final Token getNextToken()
+{
+ int kind;
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+ image = null;
+ jjimageLen = 0;
+
+ for (;;)
+ {
+ switch(curLexState)
+ {
+ case 0:
+ try { input_stream.backup(0);
+ while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) { continue EOFLoop; }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ break;
+ case 1:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_1();
+ break;
+ case 2:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_2();
+ break;
+ case 3:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_3();
+ break;
+ case 4:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_4();
+ if (jjmatchedPos == 0 && jjmatchedKind > 20)
+ {
+ jjmatchedKind = 20;
+ }
+ break;
+ case 5:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_5();
+ if (jjmatchedPos == 0 && jjmatchedKind > 21)
+ {
+ jjmatchedKind = 21;
+ }
+ break;
+ case 6:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_6();
+ if (jjmatchedPos == 0 && jjmatchedKind > 23)
+ {
+ jjmatchedKind = 23;
+ }
+ break;
+ case 7:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_7();
+ if (jjmatchedPos == 0 && jjmatchedKind > 25)
+ {
+ jjmatchedKind = 25;
+ }
+ break;
+ case 8:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_8();
+ if (jjmatchedPos == 0 && jjmatchedKind > 27)
+ {
+ jjmatchedKind = 27;
+ }
+ break;
+ }
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ return matchedToken;
+ }
+ else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ SkipLexicalActions(null);
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ continue EOFLoop;
+ }
+ jjimageLen += jjmatchedPos + 1;
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ curPos = 0;
+ jjmatchedKind = 0x7fffffff;
+ try {
+ curChar = input_stream.readChar();
+ continue;
+ }
+ catch (java.io.IOException e1) { }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+ }
+}
+
+static final void SkipLexicalActions(Token matchedToken)
+{
+ switch(jjmatchedKind)
+ {
+ case 8 :
+ if (image == null)
+ image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ else
+ image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ input_stream.backup(1);
+ break;
+ case 12 :
+ if (image == null)
+ image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ else
+ image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ String defineName= image.toString();
+ CPPParser.fgCallback.defineDecl(defineName, input_stream.getBeginLine(), input_stream.getBeginColumn());
+ break;
+ case 15 :
+ if (image == null)
+ image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ else
+ image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ String includeName= image.toString(); // substring(0, image.length()-1).trim();
+ CPPParser.fgCallback.includeDecl(includeName, input_stream.getBeginLine(), input_stream.getBeginColumn());
+ break;
+ case 18 :
+ if (image == null)
+ image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ else
+ image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ try
+ {
+ beginLine = Integer.parseInt(image.toString());
+ }
+ catch(NumberFormatException e) { }
+ break;
+ case 21 :
+ if (image == null)
+ image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ else
+ image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ input_stream.adjustBeginLineColumn(beginLine, 1);
+ input_stream.backup(1);
+ break;
+ default :
+ break;
+ }
+}
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/ParseException.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/ParseException.java
new file mode 100644
index 00000000000..4a95acf85e8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/ParseException.java
@@ -0,0 +1,207 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+package org.eclipse.cdt.internal.parser.generated;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+
+ /**
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException:
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/Token.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/Token.java
new file mode 100644
index 00000000000..ebf4c9dfe70
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/Token.java
@@ -0,0 +1,95 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
+package org.eclipse.cdt.internal.parser.generated;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Describes the input token stream.
+ */
+
+
+public class Token {
+
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+
+ /**
+ * Returns the image.
+ */
+ public final String toString()
+ {
+ return image;
+ }
+
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken();
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind)
+ {
+ switch(ofKind)
+ {
+ default : return new Token();
+ }
+ }
+
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/TokenMgrError.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/TokenMgrError.java
new file mode 100644
index 00000000000..09e965f9bb8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/generated/TokenMgrError.java
@@ -0,0 +1,150 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+package org.eclipse.cdt.internal.parser.generated;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+public class TokenMgrError extends Error
+{
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+
+ public TokenMgrError() {
+ }
+
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr2line.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr2line.java
new file mode 100644
index 00000000000..0bf9cf99874
--- /dev/null
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr2line.java
@@ -0,0 +1,62 @@
+package org.eclipse.cdt.utils;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+import org.eclipse.cdt.utils.spawner.ProcessFactory;
+
+public class Addr2line {
+ private Process addr2line;
+ private BufferedReader stdout;
+ private BufferedWriter stdin;
+ private String lastaddr, lastsymbol, lastline;
+
+ public Addr2line(String file) throws IOException {
+ String[] args = {"addr2line", "-C", "-f", "-e", file};
+ addr2line = ProcessFactory.getFactory().exec(args);
+ stdin = new BufferedWriter(new OutputStreamWriter(addr2line.getOutputStream()));
+ stdout = new BufferedReader(new InputStreamReader(addr2line.getInputStream()));
+ }
+
+ private void getOutput(String address) throws IOException {
+ if ( address.equals(lastaddr) == false ) {
+ stdin.write(address + "\n");
+ stdin.flush();
+ lastsymbol = stdout.readLine();
+ lastline = stdout.readLine();
+ lastaddr = address;
+ }
+ }
+
+ public String getLine(long address) throws IOException {
+ getOutput(Integer.toHexString((int)address));
+ return lastline;
+ }
+
+ public String getFunction(long address) throws IOException {
+ getOutput(Integer.toHexString((int)address));
+ return lastsymbol;
+ }
+
+ public void dispose() {
+ try {
+ //stdin.write(-1);
+ stdout.close();
+ stdin.close();
+ addr2line.getErrorStream().close();
+ }
+ catch (IOException e) {
+ }
+ addr2line.destroy();
+ }
+}
+
+
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/CPPFilt.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/CPPFilt.java
new file mode 100644
index 00000000000..9c520c68b7c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/CPPFilt.java
@@ -0,0 +1,51 @@
+package org.eclipse.cdt.utils;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+import org.eclipse.cdt.utils.spawner.ProcessFactory;
+
+public class CPPFilt {
+ private Process cppfilt;
+ private BufferedReader stdout;
+ private BufferedWriter stdin;
+ private String function;
+
+ public CPPFilt() throws IOException {
+ String[] args = {"c++filt"};
+ cppfilt = ProcessFactory.getFactory().exec(args);
+ //cppfilt = new Spawner(args);
+ stdin = new BufferedWriter(new OutputStreamWriter(cppfilt.getOutputStream()));
+ stdout = new BufferedReader(new InputStreamReader(cppfilt.getInputStream()));
+ }
+
+ public String getFunction(String symbol) throws IOException {
+ stdin.write(symbol + "\n");
+ stdin.flush();
+ String str = stdout.readLine();
+ if ( str != null ) {
+ return str.trim();
+ }
+ throw new IOException();
+ }
+
+ public void dispose() {
+ try {
+ //stdin.write(-1);
+ stdout.close();
+ stdin.close();
+ cppfilt.getErrorStream().close();
+ }
+ catch (IOException e) {
+ }
+ cppfilt.destroy();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/AR.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/AR.java
new file mode 100644
index 00000000000..757d716bb34
--- /dev/null
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/AR.java
@@ -0,0 +1,331 @@
+package org.eclipse.cdt.utils.elf;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.Vector;
+
+
+/**
+ * The AR
class is used for parsing standard ELF archive (ar) files.
+ *
+ * Each object within the archive is represented by an ARHeader class. Each of
+ * of these objects can then be turned into an Elf object for performing Elf
+ * class operations.
+ * @see ARHeader
+ */
+public class AR {
+
+ private String filename;
+ private ERandomAccessFile efile;
+ private ARHeader[] headers;
+ private long strtbl_pos = -1;
+
+
+ public void dispose() {
+ try
+ {
+ efile.close();
+ }
+ catch( IOException e )
+ {}
+ }
+
+ /**
+ * The ARHeader
class is used to store the per-object file
+ * archive headers. It can also create an Elf object for inspecting
+ * the object file data.
+ */
+ public class ARHeader {
+
+ private String object_name;
+ private String modification_time;
+ private String uid;
+ private String gid;
+ private String mode;
+ private long size;
+ private long elf_offset;
+
+
+ /**
+ * Remove the padding from the archive header strings.
+ */
+ private String removeBlanks( String str ) {
+ while( str.charAt( str.length() - 1 ) == ' ' )
+ str = str.substring( 0, str.length() - 1 );
+ return str;
+ }
+
+
+ /**
+ * Look up the name stored in the archive's string table based
+ * on the offset given.
+ *
+ * Maintains efile
file location.
+ *
+ * @param offset
+ * Offset into the string table for first character of the name.
+ * @throws IOException
+ * offset
not in string table bounds.
+ */
+ private String nameFromStringTable( long offset ) throws IOException {
+ StringBuffer name = new StringBuffer( 0 );
+ long pos = efile.getFilePointer();
+
+ try
+ {
+ if( strtbl_pos != -1 )
+ {
+ byte temp;
+ efile.seek( strtbl_pos + offset );
+ while( ( temp = efile.readByte() ) != '\n' )
+ name.append( (char)temp );
+ }
+ }
+ finally
+ {
+ efile.seek( pos );
+ }
+
+ return name.toString();
+ }
+
+
+ /**
+ * Creates a new archive header object.
+ *
+ * Assumes that efile is already at the correct location in the file.
+ *
+ * @throws IOException
+ * There was an error processing the header data from the file.
+ */
+ public ARHeader() throws IOException {
+ byte[] object_name = new byte[16];
+ byte[] modification_time = new byte[12];
+ byte[] uid = new byte[6];
+ byte[] gid = new byte[6];
+ byte[] mode = new byte[8];
+ byte[] size = new byte[10];
+ byte[] trailer = new byte[2];
+
+ //
+ // Read in the archive header data. Fixed sizes.
+ //
+ efile.read( object_name );
+ efile.read( modification_time );
+ efile.read( uid );
+ efile.read( gid );
+ efile.read( mode );
+ efile.read( size );
+ efile.read( trailer );
+
+ //
+ // Save this location so we can create the Elf object later.
+ //
+ elf_offset = efile.getFilePointer();
+
+ //
+ // Convert the raw bytes into strings and numbers.
+ //
+ this.object_name = removeBlanks( new String( object_name ) );
+ this.modification_time = new String( modification_time );
+ this.uid = new String( uid );
+ this.gid = new String( gid );
+ this.mode = new String( mode );
+ this.size = Long.parseLong( removeBlanks( new String( size ) ) );
+
+ //
+ // If the name is of the format "/", get name from the
+ // string table.
+ //
+ if( strtbl_pos != -1 &&
+ this.object_name.length() > 1 &&
+ this.object_name.charAt( 0 ) == '/' )
+ {
+ try
+ {
+ long offset = Long.parseLong( this.object_name.substring( 1 ) );
+ this.object_name = nameFromStringTable( offset );
+ }
+ catch( java.lang.Exception e )
+ {
+ }
+ }
+
+ //
+ // Strip the trailing / from the object name.
+ //
+ int len = this.object_name.length();
+ if( len > 2 && this.object_name.charAt( len - 1 ) == '/' )
+ {
+ this.object_name = this.object_name.substring( 0, len - 1 );
+ }
+
+ }
+
+ /** Get the name of the object file */
+ public String getObjectName() {
+ return object_name;
+ }
+
+ /** Get the size of the object file . */
+ public long getSize() {
+ return size;
+ }
+
+ /**
+ * Create an new Elf object for the object file.
+ *
+ * @throws IOException
+ * Not a valid Elf object file.
+ * @return A new Elf object.
+ * @see Elf#Elf( String, long )
+ */
+ public Elf getElf() throws IOException {
+ return new Elf( filename, elf_offset );
+ }
+
+ public Elf getElf( boolean filter_on ) throws IOException {
+ return new Elf( filename, elf_offset, filter_on );
+ }
+
+ public byte[] getObjectData() throws IOException {
+ byte[] temp = new byte[(int)size];
+ efile.seek( elf_offset );
+ efile.read( temp );
+ return temp;
+ }
+ }
+
+
+ /**
+ * Creates a new AR
object from the contents of
+ * the given file.
+ *
+ * @param filename The file to process.
+ * @throws IOException The file is not a valid archive.
+ */
+ public AR( String filename ) throws IOException {
+ this.filename = filename;
+ efile = new ERandomAccessFile( filename, "r" );
+ String hdr = efile.readLine();
+ if( hdr == null || hdr.compareTo( "!" ) != 0 ) {
+ efile.close();
+ throw new IOException( "Not a valid archive file." );
+ }
+ }
+
+
+ /** Load the headers from the file (if required). */
+ private void loadHeaders() throws IOException {
+ if( headers != null )
+ return;
+
+ Vector v = new Vector();
+ try
+ {
+ //
+ // Check for EOF condition
+ //
+ while( efile.getFilePointer() < efile.length() )
+ {
+ ARHeader header = new ARHeader();
+ String name = header.getObjectName();
+
+ long pos = efile.getFilePointer();
+
+ //
+ // If the name starts with a / it is specical.
+ //
+ if( name.charAt( 0 ) != '/' )
+ v.add( header );
+
+ //
+ // If the name is "//" then this is the string table section.
+ //
+ if( name.compareTo( "//" ) == 0 )
+ strtbl_pos = pos;
+
+
+ //
+ // Compute the location of the next header in the archive.
+ //
+ pos += header.getSize();
+ if( ( pos % 2 ) != 0 )
+ pos++;
+
+ efile.seek( pos );
+ }
+ }
+ catch( IOException e )
+ {
+ }
+ headers = (ARHeader[])v.toArray( new ARHeader[0] );
+ }
+
+
+ /**
+ * Get an array of all the object file headers for this archive.
+ *
+ * @throws IOException
+ * Unable to process the archive file.
+ * @return An array of headers, one for each object within the archive.
+ * @see ARHeader
+ */
+ public ARHeader[] getHeaders() throws IOException {
+ loadHeaders();
+ return headers;
+ }
+
+
+ private boolean stringInStrings( String str, String[] set ) {
+ for( int i=0; i sh_size || ( sh_name + str_size + 1) > section_strtab.length) {
+ return "";
+ }
+ while( section_strtab[(int)sh_name + str_size] != 0)
+ str_size++;
+ return new String(section_strtab, (int)sh_name, str_size);
+ } catch (IOException e) {
+ return "";
+ }
+ }
+ }
+
+ private String string_from_elf_section(Elf.Section section, int index) throws IOException {
+ StringBuffer str = new StringBuffer();
+ byte tmp;
+ if ( index > section.sh_size ) {
+ return "";
+ }
+ efile.seek(section.sh_offset + index);
+ while( true ) {
+ tmp = efile.readByte();
+ if ( tmp == 0 )
+ break;
+ str.append((char)tmp);
+ }
+ return str.toString();
+ }
+
+ public class Symbol implements Comparable {
+ /* Symbol bindings */
+ public final static int STB_LOCAL = 0;
+ public final static int STB_GLOBAL = 1;
+ public final static int STB_WEAK = 2;
+ /* Symbol type */
+ public final static int STT_NOTYPE = 0;
+ public final static int STT_OBJECT = 1;
+ public final static int STT_FUNC = 2;
+ public final static int STT_SECTION = 3;
+ public final static int STT_FILE = 4;
+ /* Special Indexes */
+ public final static int SHN_UNDEF = 0;
+ public final static int SHN_LORESERVE = 0xffffff00;
+ public final static int SHN_LOPROC = 0xffffff00;
+ public final static int SHN_HIPROC = 0xffffff1f;
+ public final static int SHN_LOOS = 0xffffff20;
+ public final static int SHN_HIOS = 0xffffff3f;
+ public final static int SHN_ABS = 0xfffffff1;
+ public final static int SHN_COMMON = 0xfffffff2;
+ public final static int SHN_XINDEX = 0xffffffff;
+ public final static int SHN_HIRESERVE = 0xffffffff;
+
+
+ public long st_name;
+ public long st_value;
+ public long st_size;
+ public short st_info;
+ public short st_other;
+ public short st_shndx;
+
+ private String name = null;
+ private String line = null;
+ private String func = null;
+
+ private Section sym_section;
+
+ private String cppFilt(String in) {
+ if (cppFiltEnabled) {
+ try {
+ if (in.indexOf("__") != -1 || in.indexOf("_._") != -1) {
+ if (cppFilt == null) {
+ cppFilt = new CPPFilt();
+ }
+ return cppFilt.getFunction(in);
+ }
+ } catch (IOException e) {
+ return in;
+ }
+ }
+ return in;
+ }
+
+ public Symbol( Section section ) {
+ sym_section = section;
+ }
+
+ public int st_type() {
+ return st_info & 0xf;
+ }
+
+ public int st_bind() {
+ return (st_info >> 4) & 0xf;
+ }
+
+ public int compareTo(Object obj) {
+ long thisVal = 0;
+ long anotherVal = 0;
+ if ( obj instanceof Symbol ) {
+ Symbol sym = (Symbol)obj;
+ thisVal = this.st_value;
+ anotherVal = sym.st_value;
+ } else if ( obj instanceof Long ) {
+ Long val = (Long)obj;
+ anotherVal = val.longValue();
+ thisVal = (long)this.st_value;
+ }
+ return (thisVal
+
+ index2 = line.indexOf(':');
+ if ( index1 == index2 ) {
+ index2 = 0;
+ } else {
+ index2--;
+ }
+ return line.substring(index2, index1);
+ }
+
+ /**
+ * Returns the line number of the function which is closest
+ * associated with the address if it is available.
+ * from the symbol information. If it is not available,
+ * then -1 is returned.
+ */
+ public int getFuncLineNumber() throws IOException {
+ if ( line == null ) {
+ lineInfo();
+ }
+ int index;
+ if(line == null || (index = line.lastIndexOf(':')) == -1) {
+ return -1;
+ }
+ try {
+ int lineno = Integer.parseInt(line.substring(index + 1));
+ return (lineno == 0) ? -1 : lineno;
+ } catch(Exception e) {
+ return -1;
+ }
+ }
+
+ /**
+ * Returns the line number of the file if it is available
+ * from the symbol information. If it is not available,
+ * then -1 is returned.
+ */
+ public int getLineNumber(long vma) throws IOException {
+ int index;
+ String ligne = lineInfo(vma);
+ if(ligne == null || (index = ligne.lastIndexOf(':')) == -1) {
+ return -1;
+ }
+ try {
+ int lineno = Integer.parseInt(ligne.substring(index + 1));
+ return (lineno == 0) ? -1 : lineno;
+ } catch(Exception e) {
+ return -1;
+ }
+ }
+ }
+
+ /**
+ * We have to implement a separate compararator since when we do the
+ * binary search down below we are using a Long and a Symbol object
+ * and the Long doesn't know how to compare against a Symbol so if
+ * we compare Symbol vs Long it is ok, but not if we do Long vs Symbol.
+ */
+ class SymbolComparator implements Comparator {
+ long val1, val2;
+ public int compare(Object o1, Object o2) {
+
+ if(o1 instanceof Long) {
+ val1 = ((Long)o1).longValue();
+ } else if(o1 instanceof Symbol) {
+ val1 = ((Symbol)o1).st_value;
+ } else {
+ return -1;
+ }
+
+ if(o2 instanceof Long) {
+ val2 = ((Long)o2).longValue();
+ } else if(o2 instanceof Symbol) {
+ val2 = ((Symbol)o2).st_value;
+ } else {
+ return -1;
+ }
+ return (val1 == val2) ? 0
+ : ((val1 < val2) ? -1 : 1);
+ }
+ }
+
+
+ public class PHdr {
+ public final static int PT_NULL = 0;
+ public final static int PT_LOAD = 1;
+ public final static int PT_DYNAMIC = 2;
+ public final static int PT_INTERP = 3;
+ public final static int PT_NOTE = 4;
+ public final static int PT_SHLIB = 5;
+ public final static int PT_PHDR = 6;
+
+ public final static int PF_X = 1;
+ public final static int PF_W = 2;
+ public final static int PF_R = 4;
+
+ public long p_type;
+ public long p_offset;
+ public long p_vaddr;
+ public long p_paddr;
+ public long p_filesz;
+ public long p_memsz;
+ public long p_flags;
+ public long p_align;
+ }
+
+ public PHdr[] getPHdrs() throws IOException {
+ if ( ehdr.e_phnum == 0 ) {
+ return new PHdr[0];
+ }
+ efile.seek(ehdr.e_phoff);
+ PHdr phdrs[] = new PHdr[ehdr.e_phnum];
+ for( int i = 0; i < ehdr.e_phnum; i++ ) {
+ phdrs[i] = new PHdr();
+ phdrs[i].p_type = efile.readIntE();
+ phdrs[i].p_offset = efile.readIntE();
+ phdrs[i].p_vaddr = efile.readIntE();
+ phdrs[i].p_paddr = efile.readIntE();
+ phdrs[i].p_filesz = efile.readIntE();
+ phdrs[i].p_memsz = efile.readIntE();
+ phdrs[i].p_flags = efile.readIntE();
+ phdrs[i].p_align = efile.readIntE();
+ }
+ return phdrs;
+ }
+
+ public class Dynamic {
+ public final static int DT_NULL = 0;
+ public final static int DT_NEEDED = 1;
+ public final static int DT_PLTRELSZ = 2;
+ public final static int DT_PLTGOT = 3;
+ public final static int DT_HASH = 4;
+ public final static int DT_STRTAB = 5;
+ public final static int DT_SYMTAB = 6;
+ public final static int DT_RELA = 7;
+ public final static int DT_RELASZ = 8;
+ public final static int DT_RELAENT = 9;
+ public final static int DT_STRSZ = 10;
+ public final static int DT_SYMENT = 11;
+ public final static int DT_INIT = 12;
+ public final static int DT_FINI = 13;
+ public final static int DT_SONAME = 14;
+ public final static int DT_RPATH = 15;
+ public long d_tag;
+ public long d_val;
+
+ private Section section;
+ private String name;
+
+ private Dynamic(Section section, long tag, long val) {
+ this.section = section;
+ d_tag = tag;
+ d_val = val;
+ }
+
+ public String toString() {
+ if ( name == null ) {
+ switch ( (int)d_tag ) {
+ case DT_NEEDED:
+ case DT_SONAME:
+ case DT_RPATH:
+ try {
+ Section symstr = sections[(int)section.sh_link];
+ name = string_from_elf_section(symstr, (int)d_val);
+ } catch (IOException e) {
+ name = "";
+ }
+ break;
+ default:
+ name = "";
+ }
+ }
+ return name;
+ }
+ }
+
+ public Dynamic[] getDynamicSections(Section section) throws IOException {
+ if ( section.sh_type != Section.SHT_DYNAMIC ) {
+ return new Dynamic[0];
+ }
+ ArrayList dynList = new ArrayList();
+ efile.seek(section.sh_offset);
+ if (section.sh_entsize == 0) {
+ Dynamic dynEnt = new Dynamic(section, efile.readIntE(), efile.readIntE());
+ dynList.add(dynEnt);
+ } else {
+ for (int i = 0; i < section.sh_size / section.sh_entsize; i++ ) {
+ Dynamic dynEnt = new Dynamic(section, efile.readIntE(), efile.readIntE());
+ if ( dynEnt.d_tag == dynEnt.DT_NULL )
+ break;
+ dynList.add(dynEnt);
+ }
+ }
+ return (Dynamic[])dynList.toArray(new Dynamic[0]);
+ }
+
+ private void commonSetup( String file, long offset, boolean filton )
+ throws IOException
+ {
+ this.cppFiltEnabled = filton;
+
+ efile = new ERandomAccessFile(file, "r");
+ efile.setFileOffset( offset );
+ try {
+ ehdr = new ELFhdr();
+ this.file = file;
+ } finally {
+ if ( ehdr == null ) {
+ efile.close();
+ }
+ }
+ }
+
+ public Elf (String file, long offset) throws IOException {
+ commonSetup( file, offset, true );
+ }
+
+ public Elf (String file) throws IOException {
+ commonSetup( file, 0, true );
+ }
+
+ public Elf (String file, long offset, boolean filton) throws IOException {
+ commonSetup( file, offset, filton );
+ }
+
+ public Elf (String file, boolean filton) throws IOException {
+ commonSetup( file, 0, filton );
+ }
+
+ public boolean cppFilterEnabled() {
+ return cppFiltEnabled;
+ }
+
+ public void setCppFilter( boolean enabled ) {
+ cppFiltEnabled = enabled;
+ }
+
+ public ELFhdr getELFhdr() throws IOException {
+ return ehdr;
+ }
+
+ public class Attribute {
+ public static final int ELF_TYPE_EXE = 1;
+ public static final int ELF_TYPE_SHLIB = 2;
+ public static final int ELF_TYPE_OBJ = 3;
+ String cpu;
+ int type;
+ boolean bDebug;
+
+ public String getCPU() {
+ return cpu;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public boolean hasDebug() {
+ return bDebug;
+ }
+ }
+
+
+ public Attribute getAttributes() throws IOException {
+ boolean bSkipElfData = false;
+ Attribute attrib = new Attribute();
+
+ switch( ehdr.e_type ) {
+ case Elf.ELFhdr.ET_EXEC:
+ attrib.type = attrib.ELF_TYPE_EXE;
+ break;
+ case Elf.ELFhdr.ET_REL:
+ attrib.type = attrib.ELF_TYPE_OBJ;
+ break;
+ case Elf.ELFhdr.ET_DYN:
+ attrib.type = attrib.ELF_TYPE_SHLIB;
+ break;
+ }
+
+ switch (ehdr.e_machine) {
+ case Elf.ELFhdr.EM_386 :
+ case Elf.ELFhdr.EM_486 :
+ attrib.cpu = new String("x86");
+ bSkipElfData = true;
+ break;
+ case Elf.ELFhdr.EM_PPC :
+ attrib.cpu = new String("ppc");
+ break;
+ case Elf.ELFhdr.EM_SH :
+ attrib.cpu = new String("sh");
+ break;
+ case Elf.ELFhdr.EM_ARM :
+ attrib.cpu = new String("arm");
+ break;
+ case Elf.ELFhdr.EM_MIPS_RS3_LE :
+ case Elf.ELFhdr.EM_MIPS :
+ case Elf.ELFhdr.EM_RS6000 :
+ attrib.cpu = "mips";
+ break;
+ case Elf.ELFhdr.EM_SPARC32PLUS:
+ case Elf.ELFhdr.EM_SPARC:
+ attrib.cpu = "sparc";
+ break;
+ case Elf.ELFhdr.EM_NONE:
+ default:
+ attrib.cpu = "none";
+ }
+ if ( !bSkipElfData) {
+ switch (ehdr.e_ident[Elf.ELFhdr.EI_DATA]) {
+ case Elf.ELFhdr.ELFDATA2LSB :
+ attrib.cpu+= "le";
+ break;
+ case Elf.ELFhdr.ELFDATA2MSB :
+ attrib.cpu += "be";
+ break;
+ }
+ }
+ // getSections
+ // find .debug using toString
+ Section [] sec = getSections();
+ for (int i = 0; i < sec.length; i++) {
+ String s = sec[i].toString();
+ attrib.bDebug = (s.equals(".debug") || s. equals(".stab"));
+ if (attrib.bDebug) {
+ break;
+ }
+ }
+ return attrib;
+ }
+
+
+ public static Attribute getAttributes(String file) throws IOException {
+ Elf elf = new Elf(file);
+ Attribute attrib = elf.getAttributes();
+ elf.dispose();
+ return attrib;
+ }
+
+ public void dispose() {
+ if ( addr2line != null ) {
+ addr2line.dispose();
+ }
+ if ( cppFilt != null ) {
+ cppFilt.dispose();
+ }
+ try {
+ efile.close();
+ } catch (IOException e) {}
+ }
+
+ public Section[] getSections(int type) throws IOException {
+ if ( sections == null )
+ getSections();
+ ArrayList slist = new ArrayList();
+ for( int i = 0; i < sections.length; i++ ) {
+ if ( sections[i].sh_type == type)
+ slist.add(sections[i]);
+ }
+ return (Section[])slist.toArray(new Section[0]);
+ }
+
+ public Section[] getSections() throws IOException {
+ if ( sections == null ) {
+ if ( ehdr.e_shoff == 0 ) {
+ sections = new Section[0];
+ return sections;
+ }
+ efile.seek(ehdr.e_shoff);
+ sections = new Section[ehdr.e_shnum];
+ for ( int i = 0; i < ehdr.e_shnum; i++ ) {
+ sections[i] = new Section();
+ sections[i].sh_name = efile.readIntE();
+ sections[i].sh_type = efile.readIntE();
+ sections[i].sh_flags = efile.readIntE();
+ sections[i].sh_addr = efile.readIntE();
+ sections[i].sh_offset = efile.readIntE();
+ sections[i].sh_size = efile.readIntE();
+ sections[i].sh_link = efile.readIntE();
+ sections[i].sh_info = efile.readIntE();
+ sections[i].sh_addralign = efile.readIntE();
+ sections[i].sh_entsize = efile.readIntE();
+ if ( sections[i].sh_type == sections[i].SHT_SYMTAB )
+ syms = i;
+ if ( syms == 0 && sections[i].sh_type == sections[i].SHT_DYNSYM )
+ syms = i;
+ }
+ }
+ return sections;
+ }
+
+
+ private Symbol[] loadSymbolsBySection( Section section ) throws IOException {
+ int numSyms = 1;
+ if (section.sh_entsize != 0) {
+ numSyms = (int)section.sh_size / (int)section.sh_entsize;
+ }
+ ArrayList symList = new ArrayList(numSyms);
+ for( int c = 0; c < numSyms; c++) {
+ efile.seek(section.sh_offset + (section.sh_entsize * c));
+ Symbol symbol = new Symbol( section );
+ symbol.st_name = efile.readIntE();
+ symbol.st_value = efile.readIntE();
+ symbol.st_size = efile.readIntE();
+ symbol.st_info = efile.readByte();
+ symbol.st_other = efile.readByte();
+ symbol.st_shndx = efile.readShortE();
+ if ( symbol.st_info == 0 )
+ continue;
+ symList.add(symbol);
+ }
+ Symbol[] results = (Symbol[])symList.toArray(new Symbol[0]);
+ Arrays.sort(results);
+ return results;
+ }
+
+
+ public void loadSymbols() throws IOException {
+ if ( symbols == null ) {
+ Section section[] = getSections(Section.SHT_SYMTAB);
+ if( section.length > 0 ) {
+ symtab_sym = section[0];
+ symtab_symbols = loadSymbolsBySection( section[0] );
+ } else {
+ symtab_sym = null;
+ symtab_symbols = new Symbol[0];
+ }
+
+ section = getSections(Section.SHT_DYNSYM);
+ if( section.length > 0 ) {
+ dynsym_sym = section[0];
+ dynsym_symbols = loadSymbolsBySection( section[0] );
+ } else {
+ dynsym_sym = null;
+ dynsym_symbols = new Symbol[0];
+ }
+
+ if( symtab_sym != null ) {
+ // sym = symtab_sym;
+ symbols = symtab_symbols;
+ } else if( dynsym_sym != null ) {
+ // sym = dynsym_sym;
+ symbols = dynsym_symbols;
+ }
+ }
+ }
+
+ public Symbol[] getSymbols() {
+ return symbols;
+ }
+
+ public Symbol[] getDynamicSymbols() {
+ return dynsym_symbols;
+ }
+
+ public Symbol[] getSymtabSymbols() {
+ return symtab_symbols;
+ }
+
+
+
+ /* return the address of the function that address is in */
+ public Symbol getSymbol( long vma ) {
+ if ( symbols == null ) {
+ return null;
+ }
+
+ //@@@ If this works, move it to a single instance in this class.
+ SymbolComparator symbol_comparator = new SymbolComparator();
+
+ int ndx = Arrays.binarySearch(symbols, new Long(vma), symbol_comparator);
+ if ( ndx > 0 )
+ return symbols[ndx];
+ if ( ndx == -1 ) {
+ return null;
+ }
+ ndx = -ndx - 1;
+ return symbols[ndx-1];
+ }
+
+ public long swapInt( long val ) {
+ if ( ehdr.e_ident[ehdr.EI_DATA] == ehdr.ELFDATA2LSB ) {
+ short tmp[] = new short[4];
+ tmp[0] = (short)(val & 0x00ff);
+ tmp[1] = (short)((val >> 8) & 0x00ff);
+ tmp[2] = (short)((val >> 16) & 0x00ff);
+ tmp[3] = (short)((val >> 24) & 0x00ff);
+ return (long)((tmp[0] << 24) + (tmp[1] << 16) + (tmp[2] << 8) + tmp[3]);
+ }
+ return val;
+ }
+
+ public int swapShort( short val ) {
+ if ( ehdr.e_ident[ehdr.EI_DATA] == ehdr.ELFDATA2LSB ) {
+ short tmp[] = new short[2];
+ tmp[0] = (short)(val & 0x00ff);
+ tmp[1] = (short)((val >> 8) & 0x00ff);
+ return (short)((tmp[0] << 8) + tmp[1]);
+ }
+ return val;
+ }
+
+ public String getFilename() {
+ return file;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java
new file mode 100644
index 00000000000..8a239f732e9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java
@@ -0,0 +1,431 @@
+package org.eclipse.cdt.utils.elf;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Vector;
+
+
+/**
+ * ElfHelper
is a wrapper class for the Elf
class
+ * to provide higher level API for sorting/searching the ELF data.
+ *
+ * @see Elf
+ */
+public class ElfHelper {
+
+ private Elf elf;
+ private Elf.ELFhdr hdr;
+ private Elf.Attribute attrib;
+ private Elf.Symbol[] dynsyms;
+ private Elf.Symbol[] symbols;
+ private Elf.Section[] sections;
+ private Elf.Dynamic[] dynamics;
+
+
+ public void dispose() {
+ if( elf != null )
+ {
+ elf.dispose();
+ elf = null;
+ }
+ }
+
+ public class Sizes {
+ public long text;
+ public long data;
+ public long bss;
+ public long total;
+ public Sizes( long t, long d, long b ) {
+ text = t;
+ data = d;
+ bss = b;
+ total = text+data+bss;
+ }
+ }
+
+
+ private void loadSymbols() throws IOException {
+ if( symbols == null )
+ {
+ elf.loadSymbols();
+ symbols = elf.getSymtabSymbols();
+ dynsyms = elf.getDynamicSymbols();
+
+ if( symbols.length <= 0 )
+ symbols = dynsyms;
+ if( dynsyms.length <= 0 )
+ dynsyms = symbols;
+ }
+ }
+
+ private void loadSections() throws IOException {
+ if( sections == null )
+ sections = elf.getSections();
+ }
+
+
+ private void loadDynamics() throws IOException {
+ loadSections();
+
+ if( dynamics == null )
+ {
+ dynamics = new Elf.Dynamic[0];
+ for( int i=0; iElfHelper
using an existing Elf
+ * object.
+ * @param elf An existing Elf object to wrap.
+ * @throws IOException Error processing the Elf file.
+ */
+ public ElfHelper( Elf elf ) throws IOException {
+ this.elf = elf;
+ commonSetup();
+ }
+
+ /**
+ * Create a new ElfHelper
based on the given filename.
+ *
+ * @param filename The file to use for creating a new Elf object.
+ * @throws IOException Error processing the Elf file.
+ * @see Elf#Elf( String )
+ */
+ public ElfHelper( String filename ) throws IOException {
+ elf = new Elf( filename );
+ commonSetup();
+ }
+
+ public ElfHelper( String filename, boolean filton ) throws IOException {
+ elf = new Elf( filename, filton );
+ commonSetup();
+ }
+
+ /** Give back the Elf object that this helper is wrapping */
+ public Elf getElf() {
+ return elf;
+ }
+
+ public Elf.Symbol[] getExternalFunctions()
+ throws IOException
+ {
+ Vector v = new Vector();
+
+ loadSymbols();
+ loadSections();
+
+ for( int i=0; i