Parsing commas
This commit is contained in:
parent
1a4b51f3ac
commit
fa744b9884
@ -30,7 +30,8 @@ typedef enum _CppFilter { CPP_FILTER_TRIGRAPH = 1 } CppFilter;
|
|||||||
|
|
||||||
typedef enum _CppCode
|
typedef enum _CppCode
|
||||||
{
|
{
|
||||||
CPP_CODE_DQUOTE = 0,
|
CPP_CODE_COMMA = 0,
|
||||||
|
CPP_CODE_DQUOTE,
|
||||||
CPP_CODE_OPERATOR_AEQUALS,
|
CPP_CODE_OPERATOR_AEQUALS,
|
||||||
CPP_CODE_OPERATOR_AMPERSAND,
|
CPP_CODE_OPERATOR_AMPERSAND,
|
||||||
CPP_CODE_OPERATOR_BAR,
|
CPP_CODE_OPERATOR_BAR,
|
||||||
@ -71,7 +72,6 @@ typedef enum _CppCode
|
|||||||
CPP_CODE_SQUOTE,
|
CPP_CODE_SQUOTE,
|
||||||
CPP_CODE_WHITESPACE,
|
CPP_CODE_WHITESPACE,
|
||||||
CPP_CODE_WORD, /* FIXME numbers and keywords? */
|
CPP_CODE_WORD, /* FIXME numbers and keywords? */
|
||||||
/* FIXME comma? */
|
|
||||||
CPP_CODE_UNKNOWN
|
CPP_CODE_UNKNOWN
|
||||||
} CppCode;
|
} CppCode;
|
||||||
|
|
||||||
|
20
src/cpp.c
20
src/cpp.c
@ -114,6 +114,8 @@ static int _cpp_callback_whitespace(Parser * parser, Token * token, int c,
|
|||||||
/* FIXME handle directives */
|
/* FIXME handle directives */
|
||||||
static int _cpp_callback_comment(Parser * parser, Token * token, int c,
|
static int _cpp_callback_comment(Parser * parser, Token * token, int c,
|
||||||
void * data);
|
void * data);
|
||||||
|
static int _cpp_callback_comma(Parser * parser, Token * token, int c,
|
||||||
|
void * data);
|
||||||
static int _cpp_callback_operator(Parser * parser, Token * token, int c,
|
static int _cpp_callback_operator(Parser * parser, Token * token, int c,
|
||||||
void * data);
|
void * data);
|
||||||
static int _cpp_callback_quote(Parser * parser, Token * token, int c,
|
static int _cpp_callback_quote(Parser * parser, Token * token, int c,
|
||||||
@ -324,7 +326,7 @@ static int _cpp_callback_comment(Parser * parser, Token * token, int c,
|
|||||||
if(c != '/')
|
if(c != '/')
|
||||||
return 1;
|
return 1;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: cpp_callback_comment()\n");
|
fprintf(stderr, "%s", "DEBUG: cpp_callback_comment()\n");
|
||||||
#endif
|
#endif
|
||||||
if((c = parser_scan_filter(parser)) != '*')
|
if((c = parser_scan_filter(parser)) != '*')
|
||||||
{
|
{
|
||||||
@ -351,6 +353,22 @@ static int _cpp_callback_comment(Parser * parser, Token * token, int c,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* cpp_callback_comma */
|
||||||
|
static int _cpp_callback_comma(Parser * parser, Token * token, int c,
|
||||||
|
void * data)
|
||||||
|
{
|
||||||
|
if(c != ',')
|
||||||
|
return 1;
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "%s", "DEBUG: cpp_callback_comma()\n");
|
||||||
|
#endif
|
||||||
|
token_set_code(token, CPP_CODE_COMMA);
|
||||||
|
token_set_string(token, ",");
|
||||||
|
parser_scan_filter(parser);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* cpp_callback_operator */
|
/* cpp_callback_operator */
|
||||||
static int _cpp_callback_operator(Parser * parser, Token * token, int c,
|
static int _cpp_callback_operator(Parser * parser, Token * token, int c,
|
||||||
void * data)
|
void * data)
|
||||||
|
Loading…
Reference in New Issue
Block a user