pygments.rb 0.5.2 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/lexers +0 -0
- data/lib/pygments/version.rb +1 -1
- data/test/test_pygments.rb +1 -1
- data/vendor/custom_lexers/github.py +15 -9
- data/vendor/pygments-main/AUTHORS +12 -2
- data/vendor/pygments-main/CHANGES +52 -2
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +52 -0
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +67 -44
- data/vendor/pygments-main/pygmentize +1 -1
- data/vendor/pygments-main/pygments/filters/__init__.py +2 -2
- data/vendor/pygments-main/pygments/formatter.py +3 -0
- data/vendor/pygments-main/pygments/lexers/__init__.py +11 -0
- data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +2880 -3124
- data/vendor/pygments-main/pygments/lexers/_mapping.py +30 -20
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +206 -20
- data/vendor/pygments-main/pygments/lexers/agile.py +378 -5
- data/vendor/pygments-main/pygments/lexers/asm.py +2 -2
- data/vendor/pygments-main/pygments/lexers/compiled.py +235 -8
- data/vendor/pygments-main/pygments/lexers/dotnet.py +88 -47
- data/vendor/pygments-main/pygments/lexers/functional.py +195 -62
- data/vendor/pygments-main/pygments/lexers/github.py +15 -9
- data/vendor/pygments-main/pygments/lexers/jvm.py +14 -11
- data/vendor/pygments-main/pygments/lexers/math.py +284 -18
- data/vendor/pygments-main/pygments/lexers/other.py +132 -21
- data/vendor/pygments-main/pygments/lexers/shell.py +29 -15
- data/vendor/pygments-main/pygments/lexers/sql.py +1 -1
- data/vendor/pygments-main/pygments/lexers/templates.py +8 -8
- data/vendor/pygments-main/pygments/lexers/text.py +59 -9
- data/vendor/pygments-main/pygments/lexers/web.py +832 -210
- data/vendor/pygments-main/pygments/modeline.py +40 -0
- data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
- data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
- data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +29 -10
- data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
- data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
- data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
- data/vendor/pygments-main/tests/examplefiles/example.stan +86 -75
- data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +40 -30
- data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +7 -0
- data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
- data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
- data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
- data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
- data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
- data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
- data/vendor/pygments-main/tests/examplefiles/type.lisp +16 -0
- data/vendor/pygments-main/tests/test_basic_api.py +3 -3
- data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
- metadata +21 -2
@@ -0,0 +1,225 @@
|
|
1
|
+
//
|
2
|
+
// std::vector
|
3
|
+
//
|
4
|
+
|
5
|
+
%include <std_container.i>
|
6
|
+
|
7
|
+
// Vector
|
8
|
+
|
9
|
+
%define %std_vector_methods(vector...)
|
10
|
+
%std_sequence_methods(vector)
|
11
|
+
|
12
|
+
void reserve(size_type n);
|
13
|
+
size_type capacity() const;
|
14
|
+
%enddef
|
15
|
+
|
16
|
+
|
17
|
+
%define %std_vector_methods_val(vector...)
|
18
|
+
%std_sequence_methods_val(vector)
|
19
|
+
|
20
|
+
void reserve(size_type n);
|
21
|
+
size_type capacity() const;
|
22
|
+
%enddef
|
23
|
+
|
24
|
+
|
25
|
+
// ------------------------------------------------------------------------
|
26
|
+
// std::vector
|
27
|
+
//
|
28
|
+
// The aim of all that follows would be to integrate std::vector with
|
29
|
+
// as much as possible, namely, to allow the user to pass and
|
30
|
+
// be returned tuples or lists.
|
31
|
+
// const declarations are used to guess the intent of the function being
|
32
|
+
// exported; therefore, the following rationale is applied:
|
33
|
+
//
|
34
|
+
// -- f(std::vector<T>), f(const std::vector<T>&):
|
35
|
+
// the parameter being read-only, either a sequence or a
|
36
|
+
// previously wrapped std::vector<T> can be passed.
|
37
|
+
// -- f(std::vector<T>&), f(std::vector<T>*):
|
38
|
+
// the parameter may be modified; therefore, only a wrapped std::vector
|
39
|
+
// can be passed.
|
40
|
+
// -- std::vector<T> f(), const std::vector<T>& f():
|
41
|
+
// the vector is returned by copy; therefore, a sequence of T:s
|
42
|
+
// is returned which is most easily used in other functions
|
43
|
+
// -- std::vector<T>& f(), std::vector<T>* f():
|
44
|
+
// the vector is returned by reference; therefore, a wrapped std::vector
|
45
|
+
// is returned
|
46
|
+
// -- const std::vector<T>* f(), f(const std::vector<T>*):
|
47
|
+
// for consistency, they expect and return a plain vector pointer.
|
48
|
+
// ------------------------------------------------------------------------
|
49
|
+
|
50
|
+
%{
|
51
|
+
#include <vector>
|
52
|
+
%}
|
53
|
+
|
54
|
+
// exported classes
|
55
|
+
|
56
|
+
|
57
|
+
namespace std {
|
58
|
+
|
59
|
+
template<class _Tp, class _Alloc = allocator< _Tp > >
|
60
|
+
class vector {
|
61
|
+
public:
|
62
|
+
typedef size_t size_type;
|
63
|
+
typedef ptrdiff_t difference_type;
|
64
|
+
typedef _Tp value_type;
|
65
|
+
typedef value_type* pointer;
|
66
|
+
typedef const value_type* const_pointer;
|
67
|
+
typedef _Tp& reference;
|
68
|
+
typedef const _Tp& const_reference;
|
69
|
+
typedef _Alloc allocator_type;
|
70
|
+
|
71
|
+
%traits_swigtype(_Tp);
|
72
|
+
%traits_enum(_Tp);
|
73
|
+
|
74
|
+
%fragment(SWIG_Traits_frag(std::vector<_Tp, _Alloc >), "header",
|
75
|
+
fragment=SWIG_Traits_frag(_Tp),
|
76
|
+
fragment="StdVectorTraits") {
|
77
|
+
namespace swig {
|
78
|
+
template <> struct traits<std::vector<_Tp, _Alloc > > {
|
79
|
+
typedef pointer_category category;
|
80
|
+
static const char* type_name() {
|
81
|
+
return "std::vector<" #_Tp "," #_Alloc " >";
|
82
|
+
}
|
83
|
+
};
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp, _Alloc >);
|
88
|
+
|
89
|
+
#ifdef %swig_vector_methods
|
90
|
+
// Add swig/language extra methods
|
91
|
+
%swig_vector_methods(std::vector<_Tp, _Alloc >);
|
92
|
+
#endif
|
93
|
+
|
94
|
+
%std_vector_methods(vector);
|
95
|
+
};
|
96
|
+
|
97
|
+
// ***
|
98
|
+
// This specialization should disappear or get simplified when
|
99
|
+
// a 'const SWIGTYPE*&' can be defined
|
100
|
+
// ***
|
101
|
+
template<class _Tp, class _Alloc >
|
102
|
+
class vector<_Tp*, _Alloc > {
|
103
|
+
public:
|
104
|
+
typedef size_t size_type;
|
105
|
+
typedef ptrdiff_t difference_type;
|
106
|
+
typedef _Tp* value_type;
|
107
|
+
typedef value_type* pointer;
|
108
|
+
typedef const value_type* const_pointer;
|
109
|
+
typedef value_type reference;
|
110
|
+
typedef value_type const_reference;
|
111
|
+
typedef _Alloc allocator_type;
|
112
|
+
|
113
|
+
%traits_swigtype(_Tp);
|
114
|
+
|
115
|
+
%fragment(SWIG_Traits_frag(std::vector<_Tp*, _Alloc >), "header",
|
116
|
+
fragment=SWIG_Traits_frag(_Tp),
|
117
|
+
fragment="StdVectorTraits") {
|
118
|
+
namespace swig {
|
119
|
+
template <> struct traits<std::vector<_Tp*, _Alloc > > {
|
120
|
+
typedef value_category category;
|
121
|
+
static const char* type_name() {
|
122
|
+
return "std::vector<" #_Tp " *," #_Alloc " >";
|
123
|
+
}
|
124
|
+
};
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp*, _Alloc >);
|
129
|
+
|
130
|
+
#ifdef %swig_vector_methods_val
|
131
|
+
// Add swig/language extra methods
|
132
|
+
%swig_vector_methods_val(std::vector<_Tp*, _Alloc >);
|
133
|
+
#endif
|
134
|
+
|
135
|
+
%std_vector_methods_val(vector);
|
136
|
+
};
|
137
|
+
|
138
|
+
// ***
|
139
|
+
// const pointer specialization
|
140
|
+
// ***
|
141
|
+
template<class _Tp, class _Alloc >
|
142
|
+
class vector<_Tp const *, _Alloc > {
|
143
|
+
public:
|
144
|
+
typedef size_t size_type;
|
145
|
+
typedef ptrdiff_t difference_type;
|
146
|
+
typedef _Tp const * value_type;
|
147
|
+
typedef value_type* pointer;
|
148
|
+
typedef const value_type* const_pointer;
|
149
|
+
typedef value_type reference;
|
150
|
+
typedef value_type const_reference;
|
151
|
+
typedef _Alloc allocator_type;
|
152
|
+
|
153
|
+
%traits_swigtype(_Tp);
|
154
|
+
|
155
|
+
%fragment(SWIG_Traits_frag(std::vector<_Tp const*, _Alloc >), "header",
|
156
|
+
fragment=SWIG_Traits_frag(_Tp),
|
157
|
+
fragment="StdVectorTraits") {
|
158
|
+
namespace swig {
|
159
|
+
template <> struct traits<std::vector<_Tp const*, _Alloc > > {
|
160
|
+
typedef value_category category;
|
161
|
+
static const char* type_name() {
|
162
|
+
return "std::vector<" #_Tp " const*," #_Alloc " >";
|
163
|
+
}
|
164
|
+
};
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp const*, _Alloc >);
|
169
|
+
|
170
|
+
#ifdef %swig_vector_methods_val
|
171
|
+
// Add swig/language extra methods
|
172
|
+
%swig_vector_methods_val(std::vector<_Tp const*, _Alloc >);
|
173
|
+
#endif
|
174
|
+
|
175
|
+
%std_vector_methods_val(vector);
|
176
|
+
};
|
177
|
+
|
178
|
+
// ***
|
179
|
+
// bool specialization
|
180
|
+
// ***
|
181
|
+
|
182
|
+
template<class _Alloc >
|
183
|
+
class vector<bool,_Alloc > {
|
184
|
+
public:
|
185
|
+
typedef size_t size_type;
|
186
|
+
typedef ptrdiff_t difference_type;
|
187
|
+
typedef bool value_type;
|
188
|
+
typedef value_type* pointer;
|
189
|
+
typedef const value_type* const_pointer;
|
190
|
+
typedef value_type reference;
|
191
|
+
typedef value_type const_reference;
|
192
|
+
typedef _Alloc allocator_type;
|
193
|
+
|
194
|
+
%traits_swigtype(bool);
|
195
|
+
|
196
|
+
%fragment(SWIG_Traits_frag(std::vector<bool, _Alloc >), "header",
|
197
|
+
fragment=SWIG_Traits_frag(bool),
|
198
|
+
fragment="StdVectorTraits") {
|
199
|
+
namespace swig {
|
200
|
+
template <> struct traits<std::vector<bool, _Alloc > > {
|
201
|
+
typedef value_category category;
|
202
|
+
static const char* type_name() {
|
203
|
+
return "std::vector<bool, _Alloc >";
|
204
|
+
}
|
205
|
+
};
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<bool, _Alloc >);
|
210
|
+
|
211
|
+
|
212
|
+
#ifdef %swig_vector_methods_val
|
213
|
+
// Add swig/language extra methods
|
214
|
+
%swig_vector_methods_val(std::vector<bool, _Alloc >);
|
215
|
+
#endif
|
216
|
+
|
217
|
+
%std_vector_methods_val(vector);
|
218
|
+
|
219
|
+
#if defined(SWIG_STD_MODERN_STL) && !defined(SWIG_STD_NOMODERN_STL)
|
220
|
+
void flip();
|
221
|
+
#endif
|
222
|
+
|
223
|
+
};
|
224
|
+
|
225
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
-- An Agda example file
|
2
|
+
|
3
|
+
module test where
|
4
|
+
|
5
|
+
open import Coinduction
|
6
|
+
open import Data.Bool
|
7
|
+
open import {- pointless comment between import and module name -} Data.Char
|
8
|
+
open import Data.Nat
|
9
|
+
open import Data.Nat.Properties
|
10
|
+
open import Data.String
|
11
|
+
open import Data.List hiding ([_])
|
12
|
+
open import Data.Vec hiding ([_])
|
13
|
+
open import Relation.Nullary.Core
|
14
|
+
open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong; trans; inspect; [_])
|
15
|
+
|
16
|
+
open SemiringSolver
|
17
|
+
|
18
|
+
{- this is a {- nested -} comment -}
|
19
|
+
|
20
|
+
-- Factorial
|
21
|
+
_! : ℕ → ℕ
|
22
|
+
0 ! = 1
|
23
|
+
(suc n) ! = (suc n) * n !
|
24
|
+
|
25
|
+
-- The binomial coefficient
|
26
|
+
_choose_ : ℕ → ℕ → ℕ
|
27
|
+
_ choose 0 = 1
|
28
|
+
0 choose _ = 0
|
29
|
+
(suc n) choose (suc m) = (n choose m) + (n choose (suc m)) -- Pascal's rule
|
30
|
+
|
31
|
+
choose-too-many : ∀ n m → n ≤ m → n choose (suc m) ≡ 0
|
32
|
+
choose-too-many .0 m z≤n = refl
|
33
|
+
choose-too-many (suc n) (suc m) (s≤s le) with n choose (suc m) | choose-too-many n m le | n choose (suc (suc m)) | choose-too-many n (suc m) (≤-step le)
|
34
|
+
... | .0 | refl | .0 | refl = refl
|
35
|
+
|
36
|
+
_++'_ : ∀ {a n m} {A : Set a} → Vec A n → Vec A m → Vec A (m + n)
|
37
|
+
_++'_ {_} {n} {m} v₁ v₂ rewrite solve 2 (λ a b → b :+ a := a :+ b) refl n m = v₁ Data.Vec.++ v₂
|
38
|
+
|
39
|
+
++'-test : (1 ∷ 2 ∷ 3 ∷ []) ++' (4 ∷ 5 ∷ []) ≡ (1 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ [])
|
40
|
+
++'-test = refl
|
41
|
+
|
42
|
+
data Coℕ : Set where
|
43
|
+
co0 : Coℕ
|
44
|
+
cosuc : ∞ Coℕ → Coℕ
|
45
|
+
|
46
|
+
nanana : Coℕ
|
47
|
+
nanana = let two = ♯ cosuc (♯ (cosuc (♯ co0))) in cosuc two
|
48
|
+
|
49
|
+
abstract
|
50
|
+
data VacuumCleaner : Set where
|
51
|
+
Roomba : VacuumCleaner
|
52
|
+
|
53
|
+
pointlessLemmaAboutBoolFunctions : (f : Bool → Bool) → f (f (f true)) ≡ f true
|
54
|
+
pointlessLemmaAboutBoolFunctions f with f true | inspect f true
|
55
|
+
... | true | [ eq₁ ] = trans (cong f eq₁) eq₁
|
56
|
+
... | false | [ eq₁ ] with f false | inspect f false
|
57
|
+
... | true | _ = eq₁
|
58
|
+
... | false | [ eq₂ ] = eq₂
|
59
|
+
|
60
|
+
mutual
|
61
|
+
isEven : ℕ → Bool
|
62
|
+
isEven 0 = true
|
63
|
+
isEven (suc n) = not (isOdd n)
|
64
|
+
|
65
|
+
isOdd : ℕ → Bool
|
66
|
+
isOdd 0 = false
|
67
|
+
isOdd (suc n) = not (isEven n)
|
68
|
+
|
69
|
+
foo : String
|
70
|
+
foo = "Hello World!"
|
71
|
+
|
72
|
+
nl : Char
|
73
|
+
nl = '\n'
|
74
|
+
|
75
|
+
private
|
76
|
+
intersperseString : Char → List String → String
|
77
|
+
intersperseString c [] = ""
|
78
|
+
intersperseString c (x ∷ xs) = Data.List.foldl (λ a b → a Data.String.++ Data.String.fromList (c ∷ []) Data.String.++ b) x xs
|
79
|
+
|
80
|
+
baz : String
|
81
|
+
baz = intersperseString nl (Data.List.replicate 5 foo)
|
82
|
+
|
83
|
+
postulate
|
84
|
+
Float : Set
|
85
|
+
|
86
|
+
{-# BUILTIN FLOAT Float #-}
|
87
|
+
|
88
|
+
pi : Float
|
89
|
+
pi = 3.141593
|
90
|
+
|
91
|
+
-- Astronomical unit
|
92
|
+
au : Float
|
93
|
+
au = 1.496e11 -- m
|
94
|
+
|
95
|
+
plusFloat : Float → Float → Float
|
96
|
+
plusFloat a b = {! !}
|
97
|
+
|
98
|
+
record Subset (A : Set) (P : A → Set) : Set where
|
99
|
+
constructor _#_
|
100
|
+
field
|
101
|
+
elem : A
|
102
|
+
.proof : P elem
|
@@ -0,0 +1,95 @@
|
|
1
|
+
|
2
|
+
;foobar!
|
3
|
+
|
4
|
+
;Include "blurg/blurg.bb"
|
5
|
+
|
6
|
+
Const ca = $10000000 ; Hex
|
7
|
+
Const cb = %10101010 ; Binary
|
8
|
+
Global ga$ = "blargh"
|
9
|
+
Local a = 124, b$ = "abcdef"
|
10
|
+
|
11
|
+
Function name_123#(zorp$, ll = False, blah#, waffles% = 100)
|
12
|
+
Return 235.7804 ; comment
|
13
|
+
End Function
|
14
|
+
Function TestString$()
|
15
|
+
End Function
|
16
|
+
|
17
|
+
Function hub(blah$, abc = Pi)
|
18
|
+
End Function
|
19
|
+
Function Blar%()
|
20
|
+
Local aa %, ab # ,ac #, ad# ,ae$,af% ; Intentional mangling
|
21
|
+
Local ba#, bb.TBlarf , bc%,bd#,be. TFooBar,ff = True
|
22
|
+
End Function
|
23
|
+
|
24
|
+
abc()
|
25
|
+
|
26
|
+
Function abc()
|
27
|
+
Print "abc" ; I cannot find a way to parse these as function calls without messing something up
|
28
|
+
Print ; Anyhow, they're generally not used in this way
|
29
|
+
Goto Eww_Goto
|
30
|
+
.Eww_Goto
|
31
|
+
End Function
|
32
|
+
|
33
|
+
Type TBlarf
|
34
|
+
End Type
|
35
|
+
|
36
|
+
Type TFooBar
|
37
|
+
End Type
|
38
|
+
|
39
|
+
Local myinst.MyClass = New MyClass
|
40
|
+
TestMethod(myinst)
|
41
|
+
|
42
|
+
Type MyClass
|
43
|
+
|
44
|
+
Field m_foo.MyClass
|
45
|
+
Field m_bar.MyClass
|
46
|
+
|
47
|
+
; abc
|
48
|
+
; def
|
49
|
+
End Type
|
50
|
+
|
51
|
+
Function TestMethod(self.MyClass) ; foobar
|
52
|
+
self\m_foo = self
|
53
|
+
self\m_bar = Object.MyClass(Handle self\m_foo)
|
54
|
+
Yell self\m_foo\m_bar\m_foo\m_bar
|
55
|
+
End Function
|
56
|
+
|
57
|
+
Function Yell(self.MyClass)
|
58
|
+
Print("huzzah!")
|
59
|
+
End Function
|
60
|
+
|
61
|
+
Function Wakka$(foo$)
|
62
|
+
Return foo + "bar"
|
63
|
+
End Function
|
64
|
+
|
65
|
+
|
66
|
+
Print("blah " + "blah " + "blah.")
|
67
|
+
|
68
|
+
Local i : For i = 0 To 10 Step 1
|
69
|
+
Print("Index: " + i)
|
70
|
+
Next
|
71
|
+
Local array$[5]
|
72
|
+
array[0] = "foo": array[1] = "bar":array[2] = "11":array[3] = "22":array[4] = "33"
|
73
|
+
For i = 0 To 4
|
74
|
+
Local value$ = array[i]
|
75
|
+
Print("Value: " + value)
|
76
|
+
Next
|
77
|
+
|
78
|
+
Local foobar = Not (1 Or (2 And (4 Shl 5 Shr 6)) Sar 7) Mod (8+2)
|
79
|
+
Local az = 1234567890
|
80
|
+
az = az + 1
|
81
|
+
az = az - 2
|
82
|
+
az = az* 3
|
83
|
+
az = az/ 4
|
84
|
+
az = az And 5
|
85
|
+
az = az Or 6
|
86
|
+
az= ~ 7
|
87
|
+
az = az Shl 8
|
88
|
+
az= az Shr 9
|
89
|
+
az = az Sar 10
|
90
|
+
az = az Mod 11
|
91
|
+
az = ((10-5+2/4*2)>(((8^2)) < 2)) And 12 Or 2
|
92
|
+
|
93
|
+
|
94
|
+
;~IDEal Editor Parameters:
|
95
|
+
;~C#Blitz3D
|
@@ -0,0 +1,31 @@
|
|
1
|
+
letter = "A" | "B" | "C" | "D" | "E" | "F" | "G"
|
2
|
+
| "H" | "I" | "J" | "K" | "L" | "M" | "N"
|
3
|
+
| "O" | "P" | "Q" | "R" | "S" | "T" | "U"
|
4
|
+
| "V" | "W" | "X" | "Y" | "Z" ;
|
5
|
+
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
|
6
|
+
symbol = "[" | "]" | "{" | "}" | "(" | ")" | "<" | ">"
|
7
|
+
| "'" | '"' | "=" | "|" | "." | "," | ";" ;
|
8
|
+
character = letter | digit | symbol | " " ;
|
9
|
+
|
10
|
+
identifier = letter , { letter | digit | " " } ;
|
11
|
+
terminal = "'" , character , { character } , "'"
|
12
|
+
| '"' , character , { character } , '"' ;
|
13
|
+
|
14
|
+
special = "?" , any , "?" ;
|
15
|
+
|
16
|
+
comment = (* this is a comment "" *) "(*" , any-symbol , "*)" ;
|
17
|
+
any-symbol = ? any visible character ? ; (* ? ... ? *)
|
18
|
+
|
19
|
+
lhs = identifier ;
|
20
|
+
rhs = identifier
|
21
|
+
| terminal
|
22
|
+
| comment , rhs
|
23
|
+
| rhs , comment
|
24
|
+
| "[" , rhs , "]"
|
25
|
+
| "{" , rhs , "}"
|
26
|
+
| "(" , rhs , ")"
|
27
|
+
| rhs , "|" , rhs
|
28
|
+
| rhs , "," , rhs ;
|
29
|
+
|
30
|
+
rule = lhs , "=" , rhs , ";" | comment ;
|
31
|
+
grammar = { rule } ;
|