tsdp_machine_utils.rl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (C) 2010-2015 Mamadou Diop.
  3. *
  4. * This file is part of Open Source Doubango Framework.
  5. *
  6. * DOUBANGO is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * DOUBANGO is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with DOUBANGO.
  18. *
  19. */
  20. /**@file tsdp_machine_utils.rl
  21. * @brief Ragel file.
  22. */
  23. %%{
  24. machine tsdp_machine_utils;
  25. OCTET = "0x"[0-9A-Fa-f]+;
  26. CHAR = 0x01..0x7f;
  27. VCHAR = 0x21..0x7e;
  28. ALPHA = 0x41..0x5a | 0x61..0x7a;
  29. DIGIT = 0x30..0x39;
  30. CTL = 0x00..0x1f | 0x7f;
  31. HTAB = "\t";
  32. LF = "\n";
  33. CR = "\r";
  34. SP = " ";
  35. DQUOTE = "\"";
  36. BIT = "0" | "1";
  37. HEXDIG = DIGIT | "A"i | "B"i | "C"i | "D"i | "E"i | "F"i;
  38. CRLF = CR LF;
  39. WSP = SP | HTAB;
  40. LWSP = ( WSP | ( CRLF WSP ) )*;
  41. LWS = ( WSP* CRLF )? WSP+;
  42. SWS = LWS?;
  43. EQUAL = SWS "=" SWS;
  44. LHEX = DIGIT | 0x61..0x66;
  45. HCOLON = ( SP | HTAB )* ":" SWS;
  46. separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\\" | DQUOTE | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HTAB;
  47. STAR = SWS "*" SWS;
  48. SLASH = SWS "/" SWS;
  49. LPAREN = SWS "(" SWS;
  50. RPAREN = SWS ")" SWS;
  51. COMMA = SWS "," SWS;
  52. SEMI = SWS ";" SWS;
  53. COLON = SWS ":" SWS;
  54. LAQUOT = SWS "<";
  55. LDQUOT = SWS DQUOTE;
  56. RAQUOT = ">" SWS;
  57. RDQUOT = DQUOTE SWS;
  58. UTF8_CONT = 0x80..0xbf;
  59. ##### FIXME: UTF8_NONASCII up to 2bytes will fail on Android
  60. UTF8_NONASCII = ( 0x80..0xff );
  61. #UTF8_NONASCII = ( 0xc0..0xdf UTF8_CONT ) | ( 0xe0..0xef UTF8_CONT{2} ) | ( 0xf0..0xf7 UTF8_CONT{3} ) | ( 0xf8..0xfb UTF8_CONT{4} ) | ( 0xfc..0xfd UTF8_CONT{5} ); ctext = 0x21..0x27 | 0x2a..0x5b | 0x5d..0x7e | UTF8_NONASCII | LWS;
  62. qvalue = ( "0" ( "." DIGIT{,3} )? ) | ( "1" ( "." "0"{,3} )? );
  63. alphanum = ALPHA | DIGIT;
  64. token = ( alphanum | "-" | "." | "!" | "%" | "*" | "_" | "+" | "`" | "'" | "~" )+;
  65. ietf_token = token;
  66. x_token = "x-"i token;
  67. iana_token = token;
  68. token_nodot = ( alphanum | "-" | "!" | "%" | "*" | "_" | "+" | "`" | "'" | "~" )+;
  69. word = ( alphanum | "-" | "." | "!" | "%" | "*" | "_" | "+" | "`" | "'" | "~" | "(" | ")" | "<" | ">" | ":" | "\\" | DQUOTE | "/" | "[" | "]" | "?" | "{" | "}" )+;
  70. }%%