From Jason Turner

[re.grammar]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpndlhgghp/{from.md → to.md} +37 -45
tmp/tmpndlhgghp/{from.md → to.md} RENAMED
@@ -13,58 +13,57 @@ including the formatted string input functions. Instead they shall call
13
  the appropriate traits member function to achieve the required effect.
14
 
15
  The following productions within the ECMAScript grammar are modified as
16
  follows:
17
 
18
- ``` cpp
19
  ClassAtom::
20
- -
21
  ClassAtomNoDash
22
  ClassAtomExClass
23
  ClassAtomCollatingElement
24
  ClassAtomEquivalence
25
 
26
  IdentityEscape::
27
- SourceCharacter but not c
28
  ```
29
 
30
  The following new productions are then added:
31
 
32
- ``` cpp
33
  ClassAtomExClass::
34
- [: ClassName :]
35
 
36
  ClassAtomCollatingElement::
37
- [. ClassName .]
38
 
39
  ClassAtomEquivalence::
40
- [= ClassName =]
41
 
42
  ClassName::
43
  ClassNameCharacter
44
  ClassNameCharacter ClassName
45
 
46
  ClassNameCharacter::
47
- SourceCharacter but not one of "." "=" ":"
48
  ```
49
 
50
- The productions `ClassAtomExClass`, `ClassAtomCollatingElement` and
51
- `ClassAtomEquivalence` provide functionality equivalent to that of the
52
  same features in regular expressions in POSIX.
53
 
54
  The regular expression grammar may be modified by any
55
  `regex_constants::syntax_option_type` flags specified when constructing
56
  an object of type specialization of `basic_regex` according to the rules
57
- in Table [[tab:re:syntaxoption]].
58
 
59
- A `ClassName` production, when used in `ClassAtomExClass`, is not valid
60
- if `traits_inst.lookup_classname` returns zero for that name. The names
61
- recognized as valid `ClassName`s are determined by the type of the
62
- traits class, but at least the following names shall be recognized:
63
- `alnum`, `alpha`, `blank`, `cntrl`, `digit`, `graph`, `lower`, `print`,
64
- `punct`, `space`, `upper`, `xdigit`, `d`, `s`, `w`. In addition the
65
- following expressions shall be equivalent:
66
 
67
  ``` cpp
68
  \d and [[:digit:]]
69
 
70
  \D and [^[:digit:]]
@@ -76,22 +75,22 @@ following expressions shall be equivalent:
76
  \w and [_[:alnum:]]
77
 
78
  \W and [^_[:alnum:]]
79
  ```
80
 
81
- A `ClassName` production when used in a `ClassAtomCollatingElement`
82
- production is not valid if the value returned by
83
- `traits_inst.lookup_collatename` for that name is an empty string.
84
 
85
  The results from multiple calls to `traits_inst.lookup_classname` can be
86
- bitwise OR’ed together and subsequently passed to `traits_inst.isctype`.
87
 
88
- A `ClassName` production when used in a `ClassAtomEquivalence`
89
- production is not valid if the value returned by
90
- `traits_inst.lookup_collatename` for that name is an empty string or if
91
- the value returned by `traits_inst.transform_primary` for the result of
92
- the call to `traits_inst.lookup_collatename` is an empty string.
93
 
94
  When the sequence of characters being transformed to a finite state
95
  machine contains an invalid class name the translator shall throw an
96
  exception object of type `regex_error`.
97
 
@@ -106,13 +105,13 @@ Where the regular expression grammar requires the conversion of a
106
  sequence of characters to an integral value, this is accomplished by
107
  calling `traits_inst.value`.
108
 
109
  The behavior of the internal finite state machine representation when
110
  used to match a sequence of characters is as described in ECMA-262. The
111
- behavior is modified according to any match_flag_type flags (
112
- [[re.matchflag]]) specified when using the regular expression object in
113
- one of the regular expression algorithms ([[re.alg]]). The behavior is
114
  also localized by interaction with the traits class template parameter
