Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,27 @@ funky keys unless there is a good reason to use them.
```


### Conversion caveats

Given the current implementation, *most* values are represented exactly the way
they are spelled out in the input file after they're queried for. The following
value notations will be converted to a different notation related to the
backing Go type:

```txt
1_000 => 1000 # Underscores are not retained.
0xFFFF => 65535 # Hexadecimal is converted to decimal.
0o755 => 493 # Octal is converted to decimal.
0b1111_1111 => 255 # Binary is converted to decimal.
+100 => 100 # The plus sign is dropped.
5e-3 => 0.005 # The exponential notation is not kept.

# Other relevant notations like date, time, date-time, with and without the
# offset, inf, nan, negative numbers, stay the way they're written in the
# input file.
```


### Multiline query with bare strings

Here is a dummy configuration file in TOML found on the web for Gitlab
Expand Down
22 changes: 6 additions & 16 deletions internal/lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,7 @@
t := l.buffer[l.offset]
start := l.offset
l.advance()
for {
if l.offset > len(l.buffer)-1 {
break
}
for l.offset <= len(l.buffer)-1 {

Check warning on line 160 in internal/lexer/lexer.go

View check run for this annotation

Codecov / codecov/patch

internal/lexer/lexer.go#L160

Added line #L160 was not covered by tests
t = l.buffer[l.offset]
if !isBareChar(t.Rune) {
break
Expand All @@ -180,10 +177,9 @@
l.advance()
for {
if l.offset > len(l.buffer)-1 {
// NOTE: This error is reported because the string goes
// past the buffer without encountering the matching
// quote character that should terminate the quoted
// string.
// NOTE: This error is reported because the string goes past the
// buffer without encountering the matching quote character that
// should terminate the quoted string.
l.setToken(Undefined, start, l.offset+1)
l.pushErr(ErrUnterminatedString)
return false
Expand All @@ -206,10 +202,7 @@
t := l.buffer[l.offset]
start := l.offset
l.advance()
for {
if l.offset > len(l.buffer)-1 {
break
}
for l.offset <= len(l.buffer)-1 {
t = l.buffer[l.offset]
if !isDigit(t.Rune) {
break
Expand All @@ -224,10 +217,7 @@
t := l.buffer[l.offset]
start := l.offset
l.advance()
for {
if l.offset > len(l.buffer)-1 {
break
}
for l.offset <= len(l.buffer)-1 {
l.resetLineOffsetOnLineBreak(t.Rune)
t = l.buffer[l.offset]
if !isWhitespace(t.Rune) {
Expand Down
Loading