equal
deleted
inserted
replaced
177 lazy val T: Parser[String, Int] = { |
177 lazy val T: Parser[String, Int] = { |
178 (F ~ p"*" ~ T).map{ case ((x, _), z) => x * z } || F } |
178 (F ~ p"*" ~ T).map{ case ((x, _), z) => x * z } || F } |
179 lazy val F: Parser[String, Int] = { |
179 lazy val F: Parser[String, Int] = { |
180 (p"(" ~ E ~ p")").map{ case ((_, y), _) => y } || NumParserInt } |
180 (p"(" ~ E ~ p")").map{ case ((_, y), _) => y } || NumParserInt } |
181 |
181 |
182 println(E.parse_all("2*2*2")) |
182 println(E.parse_all("2 * 2 * 2")) |
183 println(E.parse_all("1+3+4")) |
183 println(E.parse_all("1+3+4")) |
184 println(E.parse("1+3+4")) |
184 println(E.parse("1+3+4")) |
185 println(E.parse_all("4*2+3")) |
185 println(E.parse_all("4*2+3")) |
186 println(E.parse_all("4*(2+3)")) |
186 println(E.parse_all("4*(2+3)")) |
187 println(E.parse_all("(4)*(((2+3)))")) |
187 println(E.parse_all("(4)*(((2+3)))")) |