Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle double quoted patterns #247

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

esmasth
Copy link
Contributor

@esmasth esmasth commented Sep 7, 2024

This addresses #239

https://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/impl/xpath/regex/RegularExpression.html used by yang-lsp expects W3C pattern which is single quoted, whereas YANG double quoted syntax includes escaped backslashes \\ which need to be unescaped before passing to W3C pattern regex handler.

@esmasth esmasth changed the title Handled double quoted patterns Handle double quoted patterns Sep 7, 2024
Escaped backslashes `\\` within double quoted pattern arguments
need to be unescaped before using xerces RegularExpression()

This addresses TypeFox#239

Signed-off-by: Siddharth Sharma <[email protected]>
@@ -287,6 +287,7 @@ class YangValidator extends AbstractYangValidator {
@Check
def checkPattern(Pattern it) {
// https://tools.ietf.org/html/rfc7950#section-9.4.5
// If 'it' is double quoted replace all '\\' with '\'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhuebner could you please help how to achieve unescaping backslashes in case the pattern is double quoted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant