Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
0ca3fecf
Commit
0ca3fecf
authored
Jan 27, 2009
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use atomic groups to mimic the possessive quantifier change in Java code
parent
6a60ac33
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
TextTokenizer.cs
src/ProtocolBuffers/TextTokenizer.cs
+6
-5
No files found.
src/ProtocolBuffers/TextTokenizer.cs
View file @
0ca3fecf
...
...
@@ -69,13 +69,14 @@ namespace Google.ProtocolBuffers {
/// </summary>
private
int
previousColumn
=
0
;
private
static
readonly
Regex
WhitespaceAndCommentPattern
=
new
Regex
(
"\\G(\\s|(#.*$))+"
,
// Note: atomic groups used to mimic possessive quantifiers in Java in both of these regexes
private
static
readonly
Regex
WhitespaceAndCommentPattern
=
new
Regex
(
"\\G(?>(\\s|(#.*$))+)"
,
RegexOptions
.
Compiled
|
RegexOptions
.
Multiline
);
private
static
readonly
Regex
TokenPattern
=
new
Regex
(
"\\G[a-zA-Z_]
[0-9a-zA-Z_+-]*
|"
+
// an identifier
"\\G[0-9+-]
[0-9a-zA-Z_.+-]*
|"
+
// a number
"\\G\"(
[^\"\\\n\\\\]|\\\\.)*
(\"|\\\\?$)|"
+
// a double-quoted string
"\\G\'(
[^\"\\\n\\\\]|\\\\.)*
(\'|\\\\?$)"
,
// a single-quoted string
"\\G[a-zA-Z_]
(?>[0-9a-zA-Z_+-]*)
|"
+
// an identifier
"\\G[0-9+-]
(?>[0-9a-zA-Z_.+-]*)
|"
+
// a number
"\\G\"(
?>([^\"\\\n\\\\]|\\\\.)*)
(\"|\\\\?$)|"
+
// a double-quoted string
"\\G\'(
?>([^\"\\\n\\\\]|\\\\.)*)
(\'|\\\\?$)"
,
// a single-quoted string
RegexOptions
.
Compiled
|
RegexOptions
.
Multiline
);
private
static
readonly
Regex
DoubleInfinity
=
new
Regex
(
"^-?inf(inity)?$"
,
RegexOptions
.
Compiled
|
RegexOptions
.
IgnoreCase
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment