mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
2005-01-13 Alain Magloire
PR 82764 Fix the the type parsing. * mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java
This commit is contained in:
parent
cfdbde0d64
commit
f814de106b
2 changed files with 55 additions and 7 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2005-01-13 Alain Magloire
|
||||||
|
PR 82764 Fix the the type parsing.
|
||||||
|
* mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java
|
||||||
|
|
||||||
2005-01-10 Mikhail Khodjaiants
|
2005-01-10 Mikhail Khodjaiants
|
||||||
PR 82601 changes to the memory block interface
|
PR 82601 changes to the memory block interface
|
||||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ICDIMemoryBlock.java
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ICDIMemoryBlock.java
|
||||||
|
|
|
@ -301,13 +301,34 @@ public class GDBTypeParser {
|
||||||
//char character = (char) c;
|
//char character = (char) c;
|
||||||
|
|
||||||
if (c == '(') {
|
if (c == '(') {
|
||||||
if ((c = getch()) == ')') {
|
c = getch();
|
||||||
|
if (c == ')') {
|
||||||
token = "()"; //$NON-NLS-1$
|
token = "()"; //$NON-NLS-1$
|
||||||
tokenType = PARENS;
|
tokenType = PARENS;
|
||||||
|
} else if (isCIdentifierStart(c)) {
|
||||||
|
int i = 0;
|
||||||
|
token += (char)c;
|
||||||
|
while (i == 0 && c != ')') {
|
||||||
|
if (c == EOF) {
|
||||||
|
// Unbalanced parantheses.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
c = getch();
|
||||||
|
token += (char)c;
|
||||||
|
if (c == '(') {
|
||||||
|
++i;
|
||||||
|
} else if (c == ')') {
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tokenType = PARENS;
|
||||||
} else {
|
} else {
|
||||||
ungetch();
|
ungetch();
|
||||||
tokenType = '(';
|
tokenType = '(';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else if (c == '[') {
|
} else if (c == '[') {
|
||||||
while ((c = getch()) != ']' && c != EOF) {
|
while ((c = getch()) != ']' && c != EOF) {
|
||||||
token += (char) c;
|
token += (char) c;
|
||||||
|
@ -372,8 +393,9 @@ public class GDBTypeParser {
|
||||||
|
|
||||||
if (tokenType == '(') {
|
if (tokenType == '(') {
|
||||||
dcl();
|
dcl();
|
||||||
if (tokenType != ')') {
|
if (tokenType != ')' /*&& name.length() > 0*/) {
|
||||||
// FIXME: Do we throw an exception ? not terminate parenthese
|
// Do we throw an exception on unterminated parentheses
|
||||||
|
// It should have been handle by getToken()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (tokenType == NAME) {
|
} else if (tokenType == NAME) {
|
||||||
|
@ -396,12 +418,9 @@ public class GDBTypeParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((type = getToken()) == PARENS || type == BRACKETS) {
|
while ((type = getToken()) == PARENS || type == BRACKETS) {
|
||||||
if (type == EOF) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (type == PARENS) {
|
if (type == PARENS) {
|
||||||
insertingChild(GDBType.FUNCTION);
|
insertingChild(GDBType.FUNCTION);
|
||||||
} else {
|
} else { /* BRACKETS */
|
||||||
int len = 0;
|
int len = 0;
|
||||||
if (token.length() > 0) {
|
if (token.length() > 0) {
|
||||||
try {
|
try {
|
||||||
|
@ -483,5 +502,30 @@ public class GDBTypeParser {
|
||||||
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||||
System.out.println(parser.getGDBType().verbose());
|
System.out.println(parser.getGDBType().verbose());
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("int (int, char **)"); //$NON-NLS-1$
|
||||||
|
parser.parse("int (int, char **)"); //$NON-NLS-1$
|
||||||
|
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||||
|
System.out.println(parser.getGDBType().verbose());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("int (int)"); //$NON-NLS-1$
|
||||||
|
parser.parse("int (int)"); //$NON-NLS-1$
|
||||||
|
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||||
|
System.out.println(parser.getGDBType().verbose());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("int (void)"); //$NON-NLS-1$
|
||||||
|
parser.parse("int (void)"); //$NON-NLS-1$
|
||||||
|
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||||
|
System.out.println(parser.getGDBType().verbose());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("int ()"); //$NON-NLS-1$
|
||||||
|
parser.parse("int ()"); //$NON-NLS-1$
|
||||||
|
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||||
|
System.out.println(parser.getGDBType().verbose());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue