[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode d7ae56f698 10/15: Passing imenu-tests for PHP
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode d7ae56f698 10/15: Passing imenu-tests for PHP 8.1 |
Date: |
Sat, 26 Feb 2022 02:06:37 -0500 (EST) |
branch: externals/phps-mode
commit d7ae56f6981927c8540702f0e14c54af940f94ae
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Passing imenu-tests for PHP 8.1
---
phps-mode-ast.el | 1 +
phps-mode-parser-sdt.el | 884 +++++++++++++++++++++++++++++++++++++-----
test/phps-mode-test-ast.el | 186 ++++-----
test/phps-mode-test-parser.el | 12 +-
4 files changed, 852 insertions(+), 231 deletions(-)
diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 7ff955615d..eca2c86800 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -91,6 +91,7 @@
(reverse ast))
;; (message "AST:\n%S\n\n" ast)
+
(setq
phps-mode-ast--tree
ast)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 07edec1924..83fe389536 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -6,6 +6,581 @@
;;; Commentary:
+;; Productions PHP 8.1 grammar:
+
+;; Production 0: ((start) (top_statement_list))
+;; Production 1: ((reserved_non_modifiers) (T_INCLUDE))
+;; Production 2: ((reserved_non_modifiers) (T_INCLUDE_ONCE))
+;; Production 3: ((reserved_non_modifiers) (T_EVAL))
+;; Production 4: ((reserved_non_modifiers) (T_REQUIRE))
+;; Production 5: ((reserved_non_modifiers) (T_REQUIRE_ONCE))
+;; Production 6: ((reserved_non_modifiers) (T_LOGICAL_OR))
+;; Production 7: ((reserved_non_modifiers) (T_LOGICAL_XOR))
+;; Production 8: ((reserved_non_modifiers) (T_LOGICAL_AND))
+;; Production 9: ((reserved_non_modifiers) (T_INSTANCEOF))
+;; Production 10: ((reserved_non_modifiers) (T_NEW))
+;; Production 11: ((reserved_non_modifiers) (T_CLONE))
+;; Production 12: ((reserved_non_modifiers) (T_EXIT))
+;; Production 13: ((reserved_non_modifiers) (T_IF))
+;; Production 14: ((reserved_non_modifiers) (T_ELSEIF))
+;; Production 15: ((reserved_non_modifiers) (T_ELSE))
+;; Production 16: ((reserved_non_modifiers) (T_ENDIF))
+;; Production 17: ((reserved_non_modifiers) (T_ECHO))
+;; Production 18: ((reserved_non_modifiers) (T_DO))
+;; Production 19: ((reserved_non_modifiers) (T_WHILE))
+;; Production 20: ((reserved_non_modifiers) (T_ENDWHILE))
+;; Production 21: ((reserved_non_modifiers) (T_FOR))
+;; Production 22: ((reserved_non_modifiers) (T_ENDFOR))
+;; Production 23: ((reserved_non_modifiers) (T_FOREACH))
+;; Production 24: ((reserved_non_modifiers) (T_ENDFOREACH))
+;; Production 25: ((reserved_non_modifiers) (T_DECLARE))
+;; Production 26: ((reserved_non_modifiers) (T_ENDDECLARE))
+;; Production 27: ((reserved_non_modifiers) (T_AS))
+;; Production 28: ((reserved_non_modifiers) (T_TRY))
+;; Production 29: ((reserved_non_modifiers) (T_CATCH))
+;; Production 30: ((reserved_non_modifiers) (T_FINALLY))
+;; Production 31: ((reserved_non_modifiers) (T_THROW))
+;; Production 32: ((reserved_non_modifiers) (T_USE))
+;; Production 33: ((reserved_non_modifiers) (T_INSTEADOF))
+;; Production 34: ((reserved_non_modifiers) (T_GLOBAL))
+;; Production 35: ((reserved_non_modifiers) (T_VAR))
+;; Production 36: ((reserved_non_modifiers) (T_UNSET))
+;; Production 37: ((reserved_non_modifiers) (T_ISSET))
+;; Production 38: ((reserved_non_modifiers) (T_EMPTY))
+;; Production 39: ((reserved_non_modifiers) (T_CONTINUE))
+;; Production 40: ((reserved_non_modifiers) (T_GOTO))
+;; Production 41: ((reserved_non_modifiers) (T_FUNCTION))
+;; Production 42: ((reserved_non_modifiers) (T_CONST))
+;; Production 43: ((reserved_non_modifiers) (T_RETURN))
+;; Production 44: ((reserved_non_modifiers) (T_PRINT))
+;; Production 45: ((reserved_non_modifiers) (T_YIELD))
+;; Production 46: ((reserved_non_modifiers) (T_LIST))
+;; Production 47: ((reserved_non_modifiers) (T_SWITCH))
+;; Production 48: ((reserved_non_modifiers) (T_ENDSWITCH))
+;; Production 49: ((reserved_non_modifiers) (T_CASE))
+;; Production 50: ((reserved_non_modifiers) (T_DEFAULT))
+;; Production 51: ((reserved_non_modifiers) (T_BREAK))
+;; Production 52: ((reserved_non_modifiers) (T_ARRAY))
+;; Production 53: ((reserved_non_modifiers) (T_CALLABLE))
+;; Production 54: ((reserved_non_modifiers) (T_EXTENDS))
+;; Production 55: ((reserved_non_modifiers) (T_IMPLEMENTS))
+;; Production 56: ((reserved_non_modifiers) (T_NAMESPACE))
+;; Production 57: ((reserved_non_modifiers) (T_TRAIT))
+;; Production 58: ((reserved_non_modifiers) (T_INTERFACE))
+;; Production 59: ((reserved_non_modifiers) (T_CLASS))
+;; Production 60: ((reserved_non_modifiers) (T_CLASS_C))
+;; Production 61: ((reserved_non_modifiers) (T_TRAIT_C))
+;; Production 62: ((reserved_non_modifiers) (T_FUNC_C))
+;; Production 63: ((reserved_non_modifiers) (T_METHOD_C))
+;; Production 64: ((reserved_non_modifiers) (T_LINE))
+;; Production 65: ((reserved_non_modifiers) (T_FILE))
+;; Production 66: ((reserved_non_modifiers) (T_DIR))
+;; Production 67: ((reserved_non_modifiers) (T_NS_C))
+;; Production 68: ((reserved_non_modifiers) (T_FN))
+;; Production 69: ((reserved_non_modifiers) (T_MATCH))
+;; Production 70: ((reserved_non_modifiers) (T_ENUM))
+;; Production 71: ((semi_reserved) (reserved_non_modifiers))
+;; Production 72: ((semi_reserved) (T_STATIC))
+;; Production 73: ((semi_reserved) (T_ABSTRACT))
+;; Production 74: ((semi_reserved) (T_FINAL))
+;; Production 75: ((semi_reserved) (T_PRIVATE))
+;; Production 76: ((semi_reserved) (T_PROTECTED))
+;; Production 77: ((semi_reserved) (T_PUBLIC))
+;; Production 78: ((semi_reserved) (T_READONLY))
+;; Production 79: ((ampersand) (T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG))
+;; Production 80: ((ampersand) (T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG))
+;; Production 81: ((identifier) (T_STRING))
+;; Production 82: ((identifier) (semi_reserved))
+;; Production 83: ((top_statement_list) (top_statement_list top_statement))
+;; Production 84: ((top_statement_list) (%empty))
+;; Production 85: ((namespace_declaration_name) (identifier))
+;; Production 86: ((namespace_declaration_name) (T_NAME_QUALIFIED))
+;; Production 87: ((namespace_name) (T_STRING))
+;; Production 88: ((namespace_name) (T_NAME_QUALIFIED))
+;; Production 89: ((legacy_namespace_name) (namespace_name))
+;; Production 90: ((legacy_namespace_name) (T_NAME_FULLY_QUALIFIED))
+;; Production 91: ((name) (T_STRING))
+;; Production 92: ((name) (T_NAME_QUALIFIED))
+;; Production 93: ((name) (T_NAME_FULLY_QUALIFIED))
+;; Production 94: ((name) (T_NAME_RELATIVE))
+;; Production 95: ((attribute_decl) (class_name))
+;; Production 96: ((attribute_decl) (class_name argument_list))
+;; Production 97: ((attribute_group) (attribute_decl))
+;; Production 98: ((attribute_group) (attribute_group "," attribute_decl))
+;; Production 99: ((attribute) (T_ATTRIBUTE attribute_group possible_comma
"]"))
+;; Production 100: ((attributes) (attribute))
+;; Production 101: ((attributes) (attributes attribute))
+;; Production 102: ((attributed_statement) (function_declaration_statement))
+;; Production 103: ((attributed_statement) (class_declaration_statement))
+;; Production 104: ((attributed_statement) (trait_declaration_statement))
+;; Production 105: ((attributed_statement) (interface_declaration_statement))
+;; Production 106: ((attributed_statement) (enum_declaration_statement))
+;; Production 107: ((top_statement) (statement))
+;; Production 108: ((top_statement) (attributed_statement))
+;; Production 109: ((top_statement) (attributes attributed_statement))
+;; Production 110: ((top_statement) (T_HALT_COMPILER "(" ")" ";"))
+;; Production 111: ((top_statement) (T_NAMESPACE namespace_declaration_name
";"))
+;; Production 112: ((top_statement) (T_NAMESPACE namespace_declaration_name
"{" top_statement_list "}"))
+;; Production 113: ((top_statement) (T_NAMESPACE "{" top_statement_list "}"))
+;; Production 114: ((top_statement) (T_USE mixed_group_use_declaration ";"))
+;; Production 115: ((top_statement) (T_USE use_type group_use_declaration ";"))
+;; Production 116: ((top_statement) (T_USE use_declarations ";"))
+;; Production 117: ((top_statement) (T_USE use_type use_declarations ";"))
+;; Production 118: ((top_statement) (T_CONST const_list ";"))
+;; Production 119: ((use_type) (T_FUNCTION))
+;; Production 120: ((use_type) (T_CONST))
+;; Production 121: ((group_use_declaration) (legacy_namespace_name
T_NS_SEPARATOR "{" unprefixed_use_declarations possible_comma "}"))
+;; Production 122: ((mixed_group_use_declaration) (legacy_namespace_name
T_NS_SEPARATOR "{" inline_use_declarations possible_comma "}"))
+;; Production 123: ((possible_comma) (%empty))
+;; Production 124: ((possible_comma) (","))
+;; Production 125: ((inline_use_declarations) (inline_use_declarations ","
inline_use_declaration))
+;; Production 126: ((inline_use_declarations) (inline_use_declaration))
+;; Production 127: ((unprefixed_use_declarations) (unprefixed_use_declarations
"," unprefixed_use_declaration))
+;; Production 128: ((unprefixed_use_declarations) (unprefixed_use_declaration))
+;; Production 129: ((use_declarations) (use_declarations "," use_declaration))
+;; Production 130: ((use_declarations) (use_declaration))
+;; Production 131: ((inline_use_declaration) (unprefixed_use_declaration))
+;; Production 132: ((inline_use_declaration) (use_type
unprefixed_use_declaration))
+;; Production 133: ((unprefixed_use_declaration) (namespace_name))
+;; Production 134: ((unprefixed_use_declaration) (namespace_name T_AS
T_STRING))
+;; Production 135: ((use_declaration) (legacy_namespace_name))
+;; Production 136: ((use_declaration) (legacy_namespace_name T_AS T_STRING))
+;; Production 137: ((const_list) (const_list "," const_decl))
+;; Production 138: ((const_list) (const_decl))
+;; Production 139: ((inner_statement_list) (inner_statement_list
inner_statement))
+;; Production 140: ((inner_statement_list) (%empty))
+;; Production 141: ((inner_statement) (statement))
+;; Production 142: ((inner_statement) (attributed_statement))
+;; Production 143: ((inner_statement) (attributes attributed_statement))
+;; Production 144: ((inner_statement) (T_HALT_COMPILER "(" ")" ";"))
+;; Production 145: ((statement) ("{" inner_statement_list "}"))
+;; Production 146: ((statement) (if_stmt))
+;; Production 147: ((statement) (alt_if_stmt))
+;; Production 148: ((statement) (T_WHILE "(" expr ")" while_statement))
+;; Production 149: ((statement) (T_DO statement T_WHILE "(" expr ")" ";"))
+;; Production 150: ((statement) (T_FOR "(" for_exprs ";" for_exprs ";"
for_exprs ")" for_statement))
+;; Production 151: ((statement) (T_SWITCH "(" expr ")" switch_case_list))
+;; Production 152: ((statement) (T_BREAK optional_expr ";"))
+;; Production 153: ((statement) (T_CONTINUE optional_expr ";"))
+;; Production 154: ((statement) (T_RETURN optional_expr ";"))
+;; Production 155: ((statement) (T_GLOBAL global_var_list ";"))
+;; Production 156: ((statement) (T_STATIC static_var_list ";"))
+;; Production 157: ((statement) (T_ECHO echo_expr_list ";"))
+;; Production 158: ((statement) (T_INLINE_HTML))
+;; Production 159: ((statement) (expr ";"))
+;; Production 160: ((statement) (T_UNSET "(" unset_variables possible_comma
")" ";"))
+;; Production 161: ((statement) (T_FOREACH "(" expr T_AS foreach_variable ")"
foreach_statement))
+;; Production 162: ((statement) (T_FOREACH "(" expr T_AS foreach_variable
T_DOUBLE_ARROW foreach_variable ")" foreach_statement))
+;; Production 163: ((statement) (T_DECLARE "(" const_list ")"
declare_statement))
+;; Production 164: ((statement) (";"))
+;; Production 165: ((statement) (T_TRY "{" inner_statement_list "}" catch_list
finally_statement))
+;; Production 166: ((statement) (T_GOTO T_STRING ";"))
+;; Production 167: ((statement) (T_STRING ":"))
+;; Production 168: ((catch_list) (%empty))
+;; Production 169: ((catch_list) (catch_list T_CATCH "(" catch_name_list
optional_variable ")" "{" inner_statement_list "}"))
+;; Production 170: ((catch_name_list) (class_name))
+;; Production 171: ((catch_name_list) (catch_name_list "|" class_name))
+;; Production 172: ((optional_variable) (%empty))
+;; Production 173: ((optional_variable) (T_VARIABLE))
+;; Production 174: ((finally_statement) (%empty))
+;; Production 175: ((finally_statement) (T_FINALLY "{" inner_statement_list
"}"))
+;; Production 176: ((unset_variables) (unset_variable))
+;; Production 177: ((unset_variables) (unset_variables "," unset_variable))
+;; Production 178: ((unset_variable) (variable))
+;; Production 179: ((function_declaration_statement) (function returns_ref
T_STRING backup_doc_comment "(" parameter_list ")" return_type backup_fn_flags
"{" inner_statement_list "}" backup_fn_flags))
+;; Production 180: ((is_reference) (%empty))
+;; Production 181: ((is_reference) (T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG))
+;; Production 182: ((is_variadic) (%empty))
+;; Production 183: ((is_variadic) (T_ELLIPSIS))
+;; Production 184: ((class_declaration_statement) (class_modifiers T_CLASS
T_STRING extends_from implements_list backup_doc_comment "{"
class_statement_list "}"))
+;; Production 185: ((class_declaration_statement) (T_CLASS T_STRING
extends_from implements_list backup_doc_comment "{" class_statement_list "}"))
+;; Production 186: ((class_modifiers) (class_modifier))
+;; Production 187: ((class_modifiers) (class_modifiers class_modifier))
+;; Production 188: ((class_modifier) (T_ABSTRACT))
+;; Production 189: ((class_modifier) (T_FINAL))
+;; Production 190: ((trait_declaration_statement) (T_TRAIT T_STRING
backup_doc_comment "{" class_statement_list "}"))
+;; Production 191: ((interface_declaration_statement) (T_INTERFACE T_STRING
interface_extends_list backup_doc_comment "{" class_statement_list "}"))
+;; Production 192: ((enum_declaration_statement) (T_ENUM T_STRING
enum_backing_type implements_list backup_doc_comment "{" class_statement_list
"}"))
+;; Production 193: ((enum_backing_type) (%empty))
+;; Production 194: ((enum_backing_type) (":" type_expr))
+;; Production 195: ((enum_case) (T_CASE backup_doc_comment identifier
enum_case_expr ";"))
+;; Production 196: ((enum_case_expr) (%empty))
+;; Production 197: ((enum_case_expr) ("=" expr))
+;; Production 198: ((extends_from) (%empty))
+;; Production 199: ((extends_from) (T_EXTENDS class_name))
+;; Production 200: ((interface_extends_list) (%empty))
+;; Production 201: ((interface_extends_list) (T_EXTENDS class_name_list))
+;; Production 202: ((implements_list) (%empty))
+;; Production 203: ((implements_list) (T_IMPLEMENTS class_name_list))
+;; Production 204: ((foreach_variable) (variable))
+;; Production 205: ((foreach_variable) (ampersand variable))
+;; Production 206: ((foreach_variable) (T_LIST "(" array_pair_list ")"))
+;; Production 207: ((foreach_variable) ("[" array_pair_list "]"))
+;; Production 208: ((for_statement) (statement))
+;; Production 209: ((for_statement) (":" inner_statement_list T_ENDFOR ";"))
+;; Production 210: ((foreach_statement) (statement))
+;; Production 211: ((foreach_statement) (":" inner_statement_list T_ENDFOREACH
";"))
+;; Production 212: ((declare_statement) (statement))
+;; Production 213: ((declare_statement) (":" inner_statement_list T_ENDDECLARE
";"))
+;; Production 214: ((switch_case_list) ("{" case_list "}"))
+;; Production 215: ((switch_case_list) ("{" ";" case_list "}"))
+;; Production 216: ((switch_case_list) (":" case_list T_ENDSWITCH ";"))
+;; Production 217: ((switch_case_list) (":" ";" case_list T_ENDSWITCH ";"))
+;; Production 218: ((case_list) (%empty))
+;; Production 219: ((case_list) (case_list T_CASE expr case_separator
inner_statement_list))
+;; Production 220: ((case_list) (case_list T_DEFAULT case_separator
inner_statement_list))
+;; Production 221: ((case_separator) (":"))
+;; Production 222: ((case_separator) (";"))
+;; Production 223: ((match) (T_MATCH "(" expr ")" "{" match_arm_list "}"))
+;; Production 224: ((match_arm_list) (%empty))
+;; Production 225: ((match_arm_list) (non_empty_match_arm_list possible_comma))
+;; Production 226: ((non_empty_match_arm_list) (match_arm))
+;; Production 227: ((non_empty_match_arm_list) (non_empty_match_arm_list ","
match_arm))
+;; Production 228: ((match_arm) (match_arm_cond_list possible_comma
T_DOUBLE_ARROW expr))
+;; Production 229: ((match_arm) (T_DEFAULT possible_comma T_DOUBLE_ARROW expr))
+;; Production 230: ((match_arm_cond_list) (expr))
+;; Production 231: ((match_arm_cond_list) (match_arm_cond_list "," expr))
+;; Production 232: ((while_statement) (statement))
+;; Production 233: ((while_statement) (":" inner_statement_list T_ENDWHILE
";"))
+;; Production 234: ((if_stmt_without_else) (T_IF "(" expr ")" statement))
+;; Production 235: ((if_stmt_without_else) (if_stmt_without_else T_ELSEIF "("
expr ")" statement))
+;; Production 236: ((if_stmt) (if_stmt_without_else))
+;; Production 237: ((if_stmt) (if_stmt_without_else T_ELSE statement))
+;; Production 238: ((alt_if_stmt_without_else) (T_IF "(" expr ")" ":"
inner_statement_list))
+;; Production 239: ((alt_if_stmt_without_else) (alt_if_stmt_without_else
T_ELSEIF "(" expr ")" ":" inner_statement_list))
+;; Production 240: ((alt_if_stmt) (alt_if_stmt_without_else T_ENDIF ";"))
+;; Production 241: ((alt_if_stmt) (alt_if_stmt_without_else T_ELSE ":"
inner_statement_list T_ENDIF ";"))
+;; Production 242: ((parameter_list) (non_empty_parameter_list possible_comma))
+;; Production 243: ((parameter_list) (%empty))
+;; Production 244: ((non_empty_parameter_list) (attributed_parameter))
+;; Production 245: ((non_empty_parameter_list) (non_empty_parameter_list ","
attributed_parameter))
+;; Production 246: ((attributed_parameter) (attributes parameter))
+;; Production 247: ((attributed_parameter) (parameter))
+;; Production 248: ((optional_property_modifiers) (%empty))
+;; Production 249: ((optional_property_modifiers) (optional_property_modifiers
property_modifier))
+;; Production 250: ((property_modifier) (T_PUBLIC))
+;; Production 251: ((property_modifier) (T_PROTECTED))
+;; Production 252: ((property_modifier) (T_PRIVATE))
+;; Production 253: ((property_modifier) (T_READONLY))
+;; Production 254: ((parameter) (optional_property_modifiers
optional_type_without_static is_reference is_variadic T_VARIABLE
backup_doc_comment))
+;; Production 255: ((parameter) (optional_property_modifiers
optional_type_without_static is_reference is_variadic T_VARIABLE
backup_doc_comment "=" expr))
+;; Production 256: ((optional_type_without_static) (%empty))
+;; Production 257: ((optional_type_without_static) (type_expr_without_static))
+;; Production 258: ((type_expr) (type))
+;; Production 259: ((type_expr) ("?" type))
+;; Production 260: ((type_expr) (union_type))
+;; Production 261: ((type_expr) (intersection_type))
+;; Production 262: ((type) (type_without_static))
+;; Production 263: ((type) (T_STATIC))
+;; Production 264: ((union_type) (type "|" type))
+;; Production 265: ((union_type) (union_type "|" type))
+;; Production 266: ((intersection_type) (type
T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG type))
+;; Production 267: ((intersection_type) (intersection_type
T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG type))
+;; Production 268: ((type_expr_without_static) (type_without_static))
+;; Production 269: ((type_expr_without_static) ("?" type_without_static))
+;; Production 270: ((type_expr_without_static) (union_type_without_static))
+;; Production 271: ((type_expr_without_static)
(intersection_type_without_static))
+;; Production 272: ((type_without_static) (T_ARRAY))
+;; Production 273: ((type_without_static) (T_CALLABLE))
+;; Production 274: ((type_without_static) (name))
+;; Production 275: ((union_type_without_static) (type_without_static "|"
type_without_static))
+;; Production 276: ((union_type_without_static) (union_type_without_static "|"
type_without_static))
+;; Production 277: ((intersection_type_without_static) (type_without_static
T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG type_without_static))
+;; Production 278: ((intersection_type_without_static)
(intersection_type_without_static T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG
type_without_static))
+;; Production 279: ((return_type) (%empty))
+;; Production 280: ((return_type) (":" type_expr))
+;; Production 281: ((argument_list) ("(" ")"))
+;; Production 282: ((argument_list) ("(" non_empty_argument_list
possible_comma ")"))
+;; Production 283: ((argument_list) ("(" T_ELLIPSIS ")"))
+;; Production 284: ((non_empty_argument_list) (argument))
+;; Production 285: ((non_empty_argument_list) (non_empty_argument_list ","
argument))
+;; Production 286: ((argument) (expr))
+;; Production 287: ((argument) (identifier ":" expr))
+;; Production 288: ((argument) (T_ELLIPSIS expr))
+;; Production 289: ((global_var_list) (global_var_list "," global_var))
+;; Production 290: ((global_var_list) (global_var))
+;; Production 291: ((global_var) (simple_variable))
+;; Production 292: ((static_var_list) (static_var_list "," static_var))
+;; Production 293: ((static_var_list) (static_var))
+;; Production 294: ((static_var) (T_VARIABLE))
+;; Production 295: ((static_var) (T_VARIABLE "=" expr))
+;; Production 296: ((class_statement_list) (class_statement_list
class_statement))
+;; Production 297: ((class_statement_list) (%empty))
+;; Production 298: ((attributed_class_statement) (variable_modifiers
optional_type_without_static property_list ";"))
+;; Production 299: ((attributed_class_statement) (method_modifiers T_CONST
class_const_list ";"))
+;; Production 300: ((attributed_class_statement) (method_modifiers function
returns_ref identifier backup_doc_comment "(" parameter_list ")" return_type
backup_fn_flags method_body backup_fn_flags))
+;; Production 301: ((attributed_class_statement) (enum_case))
+;; Production 302: ((class_statement) (attributed_class_statement))
+;; Production 303: ((class_statement) (attributes attributed_class_statement))
+;; Production 304: ((class_statement) (T_USE class_name_list
trait_adaptations))
+;; Production 305: ((class_name_list) (class_name))
+;; Production 306: ((class_name_list) (class_name_list "," class_name))
+;; Production 307: ((trait_adaptations) (";"))
+;; Production 308: ((trait_adaptations) ("{" "}"))
+;; Production 309: ((trait_adaptations) ("{" trait_adaptation_list "}"))
+;; Production 310: ((trait_adaptation_list) (trait_adaptation))
+;; Production 311: ((trait_adaptation_list) (trait_adaptation_list
trait_adaptation))
+;; Production 312: ((trait_adaptation) (trait_precedence ";"))
+;; Production 313: ((trait_adaptation) (trait_alias ";"))
+;; Production 314: ((trait_precedence) (absolute_trait_method_reference
T_INSTEADOF class_name_list))
+;; Production 315: ((trait_alias) (trait_method_reference T_AS T_STRING))
+;; Production 316: ((trait_alias) (trait_method_reference T_AS
reserved_non_modifiers))
+;; Production 317: ((trait_alias) (trait_method_reference T_AS member_modifier
identifier))
+;; Production 318: ((trait_alias) (trait_method_reference T_AS
member_modifier))
+;; Production 319: ((trait_method_reference) (identifier))
+;; Production 320: ((trait_method_reference) (absolute_trait_method_reference))
+;; Production 321: ((absolute_trait_method_reference) (class_name
T_PAAMAYIM_NEKUDOTAYIM identifier))
+;; Production 322: ((method_body) (";"))
+;; Production 323: ((method_body) ("{" inner_statement_list "}"))
+;; Production 324: ((variable_modifiers) (non_empty_member_modifiers))
+;; Production 325: ((variable_modifiers) (T_VAR))
+;; Production 326: ((method_modifiers) (%empty))
+;; Production 327: ((method_modifiers) (non_empty_member_modifiers))
+;; Production 328: ((non_empty_member_modifiers) (member_modifier))
+;; Production 329: ((non_empty_member_modifiers) (non_empty_member_modifiers
member_modifier))
+;; Production 330: ((member_modifier) (T_PUBLIC))
+;; Production 331: ((member_modifier) (T_PROTECTED))
+;; Production 332: ((member_modifier) (T_PRIVATE))
+;; Production 333: ((member_modifier) (T_STATIC))
+;; Production 334: ((member_modifier) (T_ABSTRACT))
+;; Production 335: ((member_modifier) (T_FINAL))
+;; Production 336: ((member_modifier) (T_READONLY))
+;; Production 337: ((property_list) (property_list "," property))
+;; Production 338: ((property_list) (property))
+;; Production 339: ((property) (T_VARIABLE backup_doc_comment))
+;; Production 340: ((property) (T_VARIABLE "=" expr backup_doc_comment))
+;; Production 341: ((class_const_list) (class_const_list "," class_const_decl))
+;; Production 342: ((class_const_list) (class_const_decl))
+;; Production 343: ((class_const_decl) (identifier "=" expr
backup_doc_comment))
+;; Production 344: ((const_decl) (T_STRING "=" expr backup_doc_comment))
+;; Production 345: ((echo_expr_list) (echo_expr_list "," echo_expr))
+;; Production 346: ((echo_expr_list) (echo_expr))
+;; Production 347: ((echo_expr) (expr))
+;; Production 348: ((for_exprs) (%empty))
+;; Production 349: ((for_exprs) (non_empty_for_exprs))
+;; Production 350: ((non_empty_for_exprs) (non_empty_for_exprs "," expr))
+;; Production 351: ((non_empty_for_exprs) (expr))
+;; Production 352: ((anonymous_class) (T_CLASS ctor_arguments extends_from
implements_list backup_doc_comment "{" class_statement_list "}"))
+;; Production 353: ((new_expr) (T_NEW class_name_reference ctor_arguments))
+;; Production 354: ((new_expr) (T_NEW anonymous_class))
+;; Production 355: ((new_expr) (T_NEW attributes anonymous_class))
+;; Production 356: ((expr) (variable))
+;; Production 357: ((expr) (T_LIST "(" array_pair_list ")" "=" expr))
+;; Production 358: ((expr) ("[" array_pair_list "]" "=" expr))
+;; Production 359: ((expr) (variable "=" expr))
+;; Production 360: ((expr) (variable "=" ampersand variable))
+;; Production 361: ((expr) (T_CLONE expr))
+;; Production 362: ((expr) (variable T_PLUS_EQUAL expr))
+;; Production 363: ((expr) (variable T_MINUS_EQUAL expr))
+;; Production 364: ((expr) (variable T_MUL_EQUAL expr))
+;; Production 365: ((expr) (variable T_POW_EQUAL expr))
+;; Production 366: ((expr) (variable T_DIV_EQUAL expr))
+;; Production 367: ((expr) (variable T_CONCAT_EQUAL expr))
+;; Production 368: ((expr) (variable T_MOD_EQUAL expr))
+;; Production 369: ((expr) (variable T_AND_EQUAL expr))
+;; Production 370: ((expr) (variable T_OR_EQUAL expr))
+;; Production 371: ((expr) (variable T_XOR_EQUAL expr))
+;; Production 372: ((expr) (variable T_SL_EQUAL expr))
+;; Production 373: ((expr) (variable T_SR_EQUAL expr))
+;; Production 374: ((expr) (variable T_COALESCE_EQUAL expr))
+;; Production 375: ((expr) (variable T_INC))
+;; Production 376: ((expr) (T_INC variable))
+;; Production 377: ((expr) (variable T_DEC))
+;; Production 378: ((expr) (T_DEC variable))
+;; Production 379: ((expr) (expr T_BOOLEAN_OR expr))
+;; Production 380: ((expr) (expr T_BOOLEAN_AND expr))
+;; Production 381: ((expr) (expr T_LOGICAL_OR expr))
+;; Production 382: ((expr) (expr T_LOGICAL_AND expr))
+;; Production 383: ((expr) (expr T_LOGICAL_XOR expr))
+;; Production 384: ((expr) (expr "|" expr))
+;; Production 385: ((expr) (expr T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG
expr))
+;; Production 386: ((expr) (expr T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG expr))
+;; Production 387: ((expr) (expr "^" expr))
+;; Production 388: ((expr) (expr "." expr))
+;; Production 389: ((expr) (expr "+" expr))
+;; Production 390: ((expr) (expr "-" expr))
+;; Production 391: ((expr) (expr "*" expr))
+;; Production 392: ((expr) (expr T_POW expr))
+;; Production 393: ((expr) (expr "/" expr))
+;; Production 394: ((expr) (expr "%" expr))
+;; Production 395: ((expr) (expr T_SL expr))
+;; Production 396: ((expr) (expr T_SR expr))
+;; Production 397: ((expr) ("+" expr))
+;; Production 398: ((expr) ("-" expr))
+;; Production 399: ((expr) ("!" expr))
+;; Production 400: ((expr) ("~" expr))
+;; Production 401: ((expr) (expr T_IS_IDENTICAL expr))
+;; Production 402: ((expr) (expr T_IS_NOT_IDENTICAL expr))
+;; Production 403: ((expr) (expr T_IS_EQUAL expr))
+;; Production 404: ((expr) (expr T_IS_NOT_EQUAL expr))
+;; Production 405: ((expr) (expr "<" expr))
+;; Production 406: ((expr) (expr T_IS_SMALLER_OR_EQUAL expr))
+;; Production 407: ((expr) (expr ">" expr))
+;; Production 408: ((expr) (expr T_IS_GREATER_OR_EQUAL expr))
+;; Production 409: ((expr) (expr T_SPACESHIP expr))
+;; Production 410: ((expr) (expr T_INSTANCEOF class_name_reference))
+;; Production 411: ((expr) ("(" expr ")"))
+;; Production 412: ((expr) (new_expr))
+;; Production 413: ((expr) (expr "?" expr ":" expr))
+;; Production 414: ((expr) (expr "?" ":" expr))
+;; Production 415: ((expr) (expr T_COALESCE expr))
+;; Production 416: ((expr) (internal_functions_in_yacc))
+;; Production 417: ((expr) (T_INT_CAST expr))
+;; Production 418: ((expr) (T_DOUBLE_CAST expr))
+;; Production 419: ((expr) (T_STRING_CAST expr))
+;; Production 420: ((expr) (T_ARRAY_CAST expr))
+;; Production 421: ((expr) (T_OBJECT_CAST expr))
+;; Production 422: ((expr) (T_BOOL_CAST expr))
+;; Production 423: ((expr) (T_UNSET_CAST expr))
+;; Production 424: ((expr) (T_EXIT exit_expr))
+;; Production 425: ((expr) ("@" expr))
+;; Production 426: ((expr) (scalar))
+;; Production 427: ((expr) ("`" backticks_expr "`"))
+;; Production 428: ((expr) (T_PRINT expr))
+;; Production 429: ((expr) (T_YIELD))
+;; Production 430: ((expr) (T_YIELD expr))
+;; Production 431: ((expr) (T_YIELD expr T_DOUBLE_ARROW expr))
+;; Production 432: ((expr) (T_YIELD_FROM expr))
+;; Production 433: ((expr) (T_THROW expr))
+;; Production 434: ((expr) (inline_function))
+;; Production 435: ((expr) (attributes inline_function))
+;; Production 436: ((expr) (T_STATIC inline_function))
+;; Production 437: ((expr) (attributes T_STATIC inline_function))
+;; Production 438: ((expr) (match))
+;; Production 439: ((inline_function) (function returns_ref backup_doc_comment
"(" parameter_list ")" lexical_vars return_type backup_fn_flags "{"
inner_statement_list "}" backup_fn_flags))
+;; Production 440: ((inline_function) (fn returns_ref backup_doc_comment "("
parameter_list ")" return_type T_DOUBLE_ARROW backup_fn_flags backup_lex_pos
expr backup_fn_flags))
+;; Production 441: ((fn) (T_FN))
+;; Production 442: ((function) (T_FUNCTION))
+;; Production 443: ((backup_doc_comment) (%empty))
+;; Production 444: ((backup_fn_flags) (%empty))
+;; Production 445: ((backup_lex_pos) (%empty))
+;; Production 446: ((returns_ref) (%empty))
+;; Production 447: ((returns_ref) (ampersand))
+;; Production 448: ((lexical_vars) (%empty))
+;; Production 449: ((lexical_vars) (T_USE "(" lexical_var_list possible_comma
")"))
+;; Production 450: ((lexical_var_list) (lexical_var_list "," lexical_var))
+;; Production 451: ((lexical_var_list) (lexical_var))
+;; Production 452: ((lexical_var) (T_VARIABLE))
+;; Production 453: ((lexical_var) (ampersand T_VARIABLE))
+;; Production 454: ((function_call) (name argument_list))
+;; Production 455: ((function_call) (class_name T_PAAMAYIM_NEKUDOTAYIM
member_name argument_list))
+;; Production 456: ((function_call) (variable_class_name
T_PAAMAYIM_NEKUDOTAYIM member_name argument_list))
+;; Production 457: ((function_call) (callable_expr argument_list))
+;; Production 458: ((class_name) (T_STATIC))
+;; Production 459: ((class_name) (name))
+;; Production 460: ((class_name_reference) (class_name))
+;; Production 461: ((class_name_reference) (new_variable))
+;; Production 462: ((class_name_reference) ("(" expr ")"))
+;; Production 463: ((exit_expr) (%empty))
+;; Production 464: ((exit_expr) ("(" optional_expr ")"))
+;; Production 465: ((backticks_expr) (%empty))
+;; Production 466: ((backticks_expr) (T_ENCAPSED_AND_WHITESPACE))
+;; Production 467: ((backticks_expr) (encaps_list))
+;; Production 468: ((ctor_arguments) (%empty))
+;; Production 469: ((ctor_arguments) (argument_list))
+;; Production 470: ((dereferenceable_scalar) (T_ARRAY "(" array_pair_list ")"))
+;; Production 471: ((dereferenceable_scalar) ("[" array_pair_list "]"))
+;; Production 472: ((dereferenceable_scalar) (T_CONSTANT_ENCAPSED_STRING))
+;; Production 473: ((dereferenceable_scalar) ("\"" encaps_list "\""))
+;; Production 474: ((scalar) (T_LNUMBER))
+;; Production 475: ((scalar) (T_DNUMBER))
+;; Production 476: ((scalar) (T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE
T_END_HEREDOC))
+;; Production 477: ((scalar) (T_START_HEREDOC T_END_HEREDOC))
+;; Production 478: ((scalar) (T_START_HEREDOC encaps_list T_END_HEREDOC))
+;; Production 479: ((scalar) (dereferenceable_scalar))
+;; Production 480: ((scalar) (constant))
+;; Production 481: ((scalar) (class_constant))
+;; Production 482: ((constant) (name))
+;; Production 483: ((constant) (T_LINE))
+;; Production 484: ((constant) (T_FILE))
+;; Production 485: ((constant) (T_DIR))
+;; Production 486: ((constant) (T_TRAIT_C))
+;; Production 487: ((constant) (T_METHOD_C))
+;; Production 488: ((constant) (T_FUNC_C))
+;; Production 489: ((constant) (T_NS_C))
+;; Production 490: ((constant) (T_CLASS_C))
+;; Production 491: ((class_constant) (class_name T_PAAMAYIM_NEKUDOTAYIM
identifier))
+;; Production 492: ((class_constant) (variable_class_name
T_PAAMAYIM_NEKUDOTAYIM identifier))
+;; Production 493: ((optional_expr) (%empty))
+;; Production 494: ((optional_expr) (expr))
+;; Production 495: ((variable_class_name) (fully_dereferenceable))
+;; Production 496: ((fully_dereferenceable) (variable))
+;; Production 497: ((fully_dereferenceable) ("(" expr ")"))
+;; Production 498: ((fully_dereferenceable) (dereferenceable_scalar))
+;; Production 499: ((fully_dereferenceable) (class_constant))
+;; Production 500: ((array_object_dereferenceable) (fully_dereferenceable))
+;; Production 501: ((array_object_dereferenceable) (constant))
+;; Production 502: ((callable_expr) (callable_variable))
+;; Production 503: ((callable_expr) ("(" expr ")"))
+;; Production 504: ((callable_expr) (dereferenceable_scalar))
+;; Production 505: ((callable_variable) (simple_variable))
+;; Production 506: ((callable_variable) (array_object_dereferenceable "["
optional_expr "]"))
+;; Production 507: ((callable_variable) (array_object_dereferenceable "{" expr
"}"))
+;; Production 508: ((callable_variable) (array_object_dereferenceable
T_OBJECT_OPERATOR property_name argument_list))
+;; Production 509: ((callable_variable) (array_object_dereferenceable
T_NULLSAFE_OBJECT_OPERATOR property_name argument_list))
+;; Production 510: ((callable_variable) (function_call))
+;; Production 511: ((variable) (callable_variable))
+;; Production 512: ((variable) (static_member))
+;; Production 513: ((variable) (array_object_dereferenceable T_OBJECT_OPERATOR
property_name))
+;; Production 514: ((variable) (array_object_dereferenceable
T_NULLSAFE_OBJECT_OPERATOR property_name))
+;; Production 515: ((simple_variable) (T_VARIABLE))
+;; Production 516: ((simple_variable) ("$" "{" expr "}"))
+;; Production 517: ((simple_variable) ("$" simple_variable))
+;; Production 518: ((static_member) (class_name T_PAAMAYIM_NEKUDOTAYIM
simple_variable))
+;; Production 519: ((static_member) (variable_class_name
T_PAAMAYIM_NEKUDOTAYIM simple_variable))
+;; Production 520: ((new_variable) (simple_variable))
+;; Production 521: ((new_variable) (new_variable "[" optional_expr "]"))
+;; Production 522: ((new_variable) (new_variable "{" expr "}"))
+;; Production 523: ((new_variable) (new_variable T_OBJECT_OPERATOR
property_name))
+;; Production 524: ((new_variable) (new_variable T_NULLSAFE_OBJECT_OPERATOR
property_name))
+;; Production 525: ((new_variable) (class_name T_PAAMAYIM_NEKUDOTAYIM
simple_variable))
+;; Production 526: ((new_variable) (new_variable T_PAAMAYIM_NEKUDOTAYIM
simple_variable))
+;; Production 527: ((member_name) (identifier))
+;; Production 528: ((member_name) ("{" expr "}"))
+;; Production 529: ((member_name) (simple_variable))
+;; Production 530: ((property_name) (T_STRING))
+;; Production 531: ((property_name) ("{" expr "}"))
+;; Production 532: ((property_name) (simple_variable))
+;; Production 533: ((array_pair_list) (non_empty_array_pair_list))
+;; Production 534: ((possible_array_pair) (%empty))
+;; Production 535: ((possible_array_pair) (array_pair))
+;; Production 536: ((non_empty_array_pair_list) (non_empty_array_pair_list ","
possible_array_pair))
+;; Production 537: ((non_empty_array_pair_list) (possible_array_pair))
+;; Production 538: ((array_pair) (expr T_DOUBLE_ARROW expr))
+;; Production 539: ((array_pair) (expr))
+;; Production 540: ((array_pair) (expr T_DOUBLE_ARROW ampersand variable))
+;; Production 541: ((array_pair) (ampersand variable))
+;; Production 542: ((array_pair) (T_ELLIPSIS expr))
+;; Production 543: ((array_pair) (expr T_DOUBLE_ARROW T_LIST "("
array_pair_list ")"))
+;; Production 544: ((array_pair) (T_LIST "(" array_pair_list ")"))
+;; Production 545: ((encaps_list) (encaps_list encaps_var))
+;; Production 546: ((encaps_list) (encaps_list T_ENCAPSED_AND_WHITESPACE))
+;; Production 547: ((encaps_list) (encaps_var))
+;; Production 548: ((encaps_list) (T_ENCAPSED_AND_WHITESPACE encaps_var))
+;; Production 549: ((encaps_var) (T_VARIABLE))
+;; Production 550: ((encaps_var) (T_VARIABLE "[" encaps_var_offset "]"))
+;; Production 551: ((encaps_var) (T_VARIABLE T_OBJECT_OPERATOR T_STRING))
+;; Production 552: ((encaps_var) (T_VARIABLE T_NULLSAFE_OBJECT_OPERATOR
T_STRING))
+;; Production 553: ((encaps_var) (T_DOLLAR_OPEN_CURLY_BRACES expr "}"))
+;; Production 554: ((encaps_var) (T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME
"}"))
+;; Production 555: ((encaps_var) (T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME
"[" expr "]" "}"))
+;; Production 556: ((encaps_var) (T_CURLY_OPEN variable "}"))
+;; Production 557: ((encaps_var_offset) (T_STRING))
+;; Production 558: ((encaps_var_offset) (T_NUM_STRING))
+;; Production 559: ((encaps_var_offset) ("-" T_NUM_STRING))
+;; Production 560: ((encaps_var_offset) (T_VARIABLE))
+;; Production 561: ((internal_functions_in_yacc) (T_ISSET "(" isset_variables
possible_comma ")"))
+;; Production 562: ((internal_functions_in_yacc) (T_EMPTY "(" expr ")"))
+;; Production 563: ((internal_functions_in_yacc) (T_INCLUDE expr))
+;; Production 564: ((internal_functions_in_yacc) (T_INCLUDE_ONCE expr))
+;; Production 565: ((internal_functions_in_yacc) (T_EVAL "(" expr ")"))
+;; Production 566: ((internal_functions_in_yacc) (T_REQUIRE expr))
+;; Production 567: ((internal_functions_in_yacc) (T_REQUIRE_ONCE expr))
+;; Production 568: ((isset_variables) (isset_variable))
+;; Production 569: ((isset_variables) (isset_variables "," isset_variable))
+;; Production 570: ((isset_variable) (expr))
+
+
;;; Code:
;; TODO Add SDT for
@@ -53,7 +628,7 @@
;; top_statement_list -> (top_statement_list top_statement)
(puthash
- 79
+ 83
(lambda(args _terminals)
(if (car args)
(append (car args) (cdr args))
@@ -62,7 +637,7 @@
;; top_statement -> (T_NAMESPACE namespace_declaration_name ";")
(puthash
- 106
+ 111
(lambda(args terminals)
`(
ast-type
@@ -80,7 +655,7 @@
;; top_statement -> (T_NAMESPACE namespace_declaration_name "{"
top_statement_list "}")
(puthash
- 107
+ 112
(lambda(args terminals)
`(
ast-type
@@ -100,14 +675,14 @@
;; top_statement -> (T_NAMESPACE "{" top_statement_list "}")
(puthash
- 108
+ 113
(lambda(args _terminals)
(nth 2 args))
phps-mode-parser--table-translations)
;; inner_statement_list -> (inner_statement_list inner_statement)
(puthash
- 134
+ 139
(lambda(args _terminals)
(if (car args)
(append (car args) (cdr args))
@@ -116,14 +691,14 @@
;; statement -> ("{" inner_statement_list "}")
(puthash
- 140
+ 145
(lambda(args _terminals)
(nth 1 args))
phps-mode-parser--table-translations)
;; statement -> (T_WHILE "(" expr ")" while_statement)
(puthash
- 143
+ 148
(lambda(args _terminals)
`(
ast-type
@@ -137,7 +712,7 @@
;; statement -> (T_DO statement T_WHILE "(" expr ")" ";")
(puthash
- 144
+ 149
(lambda(args _terminals)
`(
ast-type
@@ -151,7 +726,7 @@
;; statement -> (T_FOR "(" for_exprs ";" for_exprs ";" for_exprs ")"
for_statement)
(puthash
- 145
+ 150
(lambda(args _terminals)
`(
ast-type
@@ -169,7 +744,7 @@
;; statement -> (T_RETURN optional_expr ";")
(puthash
- 149
+ 154
(lambda(args _terminals)
`(
ast-type
@@ -181,7 +756,7 @@
;; statement -> (T_GLOBAL global_var_list ";")
(puthash
- 150
+ 155
(lambda(args _terminals)
`(
ast-type
@@ -193,7 +768,7 @@
;; statement -> (T_STATIC static_var_list ";")
(puthash
- 151
+ 156
(lambda(args _terminals)
`(
ast-type
@@ -205,7 +780,7 @@
;; statement -> (T_ECHO echo_expr_list ";")
(puthash
- 152
+ 157
(lambda(args _terminals)
`(
ast-type
@@ -217,14 +792,14 @@
;; statement -> (expr ";")
(puthash
- 154
+ 159
(lambda(args _terminals)
(nth 0 args))
phps-mode-parser--table-translations)
;; statement -> (T_FOREACH "(" expr T_AS foreach_variable ")"
foreach_statement)
(puthash
- 156
+ 161
(lambda(args _terminals)
`(
ast-type
@@ -238,9 +813,9 @@
))
phps-mode-parser--table-translations)
-;; 157: statement -> (T_FOREACH "(" expr T_AS foreach_variable T_DOUBLE_ARROW
foreach_variable ")" foreach_statement)
+;; statement -> (T_FOREACH "(" expr T_AS foreach_variable T_DOUBLE_ARROW
foreach_variable ")" foreach_statement)
(puthash
- 157
+ 162
(lambda(args _terminals)
`(
ast-type
@@ -258,7 +833,7 @@
;; statement -> (T_TRY "{" inner_statement_list "}" catch_list
finally_statement)
(puthash
- 160
+ 165
(lambda(args _terminals)
`(
ast-type
@@ -274,7 +849,7 @@
;; catch_list -> (catch_list T_CATCH "(" catch_name_list optional_variable ")"
"{" inner_statement_list "}")
(puthash
- 164
+ 169
(lambda(args terminals)
`(
ast-type
@@ -294,7 +869,7 @@
;; function_declaration_statement -> (function returns_ref T_STRING
backup_doc_comment "(" parameter_list ")" return_type backup_fn_flags "{"
inner_statement_list "}" backup_fn_flags)
(puthash
- 174
+ 179
(lambda(args terminals)
`(
ast-type
@@ -318,9 +893,35 @@
))
phps-mode-parser--table-translations)
+;; class_declaration_statement -> (class_modifiers T_CLASS T_STRING
extends_from implements_list backup_doc_comment "{" class_statement_list "}")
+(puthash
+ 184
+ (lambda(args terminals)
+ `(
+ ast-type
+ class
+ modifiers
+ ,(nth 0 args)
+ name
+ ,(nth 2 args)
+ extends
+ ,(phps-mode-parser-sdt--get-list-of-object (nth 3 args))
+ implements
+ ,(phps-mode-parser-sdt--get-list-of-object (nth 4 args))
+ index
+ ,(car (cdr (nth 2 terminals)))
+ start
+ ,(car (cdr (nth 6 terminals)))
+ end
+ ,(car (cdr (nth 8 terminals)))
+ children
+ ,(phps-mode-parser-sdt--get-list-of-object (nth 7 args))
+ ))
+ phps-mode-parser--table-translations)
+
;; class_declaration_statement -> (T_CLASS T_STRING extends_from
implements_list backup_doc_comment "{" class_statement_list "}")
(puthash
- 180
+ 185
(lambda(args terminals)
`(
ast-type
@@ -344,7 +945,7 @@
;; interface_declaration_statement -> (T_INTERFACE T_STRING
interface_extends_list backup_doc_comment "{" class_statement_list "}")
(puthash
- 186
+ 191
(lambda(args terminals)
`(
ast-type
@@ -366,7 +967,7 @@
;; extends_from -> (%empty)
(puthash
- 187
+ 198
(lambda(_args _terminals)
nil
)
@@ -374,14 +975,14 @@
;; extends_from -> (T_EXTENDS class_name)
(puthash
- 188
+ 199
(lambda(args _terminals)
(nth 1 args))
phps-mode-parser--table-translations)
-;; foreach_variable -> ("&" variable)
+;; foreach_variable -> (ampersand variable)
(puthash
- 194
+ 205
(lambda(args _terminals)
`(
ast-type
@@ -393,7 +994,7 @@
;; if_stmt_without_else -> (T_IF "(" expr ")" statement)
(puthash
- 223
+ 234
(lambda(args _terminals)
`(
ast-type
@@ -405,30 +1006,30 @@
))
phps-mode-parser--table-translations)
-;; 231: parameter_list -> (non_empty_parameter_list possible_comma)
+;; parameter_list -> (non_empty_parameter_list possible_comma)
(puthash
- 231
+ 242
(lambda(args _terminals)
(nth 0 args))
phps-mode-parser--table-translations)
-; 233: non_empty_parameter_list -> (attributed_parameter)
+;; non_empty_parameter_list -> (attributed_parameter)
(puthash
- 233
+ 244
(lambda(args _terminals)
(list args))
phps-mode-parser--table-translations)
-; 234: non_empty_parameter_list -> (non_empty_parameter_list ","
attributed_parameter)
+;; non_empty_parameter_list -> (non_empty_parameter_list ","
attributed_parameter)
(puthash
- 234
+ 245
(lambda(args _terminals)
(append (nth 0 args) (list (nth 2 args))))
phps-mode-parser--table-translations)
-;; 241: parameter -> (optional_visibility_modifier
optional_type_without_static is_reference is_variadic T_VARIABLE
backup_doc_comment)
+;; parameter -> (optional_property_modifiers optional_type_without_static
is_reference is_variadic T_VARIABLE backup_doc_comment)
(puthash
- 241
+ 254
(lambda(args terminals)
`(
ast-type
@@ -450,9 +1051,9 @@
))
phps-mode-parser--table-translations)
-;; 242: parameter -> (optional_visibility_modifier
optional_type_without_static is_reference is_variadic T_VARIABLE
backup_doc_comment "=" expr)
+;; parameter -> (optional_property_modifiers optional_type_without_static
is_reference is_variadic T_VARIABLE backup_doc_comment "=" expr)
(puthash
- 242
+ 255
(lambda(args terminals)
`(
ast-type
@@ -478,37 +1079,37 @@
))
phps-mode-parser--table-translations)
-;; 262: argument_list -> ("(" ")")
+;; argument_list -> ("(" ")")
(puthash
- 262
+ 281
(lambda(_args _terminals)
nil)
phps-mode-parser--table-translations)
-;; 263: argument_list -> ("(" non_empty_argument_list possible_comma ")")
+;; argument_list -> ("(" non_empty_argument_list possible_comma ")")
(puthash
- 263
+ 282
(lambda(args _terminals)
(nth 1 args))
phps-mode-parser--table-translations)
;; static_var_list -> (static_var_list "," static_var)
(puthash
- 272
+ 292
(lambda(args _terminals)
(append (nth 0 args) (list (nth 2 args))))
phps-mode-parser--table-translations)
;; static_var_list -> (static_var)
(puthash
- 273
+ 293
(lambda(args _terminals)
(list args))
phps-mode-parser--table-translations)
;; static_var -> (T_VARIABLE)
(puthash
- 274
+ 292
(lambda(args terminals)
`(
ast-type
@@ -526,7 +1127,7 @@
;; static_var -> (T_VARIABLE "=" expr)
(puthash
- 275
+ 295
(lambda(args terminals)
`(
ast-type
@@ -546,7 +1147,7 @@
;; class_statement_list -> (class_statement_list class_statement)
(puthash
- 276
+ 296
(lambda(args _terminals)
(if (car args)
(append (car args) (cdr args))
@@ -555,7 +1156,7 @@
;; attributed_class_statement -> (variable_modifiers
optional_type_without_static property_list ";")
(puthash
- 278
+ 299
(lambda(args terminals)
`(
ast-type
@@ -575,7 +1176,7 @@
;; attributed_class_statement -> (method_modifiers function returns_ref
identifier backup_doc_comment "(" parameter_list ")" return_type
backup_fn_flags method_body backup_fn_flags)
(puthash
- 280
+ 300
(lambda(args terminals)
`(
ast-type
@@ -607,79 +1208,79 @@
))
phps-mode-parser--table-translations)
-;; 301: method_body -> (";")
+;; method_body -> (";")
(puthash
- 301
+ 322
(lambda(_args _terminals)
nil)
phps-mode-parser--table-translations)
-;; 302: method_body -> ("{" inner_statement_list "}")
+;; method_body -> ("{" inner_statement_list "}")
(puthash
- 302
+ 323
(lambda(args _terminals)
(nth 1 args))
phps-mode-parser--table-translations)
-;; 304: variable_modifiers -> (T_VAR)
+;; variable_modifiers -> (T_VAR)
(puthash
- 304
+ 325
(lambda(_args _terminals)
'public)
phps-mode-parser--table-translations)
-;; 309: member_modifier -> (T_PUBLIC)
+;; member_modifier -> (T_PUBLIC)
(puthash
- 309
+ 330
(lambda(_args _terminals)
'public)
phps-mode-parser--table-translations)
-;; 310: member_modifier -> (T_PROTECTED)
+;; member_modifier -> (T_PROTECTED)
(puthash
- 310
+ 331
(lambda(_args _terminals)
'protected)
phps-mode-parser--table-translations)
-;; 311: member_modifier -> (T_PRIVATE)
+;; member_modifier -> (T_PRIVATE)
(puthash
- 311
+ 332
(lambda(_args _terminals)
'private)
phps-mode-parser--table-translations)
-;; 312: member_modifier -> (T_STATIC)
+;; member_modifier -> (T_STATIC)
(puthash
- 312
+ 333
(lambda(_args _terminals)
'static)
phps-mode-parser--table-translations)
-;; 313: member_modifier -> (T_ABSTRACT)
+;; member_modifier -> (T_ABSTRACT)
(puthash
- 313
+ 334
(lambda(_args _terminals)
'abstract)
phps-mode-parser--table-translations)
-;; 314: member_modifier -> (T_FINAL)
+;; member_modifier -> (T_FINAL)
(puthash
- 314
+ 335
(lambda(_args _terminals)
'final)
phps-mode-parser--table-translations)
;; property -> (T_VARIABLE backup_doc_comment)
(puthash
- 317
+ 339
(lambda(args _terminals)
(nth 0 args))
phps-mode-parser--table-translations)
;; property -> (T_VARIABLE "=" expr backup_doc_comment)
(puthash
- 318
+ 340
(lambda(args terminals)
`(
ast-type
@@ -699,7 +1300,7 @@
;; expr -> ("[" array_pair_list "]" "=" expr)
(puthash
- 336
+ 358
(lambda(args _terminals)
`(
ast-type
@@ -713,7 +1314,7 @@
;; expr -> (variable "=" expr)
(puthash
- 337
+ 359
(lambda(args terminals)
`(
ast-type
@@ -733,7 +1334,7 @@
;; expr -> (variable T_INC)
(puthash
- 353
+ 375
(lambda(args _terminals)
`(
ast-type
@@ -745,7 +1346,7 @@
;; expr -> (expr T_BOOLEAN_OR expr)
(puthash
- 357
+ 379
(lambda(args _terminals)
`(
ast-type
@@ -759,7 +1360,7 @@
;; expr -> (expr T_BOOLEAN_AND expr)
(puthash
- 358
+ 380
(lambda(args _terminals)
`(
ast-type
@@ -773,7 +1374,7 @@
;; expr -> (expr T_LOGICAL_OR expr)
(puthash
- 359
+ 381
(lambda(args _terminals)
`(
ast-type
@@ -787,7 +1388,7 @@
;; expr -> (expr T_LOGICAL_AND expr)
(puthash
- 360
+ 382
(lambda(args _terminals)
`(
ast-type
@@ -801,7 +1402,7 @@
;; expr -> (expr T_LOGICAL_XOR expr)
(puthash
- 361
+ 383
(lambda(args _terminals)
`(
ast-type
@@ -815,7 +1416,7 @@
;; expr -> (expr "." expr)
(puthash
- 365
+ 388
(lambda(args _terminals)
`(
ast-type
@@ -829,7 +1430,7 @@
;; expr -> (expr "+" expr)
(puthash
- 366
+ 397
(lambda(args _terminals)
`(
ast-type
@@ -843,7 +1444,7 @@
;; expr -> ("!" expr)
(puthash
- 376
+ 399
(lambda(args _terminals)
`(
ast-type
@@ -855,7 +1456,7 @@
;; expr -> (T_STATIC inline_function)
(puthash
- 413
+ 436
(lambda(args _terminals)
`(
'ast-type
@@ -867,7 +1468,7 @@
;; inline_function -> (function returns_ref backup_doc_comment "("
parameter_list ")" lexical_vars return_type backup_fn_flags "{"
inner_statement_list "}" backup_fn_flags)
(puthash
- 416
+ 439
(lambda(args terminals)
`(
ast-type
@@ -897,7 +1498,7 @@
;; inline_function -> (fn returns_ref backup_doc_comment "(" parameter_list
")" return_type T_DOUBLE_ARROW backup_fn_flags backup_lex_pos expr
backup_fn_flags)
(puthash
- 417
+ 440
(lambda(args terminals)
`(
ast-type
@@ -927,14 +1528,14 @@
;; lexical_vars -> (T_USE "(" lexical_var_list possible_comma ")")
(puthash
- 426
+ 449
(lambda(args _terminals)
(nth 2 args))
phps-mode-parser--table-translations)
;; lexical_var -> (T_VARIABLE)
(puthash
- 429
+ 452
(lambda(args terminals)
`(
ast-type
@@ -950,7 +1551,7 @@
;; function_call -> (name argument_list)
(puthash
- 431
+ 454
(lambda(args _terminals)
`(
ast-type
@@ -964,7 +1565,7 @@
;; dereferencable_scalar -> (T_ARRAY "(" array_pair_list ")")
(puthash
- 447
+ 470
(lambda(args _terminals)
`(
ast-type
@@ -976,28 +1577,28 @@
;; dereferencable_scalar -> (T_CONSTANT_ENCAPSED_STRING)
(puthash
- 449
+ 472
(lambda(args _terminals)
(substring args 1 -1))
phps-mode-parser--table-translations)
;; scalar -> (T_LNUMBER)
(puthash
- 451
+ 474
(lambda(args _terminals)
(string-to-number args))
phps-mode-parser--table-translations)
-;; scalar -> (T_T_DNUMBER)
+;; scalar -> (T_DNUMBER)
(puthash
- 452
+ 475
(lambda(args _terminals)
(string-to-number args))
phps-mode-parser--table-translations)
-;; callable_variable -> (array_object_dereferencable "[" optional_expr "]")
+;; callable_variable -> (array_object_dereferenceable "[" optional_expr "]")
(puthash
- 483
+ 506
(lambda(args _terminals)
`(
ast-type
@@ -1008,15 +1609,48 @@
))
phps-mode-parser--table-translations)
+;; callable_variable -> (array_object_dereferenceable "{" expr "}")
+(puthash
+ 507
+ (lambda(args _terminals)
+ `(
+ ast-type
+ callable-variable
+ array-object-dereferencable
+ expr
+ ,(phps-mode-parser-sdt--get-list-of-object (nth 2 args))
+ ))
+ phps-mode-parser--table-translations)
+
;; callable_variable -> (array_object_dereferencable T_OBJECT_OPERATOR
property_name argument_list)
(puthash
- 485
+ 508
+ (lambda(args _terminals)
+ `(
+ ast-type
+ callable-variable
+ array-object-dereferencable
+ ,(nth 0 args)
+ operator
+ object-operator
+ property-name
+ ,(nth 2 args)
+ argument-list
+ ,(phps-mode-parser-sdt--get-list-of-object (nth 3 args))
+ ))
+ phps-mode-parser--table-translations)
+
+;; callable_variable -> (array_object_dereferenceable
T_NULLSAFE_OBJECT_OPERATOR property_name argument_list)
+(puthash
+ 509
(lambda(args _terminals)
`(
ast-type
callable-variable
array-object-dereferencable
,(nth 0 args)
+ operator
+ nullsafe-object-operator
property-name
,(nth 2 args)
argument-list
@@ -1024,15 +1658,37 @@
))
phps-mode-parser--table-translations)
-;; 490: variable -> (array_object_dereferencable T_OBJECT_OPERATOR
property_name)
+;; variable -> (array_object_dereferencable T_OBJECT_OPERATOR property_name)
(puthash
- 490
+ 513
(lambda(args terminals)
`(
ast-type
+ variable
array-object-dereferencable
- subject
,(nth 0 args)
+ operator
+ object-operator
+ property-name
+ ,(nth 2 args)
+ property-start
+ ,(car (cdr (nth 2 terminals)))
+ property-end
+ ,(cdr (cdr (nth 2 terminals)))
+ ))
+ phps-mode-parser--table-translations)
+
+;; variable -> (array_object_dereferenceable T_NULLSAFE_OBJECT_OPERATOR
property_name)
+(puthash
+ 514
+ (lambda(args terminals)
+ `(
+ ast-type
+ variable
+ array-object-dereferencable
+ ,(nth 0 args)
+ operator
+ nullsafe-object-operator
property-name
,(nth 2 args)
property-start
@@ -1044,7 +1700,7 @@
;; simple_variable -> (T_VARIABLE)
(puthash
- 492
+ 515
(lambda(args terminals)
`(
ast-type
@@ -1060,7 +1716,7 @@
;; static_member -> (class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable)
(puthash
- 495
+ 518
(lambda(args terminals)
`(
ast-type
@@ -1076,9 +1732,27 @@
))
phps-mode-parser--table-translations)
+;; static_member -> (variable_class_name T_PAAMAYIM_NEKUDOTAYIM
simple_variable)
+(puthash
+ 519
+ (lambda(args terminals)
+ `(
+ ast-type
+ static-member
+ variable-class-name
+ ,(nth 0 args)
+ member
+ ,(nth 2 args)
+ start
+ ,(car (cdr (nth 0 terminals)))
+ end
+ ,(cdr (cdr (nth 0 terminals)))
+ ))
+ phps-mode-parser--table-translations)
+
;; non_empty_array_pair_list -> (non_empty_array_pair_list ","
possible_array_pair)
(puthash
- 513
+ 536
(lambda(args _terminals)
(if (nth 2 args)
(append (nth 0 args) (list (nth 2 args)))
@@ -1087,14 +1761,14 @@
;; non_empty_array_pair_list -> (possible_array_pair)
(puthash
- 514
+ 537
(lambda(args _terminals)
(list args))
phps-mode-parser--table-translations)
;; internal_functions_in_yacc -> (T_ISSET "(" isset_variables possible_comma
")")
(puthash
- 538
+ 561
(lambda(args _terminals)
`(
ast-type
@@ -1106,7 +1780,7 @@
;; internal_functions_in_yacc -> (T_EMPTY "(" expr ")")
(puthash
- 539
+ 562
(lambda(args _terminals)
`(
ast-type
@@ -1118,21 +1792,21 @@
;; isset_variables -> (isset_variable)
(puthash
- 545
+ 568
(lambda(args _terminals)
args)
phps-mode-parser--table-translations)
;; isset_variables -> (isset_variables "," isset_variable)
(puthash
- 546
+ 569
(lambda(args _terminals)
(append (nth 0 args) (nth 2 args)))
phps-mode-parser--table-translations)
;; isset_variable -> (expr)
(puthash
- 547
+ 570
(lambda(args _terminals)
(list args))
phps-mode-parser--table-translations)
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index dfc4d868b4..bab8269a7b 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -10,6 +10,7 @@
;;; Code:
+
(require 'ert)
(require 'phps-mode)
(require 'phps-mode-ast)
@@ -23,17 +24,18 @@
buffer-contents
name
(lambda()
- ;; (let ((parse (phps-mode-parser-parse)))
- ;; (message "Left-to-right with right-most derivation:\n%S\n" parse)
- ;; (dolist (production-number (reverse parse))
- ;; (let ((production
- ;; (phps-mode-parser--get-grammar-production-by-number
- ;; production-number)))
- ;; (message
- ;; "%d: %S -> %S"
- ;; production-number
- ;; (car (car production))
- ;; (car (cdr production))))))
+ (let ((parse (phps-mode-parser-parse)))
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
+ (dolist (production-number (reverse parse))
+ (let ((production
+ (phps-mode-parser--get-grammar-production-by-number
+ production-number)))
+ (message
+ "%d: %S -> %S"
+ production-number
+ (car (car production))
+ (car (cdr production))))))
+ (message "\n")
(phps-mode-ast--generate)
(phps-mode-ast-bookkeeping--generate)
(message "bookkeeping: %S" (phps-mode-test--hash-to-list
@@ -46,6 +48,31 @@
t)
bookkeeping)))))
+(defun phps-mode-test-ast--should-imenu (buffer-contents name imenu)
+ (phps-mode-test-ast--buffer-contents
+ buffer-contents
+ name
+ (lambda()
+ (let ((parse (phps-mode-parser-parse)))
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
+ (dolist (production-number (reverse parse))
+ (let ((production
+ (phps-mode-parser--get-grammar-production-by-number
+ production-number)))
+ (message
+ "%d: %S -> %S"
+ production-number
+ (car (car production))
+ (car (cdr production))))))
+ (message "\n")
+ (phps-mode-ast--generate)
+ (phps-mode-ast-imenu--generate)
+ (message "imenu: %S" phps-mode-ast-imenu--index)
+ (should
+ (equal
+ phps-mode-ast-imenu--index
+ imenu)))))
+
(defun phps-mode-test-ast--buffer-contents (buffer-contents name logic)
(with-temp-buffer
;; Setup buffer
@@ -99,157 +126,76 @@
"Run test for imenu generation."
(message "-- Running tests for imenu generation... --\n")
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nclass myClass\n{\n\n public function myFunction1()\n {\n
echo \"my string with variable {$variable} inside it\";\n }\n\n public
function myFunction2()\n {\n }\n\n}"
"Imenu generated via parser SDT for simple class"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should (equal
- phps-mode-ast-imenu--index
- '(("myClass" ("myFunction1" . 44) ("myFunction2" . 153)))))))
+ '(("myClass" ("myFunction1" . 44) ("myFunction2" . 153))))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\ninterface myInterface {\n public function myFunctionA() {}\n
protected function myFunctionB() {}\n}\n"
"Imenu generated via parser SDT for interface"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should (equal
- phps-mode-ast-imenu--index
- '(("myInterface" . (("myFunctionA" . 51) ("myFunctionB" .
91))))))))
+ '(("myInterface" . (("myFunctionA" . 51) ("myFunctionB" . 91)))))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n$var =
function () {\n echo 'here';\n};"
"Imenu generated via parser SDT for function-oriented file without
namespace"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should (equal
- phps-mode-ast-imenu--index
- '(("myFunctionA" . 16) ("myFunctionB" . 42))))))
+ '(("myFunctionA" . 16) ("myFunctionB" . 42)))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\n\nnamespace MyNamespace;\n\nfunction aFunction() {\n /**\n *
With some contents\n */\n}\n\nclass MyClass\n{\n\n /**\n *\n
*/\n public function __construct()\n {\n if ($test) {\n }\n
}\n\n /**\n *\n */\n public function myFunction1()\n {\n
$this->addMessage(\"My random {$message} here\" . ($random > 1 ? \"A\" :
\"\") . \" was here.\");\n }\n \n /**\n *\n */\n public
function myFunction2()\n [...]
"Passed imenu-generation via parser AST for basic object oriented file"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("MyNamespace" ("aFunction" . 41) ("MyClass" ("__construct" . 160)
("myFunction1" . 261) ("myFunction2" . 433) ("myFunction3" . 513)
("myFunction4" . 583))))))))
+ '(("MyNamespace" ("aFunction" . 41) ("MyClass" ("__construct" . 160)
("myFunction1" . 261) ("myFunction2" . 433) ("myFunction3" . 513)
("myFunction4" . 583)))))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\n\nnamespace MyNamespaceA\n{\n function aFunctionA() {\n
/**\n * With some contents\n */\n }\n class MyClass\n
{\n\n /**\n *\n */\n public function
__construct()\n {\n if ($test) {\n }\n
}\n\n /**\n *\n */\n public function
myFunction1()\n {\n $this->addMessage(\"My random {$message}
here\" . ($random > 1 ? \"A\" : \"\") . \" was h [...]
"Passed imenu-generation via parser AST for advanced object oriented file"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("MyNamespaceA" ("aFunctionA" . 46) ("MyClass" ("__construct" . 205)
("myFunction1" . 338) ("myFunction2" . 542) ("myFunction3" . 646)
("myFunction4" . 740))) ("aFunctionB" . 807) ("MyClass" ("__construct" . 925)
("myFunction1" . 1058) ("myFunction2" . 1262) ("myFunction3" . 1366)
("myFunction4" . 1460)))))))
+ '(("MyNamespaceA" ("aFunctionA" . 46) ("MyClass" ("__construct" . 205)
("myFunction1" . 338) ("myFunction2" . 542) ("myFunction3" . 646)
("myFunction4" . 740))) ("aFunctionB" . 807) ("MyClass" ("__construct" . 925)
("myFunction1" . 1058) ("myFunction2" . 1262) ("myFunction3" . 1366)
("myFunction4" . 1460))))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nnamespace myNamespace {\n class myClass extends myAbstract {\n
public function myFunctionA() {}\n protected function myFunctionB()
{}\n }\n}\n"
"Imenu object-oriented file with namespace, class that extends and
functions"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("myNamespace" ("myClass" ("myFunctionA" . 94) ("myFunctionB" .
138))))))))
+ '(("myNamespace" ("myClass" ("myFunctionA" . 94) ("myFunctionB" . 138)))))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements
myInterface {\n public function myFunctionA() {}\n protected function
myFunctionB() {}\n}\n"
"Imenu object-oriented file with bracket-less namespace, class that extends
and implements and functions"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" .
148))))))))
+ '(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" . 148)))))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nclass myClass {}"
"Imenu empty class"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("myClass" . 13))))))
+ '(("myClass" . 13)))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nnamespace myNamespace {}"
"Imenu empty bracketed namespace"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("myNamespace" . 17))))))
+ '(("myNamespace" . 17)))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nnamespace myNamespace;"
"Imenu empty namespace without brackets"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("myNamespace" . 17))))))
+ '(("myNamespace" . 17)))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements
myInterface {\n public function myFunctionA($myArg = null) {}\n protected
function myFunctionB($myArg = 'abc') {}\n}\n"
"Imenu object-oriented file with bracket-less namespace, class that extends
and implements and functions with optional arguments"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" .
161))))))))
+ '(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" . 161)))))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nnamespace myNamespace\\myNamespace2;\nclass myClass extends
myAbstract implements myInterface {\n public function myFunctionA($myArg =
null) {}\n protected function myFunctionB($myArg = 'abc') {}\n}\n"
"Imenu object-oriented file with bracket-less namespace with multiple
levels, class that extends and implements and functions with optional arguments"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- '(("myNamespace\\myNamespace2" ("myClass" ("myFunctionA" . 121)
("myFunctionB" . 174))))))))
+ '(("myNamespace\\myNamespace2" ("myClass" ("myFunctionA" . 121)
("myFunctionB" . 174)))))
- (phps-mode-test-ast--buffer-contents
+ (phps-mode-test-ast--should-imenu
"<?php\nnamespace {}"
"Imenu empty unnamed bracketed namespace"
- (lambda()
- (phps-mode-ast--generate)
- (phps-mode-ast-imenu--generate)
- (should
- (equal
- phps-mode-ast-imenu--index
- nil))))
+ nil)
;; TODO Make this test pass
- ;; (phps-mode-test-ast--buffer-contents
+ ;; (phps-mode-test-ast--should-imenu
;; "<?php\n\nnamespace myNamespace;\n\nif (!function_exists('myFunction'))
{\n function myFunction() {\n if (!class_exists('myClassA')) {\n
class myClassA {\n public function myMethodA()\n
{\n \n }\n }\n }\n
}\n}\n\nif (!class_exists('myClassB')) {\n class myClassB\n {\n
function myMethodB()\n {\n }\n }\n}"
;; "Imenu for conditionally declared function and class"
- ;; (lambda()
- ;; (phps-mode-ast--generate)
- ;; (phps-mode-ast-imenu--generate)
- ;; (should
- ;; (equal
- ;; phps-mode-ast-imenu--index
- ;; '(("myNamespace" ("myFunction" . 183) ("myClassA" ("myMethodA" .
200)) ("myClassB" . ("myMethodB" . 377))))))))
+ ;; '(("myNamespace" ("myFunction" . 183) ("myClassA" ("myMethodA" . 200))
("myClassB" . ("myMethodB" . 377)))))
(message "\n-- Ran tests for imenu generation. --"))
diff --git a/test/phps-mode-test-parser.el b/test/phps-mode-test-parser.el
index 03bebe3f84..92f59c5aca 100644
--- a/test/phps-mode-test-parser.el
+++ b/test/phps-mode-test-parser.el
@@ -76,7 +76,7 @@
(let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
- (dolist (production-number parse)
+ (dolist (production-number (reverse parse))
(let ((production
(phps-mode-parser--get-grammar-production-by-number
production-number)))
@@ -129,7 +129,7 @@
(lambda()
(let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
- (dolist (production-number parse)
+ (dolist (production-number (reverse parse))
(let ((production
(phps-mode-parser--get-grammar-production-by-number
production-number)))
@@ -150,7 +150,7 @@
(lambda()
(let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
- (dolist (production-number parse)
+ (dolist (production-number (reverse parse))
(let ((production
(phps-mode-parser--get-grammar-production-by-number
production-number)))
@@ -171,7 +171,7 @@
(lambda()
(let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
- (dolist (production-number parse)
+ (dolist (production-number (reverse parse))
(let ((production
(phps-mode-parser--get-grammar-production-by-number
production-number)))
@@ -192,7 +192,7 @@
(lambda()
(let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
- (dolist (production-number parse)
+ (dolist (production-number (reverse parse))
(let ((production
(phps-mode-parser--get-grammar-production-by-number
production-number)))
@@ -213,7 +213,7 @@
(lambda()
(let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
- (dolist (production-number parse)
+ (dolist (production-number (reverse parse))
(let ((production
(phps-mode-parser--get-grammar-production-by-number
production-number)))
- [elpa] externals/phps-mode 2122f23ad1 01/15: Added failing indentation case, (continued)
- [elpa] externals/phps-mode 2122f23ad1 01/15: Added failing indentation case, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode 924fb345ec 06/15: Minor tweaks in parser generation automation, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode b82471b38a 09/15: Removed TODO item, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode 85eed0d30e 07/15: Updated parser to PHP 8.1, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode bc2ecad56a 11/15: More work on PHP 8.1, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode b5fcf0e7b7 02/15: Updated automation for PHP 8.1, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode 3e1142c30c 14/15: Passing bookkeeping tests with PHP 8.1 parser and AST, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode be18349ec9 15/15: Updated version, date and TODO, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode fe89129aaa 03/15: More work on PHP 8.1 automation, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode 10336eed90 08/15: Parser now handles multiple alternative cases switch case statement, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode d7ae56f698 10/15: Passing imenu-tests for PHP 8.1,
Christian Johansson <=
- [elpa] externals/phps-mode faf6632911 13/15: Improved SDT for more infix operators, Christian Johansson, 2022/02/26
- [elpa] externals/phps-mode 16ec02520a 12/15: Fixed ampersand in lexer, Christian Johansson, 2022/02/26