korekto 1.4.210318 → 1.6.210409

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebe8d20d5b0f785dab1f984276491bf452941f3ded713c07fe11707af9cbe501
4
- data.tar.gz: e5b861d5be1dc2e1595bfa47a34186922a3eb3867295b5b41eafab8204941516
3
+ metadata.gz: 91b2307d9115580d8a6882a7bf8d417d1eca426d7539fff91dce791ea7dd1ff9
4
+ data.tar.gz: 1a1db1ac36359058341083031abe61e6e9c3258fdaf2cb2388140ef3e179b8fa
5
5
  SHA512:
6
- metadata.gz: c682441f95e8bf3b149085946a0f8cc44665b46cfdcfd6acbf87654f19a70a28c7ac03a6b82bd8a0f98a3d7db5c328364ef0597aeb2b1c2b1da0a54498f19d60
7
- data.tar.gz: a0b41a23ea9302ee486952c49e088a7651f7d08d694385f8417f398482724217f4ab254fb6cdbf31d48f4946ef4ed76d070cf86bd4f2ed0d2588a4cf3ebdee20
6
+ metadata.gz: 0bbcd36ec3471eb628d1274e013d2c9f6e8b85ab4e8b0d99a226a43d58cbe471a74f9b39a5db0c63e66af888353fa7be0069224fb35df4a80d75b148356fccc9
7
+ data.tar.gz: ca4b3a0d970d6463f49f18af87767301d376d9a102031a88ebe3c8707114e60161f4ba4014e2608fda377515500b608361178b8b9ea9d02d3f577daa5e069c91
data/bin/korekto CHANGED
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'help_parser'
3
3
 
4
- OPTIONS = HelpParser['1.4.210318', <<HELP]
4
+ OPTIONS = HelpParser['1.6.210409', <<HELP]
5
5
  Usage:
6
- korekto [:options+]
6
+ korekto [:options]
7
7
  Options:
8
8
  -h --help
9
9
  -v --version
10
+ --edits \tShow only needed edits
10
11
  --install \tInstalls the korekto neovim ruby plugin
11
12
  --readme \tOpen korekto github page
12
13
  # Example usage:
data/lib/korekto.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Korekto
2
- VERSION = '1.4.210318'
2
+ VERSION = '1.6.210409'
3
3
  class Error < Exception; end
4
4
  require 'korekto/symbols'
5
5
  require 'korekto/syntax'
@@ -12,4 +12,5 @@ end
12
12
  # Requires:
13
13
  # `ruby`
14
14
  # `nvim`
15
+ # `neovim-ruby-host`
15
16
  # `xdg-open`
data/lib/korekto/heap.rb CHANGED
@@ -9,6 +9,10 @@ class Heap
9
9
  @a = []
10
10
  end
11
11
 
12
+ def to_a
13
+ @a
14
+ end
15
+
12
16
  def add(s)
13
17
  @a.unshift s
14
18
  @a.pop if @a.length > @limit
data/lib/korekto/main.rb CHANGED
@@ -112,13 +112,13 @@ class Main
112
112
  next unless active?
113
113
  next if preprocess?
114
114
  if md = MD_STATEMENT_CODE_TITLE.match(@line)
115
- statement_number += 1
116
115
  code,title = @statements.add(md[:statement].strip,
117
116
  md[:code],
118
117
  md[:title],
119
- @section,
120
- statement_number)
121
- puts "#{@filename}:#{line_number}:#{code}:#{title}"
118
+ @section){ statement_number += 1 }
119
+ if not OPTIONS.edits? or (@filename=='-' and not (md[:code]==code and md[:title]==title))
120
+ puts "#{@filename}:#{line_number}:#{code}:#{title}"
121
+ end
122
122
  else
123
123
  raise Error, 'unrecognized korekto line'
124
124
  end
@@ -75,7 +75,7 @@ class Statement
75
75
  @code = "#{@code[0]}#{@statement_number}"
76
76
  @code += '.' + @section unless @section=='-'
77
77
  @code += "/#{support}" if support
78
- @title = title.split(':',2).first if title
78
+ @title = title if (title=title&.split(':',2)&.first) and not title.empty?
79
79
  end
