1 /* 2 * Copyright 2008, Haiku. 3 * Distributed under the terms of the MIT license. 4 * 5 * Authors: 6 * Michael Pfeiffer <laplace@users.sourceforge.net> 7 */ 8 9 #include "StatementListVisitor.h" 10 11 void StatementListVisitor::Visit(StatementList* list) 12 { 13 if (list == NULL) return; 14 15 const int32 n = list->Size(); 16 for (int32 i = 0; i < n; i ++) { 17 Statement* statement = list->StatementAt(i); 18 GroupStatement group(statement); 19 if (group.IsOpenGroup()) { 20 BeginGroup(&group); 21 fLevel ++; 22 } else if (statement->IsValueStatement()) { 23 DoValue(statement); 24 } else if (statement->IsDefaultStatement()) { 25 DoDefault(statement); 26 } else if (statement->IsQueryStatement()) { 27 DoQuery(statement); 28 } else if (statement->IsParamStatement()) { 29 DoParam(statement); 30 } 31 32 StatementList* children = statement->GetChildren(); 33 if (children != NULL) { 34 Visit(children); 35 } 36 37 // Close statements have been removed 38 if (group.IsOpenGroup()) { 39 fLevel --; 40 EndGroup(&group); 41 } 42 } 43 } 44