115
  as follows:
116
 
117
  - During matching of a regular expression finite state machine against a
118
  sequence of characters, two characters `c` and `d` are compared using
@@ -125,24 +124,24 @@ as follows:
125
  `traits_inst.translate(c) == traits_inst.translate(d)`;
126
  - otherwise, the two characters are equal if `c == d`.
127
  - During matching of a regular expression finite state machine against a
128
  sequence of characters, comparison of a collating element range
129
  `c1-c2` against a character `c` is conducted as follows: if
130
- `flags() & regex_constants::collate` is false then the character `c`
131
  is matched if `c1
132
  <= c && c <= c2`, otherwise `c` is matched in accordance with the
133
  following algorithm:
134
  ``` cpp
135
  string_type str1 = string_type(1,
136
  flags() & icase ?
137
- traits_inst.translate_nocase(c1) : traits_inst.translate(c1);
138
  string_type str2 = string_type(1,
139
  flags() & icase ?
140
- traits_inst.translate_nocase(c2) : traits_inst.translate(c2);
141
  string_type str = string_type(1,
142
  flags() & icase ?
143
- traits_inst.translate_nocase(c) : traits_inst.translate(c);
144
  return traits_inst.transform(str1.begin(), str1.end())
145
  <= traits_inst.transform(str.begin(), str.end())
146
  && traits_inst.transform(str.begin(), str.end())
147
  <= traits_inst.transform(str2.begin(), str2.end());
148
  ```
@@ -156,10 +155,12 @@ as follows:
156
  sequence of characters, a character `c` is a member of a character
157
  class designated by an iterator range \[`first`, `last`) if
158
  `traits_inst.isctype(c, traits_inst.lookup_classname(first, last, flags() & icase))`
159
  is `true`.
160
 
 
 
161
  <!-- Link reference definitions -->
162
  [algorithms]: algorithms.md#algorithms
163
  [bidirectional.iterators]: iterators.md#bidirectional.iterators
164
  [bitmask.types]: library.md#bitmask.types
165
  [container.requirements.general]: containers.md#container.requirements.general
@@ -181,14 +182,12 @@ as follows:
181
  [re.grammar]: #re.grammar
182
  [re.iter]: #re.iter
183
  [re.matchflag]: #re.matchflag
184
  [re.regex]: #re.regex
185
  [re.regex.assign]: #re.regex.assign
186
- [re.regex.const]: #re.regex.const
187
  [re.regex.construct]: #re.regex.construct
188
  [re.regex.locale]: #re.regex.locale
189
- [re.regex.nmswap]: #re.regex.nmswap
190
  [re.regex.nonmemb]: #re.regex.nonmemb
191
  [re.regex.operations]: #re.regex.operations
192
  [re.regex.swap]: #re.regex.swap
193
  [re.regiter]: #re.regiter
194
  [re.regiter.cnstr]: #re.regiter.cnstr
@@ -206,27 +205,20 @@ as follows:
206
  [re.results.state]: #re.results.state
207
  [re.results.swap]: #re.results.swap
208
  [re.submatch]: #re.submatch
209
  [re.submatch.members]: #re.submatch.members
210
  [re.submatch.op]: #re.submatch.op
 
211
  [re.syn]: #re.syn
212
  [re.synopt]: #re.synopt
213
  [re.tokiter]: #re.tokiter
214
  [re.tokiter.cnstr]: #re.tokiter.cnstr
215
  [re.tokiter.comp]: #re.tokiter.comp
216
  [re.tokiter.deref]: #re.tokiter.deref
217
  [re.tokiter.incr]: #re.tokiter.incr
218
  [re.traits]: #re.traits
 
219
  [sequence.reqmts]: containers.md#sequence.reqmts
220
  [strings.general]: strings.md#strings.general