80
80
 
81
81
  def support(*s)
@@ -150,7 +150,12 @@ class Statement
150
150
  set_regexp
151
151
  newlines_count(nl)
152
152
  undefined_in_pattern
153
- set_statement
153
+ follows = @context.heap.to_a[0..nl].reverse
154
+ if @regexp.match? follows.map{_1.to_s}.join("\n")
155
+ set_statement(support(*follows))
156
+ else
157
+ set_statement
158
+ end
154
159
  end
155
160
 
156
161
  def tautology
@@ -11,7 +11,7 @@ class Statements
11
11
  def type(c) = @statements.select{_1.type==c}
12
12
  def length = @statements.length
13
13
 
14
- def add(statement,code,title,filename,statement_number)
14
+ def add(statement,code,title,filename)
15
15
  c = code[0]; w = c=='W'
16
16
  if restatement = @statements.detect{(w or _1.type==c) and _1.to_s==statement}
17
17
  case restatement.type
@@ -24,6 +24,7 @@ class Statements
24
24
  title ||= restatement.title
25
25
  return code, title
26
26
  end
27
+ statement_number = yield
27
28
  statement = Statement.new(statement,code,title,filename,statement_number,self)
28
29
  @statements.push statement
29
30
  case statement.type
@@ -1,6 +1,6 @@
1
1
  Neovim.plugin do |plug|
2
2
  plug.command(:Korekto) do |nvim|
3
- validations = nvim.command_output('w !korekto').strip.split("\n").map(&:strip)
3
+ validations = nvim.command_output('w !korekto --edits').strip.split("\n").map(&:strip)
4
4
  msg = 'OK'
5
5
  unless validations.empty?
6
6
  buf = nvim.get_current_buf
@@ -1,12 +1,21 @@
1
+ syntax match Unsup /#[A-Z]\d\+\(\.\w\+\)\?/ contained containedin=Type
2
+ syntax match Sup /#[A-Z]\d\+\(\.\w\+\)\?\/\S\+/ contained containedin=Type
3
+ syntax match Title / [^:]\+/ contained containedin=Type
4
+ syntax match Undef /:[^#]\+$/ contained containedin=Type
5
+ syntax match Type /\s#[A-Z][^#]\+/ contains=Unsup,Sup,Title,Undef
1
6
  syntax match Comment /^\s*#.\+$/
2
- syntax match Pass /\s#[A-Z][^#]*$/
3
- syntax match Syntax /^[?] \w.\+$/
7
+ syntax match Syntax /^[?] \S.\+$/
4
8
  syntax match Patch /^::[A-Z]\w\+#\w\+[^=]\+=.\+$/
5
9
  syntax match Import /^< [\/A-Za-z\_\-\.]\+$/
10
+ syntax match Setting /^! \S.*$/
11
+ highlight Unsup ctermfg=brown
12
+ highlight Sup ctermfg=darkgreen
13
+ highlight Title ctermfg=darkblue
14
+ highlight Undef ctermfg=red
6
15
  highlight Comment ctermfg=darkblue
7
- highlight Pass ctermfg=darkgreen
8
- highlight Syntax ctermfg=darkmagenta
16
+ highlight Import ctermfg=brown
9
17
  highlight Patch ctermfg=darkgrey
10
- highlight Import ctermfg=darkyellow
18
+ highlight Syntax ctermfg=darkgrey
19
+ highlight Setting ctermfg=darkmagenta
11
20
  setlocal tabstop=23
12
21
  map <F7> :Korekto<CR>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: korekto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.210318
4
+ version: 1.6.210409
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-18 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: help_parser
@@ -70,10 +70,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements:
73
- - 'ruby: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]'
73
+ - 'ruby: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]'
74
74
  - 'nvim: NVIM v0.4.4'
75
+ - 'neovim-ruby-host: 0.8.1'
75
76
  - 'xdg-open: xdg-open 1.1.3+'
76
- rubygems_version: 3.2.3
77
+ rubygems_version: 3.2.15
77
78
  signing_key:
78
79
  specification_version: 4
79
80
  summary: A general proof checker.