Source:
public static List<FileInfo> parseFileStatement(FileInfo parentContext, String statement) { Matcher fileMatcher = FileToken.matcher(statement); if (! fileMatcher.lookingAt()) { return null; } String remainder = statement.substring(fileMatcher.end(), statement.length()); List<FileInfo> filesInfo = null; Matcher inlineBatchMatcher = DashInlineBatchToken.matcher(remainder); if (inlineBatchMatcher.lookingAt()) { remainder = remainder.substring(inlineBatchMatcher.end(), remainder.length()); Matcher delimiterMatcher = DelimiterToken.matcher(remainder); if (delimiterMatcher.matches()) { String delimiter = delimiterMatcher.group(1); filesInfo = new ArrayList<FileInfo>(); filesInfo.add(new FileInfo(parentContext, FileOption.INLINEBATCH, delimiter)); return filesInfo; } throw new SQLParser.Exception( "Did not find valid delimiter for \"file -inlinebatch\" command."); } FileOption option = FileOption.PLAIN; Matcher batchMatcher = DashBatchToken.matcher(remainder); if (batchMatcher.lookingAt()) { option = FileOption.BATCH; remainder = remainder.substring(batchMatcher.end(), remainder.length()); } remainder = remainder.trim(); List<String> filenames = new ArrayList<String>(); Pattern regex = Pattern.compile("[^\\s\"']+|'[^']*'"); Matcher regexMatcher = regex.matcher(remainder); while (regexMatcher.find()) { filenames.add(regexMatcher.group()); } filesInfo = new ArrayList<FileInfo>(); for (String filename: filenames) { Matcher filenameMatcher = FilenameToken.matcher(filename); if (filenameMatcher.matches()) { filename = filenameMatcher.group(1); filename = filename.trim(); if (filename.startsWith("~")) { filename = filename.replaceFirst("~", System.getProperty("user.home")); } filesInfo.add(new FileInfo(parentContext, option, filename)); } } if ( filesInfo.size() == 0 ) { String msg = String.format("Did not find valid file name in \"file%s\" command.", option == FileOption.BATCH ? " -batch" : ""); throw new SQLParser.Exception(msg); } return filesInfo; }

Target:
public static List<FileInfo> parseFileStatement(FileInfo parentContext, String statement) { Matcher fileMatcher = FileToken.matcher(statement); if (! fileMatcher.lookingAt()) { return null; } String remainder = statement.substring(fileMatcher.end(), statement.length()); List<FileInfo> filesInfo = new ArrayList<FileInfo>(); Matcher inlineBatchMatcher = DashInlineBatchToken.matcher(remainder); if (inlineBatchMatcher.lookingAt()) { remainder = remainder.substring(inlineBatchMatcher.end(), remainder.length()); Matcher delimiterMatcher = DelimiterToken.matcher(remainder); if (delimiterMatcher.matches()) { String delimiter = delimiterMatcher.group(1); filesInfo.add(new FileInfo(parentContext, FileOption.INLINEBATCH, delimiter)); return filesInfo; } throw new SQLParser.Exception( "Did not find valid delimiter for \"file -inlinebatch\" command."); } FileOption option = FileOption.PLAIN; Matcher batchMatcher = DashBatchToken.matcher(remainder); if (batchMatcher.lookingAt()) { option = FileOption.BATCH; remainder = remainder.substring(batchMatcher.end(), remainder.length()); } remainder = remainder.trim(); List<String> filenames = new ArrayList<String>(); Pattern regex = Pattern.compile("[^\\s\']+|'[^']*'"); Matcher regexMatcher = regex.matcher(remainder); while (regexMatcher.find()) { filenames.add(regexMatcher.group()); } for (String filename : filenames) { Matcher filenameMatcher = FilenameToken.matcher(filename); if (filenameMatcher.matches()) { filename = filenameMatcher.group(1); filename = filename.trim(); if (filename.startsWith("~")) { filename = filename.replaceFirst("~", System.getProperty("user.home")); } filesInfo.add(new FileInfo(parentContext, option, filename)); } } if ( filesInfo.size() == 0 ) { String msg = String.format("Did not find valid file name in \"file%s\" command.", option == FileOption.BATCH ? " -batch" : ""); throw new SQLParser.Exception(msg); } return filesInfo; }