Skip to content

remove latex-style quoting #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ trait JavaTokenParsers extends RegexParsers {
*/
def ident: Parser[String] = (
"" ~> // handle whitespace
rep1(acceptIf(Character.isJavaIdentifierStart)("identifier expected but `" + _ + "' found"),
rep1(acceptIf(Character.isJavaIdentifierStart)("identifier expected but '" + _ + "' found"),
elem("identifier part", Character.isJavaIdentifierPart(_: Char))) ^^ (_.mkString)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ trait RegexParsers extends Parsers {
if (i == s.length)
Success(source.subSequence(start, j).toString, in.drop(j - offset))
else {
val found = if (start == source.length()) "end of source" else "`"+source.charAt(start)+"'"
Failure("`"+s+"' expected but "+found+" found", in.drop(start - offset))
val found = if (start == source.length()) "end of source" else "'"+source.charAt(start)+"'"
Failure("'"+s+"' expected but "+found+" found", in.drop(start - offset))
}
}
}
Expand All @@ -112,8 +112,8 @@ trait RegexParsers extends Parsers {
Success(source.subSequence(start, start + matched.end).toString,
in.drop(start + matched.end - offset))
case None =>
val found = if (start == source.length()) "end of source" else "`"+source.charAt(start)+"'"
Failure("string matching regex `"+r+"' expected but "+found+" found", in.drop(start - offset))
val found = if (start == source.length()) "end of source" else "'"+source.charAt(start)+"'"
Failure("string matching regex '"+r+"' expected but "+found+" found", in.drop(start - offset))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package token
trait StdTokens extends Tokens {
/** The class of keyword tokens */
case class Keyword(chars: String) extends Token {
override def toString = "`"+chars+"'"
override def toString = "'"+chars+"'"
}

/** The class of numeric literal tokens */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class JavaTokenParsersTest {
assertEquals(".1", decimalNumber(new CharArrayReader(".1".toCharArray)).get)
// should fail to parse and we should get Failure as ParseResult
val failure = decimalNumber(new CharArrayReader("!1".toCharArray)).asInstanceOf[Failure]
assertEquals("""string matching regex `(\d+(\.\d*)?|\d*\.\d+)' expected but `!' found""", failure.msg)
assertEquals("""string matching regex '(\d+(\.\d*)?|\d*\.\d+)' expected but '!' found""", failure.msg)
}

@Test
Expand Down Expand Up @@ -73,7 +73,7 @@ class JavaTokenParsersTest {
parseResult1 match {
case e @ Failure(message, next) =>
assertEquals(next.pos.column, 7)
assert(message.endsWith("string matching regex `(?i)AND' expected but `s' found"))
assert(message.endsWith("string matching regex '(?i)AND' expected but 's' found"))
case _ => sys.error(parseResult1.toString)
}

Expand All @@ -97,7 +97,7 @@ class JavaTokenParsersTest {
case Failure(message, next) =>
assertEquals(next.pos.line, 1)
assertEquals(next.pos.column, 1)
assert(message.endsWith(s"identifier expected but `-' found"))
assert(message.endsWith(s"identifier expected but '-' found"))
case _ => sys.error(parseResult.toString)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class PackratParsersTest {
val failure = parseResult.asInstanceOf[Failure]
assertEquals(expectedFailureMsg, failure.msg)
}
assertFailure("'`b'' expected but `c' found", "a a a a b b b c c c c")
assertFailure("''b'' expected but 'c' found", "a a a a b b b c c c c")
assertFailure("end of input", "a a a a b b b b c c c")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class RegexParsersTest {
}

val failure1 = parseAll(p, "-x").asInstanceOf[Failure]
assertEquals("string matching regex `\\d+' expected but `x' found", failure1.msg)
assertEquals("string matching regex '\\d+' expected but 'x' found", failure1.msg)
val failure2 = parseAll(p, "x").asInstanceOf[Failure]
assertEquals("string matching regex `\\d+' expected but `x' found", failure2.msg)
assertEquals("string matching regex '\\d+' expected but 'x' found", failure2.msg)
assertEquals(result(-5), extractResult(parseAll(p, "-5")))
assertEquals(result(5), extractResult(parseAll(p, "5")))
val error1 = parseAll(q, "-x").asInstanceOf[Error]
Expand Down