/library/kernel/scanner/json_tokens.e

http://github.com/Eiffel-World/ejson-ise-svn · Specman e · 77 lines · 50 code · 14 blank · 13 comment · 0 complexity · 6283416b9ff6c91387b110b9909487a2 MD5 · raw file

  1. note
  2. description: ""
  3. author: "jvelilla"
  4. date: "2008/08/24"
  5. revision: "0.1"
  6. class
  7. JSON_TOKENS
  8. feature -- Access
  9. j_OBJECT_OPEN: CHARACTER = '{'
  10. j_ARRAY_OPEN: CHARACTER = '['
  11. j_OBJECT_CLOSE: CHARACTER = '}'
  12. j_ARRAY_CLOSE: CHARACTER = ']'
  13. j_STRING: CHARACTER = '"'
  14. j_PLUS: CHARACTER = '+'
  15. j_MINUS: CHARACTER = '-'
  16. j_DOT: CHARACTER = '.'
  17. feature -- Status report
  18. is_open_token (c: CHARACTER): BOOLEAN
  19. -- Characters which open a type
  20. do
  21. inspect c
  22. when j_OBJECT_OPEN, j_ARRAY_OPEN, j_STRING, j_PLUS, j_MINUS, j_DOT then
  23. Result := True
  24. else
  25. end
  26. end
  27. is_close_token (c: CHARACTER): BOOLEAN
  28. -- Characters which close a type
  29. do
  30. inspect c
  31. when j_OBJECT_CLOSE, j_ARRAY_CLOSE, j_STRING then
  32. Result := True
  33. else
  34. end
  35. end
  36. is_special_character (c: CHARACTER): BOOLEAN
  37. -- Control Characters
  38. -- %F Form feed
  39. -- %H backslasH
  40. -- %N Newline
  41. -- %R carriage Return
  42. -- %T horizontal Tab
  43. -- %B Backspace
  44. -- / Solidus
  45. -- " Quotation
  46. do
  47. inspect c
  48. when '%F', '%H', '%N', '%R', '%T', '%B', '/', '"' then
  49. Result := True
  50. else
  51. end
  52. end
  53. is_special_control (c: CHARACTER): BOOLEAN
  54. --Control Characters
  55. -- \b\f\n\r\t
  56. do
  57. inspect c
  58. when 'b', 'f', 'n', 'r', 't' then
  59. Result := True
  60. else
  61. end
  62. end
  63. end