31 else result ++= s |
31 else result ++= s |
32 } |
32 } |
33 result += '"' |
33 result += '"' |
34 result.toString |
34 result.toString |
35 } |
35 } |
|
36 |
|
37 def init(): Outer_Syntax = new Outer_Syntax() |
36 } |
38 } |
37 |
39 |
38 class Outer_Syntax |
40 class Outer_Syntax private( |
|
41 keywords: Map[String, String] = Map((";" -> Keyword.DIAG)), |
|
42 lexicon: Scan.Lexicon = Scan.Lexicon.empty, |
|
43 val completion: Completion = Completion.init()) |
39 { |
44 { |
40 protected val keywords: Map[String, String] = Map((";" -> Keyword.DIAG)) |
|
41 protected val lexicon: Scan.Lexicon = Scan.Lexicon.empty |
|
42 lazy val completion: Completion = Completion.init() // FIXME odd initialization |
|
43 |
|
44 def keyword_kind(name: String): Option[String] = keywords.get(name) |
45 def keyword_kind(name: String): Option[String] = keywords.get(name) |
45 |
46 |
46 def + (name: String, kind: String, replace: String): Outer_Syntax = |
47 def + (name: String, kind: String, replace: String): Outer_Syntax = |
47 { |
48 new Outer_Syntax( |
48 val new_keywords = keywords + (name -> kind) |
49 keywords + (name -> kind), |
49 val new_lexicon = lexicon + name |
50 lexicon + name, |
50 val new_completion = |
51 if (Keyword.control(kind)) completion else completion + (name, replace)) |
51 if (Keyword.control(kind)) completion |
|
52 else completion + (name, replace) |
|
53 new Outer_Syntax { |
|
54 override val lexicon = new_lexicon |
|
55 override val keywords = new_keywords |
|
56 override lazy val completion = new_completion |
|
57 } |
|
58 } |
|
59 |
52 |
60 def + (name: String, kind: String): Outer_Syntax = this + (name, kind, name) |
53 def + (name: String, kind: String): Outer_Syntax = this + (name, kind, name) |
61 |
54 |
62 def + (name: String): Outer_Syntax = this + (name, Keyword.MINOR) |
55 def + (name: String): Outer_Syntax = this + (name, Keyword.MINOR) |
63 |
56 |