equal
deleted
inserted
replaced
19 |
19 |
20 object Parse extends RegexParsers |
20 object Parse extends RegexParsers |
21 { |
21 { |
22 override val whiteSpace = "".r |
22 override val whiteSpace = "".r |
23 |
23 |
24 def rev_symbol: Parser[String] = """>[A-Za-z0-9_']+<\\""".r |
24 def reverse_symbol: Parser[String] = """>[A-Za-z0-9_']+<\\""".r |
25 def rev_symb: Parser[String] = """[A-Za-z0-9_']{2,}<\\""".r |
25 def reverse_symb: Parser[String] = """[A-Za-z0-9_']{2,}<\\""".r |
26 def word: Parser[String] = "[a-zA-Z0-9_']{3,}".r |
26 def word: Parser[String] = "[a-zA-Z0-9_']{3,}".r |
27 |
27 |
28 def read(in: CharSequence): Option[String] = |
28 def read(in: CharSequence): Option[String] = |
29 { |
29 { |
30 val rev_in = new Library.Reverse(in) |
30 val reverse_in = new Library.Reverse(in) |
31 parse((rev_symbol | rev_symb | word) ^^ (_.reverse), rev_in) match { |
31 parse((reverse_symbol | reverse_symb | word) ^^ (_.reverse), reverse_in) match { |
32 case Success(result, _) => Some(result) |
32 case Success(result, _) => Some(result) |
33 case _ => None |
33 case _ => None |
34 } |
34 } |
35 } |
35 } |
36 } |
36 } |
84 /* complete */ |
84 /* complete */ |
85 |
85 |
86 def complete(line: CharSequence): Option[(String, List[String])] = |
86 def complete(line: CharSequence): Option[(String, List[String])] = |
87 { |
87 { |
88 abbrevs_lex.parse(abbrevs_lex.keyword, new Library.Reverse(line)) match { |
88 abbrevs_lex.parse(abbrevs_lex.keyword, new Library.Reverse(line)) match { |
89 case abbrevs_lex.Success(rev_a, _) => |
89 case abbrevs_lex.Success(reverse_a, _) => |
90 val (word, c) = abbrevs_map(rev_a) |
90 val (word, c) = abbrevs_map(reverse_a) |
91 Some(word, List(c)) |
91 Some(word, List(c)) |
92 case _ => |
92 case _ => |
93 Completion.Parse.read(line) match { |
93 Completion.Parse.read(line) match { |
94 case Some(word) => |
94 case Some(word) => |
95 words_lex.completions(word).map(words_map(_)) match { |
95 words_lex.completions(word).map(words_map(_)) match { |