Skip to content

Commit

Permalink
improve performance on chompOps function
Browse files Browse the repository at this point in the history
  • Loading branch information
decioferreira committed Dec 11, 2024
1 parent 8d53954 commit 03a6c67
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/Compiler/Parse/Symbol.elm
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,13 @@ operator toExpectation toError =

chompOps : String -> Int -> Int -> Int
chompOps src pos end =
if pos < end && isBinopChar src pos then
if pos < end && isBinopCharHelp (P.unsafeIndex src pos) then
chompOps src (pos + 1) end

else
pos


isBinopChar : String -> Int -> Bool
isBinopChar src pos =
src
|> String.dropLeft pos
|> String.toList
|> List.head
|> Maybe.map isBinopCharHelp
|> Maybe.withDefault False


isBinopCharHelp : Char -> Bool
isBinopCharHelp char =
let
Expand Down

0 comments on commit 03a6c67

Please sign in to comment.