[YANGTOOLS-471] Use of reference keyword in a YANG extension causes YangSyntaxErrorException Created: 25/Jun/15  Updated: 10/Apr/22  Due: 13/Aug/15  Resolved: 26/Aug/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Claudia Hwang Assignee: Martin Ciglan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 3859

 Description   

Here is a small example of a yang file to demonstrate the problem. It includes the extension in the same module for brevity. The Yangtools version is 0.6.5-Helium-SR3.

module extension-with-reference {
namespace "http://example.com/extension-with-reference";
prefix "ewr";

description
"Simple example to see an extension with reference";

extension myalias

{ argument "descriptor"; }

container foo {
ewr:myalias some-alias

{ description "..."; reference "..."; }

}
}

This causes following exception:

org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException: extraneous input 'reference' expecting

{'}

', 'yin-element', 'yang-version', 'when', 'value', 'uses', 'units', 'unique', 'typedef', 'type', 'submodule', 'status', 'rpc', 'revision-date', 'revision', 'require-instance', 'refine', 'range', 'presence', 'prefix', 'position', 'pattern', 'path', 'output', 'organization', 'ordered-by', 'notification', 'namespace', 'must', 'module', 'min-elements', 'max-elements', 'mandatory', 'list', 'length', 'leaf-list', 'leaf', 'key', 'input', 'include', 'import', 'if-feature', 'identity', 'grouping', 'fraction-digits', 'feature', 'deviate', 'deviation', 'extension', 'error-message', 'error-app-tag', 'enum', 'description', 'default', 'container', 'contact', 'config', 'choice', 'case', 'bit', 'belongs-to', 'base', 'augment', 'anyxml', IDENTIFIER} in module extension-with-reference on line 15 character 12
at org.opendaylight.yangtools.yang.parser.impl.YangErrorListener.syntaxError(YangErrorListener.java:30)
at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:57)
at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:367)
at org.antlr.v4.runtime.DefaultErrorStrategy.reportUnwantedToken(DefaultErrorStrategy.java:255)
at org.antlr.v4.runtime.DefaultErrorStrategy.sync(DefaultErrorStrategy.java:197)
at org.opendaylight.yangtools.antlrv4.code.gen.YangParser.identifier_stmt(YangParser.java:330)
at org.opendaylight.yangtools.antlrv4.code.gen.YangParser.container_stmt(YangParser.java:5274)
at org.opendaylight.yangtools.antlrv4.code.gen.YangParser.data_def_stmt(YangParser.java:9809)
at org.opendaylight.yangtools.antlrv4.code.gen.YangParser.body_stmts(YangParser.java:10002)
at org.opendaylight.yangtools.antlrv4.code.gen.YangParser.module_stmt(YangParser.java:10805)
at org.opendaylight.yangtools.antlrv4.code.gen.YangParser.yang(YangParser.java:170)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.parseYangSource(YangParserImpl.java:656)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.parseYangSources(YangParserImpl.java:641)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.parseSourcesToBuilders(YangParserImpl.java:385)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.resolveSources(YangParserImpl.java:378)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.parseYangModelSources(YangParserImpl.java:350)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.parseSources(YangParserImpl.java:195)



 Comments   
Comment by Claudia Hwang [ 30/Jun/15 ]

(In reply to Martin Ciglan from comment #1)
>
> *** This bug has been marked as a duplicate of YANGTOOLS-223 ***

The bug is similar but is not the same. YANGTOOLS-223 fixes a problem with the 'description' keyword in yang extensions. I get an exception when using the 'reference' keyword.

YANGTOOLS-223 has been marked as fixed, while I see the exception with the 'reference' keyword in Helium-SR3.

Comment by Martin Ciglan [ 19/Aug/15 ]

Hi

I had a look again and for sure, reference stmt is not added into unknown stmt as sub-stmt, so I can confirm this bug in yangtools Helium branch.

Comment by Martin Ciglan [ 21/Aug/15 ]

fix pushed:

https://git.opendaylight.org/gerrit/#/c/25571/

Generated at Wed Feb 07 20:53:20 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.