### Question:
StandardDdlParser implements DdlParser, DdlConstants, DdlConstants.StatementStartPhrases { protected String parseUntilTerminator( DdlTokenStream tokens ) throws ParsingException { StringBuffer sb = new StringBuffer(); if (doUseTerminator()) { boolean lastTokenWasPeriod = false; while (tokens.hasNext() && !tokens.matches(DdlTokenizer.STATEMENT_KEY) && !isTerminator(tokens)) { String thisToken = tokens.consume(); boolean thisTokenIsPeriod = thisToken.equals(PERIOD); boolean thisTokenIsComma = thisToken.equals(COMMA); if (lastTokenWasPeriod || thisTokenIsPeriod || thisTokenIsComma) { sb.append(thisToken); } else { sb.append(SPACE).append(thisToken); } if (thisTokenIsPeriod) { lastTokenWasPeriod = true; } else { lastTokenWasPeriod = false; } } } else { boolean lastTokenWasPeriod = false; while (tokens.hasNext() && !tokens.matches(DdlTokenizer.STATEMENT_KEY)) { String thisToken = tokens.consume(); boolean thisTokenIsPeriod = thisToken.equals(PERIOD); boolean thisTokenIsComma = thisToken.equals(COMMA); if (lastTokenWasPeriod || thisTokenIsPeriod || thisTokenIsComma) { sb.append(thisToken); } else { sb.append(SPACE).append(thisToken); } if (thisTokenIsPeriod) { lastTokenWasPeriod = true; } else { lastTokenWasPeriod = false; } } } return sb.toString(); } StandardDdlParser(); DataTypeParser getDatatypeParser(); void setDatatypeParser( DataTypeParser datatypeParser ); AstNodeFactory nodeFactory(); AstNode getRootNode(); void setRootNode( AstNode rootNode ); Object score( String ddl,
                         String fileName,
                         DdlParserScorer scorer ); String[] getIdentifyingKeywords(); void parse( String ddl,
                       AstNode rootNode,
                       Object scoreReturnObject ); final void addProblem( DdlParserProblem problem,
                                  AstNode node ); final void addProblem( DdlParserProblem problem ); final List<DdlParserProblem> getProblems(); final void attachNewProblem( DdlParserProblem problem,
                                        AstNode parentNode ); void mergeNodes( DdlTokenStream tokens,
                            AstNode firstNode,
                            AstNode secondNode ); AstNode handleUnknownToken( DdlTokenStream tokens,
                                       String tokenValue ); final AstNode unknownTerminatedNode( AstNode parentNode ); final AstNode missingTerminatorNode( AstNode parentNode ); final boolean isMissingTerminatorNode( AstNode node ); final boolean isValidSchemaChild( AstNode node ); final boolean setAsSchemaChildNode( AstNode statementNode,
                                               boolean stmtIsMissingTerminator ); boolean doUseTerminator(); void setDoUseTerminator( boolean useTerminator ); String getStatementTypeName( String[] stmtPhrase ); final Position getCurrentMarkedPosition(); final void markStartOfStatement( DdlTokenStream tokens ); final void markEndOfStatement( DdlTokenStream tokens,
                                          AstNode statementNode ); boolean isTestMode(); void setTestMode( boolean testMode ); String getId(); @Override int hashCode(); @Override boolean equals( Object obj );  }### Answer:
@Test public void shoudParseUntilTerminated() { printTest("shoudParseUntilTerminated()"); String prefix = " ( COL_SUM, COL_DIFF ) AS SELECT COMM + BONUS, COMM - BONUS FROM SAMP.EMPLOYEE"; String content = prefix + "; CREATE TABLE someName"; DdlTokenStream tokens = getTokens(content); String result = parser.parseUntilTerminator(tokens); printTest(result); assertEquals(prefix, result); }