tmedia_machine_utils.rl 2.5 KB

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