zend_language_scanner.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1998-2018 Zend Technologies Ltd. (http://www.zend.com) |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.00 of the Zend license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.zend.com/license/2_00.txt. |
  11. | If you did not receive a copy of the Zend license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@zend.com so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Andi Gutmans <andi@php.net> |
  16. | Zeev Suraski <zeev@php.net> |
  17. +----------------------------------------------------------------------+
  18. */
  19. #ifndef ZEND_SCANNER_H
  20. #define ZEND_SCANNER_H
  21. typedef struct _zend_lex_state {
  22. unsigned int yy_leng;
  23. unsigned char *yy_start;
  24. unsigned char *yy_text;
  25. unsigned char *yy_cursor;
  26. unsigned char *yy_marker;
  27. unsigned char *yy_limit;
  28. int yy_state;
  29. zend_stack state_stack;
  30. zend_ptr_stack heredoc_label_stack;
  31. zend_file_handle *in;
  32. uint32_t lineno;
  33. zend_string *filename;
  34. /* original (unfiltered) script */
  35. unsigned char *script_org;
  36. size_t script_org_size;
  37. /* filtered script */
  38. unsigned char *script_filtered;
  39. size_t script_filtered_size;
  40. /* input/output filters */
  41. zend_encoding_filter input_filter;
  42. zend_encoding_filter output_filter;
  43. const zend_encoding *script_encoding;
  44. /* hooks */
  45. void (*on_event)(zend_php_scanner_event event, int token, int line, void *context);
  46. void *on_event_context;
  47. zend_ast *ast;
  48. zend_arena *ast_arena;
  49. } zend_lex_state;
  50. typedef struct _zend_heredoc_label {
  51. char *label;
  52. int length;
  53. int indentation;
  54. zend_bool indentation_uses_spaces;
  55. } zend_heredoc_label;
  56. BEGIN_EXTERN_C()
  57. ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state);
  58. ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state);
  59. ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename);
  60. ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding);
  61. ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding);
  62. ZEND_API void zend_lex_tstring(zval *zv);
  63. END_EXTERN_C()
  64. #endif
  65. /*
  66. * Local variables:
  67. * tab-width: 4
  68. * c-basic-offset: 4
  69. * indent-tabs-mode: t
  70. * End:
  71. * vim600: sw=4 ts=4 fdm=marker
  72. * vim<600: sw=4 ts=4
  73. */