Skip to content
Discussion options

You must be logged in to vote

Even with that example, you should not overlap your lexer rules. You solve that at the parser level:

type Pair struct {
	Key   string  `parser:"(@Ident | @Number) '='"`
	Value float64 `parser:"@Number"`
}

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jusito
Comment options

@alecthomas
Comment options

Answer selected by jusito
@jusito
Comment options

@alecthomas
Comment options

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