(defun dojo-js2-node-to-string (node) (concat (format "[%s:%s:%s:%s]" (js2-node-short-name node) (js2-node-abs-pos node) (js2-node-abs-end node) (cond ((dojo-has-node-type node "js2-prop-get-node") (dojo-js2-infix-node-to-string node)) ((dojo-has-node-type node "js2-infix-node") (dojo-js2-infix-node-to-string node)) ((dojo-has-node-type node "js2-keyword-node") (dojo-js2-keyword-node-to-string node)) ((dojo-has-node-type node "js2-name-node") (dojo-js2-name-node-to-string node)) (t (format "Unrecognized node type: [%s]" (js2-node-short-name node))) ) ) ) ) (defun dojo-js2-infix-node-to-string (node) (concat (if (null (js2-infix-node-left node)) "[null]" (format "[%s]" (dojo-js2-node-to-string (js2-infix-node-left node)))) (format "[%s]" (dojo-js2-node-type-to-string (js2-infix-node-type node))) (if (null (js2-infix-node-right node)) "[null]" (format "[%s]" (dojo-js2-node-to-string (js2-infix-node-right node)))) ) ) (defun dojo-js2-keyword-node-to-string (node) (dojo-js2-node-type-to-string (js2-node-type node)) ) (defun dojo-js2-name-node-to-string (node) (concat (format "[%s:%s:%s:%s]" (js2-node-short-name node) (js2-node-abs-pos node) (js2-node-abs-end node) (dojo-get-name-from-name-node node)))) ;(defun dojo-js2-labeled-stmt-node-to-string (node) ;) (defun dojo-js2-node-type-to-string (type) (cond ((= type js2-ERROR) "js2-ERROR") ((= type js2-EOF) "js2-EOF") ((= type js2-EOL) "js2-EOL") ((= type js2-ENTERWITH) "js2-ENTERWITH") ((= type js2-LEAVEWITH) "js2-LEAVEWITH") ((= type js2-RETURN) "js2-RETURN") ((= type js2-GOTO) "js2-GOTO") ((= type js2-IFEQ) "js2-IFEQ") ((= type js2-IFNE) "js2-IFNE") ((= type js2-SETNAME) "js2-SETNAME") ((= type js2-BITOR) "js2-BITOR") ((= type js2-BITXOR) "js2-BITXOR") ((= type js2-BITAND) "js2-BITAND") ((= type js2-EQ) "js2-EQ") ((= type js2-NE) "js2-NE") ((= type js2-LT) "js2-LT") ((= type js2-LE) "js2-LE") ((= type js2-GT) "js2-GT") ((= type js2-GE) "js2-GE") ((= type js2-LSH) "js2-LSH") ((= type js2-RSH) "js2-RSH") ((= type js2-URSH) "js2-URSH") ((= type js2-ADD) "js2-ADD") ((= type js2-SUB) "js2-SUB") ((= type js2-MUL) "js2-MUL") ((= type js2-DIV) "js2-DIV") ((= type js2-MOD) "js2-MOD") ((= type js2-NOT) "js2-NOT") ((= type js2-BITNOT) "js2-BITNOT") ((= type js2-POS) "js2-POS") ((= type js2-NEG) "js2-NEG") ((= type js2-NEW) "js2-NEW") ((= type js2-DELPROP) "js2-DELPROP") ((= type js2-TYPEOF) "js2-TYPEOF") ((= type js2-GETPROP) "js2-GETPROP") ((= type js2-GETPROPNOWARN) "js2-GETPROPNOWARN") ((= type js2-SETPROP) "js2-SETPROP") ((= type js2-GETELEM) "js2-GETELEM") ((= type js2-SETELEM) "js2-SETELEM") ((= type js2-CALL) "js2-CALL") ((= type js2-NAME) "js2-NAME") ((= type js2-NUMBER) "js2-NUMBER") ((= type js2-STRING) "js2-STRING") ((= type js2-NULL) "js2-NULL") ((= type js2-THIS) "js2-THIS") ((= type js2-FALSE) "js2-FALSE") ((= type js2-TRUE) "js2-TRUE") ((= type js2-SHEQ) "js2-SHEQ") ((= type js2-SHNE) "js2-SHNE") ((= type js2-REGEXP) "js2-REGEXP") ((= type js2-BINDNAME) "js2-BINDNAME") ((= type js2-THROW) "js2-THROW") ((= type js2-RETHROW) "js2-RETHROW") ((= type js2-IN) "js2-IN") ((= type js2-INSTANCEOF) "js2-INSTANCEOF") ((= type js2-LOCAL_LOAD) "js2-LOCAL_LOAD") ((= type js2-GETVAR) "js2-GETVAR") ((= type js2-SETVAR) "js2-SETVAR") ((= type js2-CATCH_SCOPE) "js2-CATCH_SCOPE") ((= type js2-ENUM_INIT_KEYS) "js2-ENUM_INIT_KEYS") ((= type js2-ENUM_INIT_VALUES) "js2-ENUM_INIT_VALUES") ((= type js2-ENUM_INIT_ARRAY) "js2-ENUM_INIT_ARRAY") ((= type js2-ENUM_NEXT) "js2-ENUM_NEXT") ((= type js2-ENUM_ID) "js2-ENUM_ID") ((= type js2-THISFN) "js2-THISFN") ((= type js2-RETURN_RESULT) "js2-RETURN_RESULT") ((= type js2-ARRAYLIT) "js2-ARRAYLIT") ((= type js2-OBJECTLIT) "js2-OBJECTLIT") ((= type js2-GET_REF) "js2-GET_REF") ((= type js2-SET_REF) "js2-SET_REF") ((= type js2-DEL_REF) "js2-DEL_REF") ((= type js2-REF_CALL) "js2-REF_CALL") ((= type js2-REF_SPECIAL) "js2-REF_SPECIAL") ((= type js2-YIELD) "js2-YIELD") ((= type js2-DEFAULTNAMESPACE) "js2-DEFAULTNAMESPACE") ((= type js2-ESCXMLATTR) "js2-ESCXMLATTR") ((= type js2-ESCXMLTEXT) "js2-ESCXMLTEXT") ((= type js2-REF_MEMBER) "js2-REF_MEMBER") ((= type js2-REF_NS_MEMBER) "js2-REF_NS_MEMBER") ((= type js2-REF_NAME) "js2-REF_NAME") ((= type js2-REF_NS_NAME) "js2-REF_NS_NAME") ((= type js2-first-bytecode) "js2-first-bytecode") ((= type js2-last-bytecode) "js2-last-bytecode") ((= type js2-TRY) "js2-TRY") ((= type js2-SEMI) "js2-SEMI") ((= type js2-LB) "js2-LB") ((= type js2-RB) "js2-RB") ((= type js2-LC) "js2-LC") ((= type js2-RC) "js2-RC") ((= type js2-LP) "js2-LP") ((= type js2-RP) "js2-RP") ((= type js2-COMMA) "js2-COMMA") ((= type js2-ASSIGN) "js2-ASSIGN") ((= type js2-ASSIGN_BITOR) "js2-ASSIGN_BITOR") ((= type js2-ASSIGN_BITXOR) "js2-ASSIGN_BITXOR") ((= type js2-ASSIGN_BITAND) "js2-ASSIGN_BITAND") ((= type js2-ASSIGN_LSH) "js2-ASSIGN_LSH") ((= type js2-ASSIGN_RSH) "js2-ASSIGN_RSH") ((= type js2-ASSIGN_URSH) "js2-ASSIGN_URSH") ((= type js2-ASSIGN_ADD) "js2-ASSIGN_ADD") ((= type js2-ASSIGN_SUB) "js2-ASSIGN_SUB") ((= type js2-ASSIGN_MUL) "js2-ASSIGN_MUL") ((= type js2-ASSIGN_DIV) "js2-ASSIGN_DIV") ((= type js2-ASSIGN_MOD) "js2-ASSIGN_MOD") ((= type js2-ASSIGN_EXPON) "js2-ASSIGN_EXPON") ((= type js2-first-assign) "js2-first-assign") ((= type js2-last-assign) "js2-last-assign") ((= type js2-COLON) "js2-COLON") ((= type js2-OR) "js2-OR") ((= type js2-AND) "js2-AND") ((= type js2-INC) "js2-INC") ((= type js2-DEC) "js2-DEC") ((= type js2-DOT) "js2-DOT") ((= type js2-FUNCTION) "js2-FUNCTION") ((= type js2-EXPORT) "js2-EXPORT") ((= type js2-IMPORT) "js2-IMPORT") ((= type js2-IF) "js2-IF") ((= type js2-ELSE) "js2-ELSE") ((= type js2-SWITCH) "js2-SWITCH") ((= type js2-CASE) "js2-CASE") ((= type js2-DEFAULT) "js2-DEFAULT") ((= type js2-WHILE) "js2-WHILE") ((= type js2-DO) "js2-DO") ((= type js2-FOR) "js2-FOR") ((= type js2-BREAK) "js2-BREAK") ((= type js2-CONTINUE) "js2-CONTINUE") ((= type js2-VAR) "js2-VAR") ((= type js2-WITH) "js2-WITH") ((= type js2-CATCH) "js2-CATCH") ((= type js2-FINALLY) "js2-FINALLY") ((= type js2-VOID) "js2-VOID") ((= type js2-RESERVED) "js2-RESERVED") ((= type js2-EMPTY) "js2-EMPTY") ((= type js2-BLOCK) "js2-BLOCK") ((= type js2-LABEL) "js2-LABEL") ((= type js2-TARGET) "js2-TARGET") ((= type js2-LOOP) "js2-LOOP") ((= type js2-EXPR_VOID) "js2-EXPR_VOID") ((= type js2-EXPR_RESULT) "js2-EXPR_RESULT") ((= type js2-JSR) "js2-JSR") ((= type js2-SCRIPT) "js2-SCRIPT") ((= type js2-TYPEOFNAME) "js2-TYPEOFNAME") ((= type js2-USE_STACK) "js2-USE_STACK") ((= type js2-SETPROP_OP) "js2-SETPROP_OP") ((= type js2-SETELEM_OP) "js2-SETELEM_OP") ((= type js2-LOCAL_BLOCK) "js2-LOCAL_BLOCK") ((= type js2-SET_REF_OP) "js2-SET_REF_OP") ((= type js2-DOTDOT) "js2-DOTDOT") ((= type js2-COLONCOLON) "js2-COLONCOLON") ((= type js2-XML) "js2-XML") ((= type js2-DOTQUERY) "js2-DOTQUERY") ((= type js2-XMLATTR) "js2-XMLATTR") ((= type js2-XMLEND) "js2-XMLEND") ((= type js2-TO_OBJECT) "js2-TO_OBJECT") ((= type js2-TO_DOUBLE) "js2-TO_DOUBLE") ((= type js2-GET) "js2-GET") ((= type js2-SET) "js2-SET") ((= type js2-LET) "js2-LET") ((= type js2-CONST) "js2-CONST") ((= type js2-SETCONST) "js2-SETCONST") ((= type js2-SETCONSTVAR) "js2-SETCONSTVAR") ((= type js2-ARRAYCOMP) "js2-ARRAYCOMP") ((= type js2-LETEXPR) "js2-LETEXPR") ((= type js2-WITHEXPR) "js2-WITHEXPR") ((= type js2-DEBUGGER) "js2-DEBUGGER") ((= type js2-COMMENT) "js2-COMMENT") ((= type js2-TRIPLEDOT) "js2-TRIPLEDOT") ((= type js2-ARROW) "js2-ARROW") ((= type js2-CLASS) "js2-CLASS") ((= type js2-EXTENDS) "js2-EXTENDS") ((= type js2-SUPER) "js2-SUPER") ((= type js2-TEMPLATE_HEAD) "js2-TEMPLATE_HEAD") ((= type js2-NO_SUBS_TEMPLATE) "js2-NO_SUBS_TEMPLATE") ((= type js2-TAGGED_TEMPLATE) "js2-TAGGED_TEMPLATE") ((= type js2-AWAIT) "js2-AWAIT") ((= type js2-HOOK) "js2-HOOK") ((= type js2-EXPON) "js2-EXPON") )) (provide 'dojo-common-node-to-string)