DescriptionParse inline scheme using per-expression port
Introduces a throw-away string port, Overlay_string_port, which makes
a port out of a random section of a C string. It does not own the
string, so there is no overhead in creating and discarding the ports
during parse time.
For GUILE v2, Overlay_string_port uses UTF-8 encoding, so UTF-8
encoded string constants within the Scheme constants are interpreted
as Unicode correctly.
This has several benefits:
* This obviates the string port that Source_file carries along, as a
result, it is no longer necessary to synchronize offsets within the
parser and that port. We don't have to copy the input data in a
separate byte vector anymore.
In earlier versions, the offset synchronization caused a problem
where LilyPond calculates offsets in the source file as bytes, while
GUILE interprets the source file as UTF-8 encoded Unicode. As a
result, files with Unicode before embedded scheme break completely.
* We don't need to switch the encoding of the port back and forth
during parsing.
* We don't need to access binary-ports or %default-port-encoding
This patch effectively reverts the following commits:
* commit 779715fdd5a582f8882a374a9a6546501e23a84a
GUILE2: Fix wide characters support in embedded SCM with guile-2.0
* commit de9f49055ca805e34e3ee537e3331b3932c58b95
GUILE2: Source_file::init_port: Keep GUILEv2 from redecoding string
input
Add comments that clarify how embedded scheme within #{ is #} is
parsed. Rename variable in Source_file::get_counts to avoid confusing
global and per-line offsets.
Adds the example from 779715f as a regression test.
Patch Set 1 #Patch Set 2 : rebase #Patch Set 3 : fix line/global confusion #Patch Set 4 : rebase #
Total comments: 1
Patch Set 5 : (C) #Patch Set 6 : set filename on port #
Total comments: 4
Patch Set 7 : configure #Patch Set 8 : rebase #
MessagesTotal messages: 31
|