* 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.ir;
+package org.opendaylight.yangtools.yang.parser.rfc7950.antlr;
import static com.google.common.base.Verify.verify;
-import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.CharMatcher;
import com.google.common.base.VerifyException;
import org.opendaylight.yangtools.yang.parser.antlr.YangStatementParser.KeywordContext;
import org.opendaylight.yangtools.yang.parser.antlr.YangStatementParser.StatementContext;
import org.opendaylight.yangtools.yang.parser.antlr.YangStatementParser.UnquotedStringContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRArgument;
import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRArgument.Single;
+import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRKeyword;
import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRKeyword.Qualified;
import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRKeyword.Unqualified;
+import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRStatement;
-@Beta
-public final class AntlrSupport {
+public final class IRSupport {
private static final CharMatcher WHITESPACE_MATCHER = CharMatcher.whitespace();
private final Map<String, Single> dquotArguments = new HashMap<>();
private final Map<Entry<String, String>, Qualified> qualKeywords = new HashMap<>();
private final Map<String, String> strings = new HashMap<>();
- private AntlrSupport() {
+ private IRSupport() {
// Hidden on purpose
}
* @throws NullPointerException if {@code stmt} is null
*/
public static @NonNull IRStatement createStatement(@SuppressWarnings("exports") final StatementContext stmt) {
- return new AntlrSupport().statementOf(stmt);
+ return new IRSupport().statementOf(stmt);
}
private @NonNull IRStatement statementOf(final StatementContext stmt) {
* which represents a single YANG statement. Every YANG file is required to contain exactly one top-level statement,
* {@code module} or {@code submodule}, hence an IRStatement also represents the significant contents of a YANG file.
* One way of creating an IRStatement is through
- * {@link org.opendaylight.yangtools.yang.parser.rfc7950.ir.AntlrSupport#createStatement(
+ * {@link org.opendaylight.yangtools.yang.parser.rfc7950.antlr.IRSupport#createStatement(
* org.opendaylight.yangtools.yang.parser.antlr.YangStatementParser.FileContext)}.
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.ir;
\ No newline at end of file
import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceRegistry;
import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceTransformer;
import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.rfc7950.ir.AntlrSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.antlr.IRSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRStatement;
@Beta
public static @NonNull IRSchemaSource transformText(final YangTextSchemaSource text)
throws YangSyntaxErrorException, IOException {
- final IRStatement rootStatement = AntlrSupport.createStatement(YangStatementStreamSource.parseYangSource(text));
+ final IRStatement rootStatement = IRSupport.createStatement(YangStatementStreamSource.parseYangSource(text));
final String name = YangModelDependencyInfo.safeStringArgument(text.getIdentifier(), rootStatement, "name");
final String latestRevision = YangModelDependencyInfo.getLatestRevision(rootStatement, text.getIdentifier());
final SourceIdentifier sourceId = new SourceIdentifier(name, latestRevision);
import org.opendaylight.yangtools.yang.parser.antlr.YangStatementParser.StatementContext;
import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
import org.opendaylight.yangtools.yang.parser.rfc7950.antlr.CompactYangStatementLexer;
-import org.opendaylight.yangtools.yang.parser.rfc7950.ir.AntlrSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.antlr.IRSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRKeyword;
import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRStatement;
import org.opendaylight.yangtools.yang.parser.spi.source.PrefixResolver;
public static YangStatementStreamSource create(final YangTextSchemaSource source) throws IOException,
YangSyntaxErrorException {
return new YangStatementStreamSource(source.getIdentifier(),
- AntlrSupport.createStatement(parseYangSource(source)), source.getSymbolicName().orElse(null));
+ IRSupport.createStatement(parseYangSource(source)), source.getSymbolicName().orElse(null));
}
/**
* 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.ir;
+package org.opendaylight.yangtools.yang.parser.rfc7950.antlr;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.yangtools.yang.parser.rfc7950.ir.AntlrSupport.trimWhitespace;
+import static org.opendaylight.yangtools.yang.parser.rfc7950.antlr.IRSupport.trimWhitespace;
import org.junit.Test;
-public class AntlrSupportTest {
+public class IRSupportTest {
@Test
public void testTrimWhitespace() {
assertEquals("\n", trimWhitespace("\n", 0));