diff options
Diffstat (limited to '2015/23/puzzles.l')
-rw-r--r-- | 2015/23/puzzles.l | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/2015/23/puzzles.l b/2015/23/puzzles.l index 7d654e1..6793126 100644 --- a/2015/23/puzzles.l +++ b/2015/23/puzzles.l @@ -1,5 +1,4 @@ %{ -#define _POSIX_C_SOURCE #include <err.h> #include <stdbool.h> #include <stdio.h> @@ -38,17 +37,17 @@ unsigned long long registers[2]; %% -hlf { program[i].type = HLF; BEGIN(ARGS); } -inc { program[i].type = INC; BEGIN(ARGS); } -jie { program[i].type = JIE; BEGIN(ARGS); } -jio { program[i].type = JIO; BEGIN(ARGS); } -jmp { program[i].type = JMP; BEGIN(ARGS); } -tpl { program[i].type = TPL; BEGIN(ARGS); } - -<ARGS>[ab] { program[i].reg = *yytext - 'a'; } -<ARGS>[+\-][0-9]+ { program[i].imm = atoi(yytext); } -<ARGS>[ ,]+ { ; } -<ARGS>\n { i++; BEGIN(INITIAL); } +hlf { program[i].type = HLF; BEGIN(ARGS); } +inc { program[i].type = INC; BEGIN(ARGS); } +jie { program[i].type = JIE; BEGIN(ARGS); } +jio { program[i].type = JIO; BEGIN(ARGS); } +jmp { program[i].type = JMP; BEGIN(ARGS); } +tpl { program[i].type = TPL; BEGIN(ARGS); } + +<ARGS>[ab] { program[i].reg = *yytext - 'a'; } +<ARGS>[+\-][0-9]+ { program[i].imm = atoi(yytext); } +<ARGS>[ ,]+ { ; } +<ARGS>\n { i++; BEGIN(INITIAL); } %% |