Skip to content

Commit

Permalink
fix: Parsing the AS with the built-in parsing function
Browse files Browse the repository at this point in the history
  • Loading branch information
jeltevanbommel committed Sep 20, 2024
1 parent 40e047e commit 218f24f
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 218f24f

Please sign in to comment.