221
- [tab:re.lib.summary]: #tab:re.lib.summary
222
- [tab:re.traits.classnames]: #tab:re.traits.classnames
223
- [tab:re:RegexpTraits]: #tab:re:RegexpTraits
224
- [tab:re:alg:match]: #tab:re:alg:match
225
- [tab:re:alg:search]: #tab:re:alg:search
226
- [tab:re:errortype]: #tab:re:errortype
227
- [tab:re:matchflag]: #tab:re:matchflag
228
- [tab:re:results:assign]: #tab:re:results:assign
229
- [tab:re:syntaxoption]: #tab:re:syntaxoption
230
 
231
  [^1]: For example, if the parameter `icase` is `true` then `[[:lower:]]`
232
  is the same as `[[:alpha:]]`.
 
13
  the appropriate traits member function to achieve the required effect.
14
 
15
  The following productions within the ECMAScript grammar are modified as
16
  follows:
17
 
18
+ ``` bnf
19
  ClassAtom::
20
+ '-'
21
  ClassAtomNoDash
22
  ClassAtomExClass
23
  ClassAtomCollatingElement
24
  ClassAtomEquivalence
25
 
26
  IdentityEscape::
27
+ SourceCharacter but not 'c'
28
  ```
29
 
30
  The following new productions are then added:
31
 
32
+ ``` bnf
33
  ClassAtomExClass::
34
+ '[:' ClassName ':]'
35
 
36
  ClassAtomCollatingElement::
37
+ '[.' ClassName '.]'
38
 
39
  ClassAtomEquivalence::
40
+ '[=' ClassName '=]'
41
 
42
  ClassName::
43
  ClassNameCharacter
44
  ClassNameCharacter ClassName
45
 
46
  ClassNameCharacter::
47
+ SourceCharacter but not one of '.' or '=' or ':'
48
  ```
49
 
50
+ The productions , and provide functionality equivalent to that of the
 
51
  same features in regular expressions in POSIX.
52
 
53
  The regular expression grammar may be modified by any
54
  `regex_constants::syntax_option_type` flags specified when constructing
55
  an object of type specialization of `basic_regex` according to the rules
56
+ in [[re.synopt]].
57
 
58
+ A production, when used in , is not valid if
59
+ `traits_inst.lookup_classname` returns zero for that name. The names
60
+ recognized as valid s are determined by the type of the traits class,
61
+ but at least the following names shall be recognized: `alnum`, `alpha`,
62
+ `blank`, `cntrl`, `digit`, `graph`, `lower`, `print`, `punct`, `space`,
63
+ `upper`, `xdigit`, `d`, `s`, `w`. In addition the following expressions
64
+ shall be equivalent:
65
 
66
  ``` cpp
67
  \d and [[:digit:]]
68
 
69
  \D and [^[:digit:]]
 
75
  \w and [_[:alnum:]]
76
 
77
  \W and [^_[:alnum:]]
78
  ```
79
 
80
+ A production when used in a production is not valid if the value
81
+ returned by `traits_inst.lookup_collatename` for that name is an empty
82
+ string.
83
 
84
  The results from multiple calls to `traits_inst.lookup_classname` can be
85
+ bitwise ’ed together and subsequently passed to `traits_inst.isctype`.
86
 
87
+ A production when used in a production is not valid if the value
88
+ returned by `traits_inst.lookup_collatename` for that name is an empty
89
+ string or if the value returned by `traits_inst.transform_primary` for
90
+ the result of the call to `traits_inst.lookup_collatename` is an empty
91
+ string.
92
 
93
  When the sequence of characters being transformed to a finite state
94
  machine contains an invalid class name the translator shall throw an
95
  exception object of type `regex_error`.
96
 
 
105
  sequence of characters to an integral value, this is accomplished by
106
  calling `traits_inst.value`.
107
 
108
  The behavior of the internal finite state machine representation when
109
  used to match a sequence of characters is as described in ECMA-262. The
110
+ behavior is modified according to any `match_flag_type` flags
111
+ [[re.matchflag]] specified when using the regular expression object in
112
+ one of the regular expression algorithms [[re.alg]]. The behavior is
113
  also localized by interaction with the traits class template parameter
