Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Worked on #65. Added array parts to the scanner ([, ]). Removed the R…
Browse files Browse the repository at this point in the history
…ADIX token.
  • Loading branch information
mjstahl committed May 30, 2013
1 parent 958af15 commit 568b9ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/soma/scan/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ func (s *Scanner) Scan() (pos file.Pos, tok Token, lit string) {
tok, lit = LBRACE, "{"
case '}':
tok, lit = RBRACE, "}"
case '[':
tok, lit = LBRACK, "["
case ']':
tok, lit = RBRACK, "]"
case '(':
tok, lit = LPAREN, "("
case ')':
Expand Down
9 changes: 6 additions & 3 deletions src/soma/scan/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@ type Token int

const (
ILLEGAL Token = iota
EOF // EOF
EOF // EOF

COMMENT // "a comment"

BINARY // +, |, &, ^
BINARY // '!', '%', '*', '/', '+', '|', '&', '^', '-', '>', '<', '=', '?', '\', '~':
IDENT // aBool, not
KEYWORD // ifTrue:
GLOBAL // True, False nil

INT
RADIX

ASSIGN // :=
DEFINE // =>

LBRACE // {
RBRACE // }
LBRACK // [
RBRACK // ]
LPAREN // (
RPAREN // )

Expand Down Expand Up @@ -58,6 +59,8 @@ var tokens = [...]string{

LBRACE: "{",
RBRACE: "}",
LBRACK: "[",
RBRACK: "]",
LPAREN: "(",
RPAREN: ")",

Expand Down

0 comments on commit 568b9ca

Please sign in to comment.