minor formatting

This commit is contained in:
Joseph Poirier 2015-06-13 12:05:27 -05:00
parent b35b1005d8
commit f44d7556be
4 changed files with 91 additions and 23 deletions

View file

@ -2,7 +2,7 @@ CC=gcc
# -O3 -g # -O3 -g
# -std=gnu11 # -std=gnu11
CFLAGS=-Wall -pg -std=gnu11 -pedantic -DUNIX_HOST -DVER=\"`git show-ref --abbrev=8 --head --hash head`\" -DTAG=\"`git describe --abbrev=0 --tags`\" CFLAGS=-Wall -g -std=gnu11 -pedantic -DUNIX_HOST -DVER=\"`git show-ref --abbrev=8 --head --hash head`\" -DTAG=\"`git describe --abbrev=0 --tags`\"
LIBS=-lm -lreadline LIBS=-lm -lreadline
TARGET = picoc TARGET = picoc

View file

@ -650,7 +650,7 @@ void ExpressionPrefixOperator(struct ParseState *Parser,
TypeGetMatching(Parser->pc, Parser, TopValue->Typ, TypeGetMatching(Parser->pc, Parser, TopValue->Typ,
TypePointer, 0, Parser->pc->StrEmpty, true), TypePointer, 0, Parser->pc->StrEmpty, true),
false, NULL, false); false, NULL, false);
Result->Val->Pointer = (void *)ValPtr; Result->Val->Pointer = (void*)ValPtr;
ExpressionStackPushValueNode(Parser, StackTop, Result); ExpressionStackPushValueNode(Parser, StackTop, Result);
break; break;
case TokenAsterisk: case TokenAsterisk:

View file

