154 { |
154 { |
155 val improper1 = tokens.forall(_.is_improper) |
155 val improper1 = tokens.forall(_.is_improper) |
156 val command1 = tokens.exists(_.is_command) |
156 val command1 = tokens.exists(_.is_command) |
157 |
157 |
158 val depth1 = |
158 val depth1 = |
159 if (tokens.exists(tok => tok.is_command_kind(keywords, Keyword.theory))) 0 |
159 if (tokens.exists(keywords.is_command(_, Keyword.theory))) 0 |
160 else if (command1) structure.after_span_depth |
160 else if (command1) structure.after_span_depth |
161 else structure.span_depth |
161 else structure.span_depth |
162 |
162 |
163 val (span_depth1, after_span_depth1) = |
163 val (span_depth1, after_span_depth1) = |
164 ((structure.span_depth, structure.after_span_depth) /: tokens) { |
164 ((structure.span_depth, structure.after_span_depth) /: tokens) { |
165 case ((x, y), tok) => |
165 case ((x, y), tok) => |
166 if (tok.is_command) { |
166 if (tok.is_command) { |
167 if (tok.is_command_kind(keywords, Keyword.theory_goal)) (2, 1) |
167 if (keywords.is_command(tok, Keyword.theory_goal)) (2, 1) |
168 else if (tok.is_command_kind(keywords, Keyword.theory)) (1, 0) |
168 else if (keywords.is_command(tok, Keyword.theory)) (1, 0) |
169 else if (tok.is_command_kind(keywords, Keyword.proof_open)) (y + 2, y + 1) |
169 else if (keywords.is_command(tok, Keyword.proof_open)) (y + 2, y + 1) |
170 else if (tok.is_command_kind(keywords, Keyword.PRF_BLOCK == _)) (y + 2, y + 1) |
170 else if (keywords.is_command(tok, Keyword.PRF_BLOCK == _)) (y + 2, y + 1) |
171 else if (tok.is_command_kind(keywords, Keyword.QED_BLOCK == _)) (y + 1, y - 2) |
171 else if (keywords.is_command(tok, Keyword.QED_BLOCK == _)) (y + 1, y - 2) |
172 else if (tok.is_command_kind(keywords, Keyword.proof_close)) (y + 1, y - 1) |
172 else if (keywords.is_command(tok, Keyword.proof_close)) (y + 1, y - 1) |
173 else if (tok.is_command_kind(keywords, Keyword.qed_global)) (1, 0) |
173 else if (keywords.is_command(tok, Keyword.qed_global)) (1, 0) |
174 else (x, y) |
174 else (x, y) |
175 } |
175 } |
176 else (x, y) |
176 else (x, y) |
177 } |
177 } |
178 |
178 |