parser.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * \file libyasm/parser.h
  3. * \brief YASM parser module interface.
  4. *
  5. * \license
  6. * Copyright (C) 2001-2007 Peter Johnson
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the distribution.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
  18. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
  21. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  22. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  23. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  24. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  25. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  26. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  27. * POSSIBILITY OF SUCH DAMAGE.
  28. * \endlicense
  29. */
  30. #ifndef YASM_PARSER_H
  31. #define YASM_PARSER_H
  32. /** YASM parser module interface. The "front end" of the assembler. */
  33. typedef struct yasm_parser_module {
  34. /** One-line description of the parser */
  35. const char *name;
  36. /** Keyword used to select parser on the command line */
  37. const char *keyword;
  38. /** NULL-terminated list of preprocessors that are valid to use with this
  39. * parser. The raw preprocessor (raw_preproc) should always be in this
  40. * list so it's always possible to have no preprocessing done.
  41. */
  42. const char **preproc_keywords;
  43. /** Default preprocessor. */
  44. const char *default_preproc_keyword;
  45. /** NULL-terminated list of standard macro lookups. NULL if none. */
  46. const yasm_stdmac *stdmacs;
  47. /** Parse a source file into an object.
  48. * \param object object to parse into (already created)
  49. * \param pp preprocessor
  50. * \param save_input nonzero if the parser should save the original
  51. * lines of source into the object's linemap (via
  52. * yasm_linemap_add_data()).
  53. * \param errwarns error/warning set
  54. * \note Parse errors and warnings are stored into errwarns.
  55. */
  56. void (*do_parse)
  57. (yasm_object *object, yasm_preproc *pp, int save_input,
  58. yasm_linemap *linemap, yasm_errwarns *errwarns);
  59. } yasm_parser_module;
  60. #endif