hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/sfinae.l
diff options
context:
space:
mode:
Diffstat (limited to 'sfinae.l')
-rw-r--r--sfinae.l14
1 files changed, 5 insertions, 9 deletions
diff --git a/sfinae.l b/sfinae.l
index f969a98..5c67f3c 100644
--- a/sfinae.l
+++ b/sfinae.l
@@ -2,12 +2,13 @@
%{
#include "lexer.h"
+#include "ast.h"
+#include "parser.h"
#include <stdbool.h>
#include <stdio.h>
static bool failed = false;
-static char character = '\0';
static char unescape(char escaped)
{
@@ -24,7 +25,7 @@ static int fail(const char* message)
{
(void)fprintf(stderr, "line %d: %s\n", yylineno, message);
failed = true;
- return TOK_END;
+ return 0;
}
%}
@@ -36,8 +37,8 @@ static int fail(const char* message)
"decltype" return TOK_DECLTYPE;
"difference" return TOK_DIFFERENCE;
[<>(),;] return yytext[0];
-'\\.' character = unescape(yytext[2]); return TOK_CHAR;
-'.' character = yytext[1]; return TOK_CHAR;
+'\\.' yylval.character = unescape(yytext[2]); return TOK_CHAR;
+'.' yylval.character = yytext[1]; return TOK_CHAR;
"//"[^\n]* /* a comment */
[ \t\r\n]+ /* blanks */
[0-9]+ return fail("numeric literals are for the weak, subtract two characters");
@@ -50,8 +51,3 @@ bool lexer_failed(void)
{
return failed;
}
-
-char lexer_character(void)
-{
- return character;
-}