Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor fix to quote handling in the script.

  • Loading branch information...
commit 34b6bf85c2d4d766d1129975d4bc54a6fbeabcf6 1 parent 9ca02ae
Derek Chen-Becker dchenbecker authored
Showing with 17 additions and 9 deletions.
  1. +17 −9 findBrokenQuotes.scala
26 findBrokenQuotes.scala
View
@@ -3,6 +3,7 @@ import scala.io.Source
sealed abstract class State
case object Normal extends State
case object InListing extends State
+case object InQuotes extends State
var state: State = Normal
var insetDepth = 0
@@ -22,18 +23,25 @@ for (file <- args) {
if (line.matches("""(?s)\\begin_inset Quotes e[lr]d.*""")) {
printf("Bad quotes at %s : %d\n", file, index + 1)
- output = "\""
- }
- if (line.matches("""(?s)\\begin_inset.*""")) {
- insetDepth += 1
- }
- if (line.matches("""(?s)\\end_inset.*""")) {
- insetDepth -= 1
- }
- if (insetDepth == 0) {
+ output = "\"\n"
+ state = InQuotes
+ } else {
+ if (line.matches("""(?s)\\begin_inset.*""")) {
+ insetDepth += 1
+ }
+ if (line.matches("""(?s)\\end_inset.*""")) {
+ insetDepth -= 1
+ }
+ if (insetDepth == 0) {
state = Normal
+ }
}
}
+ case InQuotes if line.matches("""(?s)\\end_inset.*""") => {
+ output = ""
+ state = InListing
+ }
+ case InQuotes => output = ""
case Normal =>
// ok
}
Please sign in to comment.
Something went wrong with that request. Please try again.