Skip to content

Commit

Permalink
Add 'is?' and 'to_s' method in Token
Browse files Browse the repository at this point in the history
  • Loading branch information
hahwul committed Jan 27, 2024
1 parent 65fe112 commit 71e4809
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/models/minilexer/token.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ class Token

def initialize(@type, @value, @position)
end

def is?(type)
@type == type
end

def to_s
"#{@type} #{@value}"
end
end

0 comments on commit 71e4809

Please sign in to comment.