Kazuyoshi Kato
4874e8477b
Fix parsing of single quoted keys ( #201 )
...
Patch #193 doesn't work correctly because that must be handled by the
lexer, and `parseKey()` must not handle escape sequences.
Ref #61
2018-01-18 13:52:12 -08:00
Thomas Pelletier
861c4734ac
Support for hex, oct, and bin integers ( #205 )
...
Add support for non-decimal integers. At the time of writing, this is an
unreleased backward-compatible feature of TOML:
```
Non-negative integer values may also be expressed in hexadecimal, octal, or
binary. In these formats, leading zeros are allowed (after the prefix). Hex
values are case insensitive. Underscores are allowed between digits (but
not between the prefix and the value).
# hexadecimal with prefix `0x`
hex1 = 0xDEADBEEF
hex2 = 0xdeadbeef
hex3 = 0xdead_beef
# octal with prefix `0o`
oct1 = 0o01234567
oct2 = 0o755 # useful for Unix file permissions
# binary with prefix `0b`
bin1 = 0b11010110
```
Fixes #204
2017-12-22 12:24:26 +01:00
Thomas Pelletier
69d355db53
Lex performance improvement ( #176 )
...
* Use []token instead of chan token
name old time/op new time/op delta
ParseToml-8 1.18ms ± 0% 0.91ms ± 0% -22.98%
UnmarshalToml-8 1.29ms ± 0% 0.95ms ± 0% -25.96%
name old alloc/op new alloc/op delta
ParseToml-8 429kB ± 0% 444kB ± 0% +3.49%
UnmarshalToml-8 451kB ± 0% 466kB ± 0% +3.32%
name old allocs/op new allocs/op delta
ParseToml-8 14.1k ± 0% 13.7k ± 0% -2.31%
UnmarshalToml-8 15.1k ± 0% 14.7k ± 0% -2.16%
* Lex on []byte instead of io.Reader
name old time/op new time/op delta
ParseToml-8 1.18ms ± 0% 0.29ms ± 0% -75.18%
UnmarshalToml-8 1.27ms ± 0% 0.38ms ± 0% -70.38%
name old alloc/op new alloc/op delta
ParseToml-8 429kB ± 0% 135kB ± 0% -68.53%
UnmarshalToml-8 451kB ± 0% 157kB ± 0% -65.22%
name old allocs/op new allocs/op delta
ParseToml-8 14.1k ± 0% 3.2k ± 0% -77.20%
UnmarshalToml-8 15.1k ± 0% 4.2k ± 0% -72.00%
2017-06-27 18:26:37 -07:00
Albert Nigmatzianov
26ae43fdee
Use bytes.Buffer for tomlLexer.buffer ( #166 )
...
* Use bytes.Buffer for tomlLexer.buffer
* Add BenchmarkLexer
Fix #165
name old time/op new time/op delta
Lexer-4 343µs ± 1% 331µs ± 1% -3.56% (p=0.000 n=20+19)
name old alloc/op new alloc/op delta
Lexer-4 55.8kB ± 0% 50.8kB ± 0% -8.86% (p=0.000 n=20+20)
name old allocs/op new allocs/op delta
Lexer-4 2.01k ± 0% 1.84k ± 0% -8.46% (p=0.000 n=20+20)
2017-05-30 10:27:36 -07:00
Thomas Pelletier
d0ec4317d3
Fix compatibility with latest go-buffruneio ( #131 )
2017-02-27 14:18:12 -08:00
Thomas Pelletier
439fbba1f8
Make lexComment jump back to the previous state ( #122 )
...
When a comment appears in an rvalue, the lexer needs to jump back to
lexRValue, not to lexVoid.
Fixes #120 .
2016-12-29 19:51:04 +01:00
Thomas Pelletier
ce7be745f0
Rename group to table ( #115 )
...
* Rename Group to Table Fixes #45
* Change fmt.Errorf to errors.new for simple strings
2016-12-03 12:32:16 +01:00
Cameron Moore
d05a14897c
Fix typo in comment ( #94 )
2016-08-23 09:46:25 +02:00
Thomas Pelletier
64ff1ea4d5
Don't hang when reading an invalid rvalue ( #77 )
...
Fixes #76
2016-06-30 16:21:25 +02:00
Thomas Pelletier
1a8565204c
Fix multiline strings ( #62 )
2016-04-21 17:47:41 +02:00
Cameron Moore
92c565e02b
Use literal string for regexp pattern
2016-04-18 17:14:18 -05:00
Cameron Moore
6e26017b00
Clean up lint ( #56 )
...
The only real change in this commit is that MaxInt is made private.
Everything else should be gofmt'ing, docs and cleanup of lint.
2016-04-18 16:58:23 +02:00
Thomas Pelletier
2df083520a
Fix support for CRLF line ending
2016-02-19 14:12:13 +01:00
Thomas Pelletier
f963bc320f
Generic input
...
Fixes #47
2016-01-31 16:54:40 +01:00
Thomas Pelletier
6d743bb19f
Improve error checking on number parsing
2015-12-01 14:38:33 +01:00
Thomas Pelletier
dd4c4ffc2b
Implement inline tables
2015-09-09 16:56:18 +01:00
Thomas Pelletier
f58048cec0
Merge pull request #39 from pelletier/pelletier/integers_underscores
...
Accept underscores in integers
2015-07-17 16:54:19 -07:00
Thomas Pelletier
8e75093380
Accept underscores in integers
2015-07-16 22:07:16 -07:00
Thomas Pelletier
cf5ad6a245
Fixes #27 : Reject full 00 - 1F unicode range
2015-07-16 21:54:10 -07:00
Thomas Pelletier
41a8959f14
Reject new lines in keys
2015-07-14 20:07:43 -07:00
Thomas Pelletier
16a681db2a
Allow numbers in keys parsing
2015-07-14 19:56:28 -07:00
Thomas Pelletier
222e90a7d3
Parse long unicode
2015-05-21 18:52:26 -07:00
eanderton
1f3d0e03c3
Changes to support #29 - Support multi-line literal strings
...
* Added error output to test_program.go
* Added multi-line literal string support to lexer
* Added multi-line string supprt to lexer
* Added unit-test for new string support
* Modified test.sh to take an optional parameter to run an individual BurntSushi test suite.
* Fixed formatting
2015-02-26 18:03:30 -05:00
Thomas Pelletier
a56707c85f
Fixes #28 : Support of literal strings
2014-12-06 15:23:37 +01:00
Thomas Pelletier
4b47f52cb0
Fixes #31 : Use RFC 3339 for datetimes
2014-12-06 15:00:24 +01:00
Thomas Pelletier
2f2f28631b
Fixes #32 : Ensure keys are correctly parsed
2014-12-06 14:16:42 +01:00
Thomas Pelletier
543444f747
Fixes #30 : Implement exp notation in floats
2014-12-06 13:56:27 +01:00
eanderton
081f3db916
Final Toml-Path Solution
...
* Refactored type names and file names to mesh with existing TOML library more closely
* Added QueryResult structure that provides values and position data
* Added Query() method to TomlTree type
* Tests, tests, and more tests
* Fixed bug where positions returned from some tables were invalid
* Added test case for bug patch
The bugfix was an interesting case. Position information wasn't being
set in cases where createPath was called. So table names like [foo.bar]
would result in table 'foo' having no position.
2014-09-12 22:32:15 -04:00
Thomas Pelletier
fb5423fba2
Fixes #22 : Fixes style issues
2014-08-29 18:24:51 +02:00
eanderton
7c63fff960
Added Position Support to TomlTree
...
TomlDocument provides an optional TOML processing path where position
informaiton is stored alongside a TomlTree.
* Added Position struct
* Revised TomlTree to contain position data
* Added tomlValue to bind positions to values
* Revised parser to emit position data
* Revised token to use new Position struct
* Added tests for new functionality
* Bugfixed table array duplicate key handling
* Applied gofmt to all code
2014-08-26 21:00:41 -04:00
Thomas Pelletier
65684e6bb0
Fixes #20 : Creation of subgroup in table arrays
2014-08-14 10:12:39 +02:00
Thomas Pelletier
bf549a2194
Run gofmt
2014-08-07 12:52:42 +02:00
eanderton
7d9a3c25bd
Revised error reporting
2014-08-06 07:34:01 -04:00
eanderton
dd04a2f3cd
Added line/col support to lexer
2014-08-06 07:13:15 -04:00
eanderton
5dd3b53635
Fixed formatting
2014-07-08 22:02:42 -04:00
eanderton
262211488d
Fixed path handling and key group array name lexing for test compliance
2014-07-08 22:00:46 -04:00
eanderton
7b208738bc
Fixed formatting; added name to license file
2014-07-07 21:06:42 -04:00
eanderton
c8b5633273
Group array support; ToString() support
2014-07-07 20:48:29 -04:00
half-ogre
1c0f7f552c
\r is not a keychar on Windows
2014-02-20 14:51:43 -08:00
Thomas Pelletier
dc20c454d7
Handle dots in keys
2013-12-10 21:51:40 +01:00
Thomas Pelletier
0c4e891f3e
Handle non-alpha chars in keys
2013-12-10 19:46:56 +01:00
Thomas Pelletier
b1d602f733
Add missing string escape sequences
2013-12-10 19:35:47 +01:00
Thomas Pelletier
a34fc5f051
Don't allow invalid escape sequences
2013-12-10 17:34:11 +01:00
Thomas Pelletier
e8d5dbf787
Don't allow two equals for the same key
2013-12-10 17:28:16 +01:00
Thomas Pelletier
5ffe2e5565
Don't allow float to end with a dot
2013-12-10 17:24:53 +01:00
Thomas Pelletier
278c4d97ec
Don't allow floats starting with a dot
2013-12-10 17:17:15 +01:00
Thomas Pelletier
72d57d8477
Fix multiline array comments lexing
2013-12-09 19:05:29 +01:00
Thomas Pelletier
53005a205f
Handle keys with dash. ref #10
2013-12-09 17:12:07 +01:00
Thomas Pelletier
71141675e5
Fixes #6 : implement \uXXXX escaping
2013-07-01 21:38:00 +02:00
Thomas Pelletier
329092b812
Implement escapable characters in strings
2013-03-26 11:45:36 +01:00