AnyData feature changes
Change-Id: Iccba22d731321f38b8146bbfc85477d2252a3b10
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
index cc7c0dc..432a122 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
@@ -1758,4 +1758,18 @@
* @param currentContext current context in the parsed tree
*/
void exitUnknown2(Unknown2Context currentContext);
+ /**
+ * Enters a parse tree produced by GeneratedYangParser for grammar rule
+ * anydataStatement.
+ *
+ * @param currentContext current context in the parsed tree
+ */
+ void enterAnydataStatement(AnydataStatementContext currentContext);
+ /**
+ * Exits a parse tree produced by GeneratedYangParser for grammar rule
+ * anydataStatement.
+ *
+ * @param currentContext current context in the parsed tree
+ */
+ void exitAnydataStatement(AnydataStatementContext currentContext);
}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
index dba4193..749843f 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
@@ -23,6 +23,8 @@
import org.onosproject.yang.compiler.datamodel.utils.Parsable;
import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangListener;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AnydataStatementContext;
+import org.onosproject.yang.compiler.parser.impl.listeners.AnydataListener;
import org.onosproject.yang.compiler.parser.impl.listeners.AppDataStructureListener;
import org.onosproject.yang.compiler.parser.impl.listeners.AppExtendedNameListener;
import org.onosproject.yang.compiler.parser.impl.listeners.ArgumentListener;
@@ -1952,4 +1954,14 @@
public void exitUnknown2(Unknown2Context currentContext) {
// do nothing
}
+
+ @Override
+ public void enterAnydataStatement(AnydataStatementContext ctx) {
+ AnydataListener.processAnydataEntry(this, ctx);
+ }
+
+ @Override
+ public void exitAnydataStatement(AnydataStatementContext ctx) {
+ AnydataListener.processAnydataExit(this, ctx);
+ }
}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AnydataListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AnydataListener.java
new file mode 100644
index 0000000..b75cdf2
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AnydataListener.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.compiler.parser.impl.listeners;
+
+import org.onosproject.yang.compiler.datamodel.YangAnydata;
+import org.onosproject.yang.compiler.datamodel.YangAugment;
+import org.onosproject.yang.compiler.datamodel.YangCase;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangGrouping;
+import org.onosproject.yang.compiler.datamodel.YangInput;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangOutput;
+import org.onosproject.yang.compiler.datamodel.YangSubModule;
+import org.onosproject.yang.compiler.datamodel.YangVersionHolder;
+import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AnydataStatementContext;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yang.compiler.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.ANYDATA_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.CONFIG_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DESCRIPTION_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.MANDATORY_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.REFERENCE_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.STATUS_DATA;
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.WHEN_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.getParentNodeConfig;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.validateCardinalityMaxOne;
+import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangAnydataNode;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ONE_DOT_ONE;
+
+/*
+ * Reference: RFC7950 and YANG ANTLR Grammar
+ *
+ * ABNF grammar as per RFC7950
+ * anydata-stmt = anydata-keyword sep identifier-arg-str optsep
+ * (";" /
+ * "{" stmtsep
+ * ;; these stmts can appear in any order
+ * [when-stmt]
+ * *if-feature-stmt
+ * *must-stmt
+ * [config-stmt]
+ * [mandatory-stmt]
+ * [status-stmt]
+ * [description-stmt]
+ * [reference-stmt]
+ * "}") stmtsep
+ *
+ * ANTLR grammar rule
+ * anydataStatement : ANYDATA_KEYWORD identifier (STMTEND |
+ * LEFT_CURLY_BRACE stmtSep (whenStatement | ifFeatureStatement
+ * | mustStatement | configStatement | mandatoryStatement
+ * | statusStatement | descriptionStatement | referenceStatement)*
+ * RIGHT_CURLY_BRACE) stmtSep;
+ */
+
+/**
+ * Represents listener based call back function corresponding to the "anydata"
+ * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 7950.
+ */
+public final class AnydataListener {
+
+ /**
+ * Creates a new anydata listener.
+ */
+ private AnydataListener() {
+ }
+
+ /**
+ * It is called when parser receives an input matching the grammar rule
+ * (anydata), performs validation and updates the data model tree.
+ *
+ * @param listener listener's object
+ * @param ctx context object of the grammar rule
+ */
+ public static void processAnydataEntry(TreeWalkListener listener,
+ AnydataStatementContext ctx) {
+
+ // Check for stack to be non empty.
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, ANYDATA_DATA, ctx.identifier()
+ .getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), ANYDATA_DATA, ctx);
+
+ // Validate sub statement cardinality.
+ validateSubStatementsCardinality(ctx);
+
+ // Check for identifier collision
+ int line = ctx.getStart().getLine();
+ int charPositionInLine = ctx.getStart().getCharPositionInLine();
+ detectCollidingChildUtil(listener, line, charPositionInLine, identifier, ANYDATA_DATA);
+
+ YangAnydata anyData = getYangAnydataNode(JAVA_GENERATION);
+ anyData.setName(identifier);
+
+ anyData.setLineNumber(line);
+ anyData.setCharPosition(charPositionInLine);
+ anyData.setFileName(listener.getFileName());
+ /*
+ * If "config" is not specified, the default is the same as the parent
+ * schema node's "config" value.
+ */
+ if (ctx.configStatement().isEmpty()) {
+ boolean parentConfig = getParentNodeConfig(listener);
+ anyData.setConfig(parentConfig);
+ }
+
+ Parsable curData = listener.getParsedDataStack().peek();
+ // Module/Submodule yang version check to make sure anydata supported
+ // version
+ if (!((YangVersionHolder) listener.getParsedDataStack().get(0))
+ .getVersion().equals(ONE_DOT_ONE)) {
+ throw new ParserException("YANG file error : anydata with name " + ctx.identifier()
+ .getText() + " at line number " + line + " in " + listener
+ .getFileName() + " is feature of YANG version 1.1");
+ }
+ if (curData instanceof YangModule || curData instanceof YangSubModule
+ || curData instanceof YangContainer || curData instanceof YangList
+ || curData instanceof YangCase || curData instanceof YangNotification
+ || curData instanceof YangInput || curData instanceof YangOutput
+ || curData instanceof YangAugment || curData instanceof YangGrouping) {
+ YangNode curNode = (YangNode) curData;
+ try {
+ curNode.addChild(anyData);
+ } catch (DataModelException e) {
+ throw new ParserException(constructExtendedListenerErrorMessage(
+ UNHANDLED_PARSED_DATA, ANYDATA_DATA,
+ ctx.identifier().getText(), ENTRY, e.getMessage()));
+ }
+ listener.getParsedDataStack().push(anyData);
+ } else {
+ throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ANYDATA_DATA,
+ ctx.identifier().getText(), ENTRY));
+ }
+ }
+
+ /**
+ * It is called when parser exits from grammar rule (anydata), it perform
+ * validations and updates the data model tree.
+ *
+ * @param listener listener's object
+ * @param ctx context object of the grammar rule
+ */
+ public static void processAnydataExit(TreeWalkListener listener,
+ AnydataStatementContext ctx) {
+
+ // Check for stack to be non empty.
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, ANYDATA_DATA, ctx.identifier().getText(), EXIT);
+
+ if (listener.getParsedDataStack().peek() instanceof YangAnydata) {
+ listener.getParsedDataStack().pop();
+ } else {
+ throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ANYDATA_DATA,
+ ctx.identifier().getText(), EXIT));
+ }
+ }
+
+ /**
+ * Validates the cardinality of anydata sub-statements as per grammar.
+ *
+ * @param ctx context object of the grammar rule
+ */
+ private static void validateSubStatementsCardinality(AnydataStatementContext ctx) {
+
+ String text = ctx.identifier().getText();
+ validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, ANYDATA_DATA, text);
+ validateCardinalityMaxOne(ctx.configStatement(), CONFIG_DATA, ANYDATA_DATA, text);
+ validateCardinalityMaxOne(ctx.mandatoryStatement(), MANDATORY_DATA, ANYDATA_DATA, text);
+ validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA, ANYDATA_DATA, text);
+ validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA, ANYDATA_DATA, text);
+ validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA, ANYDATA_DATA, text);
+ }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListener.java
index dbe46a8..5183cb0 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/AugmentListener.java
@@ -197,21 +197,22 @@
*/
private static void valSubStatCardinality(AugmentStatementContext ctx) {
+ String text = ctx.augment().getText();
validateCardinalityMaxOne(ctx.statusStatement(), STATUS_DATA,
- AUGMENT_DATA, ctx.augment().getText());
+ AUGMENT_DATA, text);
validateCardinalityMaxOne(ctx.descriptionStatement(), DESCRIPTION_DATA,
- AUGMENT_DATA, ctx.augment().getText());
+ AUGMENT_DATA, text);
validateCardinalityMaxOne(ctx.referenceStatement(), REFERENCE_DATA,
- AUGMENT_DATA, ctx.augment().getText());
+ AUGMENT_DATA, text);
validateCardinalityMaxOne(ctx.whenStatement(), WHEN_DATA, AUGMENT_DATA,
- ctx.augment().getText());
+ text);
validateCardinalityEitherOne(ctx.dataDefStatement(), DATA_DEF_DATA,
ctx.caseStatement(), CASE_DATA,
- AUGMENT_DATA, ctx.augment().getText(),
+ AUGMENT_DATA, text,
ctx);
}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java
index 7185cb2..b182e12 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/ModuleListener.java
@@ -50,6 +50,7 @@
import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsEmpty;
import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangModuleNode;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ONE;
/*
* Reference: RFC6020 and YANG ANTLR Grammar
@@ -103,7 +104,7 @@
yangModule.setFileName(listener.getFileName());
if (ctx.moduleBody().moduleHeaderStatement().yangVersionStatement() == null) {
- yangModule.setVersion((byte) 1);
+ yangModule.setVersion(ONE);
}
listener.getParsedDataStack().push(yangModule);
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java
index 678aa64..cc45272 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/SubModuleListener.java
@@ -41,6 +41,7 @@
import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsEmpty;
import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
import static org.onosproject.yang.compiler.translator.tojava.YangDataModelFactory.getYangSubModuleNode;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ONE;
/*
* Reference: RFC6020 and YANG ANTLR Grammar
@@ -96,7 +97,7 @@
yangSubModule.setCharPosition(ctx.getStart().getCharPositionInLine());
yangSubModule.setFileName(listener.getFileName());
if (ctx.submoduleBody().submoduleHeaderStatement().yangVersionStatement() == null) {
- yangSubModule.setVersion((byte) 1);
+ yangSubModule.setVersion(ONE);
}
listener.getParsedDataStack().push(yangSubModule);
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListener.java
index 69808e4..1110aae 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/VersionListener.java
@@ -89,7 +89,7 @@
// Check for stack to be non empty.
checkStackIsNotEmpty(listener, MISSING_HOLDER, VERSION_DATA, ctx.version().getText(), ENTRY);
- byte version = getValidVersion(ctx);
+ String version = getValidVersion(ctx);
// Obtain the node of the stack.
Parsable tmpNode = listener.getParsedDataStack().peek();
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java
index 25ec87b..538e863 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/parserutils/ListenerUtil.java
@@ -72,6 +72,8 @@
import static org.onosproject.yang.compiler.utils.UtilConstants.FALSE;
import static org.onosproject.yang.compiler.utils.UtilConstants.IN;
import static org.onosproject.yang.compiler.utils.UtilConstants.INVALID_TREE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ONE;
+import static org.onosproject.yang.compiler.utils.UtilConstants.ONE_DOT_ONE;
import static org.onosproject.yang.compiler.utils.UtilConstants.OPEN_SQUARE_BRACKET;
import static org.onosproject.yang.compiler.utils.UtilConstants.QUOTES;
import static org.onosproject.yang.compiler.utils.UtilConstants.SLASH;
@@ -100,7 +102,6 @@
private static final Pattern PREDICATE =
Pattern.compile("\\[(.*?)\\]");
private static final String XML = "xml";
- private static final String ONE = "1";
private static final int IDENTIFIER_LENGTH = 64;
private static final String DATE_FORMAT = "yyyy-MM-dd";
private static final String REGEX_EQUAL = "[=]";
@@ -201,17 +202,16 @@
* @param ctx version context object of the grammar rule
* @return valid version
*/
- public static byte getValidVersion(YangVersionStatementContext ctx) {
+ public static String getValidVersion(YangVersionStatementContext ctx) {
String value = removeQuotesAndHandleConcat(ctx.version().getText());
- if (!value.equals(ONE)) {
- ParserException parserException = new ParserException("YANG file error: Input version not supported");
- parserException.setLine(ctx.getStart().getLine());
- parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
- throw parserException;
+ if (value.equals(ONE) || value.equals(ONE_DOT_ONE)) {
+ return value;
}
-
- return Byte.valueOf(value);
+ ParserException parserException = new ParserException("YANG file error: Input version not supported");
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+ throw parserException;
}
/**
diff --git a/compiler/base/parser/src/main/resources/GeneratedYang.g4 b/compiler/base/parser/src/main/resources/GeneratedYang.g4
index 7167f7b..e30e150 100644
--- a/compiler/base/parser/src/main/resources/GeneratedYang.g4
+++ b/compiler/base/parser/src/main/resources/GeneratedYang.g4
@@ -370,7 +370,8 @@
* list-stmt /
* choice-stmt /
* anyxml-stmt /
- * uses-stmt
+ * uses-stmt /
+ * anydata-stmt
*/
dataDefStatement : containerStatement
| leafStatement
@@ -378,7 +379,8 @@
| listStatement
| choiceStatement
| anyxmlStatement
- | usesStatement;
+ | usesStatement
+ | anydataStatement;
/**
* if-feature-stmt = if-feature-keyword sep identifier-ref-arg-str
@@ -951,7 +953,7 @@
* anyxml-stmt
*/
shortCaseStatement : containerStatement | leafStatement | leafListStatement
- | listStatement | anyxmlStatement;
+ | listStatement | anyxmlStatement | anydataStatement;
/**
* case-stmt = case-keyword sep identifier-arg-str optsep
@@ -1357,6 +1359,28 @@
*/
defaultDenyAllStatement : DEFAULT_DENY_ALL STMTEND;
+
+ /**
+ * anydata-stmt = anydata-keyword sep identifier-arg-str optsep
+ * (";" /
+ * "{" stmtsep
+ * ;; these stmts can appear in any order
+ * [when-stmt]
+ * *if-feature-stmt
+ * *must-stmt
+ * [config-stmt]
+ * [mandatory-stmt]
+ * [status-stmt]
+ * [description-stmt]
+ * [reference-stmt]
+ * "}") stmtsep
+ */
+ anydataStatement : ANYDATA_KEYWORD identifier (STMTEND |
+ LEFT_CURLY_BRACE stmtSep (whenStatement | ifFeatureStatement
+ | mustStatement | configStatement | mandatoryStatement
+ | statusStatement | descriptionStatement | referenceStatement)*
+ RIGHT_CURLY_BRACE) stmtSep;
+
/**
* unknown-statement = prefix ":" identifier [sep string] optsep
* (";" / "{" *unknown-statement2 "}")
@@ -1456,4 +1480,5 @@
| FALSE_KEYWORD | MAX_KEYWORD | MIN_KEYWORD | NOT_SUPPORTED_KEYWORD | OBSOLETE_KEYWORD
| REPLACE_KEYWORD | SYSTEM_KEYWORD | TRUE_KEYWORD | UNBOUNDED_KEYWORD | USER_KEYWORD
| COMPILER_ANNOTATION_KEYWORD | APP_DATA_STRUCTURE_KEYWORD | DATA_STRUCTURE_KEYWORD
- | APP_EXTENDED_KEYWORD | DEFAULT_DENY_WRITE_KEYWORD | DEFAULT_DENY_ALL_KEYWORD;
+ | APP_EXTENDED_KEYWORD | DEFAULT_DENY_WRITE_KEYWORD | DEFAULT_DENY_ALL_KEYWORD
+ | ANYDATA_KEYWORD;
diff --git a/compiler/base/parser/src/main/resources/YangLexer.g4 b/compiler/base/parser/src/main/resources/YangLexer.g4
index 4f190b9..7a5e79c 100644
--- a/compiler/base/parser/src/main/resources/YangLexer.g4
+++ b/compiler/base/parser/src/main/resources/YangLexer.g4
@@ -118,6 +118,7 @@
DEFAULT_DENY_WRITE : IDENTIFIER COLON DEFAULT_DENY_WRITE_KEYWORD;
DEFAULT_DENY_ALL_KEYWORD : 'default-deny-all';
DEFAULT_DENY_ALL : IDENTIFIER COLON DEFAULT_DENY_ALL_KEYWORD;
+ ANYDATA_KEYWORD : 'anydata';
// Lexer tokens to be skipped
COMMENT
diff --git a/compiler/base/parser/src/main/resources/YangLexer.tokens b/compiler/base/parser/src/main/resources/YangLexer.tokens
deleted file mode 100644
index 3192512..0000000
--- a/compiler/base/parser/src/main/resources/YangLexer.tokens
+++ /dev/null
@@ -1,199 +0,0 @@
-ANYXML_KEYWORD=1
-ARGUMENT_KEYWORD=2
-AUGMENT_KEYWORD=3
-BASE_KEYWORD=4
-BELONGS_TO_KEYWORD=5
-BIT_KEYWORD=6
-CASE_KEYWORD=7
-CHOICE_KEYWORD=8
-CONFIG_KEYWORD=9
-CONTACT_KEYWORD=10
-CONTAINER_KEYWORD=11
-DEFAULT_KEYWORD=12
-DESCRIPTION_KEYWORD=13
-ENUM_KEYWORD=14
-ERROR_APP_TAG_KEYWORD=15
-ERROR_MESSAGE_KEYWORD=16
-EXTENSION_KEYWORD=17
-DEVIATION_KEYWORD=18
-DEVIATE_KEYWORD=19
-FEATURE_KEYWORD=20
-FRACTION_DIGITS_KEYWORD=21
-GROUPING_KEYWORD=22
-IDENTITY_KEYWORD=23
-IF_FEATURE_KEYWORD=24
-IMPORT_KEYWORD=25
-INCLUDE_KEYWORD=26
-INPUT_KEYWORD=27
-KEY_KEYWORD=28
-LEAF_KEYWORD=29
-LEAF_LIST_KEYWORD=30
-LENGTH_KEYWORD=31
-LIST_KEYWORD=32
-MANDATORY_KEYWORD=33
-MAX_ELEMENTS_KEYWORD=34
-MIN_ELEMENTS_KEYWORD=35
-MODULE_KEYWORD=36
-MUST_KEYWORD=37
-NAMESPACE_KEYWORD=38
-NOTIFICATION_KEYWORD=39
-ORDERED_BY_KEYWORD=40
-ORGANIZATION_KEYWORD=41
-OUTPUT_KEYWORD=42
-PATH_KEYWORD=43
-PATTERN_KEYWORD=44
-POSITION_KEYWORD=45
-PREFIX_KEYWORD=46
-PRESENCE_KEYWORD=47
-RANGE_KEYWORD=48
-REFERENCE_KEYWORD=49
-REFINE_KEYWORD=50
-REQUIRE_INSTANCE_KEYWORD=51
-REVISION_KEYWORD=52
-REVISION_DATE_KEYWORD=53
-RPC_KEYWORD=54
-STATUS_KEYWORD=55
-SUBMODULE_KEYWORD=56
-TYPE_KEYWORD=57
-TYPEDEF_KEYWORD=58
-UNIQUE_KEYWORD=59
-UNITS_KEYWORD=60
-USES_KEYWORD=61
-VALUE_KEYWORD=62
-WHEN_KEYWORD=63
-YANG_VERSION_KEYWORD=64
-YIN_ELEMENT_KEYWORD=65
-ADD_KEYWORD=66
-CURRENT_KEYWORD=67
-DELETE_KEYWORD=68
-DEPRECATED_KEYWORD=69
-FALSE_KEYWORD=70
-MAX_KEYWORD=71
-MIN_KEYWORD=72
-NOT_SUPPORTED_KEYWORD=73
-OBSOLETE_KEYWORD=74
-REPLACE_KEYWORD=75
-SYSTEM_KEYWORD=76
-TRUE_KEYWORD=77
-UNBOUNDED_KEYWORD=78
-USER_KEYWORD=79
-COMPILER_ANNOTATION_KEYWORD=80
-COMPILER_ANNOTATION=81
-APP_DATA_STRUCTURE_KEYWORD=82
-APP_DATA_STRUCTURE=83
-DATA_STRUCTURE_KEYWORD=84
-DATA_STRUCTURE=85
-DATA_STRUCTURE_KEY=86
-APP_EXTENDED_KEYWORD=87
-APP_EXTENDED=88
-DEFAULT_DENY_WRITE_KEYWORD=89
-DEFAULT_DENY_WRITE=90
-DEFAULT_DENY_ALL_KEYWORD=91
-DEFAULT_DENY_ALL=92
-COMMENT=93
-WS=94
-LINE_COMMENT=95
-INTEGER=96
-DATE_ARG=97
-LEFT_CURLY_BRACE=98
-RIGHT_CURLY_BRACE=99
-IDENTIFIER=100
-STMTEND=101
-DQUOTE=102
-COLON=103
-PLUS=104
-MINUS=105
-UNKNOWN_STATEMENT=106
-STRING=107
-'anyxml'=1
-'argument'=2
-'augment'=3
-'base'=4
-'belongs-to'=5
-'bit'=6
-'case'=7
-'choice'=8
-'config'=9
-'contact'=10
-'container'=11
-'default'=12
-'description'=13
-'enum'=14
-'error-app-tag'=15
-'error-message'=16
-'extension'=17
-'deviation'=18
-'deviate'=19
-'feature'=20
-'fraction-digits'=21
-'grouping'=22
-'identity'=23
-'if-feature'=24
-'import'=25
-'include'=26
-'input'=27
-'key'=28
-'leaf'=29
-'leaf-list'=30
-'length'=31
-'list'=32
-'mandatory'=33
-'max-elements'=34
-'min-elements'=35
-'module'=36
-'must'=37
-'namespace'=38
-'notification'=39
-'ordered-by'=40
-'organization'=41
-'output'=42
-'path'=43
-'pattern'=44
-'position'=45
-'prefix'=46
-'presence'=47
-'range'=48
-'reference'=49
-'refine'=50
-'require-instance'=51
-'revision'=52
-'revision-date'=53
-'rpc'=54
-'status'=55
-'submodule'=56
-'type'=57
-'typedef'=58
-'unique'=59
-'units'=60
-'uses'=61
-'value'=62
-'when'=63
-'yang-version'=64
-'yin-element'=65
-'add'=66
-'current'=67
-'delete'=68
-'deprecated'=69
-'false'=70
-'max'=71
-'min'=72
-'not-supported'=73
-'obsolete'=74
-'replace'=75
-'system'=76
-'true'=77
-'unbounded'=78
-'user'=79
-'compiler-annotation'=80
-'app-data-structure'=82
-'data-structure'=84
-'app-extended-name'=87
-'default-deny-write'=89
-'default-deny-all'=91
-'{'=98
-'}'=99
-';'=101
-'"'=102
-':'=103
-'+'=104
-'-'=105