chore(library/init/lean): disable new frontend for now
We are going to start making drastic changes in the parser, elaborator, attributes, etc. Examples: - No View objects. I am going to implement match_syntax. - No RecT in the parser. I am going to implement parser extensions using an approach similar to the one I used to implement environment extensions. - No Parsec. I will use an approach similar to the one used in the experiment https://github.com/leanprover/lean4/tree/master/tests/playground/parser It is easier to perform these changes with the new frontend disabled. I will slowly re-active it as I apply the changes. cc @kha
This commit is contained in:
parent
95b3ad69f9
commit
55626ba60d
24 changed files with 8 additions and 31 deletions
|
|
@ -4,10 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
|
|||
Authors: Leonardo de Moura
|
||||
-/
|
||||
prelude
|
||||
import init.lean.environment init.lean.parser.syntax
|
||||
import init.lean.environment
|
||||
|
||||
namespace Lean
|
||||
open Lean.Parser
|
||||
def Syntax := Unit -- Temporary hack
|
||||
def Syntax.missing := () -- Temporary hack
|
||||
|
||||
/- Scope management -/
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ Authors: Leonardo de Moura
|
|||
-/
|
||||
prelude
|
||||
import init.lean.compiler
|
||||
import init.lean.frontend
|
||||
import init.lean.extern
|
||||
import init.lean.environment
|
||||
import init.lean.modifiers
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
|
|||
Author: Leonardo de Moura
|
||||
-/
|
||||
prelude
|
||||
import init.lean.name init.lean.parser.stringliteral
|
||||
import init.lean.name
|
||||
namespace Lean
|
||||
open Lean.Parser
|
||||
open Lean.Parser.MonadParsec
|
||||
|
||||
private def String.mangleAux : Nat → String.Iterator → String → String
|
||||
| 0 it r := r
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
|
|||
Authors: Leonardo de Moura, Sebastian Ullrich
|
||||
-/
|
||||
prelude
|
||||
import init.data.nat init.data.rbmap init.lean.format init.lean.parser.parsec
|
||||
import init.data.nat init.data.rbmap init.lean.format
|
||||
|
||||
namespace Lean
|
||||
|
||||
|
|
@ -29,27 +29,4 @@ instance : HasFormat Position :=
|
|||
instance : Inhabited Position := ⟨⟨1, 0⟩⟩
|
||||
end Position
|
||||
|
||||
/-- A precomputed cache for quickly mapping Char offsets to positionitions. -/
|
||||
structure FileMap :=
|
||||
-- A mapping from Char offset of line start to line index
|
||||
(lines : RBMap Nat Nat (λ a b, a < b))
|
||||
|
||||
namespace FileMap
|
||||
private def fromStringAux : Nat → String.OldIterator → Nat → List (Nat × Nat)
|
||||
| 0 it line := []
|
||||
| (k+1) it line :=
|
||||
if it.hasNext = false then []
|
||||
else match it.curr with
|
||||
| '\n' := (it.next.offset, line+1) :: fromStringAux k it.next (line+1)
|
||||
| other := fromStringAux k it.next line
|
||||
|
||||
def fromString (s : String) : FileMap :=
|
||||
{lines := RBMap.ofList $ fromStringAux s.length s.mkOldIterator 1}
|
||||
|
||||
def toPosition (m : FileMap) (off : Nat) : Position :=
|
||||
match m.lines.lowerBound off with
|
||||
| some ⟨start, l⟩ := ⟨l, off - start⟩
|
||||
| none := ⟨1, off⟩
|
||||
end FileMap
|
||||
|
||||
end Lean
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ int getopt_long(int argc, char *in_argv[], const char *optstring, const option *
|
|||
|
||||
using namespace lean; // NOLINT
|
||||
|
||||
object * lean_process_file(object * filename, object * contents, uint8 json, object * env, object * world);
|
||||
// object * lean_process_file(object * filename, object * contents, uint8 json, object * env, object * world);
|
||||
|
||||
#ifndef LEAN_SERVER_DEFAULT_MAX_MEMORY
|
||||
#define LEAN_SERVER_DEFAULT_MAX_MEMORY 1024
|
||||
|
|
@ -505,6 +505,7 @@ int main(int argc, char ** argv) {
|
|||
|
||||
bool ok;
|
||||
if (new_frontend) {
|
||||
#if 0
|
||||
env.set_main_module(main_module_name);
|
||||
// Some C++ parts like profiling need a global message log. We may want to refactor them into a
|
||||
// message_log-passing state monad in the future.
|
||||
|
|
@ -521,6 +522,7 @@ int main(int argc, char ** argv) {
|
|||
ok = true;
|
||||
env = environment(cnstr_get(io_result_get_value(res.raw()), 1), true);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
message_log l;
|
||||
scope_message_log scope_log(l);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue