You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lexer-wavefront-obj.l 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. %{
  2. // In this section we can add all needed headers, from Qt or another libraries.
  3. //#include <QtScript>
  4. #include <QVariant>
  5. #include <QDebug>
  6. // Also, we must add the parser's header where are defined the tokens.
  7. #include "parser-wavefront-obj.h"
  8. #define TOKEN(type) \
  9. TOK_##type
  10. %}
  11. %option noyywrap
  12. %option prefix="wavefront_obj"
  13. %%
  14. /* Whitespace */
  15. [ \t]+ { }
  16. /* Newline */
  17. \n|\n\r { ++wavefront_objlineno; }
  18. /* Comment */
  19. "#"[^\n\r]* { }
  20. /* Material library */
  21. "mtllib" { return TOKEN(MTLLIB); }
  22. /* Use material */
  23. "usemtl" { return TOKEN(USEMTL); }
  24. /* Named object */
  25. "o" { return TOKEN(O); }
  26. /* Vertex */
  27. "v" { return TOKEN(V); }
  28. /* Texture coordinate */
  29. "vt" { return TOKEN(VT); }
  30. /* Vertex normal */
  31. "vn" { return TOKEN(VN); }
  32. /* Parameter space vertices */
  33. "vp" { return TOKEN(VP); }
  34. /* Face */
  35. "f" { return TOKEN(F); }
  36. /* Smooth */
  37. "s" { return TOKEN(S); }
  38. /* Slash */
  39. "/" { return TOKEN(SLASH); }
  40. /* Number */
  41. -?[0-9]+(.[0-9]+)? { return TOKEN(NUMBER); }
  42. /* String */
  43. [^\n\r\t ]+ { return TOKEN(STRING); }
  44. %%