114
  as follows:
115
 
116
  - During matching of a regular expression finite state machine against a
117
  sequence of characters, two characters `c` and `d` are compared using
 
124
  `traits_inst.translate(c) == traits_inst.translate(d)`;
125
  - otherwise, the two characters are equal if `c == d`.
126
  - During matching of a regular expression finite state machine against a
127
  sequence of characters, comparison of a collating element range
128
  `c1-c2` against a character `c` is conducted as follows: if
129
+ `flags() & regex_constants::collate` is `false` then the character `c`
130
  is matched if `c1
131
  <= c && c <= c2`, otherwise `c` is matched in accordance with the
132
  following algorithm:
133
  ``` cpp
134
  string_type str1 = string_type(1,
135
  flags() & icase ?
136
+ traits_inst.translate_nocase(c1) : traits_inst.translate(c1));
137
  string_type str2 = string_type(1,
138
  flags() & icase ?
139
+ traits_inst.translate_nocase(c2) : traits_inst.translate(c2));
140
  string_type str = string_type(1,
141
  flags() & icase ?
142
+ traits_inst.translate_nocase(c) : traits_inst.translate(c));
143
  return traits_inst.transform(str1.begin(), str1.end())
144
  <= traits_inst.transform(str.begin(), str.end())
145
  && traits_inst.transform(str.begin(), str.end())
146
  <= traits_inst.transform(str2.begin(), str2.end());
147
  ```
 
155
  sequence of characters, a character `c` is a member of a character
156
  class designated by an iterator range \[`first`, `last`) if
157
  `traits_inst.isctype(c, traits_inst.lookup_classname(first, last, flags() & icase))`
158
  is `true`.
159
 
160
+ ECMA-262 15.10
161
+
162
  <!-- Link reference definitions -->
163
  [algorithms]: algorithms.md#algorithms
164
  [bidirectional.iterators]: iterators.md#bidirectional.iterators
165
  [bitmask.types]: library.md#bitmask.types
166
  [container.requirements.general]: containers.md#container.requirements.general
 
182
  [re.grammar]: #re.grammar
183
  [re.iter]: #re.iter
184
  [re.matchflag]: #re.matchflag
185
  [re.regex]: #re.regex
186
  [re.regex.assign]: #re.regex.assign
 
187
  [re.regex.construct]: #re.regex.construct
188
  [re.regex.locale]: #re.regex.locale
 
189
  [re.regex.nonmemb]: #re.regex.nonmemb
190
  [re.regex.operations]: #re.regex.operations
191
  [re.regex.swap]: #re.regex.swap
192
  [re.regiter]: #re.regiter
193
  [re.regiter.cnstr]: #re.regiter.cnstr
 
205
  [re.results.state]: #re.results.state
206
  [re.results.swap]: #re.results.swap
207
  [re.submatch]: #re.submatch
208
  [re.submatch.members]: #re.submatch.members
209
  [re.submatch.op]: #re.submatch.op
210
+ [re.summary]: #re.summary
211
  [re.syn]: #re.syn
212
  [re.synopt]: #re.synopt
213
  [re.tokiter]: #re.tokiter
214
  [re.tokiter.cnstr]: #re.tokiter.cnstr
215
  [re.tokiter.comp]: #re.tokiter.comp
216
  [re.tokiter.deref]: #re.tokiter.deref
217
  [re.tokiter.incr]: #re.tokiter.incr
218
  [re.traits]: #re.traits
219
+ [re.traits.classnames]: #re.traits.classnames
220
  [sequence.reqmts]: containers.md#sequence.reqmts
221
  [strings.general]: strings.md#strings.general
 
 
 
 
 
 
 
 
 
222
 
223
  [^1]: For example, if the parameter `icase` is `true` then `[[:lower:]]`
224
  is the same as `[[:alpha:]]`.