• Russ Cox's avatar
    fmt: document and adjust Scanf space handling to eliminate a few paradoxes · 0db9518a
    Russ Cox authored
    This CL makes minor adjustment to the handling of spaces and newlines
    and then documents the result.
    
    The semantic adjustment mainly concerns the handling of a run of
    spaces following a newline in the format, like in "\n ".
    Previously, that run of spaces was ignored entirely, leading to paradoxes
    like the format "1 \n 2" not matching itself as input.
    Now, spaces following a newline in the format match zero or more
    spaces following the corresponding newline in the input.
    
    The changes to the test suite show how minor the semantic adjustments are
    and how they make the behavior more regular than previously.
    
    This CL also updates the documentation to explain the handling of
    spaces more precisely, incorporating the draft from CL 17723 but
    describing the newly introduced behavior.
    
    Fixes #13565.
    
    Change-Id: I129666e9ba42de3c28b67f75cb47488e9a4c1867
    Reviewed-on: https://go-review.googlesource.com/30611Reviewed-by: 's avatarRob Pike <r@golang.org>
    0db9518a
scan_test.go 37.5 KB