Skip to content

Commit

Permalink
fix: Parsing the AS with the built-in parsing function (#171)
Browse files Browse the repository at this point in the history
Fixes the issue introduced in
bf66782,
where the ParseASSep function was removed, but the function calls to the
function were still present. This new commit uses the formatting
functions already present.
  • Loading branch information
jeltevanbommel authored Sep 20, 2024
1 parent 40e047e commit b45a8ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/addr/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ParseFormattedAS(as string, opts ...FormatOption) (AS, error) {
}
as = trimmed
}
return ParseASSep(as, o.separator)
return parseAS(as, o.separator)
}

// FormatIA formats the ISD-AS.
Expand Down
4 changes: 2 additions & 2 deletions private/path/fabridquery/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (l *pathpolicyConstraintsListener) ExitWildcardAS(c *pathpolicyconstraints.

// ExitLegacyAS is called when exiting the LegacyAS production.
func (l *pathpolicyConstraintsListener) ExitLegacyAS(c *pathpolicyconstraints.LegacyASContext) {
as, err := addr.ParseASSep(c.GetText()[1:], "_")
as, err := addr.ParseFormattedAS(c.GetText()[1:], addr.WithSeparator("_"))
if err != nil {
c.SetException(antlr.NewFailedPredicateException(c.GetParser(), c.GetText(), err.Error()))
}
Expand All @@ -186,7 +186,7 @@ func (l *pathpolicyConstraintsListener) ExitLegacyAS(c *pathpolicyconstraints.Le

// ExitAS is called when exiting the AS production.
func (l *pathpolicyConstraintsListener) ExitAS(c *pathpolicyconstraints.ASContext) {
as, err := addr.ParseASSep(c.GetText()[1:], "_")
as, err := addr.ParseFormattedAS(c.GetText()[1:], addr.WithSeparator("_"))
if err != nil {
c.SetException(antlr.NewFailedPredicateException(c.GetParser(), c.GetText(), err.Error()))
}
Expand Down

0 comments on commit b45a8ff

Please sign in to comment.