Skip to content

Commit

Permalink
man -_-
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonak-Adipta-Kalita committed Apr 7, 2023
1 parent 717fad5 commit 2e4c863
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
25 changes: 25 additions & 0 deletions lexer/position.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package lexer

type Position struct {
Idx int
Ln int
Col int
Fn string
Ftxt string
}

func (p *Position) Advance(currentChar byte) *Position {
p.Idx += 1
p.Col += 1

if currentChar == '\n' {
p.Ln += 1
p.Col = 0
}

return p
}

func (p *Position) Copy() *Position {
return &Position{p.Idx, p.Ln, p.Col, p.Fn, p.Ftxt}
}
8 changes: 1 addition & 7 deletions lexer/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ const (
TT_EOF TokenType = iota
TT_ILLEGAL
TT_WHITE_SPACE
TT_FLOAT
TT_INT
TT_STRING
TT_BOOL
TT_PLUS
TT_MINUS
TT_MUL
Expand All @@ -18,11 +14,9 @@ const (
TT_ASSIGN
TT_LPAREN
TT_RPAREN
TT_LSQUARE
TT_RSQUARE
)

type Token struct {
Value string
Type TokenType
}
}

0 comments on commit 2e4c863

Please sign in to comment.