#include <config.h>
#include "ast_t.h"
+#include "symbol_t.h"
#include "type_t.h"
#include <assert.h>
[EXPR_UNKNOWN] = PREC_PRIM,
[EXPR_INVALID] = PREC_PRIM,
[EXPR_REFERENCE] = PREC_PRIM,
- [EXPR_CHAR_CONST] = PREC_PRIM,
+ [EXPR_CHARACTER_CONSTANT] = PREC_PRIM,
+ [EXPR_WIDE_CHARACTER_CONSTANT] = PREC_PRIM,
[EXPR_CONST] = PREC_PRIM,
[EXPR_STRING_LITERAL] = PREC_PRIM,
[EXPR_WIDE_STRING_LITERAL] = PREC_PRIM,
fputc(border, out);
}
-/**
- * Print a constant character expression.
- *
- * @param cnst the constant character expression
- */
-static void print_char_const(const const_expression_t *cnst)
-{
- print_quoted_string(&cnst->v.chars, '\'');
-}
-
-/**
- * Prints a string literal expression.
- *
- * @param string_literal the string literal expression
- */
-static void print_string_literal(
- const string_literal_expression_t *string_literal)
-{
- print_quoted_string(&string_literal->value, '"');
-}
-
/**
* Prints a wide string literal expression.
*
* @param wstr the wide string literal expression
*/
-static void print_quoted_wide_string(const wide_string_t *const wstr)
+static void print_quoted_wide_string(const wide_string_t *const wstr,
+ char border)
{
- fputs("L\"", out);
- for (const wchar_rep_t *c = wstr->begin, *end = wstr->begin + wstr->size - 1;
+ fputc('L', out);
+ fputc(border, out);
+ for (const wchar_rep_t *c = wstr->begin, *end = wstr->begin + wstr->size-1;
c != end; ++c) {
switch (*c) {
case L'\"': fputs("\\\"", out); break;
}
}
}
- fputc('"', out);
+ fputc(border, out);
+}
+
+/**
+ * Print a constant character expression.
+ *
+ * @param cnst the constant character expression
+ */
+static void print_character_constant(const const_expression_t *cnst)
+{
+ print_quoted_string(&cnst->v.character, '\'');
+}
+
+static void print_wide_character_constant(const const_expression_t *cnst)
+{
+ print_quoted_wide_string(&cnst->v.wide_character, '\'');
+}
+
+/**
+ * Prints a string literal expression.
+ *
+ * @param string_literal the string literal expression
+ */
+static void print_string_literal(
+ const string_literal_expression_t *string_literal)
+{
+ print_quoted_string(&string_literal->value, '"');
}
static void print_wide_string_literal(
const wide_string_literal_expression_t *const wstr)
{
- print_quoted_wide_string(&wstr->value);
+ print_quoted_wide_string(&wstr->value, '"');
}
static void print_compound_literal(
case EXPR_INVALID:
fprintf(out, "*invalid expression*");
break;
- case EXPR_CHAR_CONST:
- print_char_const(&expression->conste);
+ case EXPR_CHARACTER_CONSTANT:
+ print_character_constant(&expression->conste);
+ break;
+ case EXPR_WIDE_CHARACTER_CONSTANT:
+ print_wide_character_constant(&expression->conste);
break;
case EXPR_CONST:
print_const(&expression->conste);
print_quoted_string(&initializer->string.string, '"');
return;
case INITIALIZER_WIDE_STRING:
- print_quoted_wide_string(&initializer->wide_string.string);
+ print_quoted_wide_string(&initializer->wide_string.string, '"');
return;
case INITIALIZER_DESIGNATOR:
print_designator(initializer->designator.designator);
switch(expression->kind) {
case EXPR_CONST:
- case EXPR_CHAR_CONST:
+ case EXPR_CHARACTER_CONSTANT:
+ case EXPR_WIDE_CHARACTER_CONSTANT:
case EXPR_STRING_LITERAL:
case EXPR_WIDE_STRING_LITERAL:
case EXPR_SIZEOF:
#include "adt/error.h"
#include "adt/array.h"
+#include "symbol_t.h"
#include "token_t.h"
#include "type_t.h"
#include "ast_t.h"
return new_d_Const(dbgi, mode, tv);
}
-static ir_node *char_const_to_firm(const const_expression_t *cnst)
+static ir_node *character_constant_to_firm(const const_expression_t *cnst)
{
dbg_info *dbgi = get_dbg_info(&cnst->base.source_position);
ir_mode *mode = get_ir_mode(cnst->base.type);
long long int v = 0;
- for (size_t i = 0; i < cnst->v.chars.size; ++i) {
- v = (v << 8) | ((unsigned char)cnst->v.chars.begin[i]);
+ for (size_t i = 0; i < cnst->v.character.size; ++i) {
+ v = (v << 8) | ((unsigned char)cnst->v.character.begin[i]);
}
char buf[128];
size_t len = snprintf(buf, sizeof(buf), "%lld", v);
return new_d_Const(dbgi, mode, tv);
}
+static ir_node *wide_character_constant_to_firm(const const_expression_t *cnst)
+{
+ dbg_info *dbgi = get_dbg_info(&cnst->base.source_position);
+ ir_mode *mode = get_ir_mode(cnst->base.type);
+
+ long long int v = cnst->v.wide_character.begin[0];
+
+ char buf[128];
+ size_t len = snprintf(buf, sizeof(buf), "%lld", v);
+ tarval *tv = new_tarval_from_str(buf, len, mode);
+
+ return new_d_Const(dbgi, mode, tv);
+}
+
static ir_node *create_symconst(dbg_info *dbgi, ir_mode *mode,
ir_entity *entity)
{
static ir_node *_expression_to_firm(const expression_t *expression)
{
switch(expression->kind) {
- case EXPR_CHAR_CONST:
- return char_const_to_firm(&expression->conste);
+ case EXPR_CHARACTER_CONSTANT:
+ return character_constant_to_firm(&expression->conste);
+ case EXPR_WIDE_CHARACTER_CONSTANT:
+ return wide_character_constant_to_firm(&expression->conste);
case EXPR_CONST:
return const_to_firm(&expression->conste);
case EXPR_STRING_LITERAL:
EXPR_INVALID,
EXPR_REFERENCE,
EXPR_CONST,
- EXPR_CHAR_CONST,
+ EXPR_CHARACTER_CONSTANT,
+ EXPR_WIDE_CHARACTER_CONSTANT,
EXPR_STRING_LITERAL,
EXPR_WIDE_STRING_LITERAL,
EXPR_COMPOUND_LITERAL,
struct const_expression_t {
expression_base_t base;
union {
- long long int_value;
- long double float_value;
- string_t chars;
+ long long int_value;
+ long double float_value;
+ string_t character;
+ wide_string_t wide_character;
} v;
};
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
-#define INLINE inline
-
-#ifdef __GNUC__
-#define NORETURN __attribute__((noreturn))
-#elif defined _MSC_VER
-#define NORETURN __declspec(noreturn)
-#define __attribute__(x)
-#else
-#define NORETURN
-#ifndef __attribute__
-#define __attribute__(x)
-#endif
-#endif
#include <stdarg.h>
#include <stdio.h>
-#include "adt/error.h"
-#include "ast.h"
#include "diagnostic.h"
+#include "adt/error.h"
+#include "symbol_t.h"
#include "token_t.h"
+#include "ast.h"
#include "type.h"
#include "warning.h"
#ifndef DIAGNOSTIC_H
#define DIAGNOSTIC_H
+#include <stdbool.h>
#include "token_t.h"
void diagnosticf(const char *fmt, ...);
*/
#include <wctype.h>
+#include "format_check.h"
+#include "symbol_t.h"
#include "ast_t.h"
#include "diagnostic.h"
-#include "format_check.h"
#include "types.h"
#include "type_t.h"
#include "warning.h"
#include "diagnostic.h"
#include "lexer.h"
+#include "symbol_t.h"
#include "token_t.h"
#include "symbol_table_t.h"
#include "adt/error.h"
*/
static void parse_wide_character_constant(void)
{
+ const unsigned start_linenr = lexer_token.source_position.linenr;
+
eat('\'');
- int found_char = 0;
while(1) {
switch(c) {
- case '\\':
- found_char = parse_escape_sequence();
+ case '\\': {
+ wchar_rep_t tc = parse_escape_sequence();
+ obstack_grow(&symbol_obstack, &tc, sizeof(tc));
break;
+ }
MATCH_NEWLINE(
parse_error("newline while parsing character constant");
next_char();
goto end_of_wide_char_constant;
- case EOF:
- parse_error("EOF while parsing character constant");
+ case EOF: {
+ source_position_t source_position = lexer_token.source_position;
+ source_position.linenr = start_linenr;
+ errorf(source_position, "EOF while parsing character constant");
lexer_token.type = T_ERROR;
return;
+ }
- default:
- if(found_char != 0) {
- parse_error("more than 1 characters in character "
- "constant");
- goto end_of_wide_char_constant;
- } else {
- found_char = c;
- next_char();
- }
+ default: {
+ wchar_rep_t tc = (wchar_rep_t) c;
+ obstack_grow(&symbol_obstack, &tc, sizeof(tc));
+ next_char();
break;
}
+ }
}
-end_of_wide_char_constant:
- lexer_token.type = T_INTEGER;
- lexer_token.v.intvalue = found_char;
- lexer_token.datatype = type_wchar_t;
+end_of_wide_char_constant:;
+ size_t size = (size_t) obstack_object_size(&symbol_obstack);
+ const wchar_rep_t *string = obstack_finish(&symbol_obstack);
+
+ lexer_token.type = T_WIDE_CHARACTER_CONSTANT;
+ lexer_token.v.wide_string.begin = string;
+ lexer_token.v.wide_string.size = size;
+ lexer_token.datatype = type_wchar_t;
}
/**
eat('\'');
- int tc;
while(1) {
switch(c) {
- case '\\':
- tc = parse_escape_sequence();
+ case '\\': {
+ int tc = parse_escape_sequence();
obstack_1grow(&symbol_obstack, (char) tc);
break;
+ }
MATCH_NEWLINE(
parse_error("newline while parsing character constant");
break;
)
+ case '\'':
+ next_char();
+ goto end_of_char_constant;
+
case EOF: {
source_position_t source_position;
source_position.input_name = lexer_token.source_position.input_name;
return;
}
- case '\'':
- next_char();
- goto end_of_char_constant;
-
default:
obstack_1grow(&symbol_obstack, (char) c);
next_char();
const size_t size = (size_t)obstack_object_size(&symbol_obstack);
const char *const string = obstack_finish(&symbol_obstack);
- lexer_token.type = T_CHARS;
+ lexer_token.type = T_CHARACTER_CONSTANT;
lexer_token.v.string.begin = string;
lexer_token.v.string.size = size;
lexer_token.datatype = type_int;
ELSE('/')
case '%':
MAYBE_PROLOG
- MAYBE('>', T_PERCENTGREATER)
+ MAYBE('>', '}')
MAYBE('=', T_PERCENTEQUAL)
case ':':
MAYBE_PROLOG
case '%':
MAYBE_PROLOG
- MAYBE(':', T_PERCENTCOLONPERCENTCOLON)
+ MAYBE(':', T_HASHHASH)
ELSE_CODE(
put_back(c);
c = '%';
- lexer_token.type = T_PERCENTCOLON;
+ lexer_token.type = '#';
return;
)
- ELSE(T_PERCENTCOLON)
+ ELSE('#')
ELSE('%')
case '<':
MAYBE_PROLOG
- MAYBE(':', T_LESSCOLON)
- MAYBE('%', T_LESSPERCENT)
+ MAYBE(':', '[')
+ MAYBE('%', '{')
MAYBE('=', T_LESSEQUAL)
case '<':
MAYBE_PROLOG
ELSE('|')
case ':':
MAYBE_PROLOG
- MAYBE('>', T_COLONGREATER)
+ MAYBE('>', ']')
ELSE(':')
case '=':
MAYBE_PROLOG
} else if(strcmp(option, "version") == 0) {
firm_version_t ver;
firm_get_version(&ver);
- printf("cparser (%d.%d %s) using libFirm (%u.%u", 0, 1, cparser_REVISION, ver.major, ver.minor);
+ printf("cparser (%s) using libFirm (%u.%u",
+ cparser_REVISION, ver.major, ver.minor);
if(ver.revision[0] != 0) {
putchar(' ');
fputs(ver.revision, stdout);
#include <stdarg.h>
#include <stdbool.h>
+#include "parser.h"
#include "diagnostic.h"
#include "format_check.h"
-#include "parser.h"
#include "lexer.h"
+#include "symbol_t.h"
#include "token_t.h"
#include "types.h"
#include "type_t.h"
static size_t get_expression_struct_size(expression_kind_t kind)
{
static const size_t sizes[] = {
- [EXPR_INVALID] = sizeof(expression_base_t),
- [EXPR_REFERENCE] = sizeof(reference_expression_t),
- [EXPR_CONST] = sizeof(const_expression_t),
- [EXPR_CHAR_CONST] = sizeof(const_expression_t),
- [EXPR_STRING_LITERAL] = sizeof(string_literal_expression_t),
- [EXPR_WIDE_STRING_LITERAL] = sizeof(wide_string_literal_expression_t),
- [EXPR_COMPOUND_LITERAL] = sizeof(compound_literal_expression_t),
- [EXPR_CALL] = sizeof(call_expression_t),
- [EXPR_UNARY_FIRST] = sizeof(unary_expression_t),
- [EXPR_BINARY_FIRST] = sizeof(binary_expression_t),
- [EXPR_CONDITIONAL] = sizeof(conditional_expression_t),
- [EXPR_SELECT] = sizeof(select_expression_t),
- [EXPR_ARRAY_ACCESS] = sizeof(array_access_expression_t),
- [EXPR_SIZEOF] = sizeof(typeprop_expression_t),
- [EXPR_ALIGNOF] = sizeof(typeprop_expression_t),
- [EXPR_CLASSIFY_TYPE] = sizeof(classify_type_expression_t),
- [EXPR_FUNCTION] = sizeof(string_literal_expression_t),
- [EXPR_PRETTY_FUNCTION] = sizeof(string_literal_expression_t),
- [EXPR_BUILTIN_SYMBOL] = sizeof(builtin_symbol_expression_t),
- [EXPR_BUILTIN_CONSTANT_P] = sizeof(builtin_constant_expression_t),
- [EXPR_BUILTIN_PREFETCH] = sizeof(builtin_prefetch_expression_t),
- [EXPR_OFFSETOF] = sizeof(offsetof_expression_t),
- [EXPR_VA_START] = sizeof(va_start_expression_t),
- [EXPR_VA_ARG] = sizeof(va_arg_expression_t),
- [EXPR_STATEMENT] = sizeof(statement_expression_t),
+ [EXPR_INVALID] = sizeof(expression_base_t),
+ [EXPR_REFERENCE] = sizeof(reference_expression_t),
+ [EXPR_CONST] = sizeof(const_expression_t),
+ [EXPR_CHARACTER_CONSTANT] = sizeof(const_expression_t),
+ [EXPR_WIDE_CHARACTER_CONSTANT] = sizeof(const_expression_t),
+ [EXPR_STRING_LITERAL] = sizeof(string_literal_expression_t),
+ [EXPR_WIDE_STRING_LITERAL] = sizeof(wide_string_literal_expression_t),
+ [EXPR_COMPOUND_LITERAL] = sizeof(compound_literal_expression_t),
+ [EXPR_CALL] = sizeof(call_expression_t),
+ [EXPR_UNARY_FIRST] = sizeof(unary_expression_t),
+ [EXPR_BINARY_FIRST] = sizeof(binary_expression_t),
+ [EXPR_CONDITIONAL] = sizeof(conditional_expression_t),
+ [EXPR_SELECT] = sizeof(select_expression_t),
+ [EXPR_ARRAY_ACCESS] = sizeof(array_access_expression_t),
+ [EXPR_SIZEOF] = sizeof(typeprop_expression_t),
+ [EXPR_ALIGNOF] = sizeof(typeprop_expression_t),
+ [EXPR_CLASSIFY_TYPE] = sizeof(classify_type_expression_t),
+ [EXPR_FUNCTION] = sizeof(string_literal_expression_t),
+ [EXPR_PRETTY_FUNCTION] = sizeof(string_literal_expression_t),
+ [EXPR_BUILTIN_SYMBOL] = sizeof(builtin_symbol_expression_t),
+ [EXPR_BUILTIN_CONSTANT_P] = sizeof(builtin_constant_expression_t),
+ [EXPR_BUILTIN_PREFETCH] = sizeof(builtin_prefetch_expression_t),
+ [EXPR_OFFSETOF] = sizeof(offsetof_expression_t),
+ [EXPR_VA_START] = sizeof(va_start_expression_t),
+ [EXPR_VA_ARG] = sizeof(va_arg_expression_t),
+ [EXPR_STATEMENT] = sizeof(statement_expression_t),
};
if(kind >= EXPR_UNARY_FIRST && kind <= EXPR_UNARY_LAST) {
return sizes[EXPR_UNARY_FIRST];
* Search a symbol in a given namespace and returns its declaration or
* NULL if this symbol was not found.
*/
-static declaration_t *get_declaration(const symbol_t *const symbol, const namespace_t namespc)
+static declaration_t *get_declaration(const symbol_t *const symbol,
+ const namespace_t namespc)
{
declaration_t *declaration = symbol->declaration;
for( ; declaration != NULL; declaration = declaration->symbol_next) {
/**
* Parse a character constant.
*/
-static expression_t *parse_char_const(void)
+static expression_t *parse_character_constant(void)
{
- expression_t *cnst = allocate_expression_zero(EXPR_CHAR_CONST);
+ expression_t *cnst = allocate_expression_zero(EXPR_CHARACTER_CONSTANT);
+
cnst->base.source_position = HERE;
cnst->base.type = token.datatype;
- cnst->conste.v.chars.begin = token.v.string.begin;
- cnst->conste.v.chars.size = token.v.string.size;
+ cnst->conste.v.character = token.v.string;
+
+ if (cnst->conste.v.character.size != 1) {
+ if (warning.multichar && (c_mode & _GNUC)) {
+ /* TODO */
+ warningf(HERE, "multi-character character constant");
+ } else {
+ errorf(HERE, "more than 1 characters in character constant");
+ }
+ }
+ next_token();
+
+ return cnst;
+}
+
+/**
+ * Parse a wide character constant.
+ */
+static expression_t *parse_wide_character_constant(void)
+{
+ expression_t *cnst = allocate_expression_zero(EXPR_WIDE_CHARACTER_CONSTANT);
+
+ cnst->base.source_position = HERE;
+ cnst->base.type = token.datatype;
+ cnst->conste.v.wide_character = token.v.wide_string;
- if (cnst->conste.v.chars.size != 1) {
+ if (cnst->conste.v.wide_character.size != 1) {
if (warning.multichar && (c_mode & _GNUC)) {
/* TODO */
warningf(HERE, "multi-character character constant");
{
switch (token.type) {
case T_INTEGER: return parse_int_const();
- case T_CHARS: return parse_char_const();
+ case T_CHARACTER_CONSTANT: return parse_character_constant();
+ case T_WIDE_CHARACTER_CONSTANT: return parse_wide_character_constant();
case T_FLOATINGPOINT: return parse_float_const();
case T_STRING_LITERAL:
case T_WIDE_STRING_LITERAL: return parse_string_const();
case EXPR_INVALID: break;
case EXPR_REFERENCE: return false;
case EXPR_CONST: return false;
- case EXPR_CHAR_CONST: return false;
+ case EXPR_CHARACTER_CONSTANT: return false;
+ case EXPR_WIDE_CHARACTER_CONSTANT: return false;
case EXPR_STRING_LITERAL: return false;
case EXPR_WIDE_STRING_LITERAL: return false;
#ifndef SYMBOL_H
#define SYMBOL_H
-#include "ast.h"
-
-typedef struct symbol_t symbol_t;
-
-struct symbol_t {
- const char *string;
- unsigned short ID;
- unsigned short pp_ID;
- declaration_t *declaration;
-};
+typedef struct symbol_t symbol_t;
+typedef struct pp_definition pp_definition;
#endif
#include <config.h>
#include "symbol_table_t.h"
+#include "symbol_t.h"
#include "token_t.h"
#include "adt/hash_string.h"
#include "adt/obst.h"
#include <config.h>
#include "token_t.h"
+#include "symbol_t.h"
#include <assert.h>
#include <stdio.h>
#include "adt/array.h"
static symbol_t *token_symbols[T_LAST_TOKEN];
+static symbol_t *pp_token_symbols[TP_LAST_TOKEN];
source_position_t builtin_source_position = { "<built-in>", 0 };
int last_id = -2;
memset(token_symbols, 0, T_LAST_TOKEN * sizeof(token_symbols[0]));
+ memset(pp_token_symbols, 0, TP_LAST_TOKEN * sizeof(pp_token_symbols[0]));
#define T(mode,x,str,val) \
if (T_##x > 255) { \
#define T(mode,x,str,val) \
assert(TP_##x >= 0 && TP_##x < TP_LAST_TOKEN); \
- symbol = symbol_table_insert(str); \
- symbol->pp_ID = TP_##x;
+ symbol = symbol_table_insert(str); \
+ symbol->pp_ID = TP_##x; \
+ pp_token_symbols[TP_##x] = symbol;
+
+#define TS(x,str,val) \
+ assert(TP_##x >= 0 && TP_##x < T_LAST_TOKEN); \
+ symbol = symbol_table_insert(str); \
+ pp_token_symbols[TP_##x] = symbol;
#include "tokens_preprocessor.inc"
break;
}
}
+
+void print_pp_token_type(FILE *f, preprocessor_token_type_t token_type)
+{
+ if(token_type == TP_EOF) {
+ fputs("end of file", f);
+ return;
+ }
+ if(token_type == TP_ERROR) {
+ fputs("error", f);
+ return;
+ }
+
+ int token_symbols_len = TP_LAST_TOKEN;
+ if(token_type < 0 || token_type >= token_symbols_len) {
+ fputs("invalid token", f);
+ return;
+ }
+
+ const symbol_t *symbol = pp_token_symbols[token_type];
+ if(symbol != NULL) {
+ fprintf(f, "'%s'", symbol->string);
+ } else {
+ if(token_type >= 0 && token_type < 256) {
+ fprintf(f, "'%c'", token_type);
+ return;
+ }
+ fputs("unknown token", f);
+ }
+}
+
+void print_pp_token(FILE *f, const token_t *token)
+{
+ switch((preprocessor_token_type_t) token->type) {
+ case TP_IDENTIFIER:
+ fprintf(f, "symbol '%s'", token->v.symbol->string);
+ break;
+ case TP_NUMBER:
+ fprintf(f, "number %lld", token->v.intvalue);
+ break;
+ case TP_STRING_LITERAL:
+ fprintf(f, "string '%s'", token->v.string.begin);
+ break;
+ default:
+ print_pp_token_type(f, (preprocessor_token_type_t) token->type);
+ break;
+ }
+}
#include "tokens.inc"
#undef TS
#undef T
-
+ T_NULL = 0,
T_EOF = -1,
T_ERROR = -2
} token_type_t;
#include "tokens_preprocessor.inc"
#undef TS
#undef T
+ TP_NULL = T_NULL,
+ TP_EOF = T_EOF,
+ TP_ERROR = T_ERROR
} preprocessor_token_type_t;
typedef struct source_position_t source_position_t;
void print_token_type(FILE *out, token_type_t token_type);
void print_token(FILE *out, const token_t *token);
+void print_pp_token_type(FILE *out, preprocessor_token_type_t type);
+void print_pp_token(FILE *out, const token_t *token);
+
#endif
#define TS(x,str,val)
#endif
-TS(IDENTIFIER, "identifier", = 256)
-TS(INTEGER, "integer number",)
-TS(CHARS, "character constant",)
-TS(FLOATINGPOINT, "floatingpoint number",)
-TS(STRING_LITERAL, "string literal",)
-TS(WIDE_STRING_LITERAL, "wide string literal",)
+TS(IDENTIFIER, "identifier", = 256)
+TS(INTEGER, "integer number",)
+TS(CHARACTER_CONSTANT, "character constant",)
+TS(WIDE_CHARACTER_CONSTANT, "wide character constant",)
+TS(FLOATINGPOINT, "floatingpoint number",)
+TS(STRING_LITERAL, "string literal",)
+TS(WIDE_STRING_LITERAL, "wide string literal",)
+
+#define PUNCTUATOR(name,string,val) T(_ALL,name,string,val)
+#include "tokens_punctuator.inc"
+#undef PUNCTUATOR
#define S(mode,x) T(mode,x,#x,)
S(_ALL, auto)
T(_MS, int64, "_int64",)
T(_MS, __int64, "__int64", = T_int64)
-#define _T(x,str,val) T(_ALL,x,str,val)
-
-_T(MINUSGREATER, "->",)
-_T(PLUSPLUS, "++",)
-_T(MINUSMINUS, "--",)
-_T(LESSLESS, "<<",)
-_T(GREATERGREATER, ">>",)
-_T(LESSEQUAL, "<=",)
-_T(GREATEREQUAL, ">=",)
-_T(EQUALEQUAL, "==",)
-_T(EXCLAMATIONMARKEQUAL, "!=",)
-_T(ANDAND, "&&",)
-_T(PIPEPIPE, "||",)
-_T(DOTDOTDOT, "...",)
-_T(ASTERISKEQUAL, "*=",)
-_T(SLASHEQUAL, "/=",)
-_T(PERCENTEQUAL, "%=",)
-_T(PLUSEQUAL, "+=",)
-_T(MINUSEQUAL, "-=",)
-_T(LESSLESSEQUAL, "<<=",)
-_T(GREATERGREATEREQUAL, ">>=",)
-_T(ANDEQUAL, "&=",)
-_T(CARETEQUAL, "^=",)
-_T(PIPEEQUAL, "|=",)
-_T(HASHHASH, "##",)
-
-#define T_LAST_TOKEN (T_HASHHASH+1)
-
-_T(LESSCOLON, "<:", = '[')
-_T(COLONGREATER, ":>", = ']')
-_T(LESSPERCENT, "<%", = '{')
-_T(PERCENTGREATER, "%>", = '}')
-_T(PERCENTCOLON, "%:", = '#')
-_T(PERCENTCOLONPERCENTCOLON, "%:%:", = T_HASHHASH)
-
-_T(RBRACK, "[", = '[')
-_T(LBRACK, "]", = ']')
-_T(LBRACE, "(", = '(')
-_T(RBRACE, ")", = ')')
-_T(RCURLY, "{", = '{')
-_T(LCURLY, "}", = '}')
-_T(DOT, ".", = '.')
-_T(AND, "&", = '&')
-_T(ASTERISK, "*", = '*')
-_T(PLUS, "+", = '+')
-_T(MINUS, "-", = '-')
-_T(TILDE, "~", = '~')
-_T(EXCLAMATIONMARK, "!", = '!')
-_T(SLASH, "/", = '/')
-_T(PERCENT, "%", = '%')
-_T(LESS, "<", = '<')
-_T(GREATER, ">", = '>')
-_T(CARET, "^", = '^')
-_T(PIPE, "|", = '|')
-_T(QUESTIONMARK, "?", = '?')
-_T(COLON, ":", = ':')
-_T(SEMICOLON, ";", = ';')
-_T(EQUAL, "=", = '=')
-_T(COMMA, ",", = ',')
-_T(HASH, "#", = '#')
+#define T_LAST_TOKEN (T___int64+1)
#undef _T
-
-TS(NEWLINE, "newline", = '\n')
+#ifndef TS
+#define TS(x,str,val)
+#endif
+
+TS(HEADERNAME, "header name", = 256)
+TS(IDENTIFIER, "identifier",)
+TS(NUMBER, "number",)
+TS(CHARACTER_CONSTANT, "character constant",)
+TS(WIDE_CHARACTER_CONSTANT, "character constant",)
+TS(STRING_LITERAL, "string literal",)
+TS(WIDE_STRING_LITERAL, "wide string literal",)
+TS(PUNCTUATOR, "punctuator",)
+
+#define PUNCTUATOR(name,string,val) T(_ALL,name,string,val)
+#include "tokens_punctuator.inc"
+#undef PUNCTUATOR
+
#define S(x) T(_ALL,x,#x,)
S(if)
S(FENV_ACCESS)
S(CX_LIMITED_RANGE)
-#undef S
-
#define TP_LAST_TOKEN (TP_CX_LIMITED_RANGE + 1)
+
+TS(NEWLINE, "newline", = '\n')
+
+#undef S
#include <stdio.h>
#include <assert.h>
+
#include "type_t.h"
+#include "symbol_t.h"
#include "type_hash.h"
#include "adt/error.h"
#include <stdio.h>
#include <stdbool.h>
+#include "ast.h"
#include "symbol.h"
typedef struct type_base_t type_base_t;
#include <string.h>
#include "write_fluffy.h"
+#include "symbol_t.h"
#include "ast_t.h"
#include "type_t.h"
#include "type.h"