Skip to content

Commit

Permalink
Merge pull request #1 from fny/master
Browse files Browse the repository at this point in the history
Add support for single-quoted and numeric keys
Works great
  • Loading branch information
Jason Williams authored and Jason Williams committed Apr 27, 2016
2 parents 7b70ab5 + 133a3a6 commit 33d7886
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions TOML-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,18 @@ a=[ 1, 2.0 ] # note: this is NOT ok

[[Array.of.table]]

[table]

[table]
key = "value"
bare_key = "value"
bare-key = "value"
1234 = "value"

"127.0.0.1" = "value"
"character encoding" = "value"
"ʎǝʞ" = "value"
'key2' = "value"
'quoted "value"' = "value"

= "no key name" # INVALID
"" = "blank" # VALID but discouraged
'' = 'blank' # VALID but discouraged
6 changes: 3 additions & 3 deletions TOML.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repository:
'1': {name: comment.line.number-sign.toml}
'2': {name: punctuation.definition.comment.toml}
comment: Comments

tables:
patterns:
- name: invalid.illegal.table.array.toml
Expand Down Expand Up @@ -56,7 +56,7 @@ repository:
- include: '#comments'
- include: '#keys'
- include: '#illegal'

keys:
patterns:
- name: invalid.illegal.noKeyDefined.toml
Expand All @@ -65,7 +65,7 @@ repository:
- name: invalid.deprecated.noValueGiven.toml
match: (\s*[A-Za-z_\-][A-Za-z0-9_\-]*\s*=)(?=\s*$)
comment: Assignments without value are unusual
- begin: '\s*([A-Za-z_-][A-Za-z0-9_-]*|".+")\s*(=)\s*'
- begin: \s*([A-Za-z_-][A-Za-z0-9_-]*|".+"|'.+'|[0-9]+)\s*(=)\s*
end: ($|(?==)|\,|\s*\})
beginCaptures:
'1': {name: keyword.key.toml}
Expand Down
2 changes: 1 addition & 1 deletion TOML.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
</dict>
<dict>
<key>begin</key>
<string>\s*([A-Za-z_-][A-Za-z0-9_-]*|".+")\s*(=)\s*</string>
<string>\s*([A-Za-z_-][A-Za-z0-9_-]*|".+"|'.+'|[0-9]+)\s*(=)\s*</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
Expand Down

0 comments on commit 33d7886

Please sign in to comment.