aboutsummaryrefslogtreecommitdiffhomepage
path: root/tokenizer.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-09-30 13:57:36 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-09-30 13:57:36 -0700
commitcbe615224da57e96cfe609eb92f115e0d45f0f28 (patch)
tree76a75b5e03f8433733b4bf96ac567d10c9e053ed /tokenizer.cpp
parent6c70ed79ae523ea730ba29ff2e84da41a6b5e230 (diff)
Make tok_last_type return an enum token_type instead of int
Diffstat (limited to 'tokenizer.cpp')
-rw-r--r--tokenizer.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tokenizer.cpp b/tokenizer.cpp
index 4521c164..62094f92 100644
--- a/tokenizer.cpp
+++ b/tokenizer.cpp
@@ -93,7 +93,7 @@ int tok_get_error(tokenizer_t *tok)
}
-tokenizer_t::tokenizer_t(const wchar_t *b, tok_flags_t flags) : buff(NULL), orig_buff(NULL), last_type(0), last_pos(0), has_next(false), accept_unfinished(false), show_comments(false), last_quote(0), error(0), squash_errors(false), cached_lineno_offset(0), cached_lineno_count(0)
+tokenizer_t::tokenizer_t(const wchar_t *b, tok_flags_t flags) : buff(NULL), orig_buff(NULL), last_type(TOK_NONE), last_pos(0), has_next(false), accept_unfinished(false), show_comments(false), last_quote(0), error(0), squash_errors(false), cached_lineno_offset(0), cached_lineno_count(0)
{
/* We can only generate error messages on the main thread due to wgettext() thread safety issues. */
@@ -116,7 +116,7 @@ tokenizer_t::tokenizer_t(const wchar_t *b, tok_flags_t flags) : buff(NULL), orig
tok_next(this);
}
-int tok_last_type(tokenizer_t *tok)
+enum token_type tok_last_type(tokenizer_t *tok)
{
CHECK(tok, TOK_ERROR);
CHECK(tok->buff, TOK_ERROR);
@@ -440,7 +440,7 @@ static void read_comment(tokenizer_t *tok)
*/
static void read_redirect(tokenizer_t *tok, int fd)
{
- int mode = -1;
+ enum token_type redirection_mode = TOK_NONE;
if ((*tok->buff == L'>') ||
(*tok->buff == L'^'))
@@ -449,11 +449,11 @@ static void read_redirect(tokenizer_t *tok, int fd)
if (*tok->buff == *(tok->buff-1))
{
tok->buff++;
- mode = 1;
+ redirection_mode = TOK_REDIRECT_APPEND;
}
else
{
- mode = 0;
+ redirection_mode = TOK_REDIRECT_OUT;
}
if (*tok->buff == L'|')
@@ -472,7 +472,7 @@ static void read_redirect(tokenizer_t *tok, int fd)
else if (*tok->buff == L'<')
{
tok->buff++;
- mode = 2;
+ redirection_mode = TOK_REDIRECT_IN;
}
else
{
@@ -493,7 +493,7 @@ static void read_redirect(tokenizer_t *tok, int fd)
}
else
{
- tok->last_type = TOK_REDIRECT_OUT + mode;
+ tok->last_type = redirection_mode;
}
}