@ -59,32 +59,100 @@ enum LexToken
{ {
/* 0x00 */ TokenNone, /* 0x00 */ TokenNone,
/* 0x01 */ TokenComma, /* 0x01 */ TokenComma,
/* 0x02 */ TokenAssign, TokenAddAssign, TokenSubtractAssign, TokenMultiplyAssign, TokenDivideAssign, TokenModulusAssign, /* 0x02 */ TokenAssign,
/* 0x08 */ TokenShiftLeftAssign, TokenShiftRightAssign, TokenArithmeticAndAssign, TokenArithmeticOrAssign, TokenArithmeticExorAssign, TokenAddAssign,
/* 0x0d */ TokenQuestionMark, TokenColon, TokenSubtractAssign,
TokenMultiplyAssign,
TokenDivideAssign,
TokenModulusAssign,
/* 0x08 */ TokenShiftLeftAssign,
TokenShiftRightAssign,
TokenArithmeticAndAssign,
TokenArithmeticOrAssign,
TokenArithmeticExorAssign,
/* 0x0d */ TokenQuestionMark,
TokenColon,
/* 0x0f */ TokenLogicalOr, /* 0x0f */ TokenLogicalOr,
/* 0x10 */ TokenLogicalAnd, /* 0x10 */ TokenLogicalAnd,
/* 0x11 */ TokenArithmeticOr, /* 0x11 */ TokenArithmeticOr,
/* 0x12 */ TokenArithmeticExor, /* 0x12 */ TokenArithmeticExor,
/* 0x13 */ TokenAmpersand, /* 0x13 */ TokenAmpersand,
/* 0x14 */ TokenEqual, TokenNotEqual, /* 0x14 */ TokenEqual,
/* 0x16 */ TokenLessThan, TokenGreaterThan, TokenLessEqual, TokenGreaterEqual, TokenNotEqual,
/* 0x1a */ TokenShiftLeft, TokenShiftRight, /* 0x16 */ TokenLessThan,
/* 0x1c */ TokenPlus, TokenMinus, TokenGreaterThan,
/* 0x1e */ TokenAsterisk, TokenSlash, TokenModulus, TokenLessEqual,
/* 0x21 */ TokenIncrement, TokenDecrement, TokenUnaryNot, TokenUnaryExor, TokenSizeof, TokenCast, TokenGreaterEqual,
/* 0x27 */ TokenLeftSquareBracket, TokenRightSquareBracket, TokenDot, TokenArrow, /* 0x1a */ TokenShiftLeft,
/* 0x2b */ TokenOpenBracket, TokenCloseBracket, TokenShiftRight,
/* 0x2d */ TokenIdentifier, TokenIntegerConstant, TokenFPConstant, TokenStringConstant, TokenCharacterConstant, /* 0x1c */ TokenPlus,
/* 0x32 */ TokenSemicolon, TokenEllipsis, TokenMinus,
/* 0x34 */ TokenLeftBrace, TokenRightBrace, /* 0x1e */ TokenAsterisk,
/* 0x36 */ TokenIntType, TokenCharType, TokenFloatType, TokenDoubleType, TokenVoidType, TokenEnumType, TokenSlash,
/* 0x3c */ TokenLongType, TokenSignedType, TokenShortType, TokenStaticType, TokenAutoType, TokenRegisterType, TokenExternType, TokenStructType, TokenUnionType, TokenUnsignedType, TokenTypedef, TokenModulus,
/* 0x46 */ TokenContinue, TokenDo, TokenElse, TokenFor, TokenGoto, TokenIf, TokenWhile, TokenBreak, TokenSwitch, TokenCase, TokenDefault, TokenReturn, /* 0x21 */ TokenIncrement,
/* 0x52 */ TokenHashDefine, TokenHashInclude, TokenHashIf, TokenHashIfdef, TokenHashIfndef, TokenHashElse, TokenHashEndif, TokenDecrement,
/* 0x59 */ TokenNew, TokenDelete, TokenUnaryNot,
TokenUnaryExor,
TokenSizeof,
TokenCast,
/* 0x27 */ TokenLeftSquareBracket,
TokenRightSquareBracket,
TokenDot,
TokenArrow,
/* 0x2b */ TokenOpenBracket,
TokenCloseBracket,
/* 0x2d */ TokenIdentifier,
TokenIntegerConstant,
TokenFPConstant,
TokenStringConstant,
TokenCharacterConstant,
/* 0x32 */ TokenSemicolon,
TokenEllipsis,
/* 0x34 */ TokenLeftBrace,
TokenRightBrace,
/* 0x36 */ TokenIntType,
TokenCharType,
TokenFloatType,
TokenDoubleType,
TokenVoidType,
TokenEnumType,
/* 0x3c */ TokenLongType,
TokenSignedType,
TokenShortType,
TokenStaticType,
TokenAutoType,
TokenRegisterType,
TokenExternType,
TokenStructType,
TokenUnionType,
TokenUnsignedType,
TokenTypedef,
/* 0x46 */ TokenContinue,
TokenDo,
TokenElse,
TokenFor,
TokenGoto,
TokenIf,
TokenWhile,
TokenBreak,
TokenSwitch,
TokenCase,
TokenDefault,
TokenReturn,
/* 0x52 */ TokenHashDefine,
TokenHashInclude,
TokenHashIf,
TokenHashIfdef,
TokenHashIfndef,
TokenHashElse,
TokenHashEndif,
/* 0x59 */ TokenNew,
TokenDelete,
/* 0x5b */ TokenOpenMacroBracket, /* 0x5b */ TokenOpenMacroBracket,
/* 0x5c */ TokenEOF, TokenEndOfLine, TokenEndOfFunction /* 0x5c */ TokenEOF,
TokenEndOfLine,
TokenEndOfFunction
}; };
/* used in dynamic memory allocation */ /* used in dynamic memory allocation */

View file

@ -261,7 +261,7 @@ void VariableScopeEnd(struct ParseState *Parser, int ScopeID, int PrevScopeID)
Parser->ScopeID = PrevScopeID; Parser->ScopeID = PrevScopeID;
} }
int VariableDefinedAndOutOfScope(Picoc * pc, const char* Ident) int VariableDefinedAndOutOfScope(Picoc *pc, const char* Ident)
{ {
int Count; int Count;
struct TableEntry *Entry; struct TableEntry *Entry;