Now recognising and ignoring "register" and "extern".
git-svn-id: http://picoc.googlecode.com/svn/trunk@508 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
806c546e06
commit
318db09eb7
2
lex.c
2
lex.c
|
@ -56,6 +56,7 @@ static struct ReservedWord ReservedWords[] =
|
|||
#endif
|
||||
{ "else", TokenElse, NULL },
|
||||
{ "enum", TokenEnumType, NULL },
|
||||
{ "extern", TokenExternType, NULL },
|
||||
#ifndef NO_FP
|
||||
{ "float", TokenFloatType, NULL },
|
||||
#endif
|
||||
|
@ -64,6 +65,7 @@ static struct ReservedWord ReservedWords[] =
|
|||
{ "int", TokenIntType, NULL },
|
||||
{ "long", TokenLongType, NULL },
|
||||
{ "new", TokenNew, NULL },
|
||||
{ "register", TokenRegisterType, NULL },
|
||||
{ "return", TokenReturn, NULL },
|
||||
{ "short", TokenShortType, NULL },
|
||||
{ "signed", TokenSignedType, NULL },
|
||||
|
|
2
parse.c
2
parse.c
|
@ -595,6 +595,8 @@ enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemi
|
|||
case TokenSignedType:
|
||||
case TokenUnsignedType:
|
||||
case TokenStaticType:
|
||||
case TokenRegisterType:
|
||||
case TokenExternType:
|
||||
*Parser = PreState;
|
||||
CheckTrailingSemicolon = ParseDeclaration(Parser, Token);
|
||||
break;
|
||||
|
|
12
picoc.h
12
picoc.h
|
@ -73,12 +73,12 @@ enum LexToken
|
|||
/* 0x32 */ TokenSemicolon, TokenEllipsis,
|
||||
/* 0x34 */ TokenLeftBrace, TokenRightBrace,
|
||||
/* 0x36 */ TokenIntType, TokenCharType, TokenFloatType, TokenDoubleType, TokenVoidType, TokenEnumType,
|
||||
/* 0x3c */ TokenLongType, TokenSignedType, TokenShortType, TokenStaticType, TokenStructType, TokenUnionType, TokenUnsignedType, TokenTypedef,
|
||||
/* 0x43 */ TokenContinue, TokenDo, TokenElse, TokenFor, TokenIf, TokenWhile, TokenBreak, TokenSwitch, TokenCase, TokenDefault, TokenReturn,
|
||||
/* 0x4e */ TokenHashDefine, TokenHashInclude, TokenHashIf, TokenHashIfdef, TokenHashIfndef, TokenHashElse, TokenHashEndif,
|
||||
/* 0x55 */ TokenNew, TokenDelete,
|
||||
/* 0x57 */ TokenOpenMacroBracket,
|
||||
/* 0x58 */ TokenEOF, TokenEndOfLine, TokenEndOfFunction
|
||||
/* 0x3c */ TokenLongType, TokenSignedType, TokenShortType, TokenStaticType, TokenRegisterType, TokenExternType, TokenStructType, TokenUnionType, TokenUnsignedType, TokenTypedef,
|
||||
/* 0x45 */ TokenContinue, TokenDo, TokenElse, TokenFor, TokenIf, TokenWhile, TokenBreak, TokenSwitch, TokenCase, TokenDefault, TokenReturn,
|
||||
/* 0x50 */ TokenHashDefine, TokenHashInclude, TokenHashIf, TokenHashIfdef, TokenHashIfndef, TokenHashElse, TokenHashEndif,
|
||||
/* 0x57 */ TokenNew, TokenDelete,
|
||||
/* 0x59 */ TokenOpenMacroBracket,
|
||||
/* 0x5a */ TokenEOF, TokenEndOfLine, TokenEndOfFunction
|
||||
};
|
||||
|
||||
/* used in dynamic memory allocation */
|
||||
|
|
2
type.c
2
type.c
|
@ -324,7 +324,7 @@ int TypeParseFront(struct ParseState *Parser, struct ValueType **Typ)
|
|||
*Typ = NULL;
|
||||
|
||||
/* ignore leading type qualifiers */
|
||||
while (Token == TokenStaticType)
|
||||
while (Token == TokenStaticType || Token == TokenRegisterType || Token == TokenExternType)
|
||||
Token = LexGetToken(Parser, &LexerValue, TRUE);
|
||||
|
||||
/* handle signed/unsigned with no trailing type */
|
||||
|
|
Loading…
Reference in a new issue