mirror of
https://github.com/pnx/tree-sitter-dotenv
synced 2026-06-16 01:54:56 +02:00
Update grammar to correctly produce value token
Problem was before that for example the input [0x000KKK] would produce a hexadecimal and a value token (for the respective parts) However, the more correct way is to have the whole input identified as a value token. basicly if the whole input between "=" and a special "end-of-assignment" token can't be identified as a string,bool,integer whatever. it should be identified as a value token.
This commit is contained in:
parent
e7a97e884a
commit
d0b54d61aa
8 changed files with 427 additions and 539 deletions
|
|
@ -10,11 +10,9 @@ KEY_WITH_VALUE = value
|
|||
|
||||
(document
|
||||
(assignment
|
||||
key: (identifier)
|
||||
value: (value))
|
||||
key: (identifier))
|
||||
(assignment
|
||||
key: (identifier)
|
||||
value: (value))
|
||||
key: (identifier))
|
||||
(assignment
|
||||
key: (identifier)
|
||||
value: (value)))
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Comments
|
|||
EMPTY_WITH_COMMENT=# comment
|
||||
EMPTY_WITH_COMMENT_WHITESPACE = # comment
|
||||
|
||||
STRING_VALUE_WITH_COMMENT = 'string' # comment
|
||||
STRING_VALUE_WITH_COMMENT = 'string content' # comment
|
||||
STRING_VALUE_WITH_COMMENT = "string" # comment
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
@ -22,12 +22,10 @@ STRING_VALUE_WITH_COMMENT = "string" # comment
|
|||
(comment)
|
||||
(comment)
|
||||
(assignment
|
||||
key: (identifier)
|
||||
value: (value))
|
||||
key: (identifier))
|
||||
(comment)
|
||||
(assignment
|
||||
key: (identifier)
|
||||
value: (value))
|
||||
key: (identifier))
|
||||
(comment)
|
||||
(assignment
|
||||
key: (identifier)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Number - Integer
|
|||
|
||||
INTEGER_VALUE = 1234
|
||||
NEGATIVE_INTEGER_VALUE = -1234
|
||||
INVALID_INTEGER = 01234
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -15,8 +16,10 @@ NEGATIVE_INTEGER_VALUE = -1234
|
|||
(assignment
|
||||
key: (identifier)
|
||||
value: (number
|
||||
(integer))))
|
||||
|
||||
(integer)))
|
||||
(assignment
|
||||
key: (identifier)
|
||||
value: (value)))
|
||||
|
||||
================================================================================
|
||||
Number - Float
|
||||
|
|
@ -42,6 +45,7 @@ Number - Hex
|
|||
================================================================================
|
||||
|
||||
HEX = 0xff00ff
|
||||
INVALID_HEX = 0xffUUOKJ
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -49,7 +53,10 @@ HEX = 0xff00ff
|
|||
(assignment
|
||||
key: (identifier)
|
||||
value: (number
|
||||
(hexadecimal))))
|
||||
(hexadecimal)))
|
||||
(assignment
|
||||
key: (identifier)
|
||||
value: (value)))
|
||||
|
||||
================================================================================
|
||||
Boolean
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue