lexer.l 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * ZMap Copyright 2013 Regents of the University of Michigan
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy
  6. * of the License at http://www.apache.org/licenses/LICENSE-2.0
  7. */
  8. %{
  9. #pragma GCC diagnostic ignored "-Wredundant-decls"
  10. #pragma GCC diagnostic ignored "-Wmissing-noreturn"
  11. #include <string.h>
  12. #include "parser.h"
  13. %}
  14. %option noinput
  15. %option nounput
  16. %%
  17. [0-9]+ yylval.int_literal = (uint64_t) atoll(yytext); return T_NUMBER;
  18. \n /* Ignore end of line */
  19. [ \t]+ /* Ignore whitespace */
  20. != return T_NOT_EQ;
  21. >= return T_GT_EQ;
  22. "<=" return T_LT_EQ;
  23. && return T_AND;
  24. "||" return T_OR;
  25. = return '=';
  26. ">" return '>';
  27. "<" return '<';
  28. "(" return '(';
  29. ")" return ')';
  30. [a-zA-Z][a-zA-Z0-9]+ yylval.string_literal = strdup(yytext); return T_FIELD;
  31. %%