equal
deleted
inserted
replaced
265 /* abbreviations */ |
265 /* abbreviations */ |
266 |
266 |
267 private val caret_indicator = '\007' |
267 private val caret_indicator = '\007' |
268 private val antiquote = "@{" |
268 private val antiquote = "@{" |
269 private val default_abbrs = |
269 private val default_abbrs = |
270 Map("@{" -> "@{\007}", "`" -> "\\<open>\007\\<close>") |
270 List("@{" -> "@{\007}", "`" -> "\\<open>\007\\<close>", "`" -> "\\<open>", "`" -> "\\<close>") |
271 } |
271 } |
272 |
272 |
273 final class Completion private( |
273 final class Completion private( |
274 keywords: Map[String, Boolean] = Map.empty, |
274 keywords: Map[String, Boolean] = Map.empty, |
275 words_lex: Scan.Lexicon = Scan.Lexicon.empty, |
275 words_lex: Scan.Lexicon = Scan.Lexicon.empty, |
307 val symbol_abbrs = |
307 val symbol_abbrs = |
308 (for ((x, y) <- Symbol.abbrevs.iterator if !Completion.Word_Parsers.is_word(y)) |
308 (for ((x, y) <- Symbol.abbrevs.iterator if !Completion.Word_Parsers.is_word(y)) |
309 yield (y, x)).toList |
309 yield (y, x)).toList |
310 |
310 |
311 val abbrs = |
311 val abbrs = |
312 for ((a, b) <- symbol_abbrs ::: Completion.default_abbrs.toList) |
312 for ((a, b) <- symbol_abbrs ::: Completion.default_abbrs) |
313 yield (a.reverse, (a, b)) |
313 yield (a.reverse, (a, b)) |
314 |
314 |
315 new Completion( |
315 new Completion( |
316 keywords, |
316 keywords, |
317 words_lex ++ words.map(_._1), |
317 words_lex ++ words.map(_._1), |
345 abbrevs match { |
345 abbrevs match { |
346 case Nil => None |
346 case Nil => None |
347 case (a, _) :: _ => |
347 case (a, _) :: _ => |
348 val ok = |
348 val ok = |
349 if (a == Completion.antiquote) language_context.antiquotes |
349 if (a == Completion.antiquote) language_context.antiquotes |
350 else language_context.symbols || Completion.default_abbrs.isDefinedAt(a) |
350 else language_context.symbols || Completion.default_abbrs.exists(_._1 == a) |
351 if (ok) Some(((a, abbrevs), caret)) |
351 if (ok) Some(((a, abbrevs), caret)) |
352 else None |
352 else None |
353 } |
353 } |
354 case _ => None |
354 case _ => None |
355 } |
355 } |