Minor scanning changes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@1016 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d07b661b94
commit
bc2c9de5e0
4 changed files with 26 additions and 2 deletions
|
|
@ -67,6 +67,7 @@ static int map[][2] = {
|
|||
{ SWIG_TOKEN_DOLLAR, -1},
|
||||
{ SWIG_TOKEN_CODEBLOCK, HBLOCK},
|
||||
{ SWIG_TOKEN_ILLEGAL, SWIG_TOKEN_ILLEGAL},
|
||||
{ SWIG_TOKEN_RSTRING, SWIG_TOKEN_RSTRING},
|
||||
{ SWIG_TOKEN_LAST, -1},
|
||||
{0,0},
|
||||
};
|
||||
|
|
@ -319,7 +320,7 @@ yylex1(void) {
|
|||
LParse_error(0,0,"Illegal character '%s'\n", text);
|
||||
return yylex1();
|
||||
}
|
||||
if ((l1 == STRING) || (l1 == CHARCONST)) {
|
||||
if ((l1 == STRING) || (l1 == CHARCONST) || (l1 == SWIG_TOKEN_RSTRING)) {
|
||||
yylval.tok.text = NewString(yytext+1);
|
||||
Setfile(yylval.tok.text,yylval.tok.filename);
|
||||
Setline(yylval.tok.text,yylval.tok.line);
|
||||
|
|
@ -328,6 +329,10 @@ yylex1(void) {
|
|||
if ((l1 == HBLOCK) || (l1 == NUM_INT) || (l1 == NUM_FLOAT) || (l1 == NUM_UNSIGNED) || (l1 == NUM_LONG) || (l1 == NUM_ULONG)) {
|
||||
yylval.tok.text = NewString(yytext);
|
||||
}
|
||||
if (l1 == SWIG_TOKEN_RSTRING) {
|
||||
return (TYPE_TYPESTRING);
|
||||
}
|
||||
|
||||
if (l1 == ID) {
|
||||
/* Look for keywords now */
|
||||
if (strcmp(yytext,"int") == 0) return(TYPE_INT);
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ static int promote(int t1, int t2) {
|
|||
%token <tok> OC_INTERFACE OC_END OC_PUBLIC OC_PRIVATE OC_PROTECTED OC_CLASS OC_IMPLEMENT OC_PROTOCOL
|
||||
|
||||
/* C Types */
|
||||
%token <tok> TYPE_INT TYPE_UNSIGNED TYPE_SHORT TYPE_LONG TYPE_FLOAT TYPE_DOUBLE TYPE_CHAR TYPE_VOID TYPE_SIGNED TYPE_BOOL
|
||||
%token <tok> TYPE_INT TYPE_UNSIGNED TYPE_SHORT TYPE_LONG TYPE_FLOAT TYPE_DOUBLE TYPE_CHAR TYPE_VOID TYPE_SIGNED TYPE_BOOL TYPE_TYPESTRING
|
||||
|
||||
/* SWIG directives */
|
||||
%token <tok> ADDMETHODS APPLY CLEAR CONSTANT ECHO EXCEPT SCOPE
|
||||
|
|
@ -1603,6 +1603,7 @@ type : TYPE_INT { $$ = NewString("int"); }
|
|||
| TYPE_FLOAT { $$ = NewString("float"); }
|
||||
| TYPE_DOUBLE { $$ = NewString("double"); }
|
||||
| TYPE_VOID { $$ = NewString("void"); }
|
||||
| TYPE_TYPESTRING { $$ = $1.text; }
|
||||
| TYPE_SIGNED opt_signed {
|
||||
if ($2) $$ = $2;
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -295,6 +295,11 @@ look(SwigScanner *s) {
|
|||
s->string_start = s->line;
|
||||
state = 9; /* A character constant */
|
||||
}
|
||||
else if (c == '`') {
|
||||
s->string_start = s->line;
|
||||
state = 900;
|
||||
}
|
||||
|
||||
else if (c == '.') state = 100; /* Maybe a number, maybe just a period */
|
||||
else if (isdigit(c)) state = 8; /* A numerical value */
|
||||
else state = 99; /* An error */
|
||||
|
|
@ -640,6 +645,18 @@ look(SwigScanner *s) {
|
|||
break;
|
||||
|
||||
/* An illegal character */
|
||||
|
||||
/* Reverse string */
|
||||
case 900:
|
||||
if ((c = nextchar(s)) == 0) {
|
||||
/* add_error(0,"Unterminated character constant", string_start); */
|
||||
return 0;
|
||||
}
|
||||
if (c == '`') {
|
||||
return(SWIG_TOKEN_RSTRING);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return SWIG_TOKEN_ILLEGAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ extern void SwigScanner_idstart(SwigScanner *, char *idchar);
|
|||
#define SWIG_TOKEN_AT 45
|
||||
#define SWIG_TOKEN_DOLLAR 46
|
||||
#define SWIG_TOKEN_CODEBLOCK 47
|
||||
#define SWIG_TOKEN_RSTRING 48
|
||||
#define SWIG_TOKEN_ILLEGAL 98
|
||||
#define SWIG_TOKEN_LAST 99
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue