Skip to content

Commit

Permalink
refactoring type parse functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
activesys committed Apr 15, 2012
1 parent 3f01929 commit 30df443
Show file tree
Hide file tree
Showing 3 changed files with 747 additions and 71 deletions.
15 changes: 8 additions & 7 deletions src/cstl_types_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
#define _TOKEN_TEXT_LEFT_BRACKET "<"
#define _TOKEN_TEXT_RIGHT_BRACKET ">"
#define _TOKEN_TEXT_COMMA ","
#define _TOKEN_TEXT_EMPTY ""
#define _TOKEN_CHARACTER_BLANK ' '
#define _TOKEN_CHARACTER_LEFT_BRACKET '<'
#define _TOKEN_CHARACTER_RIGHT_BRACKET '>'
Expand Down Expand Up @@ -372,14 +373,14 @@ void _type_token_rollback(void)
assert(_gt_typeanalysis._t_token == _TOKEN_END_OF_INPUT ||
_gt_typeanalysis._t_token == _TOKEN_SIGN_COMMA ||
_gt_typeanalysis._t_token == _TOKEN_SIGN_RIGHT_BRACKET);
assert(_gt_typeanalysis._s_typename[_gt_typeanalysis._t_index] == '\0' ||
_gt_typeanalysis._s_typename[_gt_typeanalysis._t_index-1] == ',' ||
_gt_typeanalysis._s_typename[_gt_typeanalysis._t_index-1] == '>');
assert(strncmp(_gt_typeanalysis._s_tokentext, "", _TYPE_NAME_SIZE) == 0 ||
strncmp(_gt_typeanalysis._s_tokentext, ",", _TYPE_NAME_SIZE) == 0 ||
strncmp(_gt_typeanalysis._s_tokentext, ">", _TYPE_NAME_SIZE) == 0);
assert(_gt_typeanalysis._s_typename[_gt_typeanalysis._t_index] == _TOKEN_CHARACTER_END_OF_INPUT ||
_gt_typeanalysis._s_typename[_gt_typeanalysis._t_index-1] == _TOKEN_CHARACTER_COMMA ||
_gt_typeanalysis._s_typename[_gt_typeanalysis._t_index-1] == _TOKEN_CHARACTER_RIGHT_BRACKET);
assert(strncmp(_gt_typeanalysis._s_tokentext, _TOKEN_TEXT_EMPTY, _TYPE_NAME_SIZE) == 0 ||
strncmp(_gt_typeanalysis._s_tokentext, _TOKEN_TEXT_COMMA, _TYPE_NAME_SIZE) == 0 ||
strncmp(_gt_typeanalysis._s_tokentext, _TOKEN_TEXT_RIGHT_BRACKET, _TYPE_NAME_SIZE) == 0);

if (_gt_typeanalysis._s_typename[_gt_typeanalysis._t_index] != '\0') {
if (_gt_typeanalysis._s_typename[_gt_typeanalysis._t_index] != _TOKEN_CHARACTER_END_OF_INPUT) {
_gt_typeanalysis._t_index--;
} else if (_gt_typeanalysis._t_token == _TOKEN_SIGN_COMMA ||
_gt_typeanalysis._t_token == _TOKEN_SIGN_RIGHT_BRACKET) {
Expand Down
Loading

0 comments on commit 30df443

Please sign in to comment.