-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/astinternal: print relative positions as well
Stringifying a token.Pos shows the filename, line, and column numbers, but it omits a crucial piece of information: the relative position. This can be important for encodings or formatting. For instance, some decoders produce token.NoPos with relative positions for the sake of ensuring good formatting, such as a node being printed following a newline or the correct amount of whitespace. We would print such missing positions with a relative position as token.Pos("-") even with DebugConfig.OmitEmpty, as the token.Pos value was not invalid nor empty. We would now print, for example, token.Pos("-").WithRel("newline"). Signed-off-by: Daniel Martí <[email protected]> Change-Id: I444ae9915cb96d2797775937f45e44599b7deb43 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200205 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Matthew Sackman <[email protected]>
- Loading branch information
Showing
5 changed files
with
104 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.