Skip to content

Commit

Permalink
add example for negative numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
xiam committed Feb 9, 2020
1 parent f2ec568 commit c43bfc4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ast/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,7 @@ func (n *Node) IsVector() bool {
}
return false
}

func (n *Node) Parent() *Node {
return n.p
}
12 changes: 12 additions & 0 deletions lexer/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ func TestScanner(t *testing.T) {
testCases := []string{
`1`,

`-1 -2.22`,

`+ 1 1 1 1`,

`[ [ [] ] [] []]`,
Expand Down Expand Up @@ -132,6 +134,16 @@ func TestTokenize(t *testing.T) {
TokenEOF,
},
},
{
`-1.23`,
[]TokenType{
TokenSequence,
TokenInteger,
TokenSequence,
TokenInteger,
TokenEOF,
},
},
{
`(+
[1
Expand Down

0 comments on commit c43bfc4

Please sign in to comment.