[YANGTOOLS-798] regular expressions needs to support branches Created: 19/Jul/17  Updated: 25/Feb/18  Resolved: 25/Feb/18

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: 1.2.1, 1.1.2, 1.0.4, 2.0.1
Fix Version/s: 1.1.4, 2.0.2, 1.2.3

Type: Bug
Reporter: anzhe Assignee: Robert Varga
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: 8867

 Description   

I am using "stable/boron". When I compile yang files to java, I think yangtools mistakenly interprets the regular expressions.
For example,
typedef yang-fd-id {
type string {
pattern "[0-9a-f]

{8}/[a-z]/[0-9]|top[a-z]*fd";
}
}

The XSD regular expressions "[0-9a-f]{8}

/[a-z]/[0-9]|top[a-z]*fd" has two branches, but after converted to Java code, the Java regular expressions is "^[0-9a-f]

{8}/[a-z]/[0-9]|top[a-z]*fd$".

I think it should be "^[0-9a-f]{8}

/[a-z]/[0-9]$|^top[a-z]*fd$".



 Comments   
Comment by Robert Varga [ 20/Feb/18 ]

I am not sure we can do a complete analysis, as the results of that were ... less than stellar. I think we should further update escaping to just wrap the expression in a non-capturing group.

Comment by Robert Varga [ 20/Feb/18 ]

2.0.x: https://git.opendaylight.org/gerrit/68435

Comment by Robert Varga [ 21/Feb/18 ]

1.2.x: **https://git.opendaylight.org/gerrit/68461
carbon: https://git.opendaylight.org/gerrit/68462

 

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