Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
menhir
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
POTTIER Francois
menhir
Commits
1f486562
Commit
1f486562
authored
Dec 26, 2014
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Saved some time & space by removing some string copy operations in Lexer.
parent
2e134c47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
src/lexer.mll
src/lexer.mll
+11
-4
No files found.
src/lexer.mll
View file @
1f486562
...
...
@@ -90,10 +90,17 @@
let
ofs1
=
pos1
.
pos_cnum
and
ofs2
=
pos2
.
pos_cnum
in
let
raw_content
:
string
=
chunk
ofs1
ofs2
in
(* Transform the keywords. *)
let
content
:
bytes
=
Bytes
.
of_string
raw_content
in
transform_keywords
ofs1
pkeywords
content
;
let
content
:
string
=
Bytes
.
to_string
content
in
(* Transform the keywords, if there are any. (This explicit test
allows saving one string copy and keeping just one live copy.) *)
let
content
:
string
=
match
pkeywords
with
|
[]
->
raw_content
|
_
::
_
->
let
content
:
bytes
=
Bytes
.
of_string
raw_content
in
transform_keywords
ofs1
pkeywords
content
;
Bytes
.
unsafe_to_string
content
in
(* Add whitespace so that the column numbers match those of the source file.
If requested, add parentheses so that the semantic action can be inserted
into other code without ambiguity. *)
...
...
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