cue/ast: fix IsValidIdent for _0
Currently `IsValidIdent` returns false for the identifier `_1`.
This is not correct: the specification defines as valid identifier
as:
identifier = [ "#" | "_#" ] letter { letter | unicode_digit } .
where `letter` includes underscore.
This caused an observed panic in `internal/core/export.(*pivotter)` when it calls
`exporter.ident`.
I was wanting to add the test before introducing the fix, but this isn't
possible with the current `IsValidIdentifer` tests because they check
for consistency between `LabelName` and `IsValidIdentifier` and the
current logic is not consistent for this case.
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: Icb571edbcac97e7f076497d45a03c7b524d92d20
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/549423
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>