nodes: 0, module; 1, function_definition; 2, function_name:extractFromSQLFile; 3, parameters; 4, block; 5, identifier:self; 6, identifier:filePointer; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, comment:# reading file and splitting it into lines; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, comment:# forming SQL statements from all lines provided; 15, expression_statement; 16, expression_statement; 17, for_statement; 18, return_statement; 19, identifier:delimiter; 20, string:";"; 21, comment:"""
          Process an SQL file and extract all the queries sorted.
  
          :param filePointer: <io.TextIOWrapper> file pointer to SQL file
          :return: <list> list of queries
          """; 22, assignment; 23, assignment; 24, assignment; 25, identifier:c; 26, identifier:data; 27, block; 28, assignment; 29, assignment; 30, identifier:line; 31, identifier:dataLines; 32, comment:# ignoring comments; 33, block; 34, identifier:statements; 35, identifier:data; 36, call; 37, identifier:dataLines; 38, list; 39, identifier:dataLinesIndex; 40, integer:0; 41, if_statement; 42, if_statement; 43, identifier:statements; 44, list; 45, identifier:statementsIndex; 46, integer:0; 47, if_statement; 48, comment:# removing spaces; 49, expression_statement; 50, comment:# ignoring blank lines; 51, if_statement; 52, comment:# appending each character to it's statement until delimiter is reached; 53, for_statement; 54, attribute; 55, argument_list; 56, comparison_operator:len(dataLines) - 1 < dataLinesIndex; 57, block; 58, boolean_operator; 59, block; 60, else_clause; 61, boolean_operator; 62, block; 63, assignment; 64, comparison_operator:len(line) == 0; 65, block; 66, identifier:c; 67, identifier:line; 68, block; 69, identifier:filePointer; 70, identifier:read; 71, binary_operator:len(dataLines) - 1; 72, identifier:dataLinesIndex; 73, expression_statement; 74, boolean_operator; 75, comparison_operator:c == "\n"; 76, expression_statement; 77, block; 78, call; 79, call; 80, continue_statement; 81, identifier:line; 82, call; 83, call; 84, integer:0; 85, continue_statement; 86, if_statement; 87, expression_statement; 88, if_statement; 89, call; 90, integer:1; 91, call; 92, comparison_operator:c == "\r\n"; 93, comparison_operator:c == "\r"; 94, identifier:c; 95, string:"\n"; 96, augmented_assignment; 97, expression_statement; 98, attribute; 99, argument_list; 100, attribute; 101, argument_list; 102, attribute; 103, argument_list; 104, identifier:len; 105, argument_list; 106, comparison_operator:len(statements) - 1 < statementsIndex; 107, block; 108, assignment; 109, comparison_operator:c == delimiter; 110, block; 111, identifier:len; 112, argument_list; 113, attribute; 114, argument_list; 115, identifier:c; 116, string:"\r\n"; 117, identifier:c; 118, string:"\r"; 119, identifier:dataLinesIndex; 120, integer:1; 121, assignment; 122, identifier:line; 123, identifier:startswith; 124, string:"--"; 125, identifier:line; 126, identifier:startswith; 127, string:"#"; 128, identifier:line; 129, identifier:strip; 130, identifier:line; 131, binary_operator:len(statements) - 1; 132, identifier:statementsIndex; 133, expression_statement; 134, subscript; 135, call; 136, identifier:c; 137, identifier:delimiter; 138, expression_statement; 139, identifier:dataLines; 140, identifier:dataLines; 141, identifier:append; 142, string:""; 143, subscript; 144, call; 145, call; 146, integer:1; 147, call; 148, identifier:statements; 149, identifier:statementsIndex; 150, attribute; 151, argument_list; 152, augmented_assignment; 153, identifier:dataLines; 154, identifier:dataLinesIndex; 155, attribute; 156, argument_list; 157, identifier:len; 158, argument_list; 159, attribute; 160, argument_list; 161, string:"{}{}"; 162, identifier:format; 163, subscript; 164, identifier:c; 165, identifier:statementsIndex; 166, integer:1; 167, string:"{}{}"; 168, identifier:format; 169, subscript; 170, identifier:c; 171, identifier:statements; 172, identifier:statements; 173, identifier:append; 174, string:""; 175, identifier:statements; 176, identifier:statementsIndex; 177, identifier:dataLines; 178, identifier:dataLinesIndex
code: def extractFromSQLFile(self, filePointer, delimiter=";"):
          """
          Process an SQL file and extract all the queries sorted.
  
          :param filePointer: <io.TextIOWrapper> file pointer to SQL file
          :return: <list> list of queries
          """
          data = filePointer.read()
  
          # reading file and splitting it into lines
          dataLines = []
          dataLinesIndex = 0
          for c in data:
              if len(dataLines) - 1 < dataLinesIndex:
                  dataLines.append("")
  
              if c == "\r\n" or c == "\r" or c == "\n":
                  dataLinesIndex += 1
              else:
                  dataLines[dataLinesIndex] = "{}{}".format(
                      dataLines[dataLinesIndex],
                      c
                  )
  
          # forming SQL statements from all lines provided
          statements = []
          statementsIndex = 0
          for line in dataLines:
              # ignoring comments
              if line.startswith("--") or line.startswith("#"):
                  continue
  
              # removing spaces
              line = line.strip()
  
              # ignoring blank lines
              if len(line) == 0:
                  continue
  
              # appending each character to it's statement until delimiter is reached
              for c in line:
                  if len(statements) - 1 < statementsIndex:
                      statements.append("")
  
                  statements[statementsIndex] = "{}{}".format(
                      statements[statementsIndex],
                      c
                  )
  
                  if c == delimiter:
                      statementsIndex += 1
  
          return statements