Skip to content

Q: problem parsing URI in SIP #46

Answered by ColinH
cppden asked this question in Q&A
Discussion options

You must be logged in to vote

Probably what happens is that it is attempted to match userinfo, which successfully matches user to (the first part of) the host name, but because of the missing "@" the full userinfo does not match, and then everything backtracks, but by then the action for user has already been called.

There are several ways to fix this.

The easiest is to use look-ahead with at to make sure that it is in fact a userinfo before parsing again with actions enabled.

Another is to let the rules like user store the data in a temporary location, and only commit it to their final destination once the overarching rule successfully matches.

In addition you can merge common prefixes in the grammar and branch later…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by d-frey
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #46 on December 09, 2020 10:49.