We do not need to leak this internal implementation detail,
remove is visibility.
Change-Id: I13be830b8dedff8478c9859cda2c6b1f44eabf31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.repo;
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.Futures;
import java.io.IOException;
package org.opendaylight.yangtools.yang.parser.rfc7950.repo;
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.Futures;
import java.io.IOException;
-import org.antlr.v4.runtime.ParserRuleContext;
import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
public static ASTSchemaSource transformText(final YangTextSchemaSource text) throws SchemaSourceException,
IOException, YangSyntaxErrorException {
final YangStatementStreamSource src = YangStatementStreamSource.create(text);
public static ASTSchemaSource transformText(final YangTextSchemaSource text) throws SchemaSourceException,
IOException, YangSyntaxErrorException {
final YangStatementStreamSource src = YangStatementStreamSource.create(text);
- final ParserRuleContext ctx = src.getYangAST();
LOG.debug("Model {} parsed successfully", text);
// TODO: missing validation (YangModelBasicValidationListener should be re-implemented to new parser)
LOG.debug("Model {} parsed successfully", text);
// TODO: missing validation (YangModelBasicValidationListener should be re-implemented to new parser)
- return ASTSchemaSource.create(text.getIdentifier(), text.getSymbolicName().orElse(null), ctx);
+ return ASTSchemaSource.create(text.getIdentifier(), text.getSymbolicName().orElse(null),
+ src.statementContext());
throws IOException, YangSyntaxErrorException {
final YangStatementStreamSource source = YangStatementStreamSource.create(
YangTextSchemaSource.forResource(refClass, resourceName));
throws IOException, YangSyntaxErrorException {
final YangStatementStreamSource source = YangStatementStreamSource.create(
YangTextSchemaSource.forResource(refClass, resourceName));
- final ParserRuleContext ast = source.getYangAST();
- checkArgument(ast instanceof StatementContext);
- return parseAST((StatementContext) ast, source.getIdentifier());
+ return parseAST(source.statementContext(), source.getIdentifier());
}
private static @NonNull YangModelDependencyInfo parseModuleContext(final StatementContext module,
}
private static @NonNull YangModelDependencyInfo parseModuleContext(final StatementContext module,
+ @Deprecated(forRemoval = true)
public ParserRuleContext getYangAST() {
public ParserRuleContext getYangAST() {
+ return statementContext();
+ }
+
+ StatementContext statementContext() {