[YANGTOOLS-1079] Audit, optimize and explicitly test YANG string unescaping Created: 12/Feb/20  Updated: 11/Apr/20  Resolved: 09/Apr/20

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: None
Fix Version/s: 5.0.0, 4.0.8, 3.0.11

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Vladyslav Marchenko
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

ArgumentContextUtils.stringFromStringContext() performs all the magic required to process YANG string handling, including proper quotes validation, unescaping and whitespace trimming. The unescaping part is using three nested Pattern.matchers() and did crop up in profiling runs.

There are a few things we can do here, most notably we should be able to turn the entire class into an enum with one constant per YangVersion, so that we would not pass that as an argument.

The pattern substitutions look a bit dodgy, and in some cases we are already performing a char-by-char walk, hence we should be able to remove the patterns completely. For that we need a proper test suite - some of which is in Bug6180Test, but we probably want to promote that to a suite providing 100% branch coverage (including pattern noop vs. real-op).


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