citrus 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/citrus.gemspec +1 -1
- data/lib/citrus.rb +9 -5
- metadata +3 -4
- data/extras/citrus.vim +0 -92
data/citrus.gemspec
CHANGED
data/lib/citrus.rb
CHANGED
@@ -8,7 +8,7 @@ require 'strscan'
|
|
8
8
|
module Citrus
|
9
9
|
autoload :File, 'citrus/file'
|
10
10
|
|
11
|
-
VERSION = [2, 1,
|
11
|
+
VERSION = [2, 1, 2]
|
12
12
|
|
13
13
|
# Returns the current version of Citrus as a string.
|
14
14
|
def self.version
|
@@ -116,6 +116,13 @@ module Citrus
|
|
116
116
|
# The number of times the cache was hit. Only present if memoing is enabled.
|
117
117
|
attr_reader :cache_hits
|
118
118
|
|
119
|
+
# Resets all internal variables so that this object may be used in
|
120
|
+
# another parse.
|
121
|
+
def reset
|
122
|
+
super
|
123
|
+
@max_offset = 0
|
124
|
+
end
|
125
|
+
|
119
126
|
# Returns the length of this input.
|
120
127
|
def length
|
121
128
|
string.length
|
@@ -212,11 +219,8 @@ module Citrus
|
|
212
219
|
end
|
213
220
|
end
|
214
221
|
|
215
|
-
|
216
|
-
# another parse.
|
217
|
-
def reset
|
222
|
+
def reset # :nodoc:
|
218
223
|
super
|
219
|
-
@max_offset = 0
|
220
224
|
@cache = {}
|
221
225
|
@cache_hits = 0
|
222
226
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 2.1.
|
8
|
+
- 2
|
9
|
+
version: 2.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Jackson
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-30 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -66,7 +66,6 @@ files:
|
|
66
66
|
- examples/calc.rb
|
67
67
|
- examples/ip.citrus
|
68
68
|
- examples/ip.rb
|
69
|
-
- extras/citrus.vim
|
70
69
|
- lib/citrus/debug.rb
|
71
70
|
- lib/citrus/file.rb
|
72
71
|
- lib/citrus.rb
|
data/extras/citrus.vim
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
" Vim syntax file for Citrus grammars.
|
2
|
-
"
|
3
|
-
" Language: Citrus
|
4
|
-
" Author: Michael Jackson
|
5
|
-
|
6
|
-
if version < 600
|
7
|
-
syntax clear
|
8
|
-
elseif exists("b:current_syntax")
|
9
|
-
finish
|
10
|
-
endif
|
11
|
-
|
12
|
-
syn include @rubyTop syntax/ruby.vim
|
13
|
-
|
14
|
-
syn case match
|
15
|
-
|
16
|
-
syn match ctDoubleColon "::" contained
|
17
|
-
syn match ctConstant "\u\w*" contained
|
18
|
-
syn match ctModule "\(\(::\)\?\u\w*\)\+" contains=ctDoubleColon,ctConstant contained
|
19
|
-
syn match ctVariable "\a[a-zA-Z0-9_-]*" contained
|
20
|
-
|
21
|
-
" Comments
|
22
|
-
syn match ctComment "#.*" contains=@Spell
|
23
|
-
|
24
|
-
" Keywords
|
25
|
-
syn match ctKeyword "\<super\>" contained
|
26
|
-
|
27
|
-
" Terminals
|
28
|
-
syn region ctString matchgroup=ctStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@ctStringSpecial
|
29
|
-
syn region ctString matchgroup=ctStringDelimiter start="'" end="'" skip="\\\\\|\\'"
|
30
|
-
syn region ctRegexp matchgroup=ctRegexpDelimiter start="/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@ctRegexpSpecial contained display
|
31
|
-
syn region ctCharClass matchgroup=ctRegexpDelimiter start="\[" end="\]" skip="\\\\\|\\\[" contains=@ctRegexpSpecial contained display
|
32
|
-
syn match ctAnything "\." contained display
|
33
|
-
|
34
|
-
syn cluster ctStringSpecial contains=rubyStringEscape
|
35
|
-
syn cluster ctRegexpSpecial contains=rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment
|
36
|
-
|
37
|
-
" Quantifiers
|
38
|
-
syn match ctQuantifier "+" contained display
|
39
|
-
syn match ctQuantifier "?" contained display
|
40
|
-
syn match ctQuantifier "\d*\*\d*" contained display
|
41
|
-
|
42
|
-
" Operators
|
43
|
-
syn match ctOperator "|" contained
|
44
|
-
syn match ctOperator "\w\+:"me=e-1 contained
|
45
|
-
|
46
|
-
" Extensions
|
47
|
-
syn region ctRubyBlock start="{"ms=e+1 end="}"me=s-1 contains=@rubyTop contained
|
48
|
-
syn match ctTag "<\s*\(\(::\)\?\u\w*\)\+\s*>" contains=ctModule contained
|
49
|
-
|
50
|
-
" Declarations
|
51
|
-
syn match ctRequire "\<require\>" nextgroup=ctString skipwhite skipnl
|
52
|
-
syn match ctGrammar "\<grammar\>" nextgroup=ctModule skipwhite skipnl
|
53
|
-
syn match ctInclude "\<include\>" nextgroup=ctModule skipwhite skipnl contained
|
54
|
-
syn match ctRoot "\<root\>" nextgroup=ctVariable skipwhite skipnl contained
|
55
|
-
syn match ctRule "\<rule\>" nextgroup=ctVariable skipwhite skipnl contained
|
56
|
-
|
57
|
-
" Blocks
|
58
|
-
syn region ctGrammarBlock start="\<grammar\>" matchgroup=ctGrammar end="\<end\>" contains=ctComment,ctGrammar,ctInclude,ctRoot,ctRuleBlock fold
|
59
|
-
syn region ctRuleBlock start="\<rule\>" matchgroup=ctRule end="\<end\>" contains=ALLBUT,ctRequire,ctGrammar,ctInclude,ctRoot,ctConstant fold
|
60
|
-
|
61
|
-
" Groups
|
62
|
-
hi def link ctComment Comment
|
63
|
-
|
64
|
-
hi def link ctRequire Include
|
65
|
-
hi def link ctInclude Include
|
66
|
-
hi def link ctGrammar ctDefine
|
67
|
-
hi def link ctRoot ctDefine
|
68
|
-
hi def link ctRule ctDefine
|
69
|
-
hi def link ctDefine Define
|
70
|
-
|
71
|
-
hi def link ctConstant Type
|
72
|
-
hi def link ctVariable Function
|
73
|
-
hi def link ctKeyword Keyword
|
74
|
-
|
75
|
-
hi def link ctString ctTerminal
|
76
|
-
hi def link ctRegexp ctTerminal
|
77
|
-
hi def link ctCharClass ctTerminal
|
78
|
-
hi def link ctAnything ctTerminal
|
79
|
-
hi def link ctTerminal String
|
80
|
-
|
81
|
-
hi def link ctRegexpDelimiter ctStringDelimiter
|
82
|
-
hi def link ctStringDelimiter Delimiter
|
83
|
-
|
84
|
-
hi def link ctRegexpSpecial ctStringSpecial
|
85
|
-
hi def link ctStringSpecial Special
|
86
|
-
|
87
|
-
hi def link ctQuantifier Number
|
88
|
-
hi def link ctOperator Operator
|
89
|
-
|
90
|
-
let b:current_syntax = "citrus"
|
91
|
-
|
92
|
-
" vim: nowrap:
|