 (in-ns 'atom-finder.classifier)
-(import '(org.eclipse.cdt.core.dom.ast IASTNode IASTName IASTIdExpression IASTBinaryExpression IASTUnaryExpression IASTExpressionStatement IASTPreprocessorFunctionStyleMacroDefinition IASTDoStatement IASTLiteralExpression IASTPreprocessorMacroExpansion cpp.ICPPASTTemplateId IASTCastExpression IASTFunctionCallExpression IASTEqualsInitializer IASTIfStatement IASTWhileStatement IASTForStatement IASTDoStatement IASTArraySubscriptExpression)
+(import '(org.eclipse.cdt.core.dom.ast IASTNode IASTName IASTIdExpression IASTBinaryExpression IASTUnaryExpression IASTExpressionStatement IASTPreprocessorFunctionStyleMacroDefinition IASTDoStatement IASTLiteralExpression IASTPreprocessorMacroExpansion cpp.ICPPASTTemplateId IASTCastExpression IASTFunctionCallExpression IASTEqualsInitializer IASTIfStatement IASTWhileStatement IASTForStatement IASTDoStatement IASTArraySubscriptExpression IASTExpressionList IASTFieldReference)
         '(org.eclipse.cdt.internal.core.parser.scanner ASTFunctionStyleMacroDefinition ASTMacroDefinition)
-        '(org.eclipse.cdt.internal.core.dom.parser.cpp CPPASTUnaryExpression)
+        '(org.eclipse.cdt.internal.core.dom.parser.cpp CPPASTUnaryExpression CPPASTExpressionList)
         )
 
 ;; ExpressionWriter adds superfluous parens to cast statements.

                     #(call-method %1 (str 'set method) %2)
                     node replacements))

(s/defn -replace-identifier!
  "If this node is capable of causing syntax ambiguities,
   try replacing parts of it to observe the ambiguity"
  [node :- IASTNode replacements :- {s/Str IASTNode}]
  (condp instance? node
    IASTIfStatement                (-maybe-set-operand! "ConditionExpression"  node replacements)
    IASTForStatement               (-maybe-set-operand! "ConditionExpression"  node replacements)
    IASTWhileStatement             (-maybe-set-operand! "Condition"  node replacements)
    IASTDoStatement                (-maybe-set-operand! "Condition"  node replacements)
    IASTEqualsInitializer          (-maybe-set-operand! "InitializerClause"  node replacements)
    IASTFunctionCallExpression     (-maybe-set-args!               node replacements)
    IASTCastExpression             (-maybe-set-operand! "Operand"  node replacements)
    IASTUnaryExpression            (-maybe-set-operand! "Operand"  node replacements)

    IASTBinaryExpression           (let [op1 (-maybe-set-operand! "Operand1" node replacements)
                                         op2 (-maybe-set-operand! "Operand2" node replacements)]
                                     (or op1 op2))
    IASTArraySubscriptExpression   (let [op1 (-maybe-set-operand! "Argument" node replacements)
                                         op2 (-maybe-set-operand! "ArrayExpression" node replacements)]
                                     (or op1 op2))
      nil))

(s/defn parse-macro

(s/defn -maybe-set-value!
  [getter setter node replacements]
  (when-let* [operand     (getter node)
              name        (cond (instance? IASTIdExpression operand) (.getName operand)
                                (instance? IASTName operand) operand
                                :else nil)
              replacement (-> name str replacements)
              _           (instance? IASTExpression replacement)
              ]
       (doto node
         (setter (.copy (cond (instance? IASTIdExpression operand) replacement
                              (instance? IASTName operand) (.getName replacement)))))))

(s/defn -maybe-set-args!
  [node :- IASTFunctionCallExpression replacements]
