h_token: Copy string correctly.
See https://github.com/ffi/ffi/wiki/Core-Concepts#string-memory-allocation for additional information.
This commit is contained in:
parent
d53ee07499
commit
96dfad0178
3 changed files with 22 additions and 11 deletions
|
|
@ -72,4 +72,14 @@ p parser.parse 'abcabd'
|
|||
p parser.parse 'abdabd'
|
||||
p parser.parse 'abd'
|
||||
|
||||
$r = parser.parse 'abcabd'
|
||||
#$r = parser.parse 'abcabd'
|
||||
|
||||
|
||||
# Test multibyte characters
|
||||
parser = Hammer::Parser.build {
|
||||
token '今日'
|
||||
end_p
|
||||
}
|
||||
|
||||
p ($r = parser.parse('今日')) # should succeed
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue