vmd_data_types.qbk 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. [/
  2. (C) Copyright Edward Diener 2011-2015
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ]
  7. [section:vmd_data_types Data types]
  8. The VMD library has functionality for testing and parsing preprocessor data.
  9. The C++ preprocessor defines preprocessor data as preprocessing tokens.
  10. The types of preprocessing tokens can be seen in section 2.5 of the C++ standard document.
  11. The VMD library works with a subset of two of these types of preprocessor tokens
  12. as "data types". These are the "identifier" and "pp-number" preprocessor tokens.
  13. The preprocessor token types which VMD cannot parse are:
  14. * header-name
  15. * character-literal
  16. * user-defined-characteral-literal
  17. * string-literal
  18. * user-defined-string-literal
  19. * preprocessing-op-or-punc
  20. Even though VMD cannot parse these preprocessor token types, it is still
  21. a very useful library since a large part of macro programming works with
  22. 'identifier' and 'pp-number' tokens.
  23. VMD identifiers are preprocessing tokens consisting
  24. of alphanumeric characters and the underscore ( _ ) character. This is very similar to a
  25. preprocessor token "identifier" with the difference being that a VMD identifier can start with a
  26. numeric character, allowing VMD identifiers to also be positive integral literals. VMD offers
  27. functionality for parsing VMD identifiers both as a separate element or in a sequence of preprocessing
  28. tokens.
  29. VMD numbers are Boost PP numbers, ie. preprocessing tokens of
  30. whole numbers between 0 and 256 inclusive. These are a small subset of preprocessor token
  31. "pp-number". VMD offers functionality for parsing numbers both as a separate element or
  32. in a sequence of preprocessing tokens. A VMD number is really a subset of VMD identifiers
  33. for which VMD offers specific functionality. The Boost PP library has it own extensive support
  34. for numbers, which VMD does not duplicate.
  35. VMD v-types are, like numbers, a subset of VMD identifiers consisting of identifiers beginning with
  36. BOOST_VMD_TYPE_ followed by a data type mnemonic. Each v-type can be recognized by VMD functionality
  37. and therefore passed or returned by macros. Like any identifier a v-type can be parsed both as a
  38. separate element or in a sequence of preprocessing tokens.
  39. VMD can also test for emptiness, or the absence of any preprocessing tokens when passed
  40. as macro input.
  41. The Boost PP library supports four individual high-level data types. These are arrays,
  42. lists, seqs, and tuples. When using variadic macros arrays are really
  43. obsolete since tuples have all the functionality of arrays with a simpler syntax.
  44. Nonetheless arrays are fully supported by VMD. A further data type supported by
  45. Boost PP is variadic data, which is a comma separated grouping of preprocessor elements.
  46. VMD has no special support for variadic data outside of what is already in Boost PP.
  47. VMD has functionality to work with the four Boost PP high-level data types. VMD can
  48. test the Boost PP data types and parse them in a sequence of preprocessor tokens.
  49. VMD can also parse sequences. A sequence consists of zero or more other top-level
  50. data types already mentioned represented consecutively. As such a sequence represents
  51. any data type which VMD can parse since it can consist of emptiness, a single data type,
  52. or multiple data types represented consecutively.
  53. Emptiness, the three identifier types, the four Boost PP composite data types, and
  54. VMD sequences are the data types which VMD understands. Other low-level preprocessor
  55. data types can of course be used in macro programming but VMD cannot parse such
  56. preprocessor data.
  57. [endsect]