예제 #1
0
import vim

import os
import re
import subprocess
import xml.etree.ElementTree as ET
import signal

from collections import deque

import vimbufsync
vimbufsync.check_version("0.1.0", who="coquille")

#: Pipe used to discuss with coqtop
coqtop = None

#: See vimbufsync ( https://github.com/def-lkb/vimbufsync )
saved_sync = None

#: Keeps track of what have been checked by Coq, and what is waiting to be
#: checked.
encountered_dots = []
send_queue = deque([])

error_at = None

info_msg = None

###################
# synchronization #
###################
예제 #2
0
import subprocess
import json
import vim
import re
import os
import sys
from sys import platform

import vimbufsync
vimbufsync.check_version("0.1.0", who="merlin")

enclosing_types = []  # nothing to see here
current_enclosing = -1
atom_bound = re.compile('[a-z_0-9A-Z\'`.]')
re_wspaces = re.compile("[\n ]+")

######## ERROR MANAGEMENT


class MerlinExc(Exception):
    def __init__(self, value):
        self.value = value

    def __str__(self):
        return repr(self.value)


class Failure(MerlinExc):
    pass

예제 #3
0
파일: merlin.py 프로젝트: sancao2/merlin
import subprocess
import json
import vim
import re
import os
import sys
from sys import platform

import vimbufsync

vimbufsync.check_version("0.1.0", who="merlin")

enclosing_types = []  # nothing to see here
current_enclosing = -1
atom_bound = re.compile("[a-z_0-9A-Z'`.]")
re_wspaces = re.compile("[\n ]+")

######## ERROR MANAGEMENT


class MerlinExc(Exception):
    def __init__(self, value):
        self.value = value

    def __str__(self):
        return repr(self.value)


class Failure(MerlinExc):
    pass
예제 #4
0
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division

import vim

import re
import xml.etree.ElementTree as ET
import coqtop as CT
import project_file

from collections import deque

import vimbufsync
vimbufsync.check_version([0, 1, 0], who="coquille")

# Define unicode in python 3
if isinstance(__builtins__, dict):
    unicode = __builtins__.get('unicode', str)
else:
    unicode = getattr(__builtins__, 'unicode', str)

# Cache whether vim has a bool type
vim_has_bool = vim.eval("exists('v:false')")


def vim_repr(value):
    "Converts a python value into a vim value"
    if isinstance(value, bool):
        if value:
            if vim_has_bool:
예제 #5
0
import os
import sys
import vim
import subprocess
import bisect

import vimbufsync
vimbufsync.check_version("0.1.0", who="ocp-indent-vim")

inline_process = None
saved_states = []
saved_sync = None
ocp_indent_path = "ocp-indent"

insert_mode = False
equal_line = None
equal_consecutive = 0
equal_lines = []

def sync():
  global saved_sync, saved_states
  curr_sync = vimbufsync.sync()
  if not saved_sync or curr_sync.buf() != saved_sync.buf():
    saved_states = []
  else:
    line = saved_sync.line()
    i = bisect.bisect_left(saved_states, (line,""))
    if i != len(saved_states):
      saved_states = saved_states[:i]
  saved_sync = curr_sync
예제 #6
0
import vim

import re
import xml.etree.ElementTree as ET
import coqtop as CT

from collections import deque

import vimbufsync
vimbufsync.check_version("0.1.0", who="coquille")

#: See vimbufsync ( https://github.com/def-lkb/vimbufsync )
saved_sync = None

#: Keeps track of what have been checked by Coq, and what is waiting to be
#: checked.
encountered_dots = []
send_queue = deque([])

error_at = None

info_msg = None

###################
# synchronization #
###################


def sync():
    global saved_sync
    curr_sync = vimbufsync.sync()
예제 #7
0
        Any,
        Callable,
        Deque,
        Dict,
        Generator,
        List,
        Optional,
        Mapping,
        Sequence,
        Text,
        Tuple,
    )
except ImportError:
    pass

vimbufsync.check_version("0.1.0", who="coqtail")


# Error Messages #
def fail(err):
    # type: (Exception) -> None
    """Print an error and stop Coqtail."""
    print(err, file=sys.stderr)
    vim.command("call coqtail#Stop()")


def unexpected(response, where):
    # type: (Any, str) -> None
    """Print a debugging error about an unexpected response."""
    print(
        "Coqtail received unexpected response {} in {}".format(
예제 #8
0
import os
import re
import sys
from collections import deque, defaultdict as ddict

import coqtop as CT
import vimbufsync

# For Mypy
try:
    from typing import (Any, Callable, Deque, Dict, Generator, List, Optional,
                        Mapping, Sequence, Text, Tuple)
except ImportError:
    pass

vimbufsync.check_version('0.1.0', who='coqtail')


# Error Messages #
def fail(err):
    # type: (Exception) -> None
    """Print an error and stop Coqtail."""
    print(err, file=sys.stderr)
    vim.command('call coqtail#Stop()')


def unexpected(response, where):
    # type: (Any, str) -> None
    """Print a debugging error about an unexpected response."""
    print("Coqtail received unexpected response {} in {}".format(
        response, where),