tokens.y 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* We currently rely on the token ID mapping to be the same between PHP 5 and PHP 7 - so the same lexer can be used for
  2. * both. This is enforced by sharing this token file. */
  3. %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
  4. %left ','
  5. %left T_LOGICAL_OR
  6. %left T_LOGICAL_XOR
  7. %left T_LOGICAL_AND
  8. %right T_PRINT
  9. %right T_YIELD
  10. %right T_DOUBLE_ARROW
  11. %right T_YIELD_FROM
  12. %left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
  13. %left '?' ':'
  14. %right T_COALESCE
  15. %left T_BOOLEAN_OR
  16. %left T_BOOLEAN_AND
  17. %left '|'
  18. %left '^'
  19. %left '&'
  20. %nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP
  21. %nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
  22. %left T_SL T_SR
  23. %left '+' '-' '.'
  24. %left '*' '/' '%'
  25. %right '!'
  26. %nonassoc T_INSTANCEOF
  27. %right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
  28. %right T_POW
  29. %right '['
  30. %nonassoc T_NEW T_CLONE
  31. %token T_EXIT
  32. %token T_IF
  33. %left T_ELSEIF
  34. %left T_ELSE
  35. %left T_ENDIF
  36. %token T_LNUMBER
  37. %token T_DNUMBER
  38. %token T_STRING
  39. %token T_STRING_VARNAME
  40. %token T_VARIABLE
  41. %token T_NUM_STRING
  42. %token T_INLINE_HTML
  43. %token T_CHARACTER
  44. %token T_BAD_CHARACTER
  45. %token T_ENCAPSED_AND_WHITESPACE
  46. %token T_CONSTANT_ENCAPSED_STRING
  47. %token T_ECHO
  48. %token T_DO
  49. %token T_WHILE
  50. %token T_ENDWHILE
  51. %token T_FOR
  52. %token T_ENDFOR
  53. %token T_FOREACH
  54. %token T_ENDFOREACH
  55. %token T_DECLARE
  56. %token T_ENDDECLARE
  57. %token T_AS
  58. %token T_SWITCH
  59. %token T_ENDSWITCH
  60. %token T_CASE
  61. %token T_DEFAULT
  62. %token T_BREAK
  63. %token T_CONTINUE
  64. %token T_GOTO
  65. %token T_FUNCTION
  66. %token T_CONST
  67. %token T_RETURN
  68. %token T_TRY
  69. %token T_CATCH
  70. %token T_FINALLY
  71. %token T_THROW
  72. %token T_USE
  73. %token T_INSTEADOF
  74. %token T_GLOBAL
  75. %right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
  76. %token T_VAR
  77. %token T_UNSET
  78. %token T_ISSET
  79. %token T_EMPTY
  80. %token T_HALT_COMPILER
  81. %token T_CLASS
  82. %token T_TRAIT
  83. %token T_INTERFACE
  84. %token T_EXTENDS
  85. %token T_IMPLEMENTS
  86. %token T_OBJECT_OPERATOR
  87. %token T_DOUBLE_ARROW
  88. %token T_LIST
  89. %token T_ARRAY
  90. %token T_CALLABLE
  91. %token T_CLASS_C
  92. %token T_TRAIT_C
  93. %token T_METHOD_C
  94. %token T_FUNC_C
  95. %token T_LINE
  96. %token T_FILE
  97. %token T_COMMENT
  98. %token T_DOC_COMMENT
  99. %token T_OPEN_TAG
  100. %token T_OPEN_TAG_WITH_ECHO
  101. %token T_CLOSE_TAG
  102. %token T_WHITESPACE
  103. %token T_START_HEREDOC
  104. %token T_END_HEREDOC
  105. %token T_DOLLAR_OPEN_CURLY_BRACES
  106. %token T_CURLY_OPEN
  107. %token T_PAAMAYIM_NEKUDOTAYIM
  108. %token T_NAMESPACE
  109. %token T_NS_C
  110. %token T_DIR
  111. %token T_NS_SEPARATOR
  112. %token T_ELLIPSIS