aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <[email protected]>2014-03-26 03:29:42 +0800
committerTeddy <[email protected]>2014-03-26 03:29:42 +0800
commitac1b4ecd8f15f19c775c951b2e5b2f3ce85c2e01 (patch)
treeb03ef7180c90979da641954e37f41c2ff9ab54f9
parentaf5df36aa343234c945fa6eae30d9bb03551e1a5 (diff)
...
-rw-r--r--cibic.y10
-rw-r--r--main.c2
2 files changed, 6 insertions, 6 deletions
diff --git a/cibic.y b/cibic.y
index 6f3fc13..597c1ce 100644
--- a/cibic.y
+++ b/cibic.y
@@ -9,11 +9,11 @@
struct CNode *cnode;
}
%error-verbose
-%token IDENTIFIER INT_CONST CHAR_CONST STR_CONST
-%token KW_VOID KW_CHAR KW_INT KW_STRUCT KW_UNION KW_IF KW_ELSE KW_WHILE
-%token KW_FOR KW_CONT KW_BREAK KW_RET KW_SIZEOF
-%token OPT_OR OPT_AND OPT_EQ OPT_NE OPT_LE OPT_GE OPT_SHL OPT_SHR OPT_INC OPT_DEC OPT_PTR
-%token ASS_MUL ASS_DIV ASS_MOD ASS_ADD ASS_SUB ASS_SHL ASS_SHR ASS_AND ASS_XOR ASS_OR
+%token IDENTIFIER "identifier" INT_CONST "integer constant" CHAR_CONST "character constant" STR_CONST "string constant"
+%token KW_VOID "void" KW_CHAR "char" KW_INT "int" KW_STRUCT "struct" KW_UNION "union" KW_IF "if" KW_ELSE "else" KW_WHILE "while"
+%token KW_FOR "for" KW_CONT "continue" KW_BREAK "break" KW_RET "ret" KW_SIZEOF "sizeof"
+%token OPT_OR "||" OPT_AND "&&" OPT_EQ "==" OPT_NE "!=" OPT_LE "<=" OPT_GE ">=" OPT_SHL "<<" OPT_SHR ">>" OPT_INC "++" OPT_DEC "--" OPT_PTR "->"
+%token ASS_MUL "*=" ASS_DIV "/=" ASS_MOD "%=" ASS_ADD "+=" ASS_SUB "-=" ASS_SHL "<<=" ASS_SHR ">>=" ASS_AND "&=" ASS_XOR "^=" ASS_OR "|="
%token UNKNOWN
%type<intval> INT_CONST
%type<strval> IDENTIFIER STR_CONST CHAR_CONST
diff --git a/main.c b/main.c
index d36dd6c..b6cc667 100644
--- a/main.c
+++ b/main.c
@@ -19,7 +19,7 @@ void print_error(char *err_msg, int row, int col) {
fprintf(stderr, "%d:%d: %s\n%s\n",
row, col, err_msg, linebuff);
while (--col) putchar(' ');
- putchar('^');
+ puts("^");
}
int yyerror(char *err_msg) {