equal
deleted
inserted
replaced
117 val ops = |
117 val ops = |
118 parse_all(rep(parser), Token.reader(toks, Token.Pos.file(file_name))) match { |
118 parse_all(rep(parser), Token.reader(toks, Token.Pos.file(file_name))) match { |
119 case Success(result, _) => result |
119 case Success(result, _) => result |
120 case bad => error(bad.toString) |
120 case bad => error(bad.toString) |
121 } |
121 } |
122 try { (options.set_section("") /: ops) { case (opts, op) => op(opts) } } |
122 try { ops.foldLeft(options.set_section("")) { case (opts, op) => op(opts) } } |
123 catch { case ERROR(msg) => error(msg + Position.here(Position.File(file_name))) } |
123 catch { case ERROR(msg) => error(msg + Position.here(Position.File(file_name))) } |
124 } |
124 } |
125 |
125 |
126 def parse_prefs(options: Options, content: String): Options = |
126 def parse_prefs(options: Options, content: String): Options = |
127 parse_file(options, PREFS.file_name, content, syntax = prefs_syntax, parser = prefs_entry) |
127 parse_file(options, PREFS.file_name, content, syntax = prefs_syntax, parser = prefs_entry) |
135 var options = empty |
135 var options = empty |
136 for { |
136 for { |
137 dir <- Isabelle_System.components() |
137 dir <- Isabelle_System.components() |
138 file = dir + OPTIONS if file.is_file |
138 file = dir + OPTIONS if file.is_file |
139 } { options = Parser.parse_file(options, file.implode, File.read(file)) } |
139 } { options = Parser.parse_file(options, file.implode, File.read(file)) } |
140 (Options.Parser.parse_prefs(options, prefs) /: opts)(_ + _) |
140 opts.foldLeft(Options.Parser.parse_prefs(options, prefs))(_ + _) |
141 } |
141 } |
142 |
142 |
143 |
143 |
144 /* encode */ |
144 /* encode */ |
145 |
145 |
179 val options = |
179 val options = |
180 { |
180 { |
181 val options0 = Options.init() |
181 val options0 = Options.init() |
182 val options1 = |
182 val options1 = |
183 if (build_options) |
183 if (build_options) |
184 (options0 /: Word.explode(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")))(_ + _) |
184 Word.explode(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")).foldLeft(options0)(_ + _) |
185 else options0 |
185 else options0 |
186 (options1 /: more_options)(_ + _) |
186 more_options.foldLeft(options1)(_ + _) |
187 } |
187 } |
188 |
188 |
189 if (get_option != "") |
189 if (get_option != "") |
190 Output.writeln(options.check_name(get_option).value, stdout = true) |
190 Output.writeln(options.check_name(get_option).value, stdout = true) |
191 |
191 |
361 case i => this + (str.substring(0, i), str.substring(i + 1)) |
361 case i => this + (str.substring(0, i), str.substring(i + 1)) |
362 } |
362 } |
363 } |
363 } |
364 |
364 |
365 def ++ (specs: List[Options.Spec]): Options = |
365 def ++ (specs: List[Options.Spec]): Options = |
366 (this /: specs)({ case (x, (y, z)) => x + (y, z) }) |
366 specs.foldLeft(this) { case (x, (y, z)) => x + (y, z) } |
367 |
367 |
368 |
368 |
369 /* sections */ |
369 /* sections */ |
370 |
370 |
371 def set_section(new_section: String): Options = |
371 def set_section(new_section: String): Options = |