Skip to content

Commit

Permalink
Implement deprecated visible modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Jul 26, 2014
1 parent 1b35d1c commit db49d5b
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 55 deletions.
3 changes: 3 additions & 0 deletions parser/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ int xx_parse_program(char *program, unsigned int program_length, char *file_path
case XX_T_INLINE:
xx_(xx_parser, XX_INLINE, NULL, parser_status);
break;
case XX_T_DEPRECATED:
xx_(xx_parser, XX_DEPRECATED, NULL, parser_status);
break;
case XX_T_FINAL:
xx_(xx_parser, XX_FINAL, NULL, parser_status);
break;
Expand Down
111 changes: 56 additions & 55 deletions parser/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,58 +60,59 @@
#define XX_FUNCTION 60
#define XX_PARENTHESES_OPEN 61
#define XX_INLINE 62
#define XX_VOID 63
#define XX_NULL 64
#define XX_THIS 65
#define XX_SBRACKET_CLOSE 66
#define XX_TYPE_INTEGER 67
#define XX_TYPE_UINTEGER 68
#define XX_TYPE_LONG 69
#define XX_TYPE_ULONG 70
#define XX_TYPE_CHAR 71
#define XX_TYPE_UCHAR 72
#define XX_TYPE_DOUBLE 73
#define XX_TYPE_BOOL 74
#define XX_TYPE_STRING 75
#define XX_TYPE_ARRAY 76
#define XX_TYPE_VAR 77
#define XX_TYPE_CALLABLE 78
#define XX_TYPE_RESOURCE 79
#define XX_TYPE_OBJECT 80
#define XX_BREAK 81
#define XX_CONTINUE 82
#define XX_IF 83
#define XX_ELSE 84
#define XX_SWITCH 85
#define XX_CASE 86
#define XX_COLON 87
#define XX_DEFAULT 88
#define XX_LOOP 89
#define XX_WHILE 90
#define XX_DO 91
#define XX_TRY 92
#define XX_CATCH 93
#define XX_FOR 94
#define XX_IN 95
#define XX_REVERSE 96
#define XX_LET 97
#define XX_ADDASSIGN 98
#define XX_SUBASSIGN 99
#define XX_MULASSIGN 100
#define XX_DIVASSIGN 101
#define XX_CONCATASSIGN 102
#define XX_MODASSIGN 103
#define XX_STRING 104
#define XX_DOUBLECOLON 105
#define XX_INCR 106
#define XX_DECR 107
#define XX_ECHO 108
#define XX_RETURN 109
#define XX_UNSET 110
#define XX_THROW 111
#define XX_INTEGER 112
#define XX_CHAR 113
#define XX_DOUBLE 114
#define XX_TRUE 115
#define XX_FALSE 116
#define XX_CBLOCK 117
#define XX_DEPRECATED 63
#define XX_VOID 64
#define XX_NULL 65
#define XX_THIS 66
#define XX_SBRACKET_CLOSE 67
#define XX_TYPE_INTEGER 68
#define XX_TYPE_UINTEGER 69
#define XX_TYPE_LONG 70
#define XX_TYPE_ULONG 71
#define XX_TYPE_CHAR 72
#define XX_TYPE_UCHAR 73
#define XX_TYPE_DOUBLE 74
#define XX_TYPE_BOOL 75
#define XX_TYPE_STRING 76
#define XX_TYPE_ARRAY 77
#define XX_TYPE_VAR 78
#define XX_TYPE_CALLABLE 79
#define XX_TYPE_RESOURCE 80
#define XX_TYPE_OBJECT 81
#define XX_BREAK 82
#define XX_CONTINUE 83
#define XX_IF 84
#define XX_ELSE 85
#define XX_SWITCH 86
#define XX_CASE 87
#define XX_COLON 88
#define XX_DEFAULT 89
#define XX_LOOP 90
#define XX_WHILE 91
#define XX_DO 92
#define XX_TRY 93
#define XX_CATCH 94
#define XX_FOR 95
#define XX_IN 96
#define XX_REVERSE 97
#define XX_LET 98
#define XX_ADDASSIGN 99
#define XX_SUBASSIGN 100
#define XX_MULASSIGN 101
#define XX_DIVASSIGN 102
#define XX_CONCATASSIGN 103
#define XX_MODASSIGN 104
#define XX_STRING 105
#define XX_DOUBLECOLON 106
#define XX_INCR 107
#define XX_DECR 108
#define XX_ECHO 109
#define XX_RETURN 110
#define XX_UNSET 111
#define XX_THROW 112
#define XX_INTEGER 113
#define XX_CHAR 114
#define XX_DOUBLE 115
#define XX_TRUE 116
#define XX_FALSE 117
#define XX_CBLOCK 118
4 changes: 4 additions & 0 deletions parser/parser.lemon
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,10 @@ xx_visibility(R) ::= INLINE . {
R = json_object_new_string("inline");
}

xx_visibility(R) ::= DEPRECATED . {
R = json_object_new_string("deprecated");
}

xx_visibility(R) ::= ABSTRACT . {
R = json_object_new_string("abstract");
}
Expand Down
1 change: 1 addition & 0 deletions parser/scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
#define XX_T_AS 396
#define XX_T_TRY 397
#define XX_T_CATCH 398
#define XX_T_DEPRECATED 399

/* Operators */
#define XX_T_AT '@'
Expand Down
6 changes: 6 additions & 0 deletions parser/scanner.re
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) {
return 0;
}
'deprecated' {
s->active_char += sizeof("deprecated")-1;
token->opcode = XX_T_DEPRECATED;
return 0;
}
'final' {
s->active_char += sizeof("final")-1;
token->opcode = XX_T_FINAL;
Expand Down

0 comments on commit db49d5b

Please sign in to comment.