Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsexplain
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verified Software
jsexplain
Commits
b0172890
Commit
b0172890
authored
9 years ago
by
charguer
Committed by
Thomas Wood
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
tokens
parent
f114bd5a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
generator/lineof.ml
+16
-6
16 additions, 6 deletions
generator/lineof.ml
navig-driver.js
+1
-0
1 addition, 0 deletions
navig-driver.js
with
17 additions
and
6 deletions
generator/lineof.ml
+
16
−
6
View file @
b0172890
...
...
@@ -87,7 +87,8 @@ type tokens = (string * tokens_start * tokens_stop) list ref
let
tokens
:
tokens
=
ref
[]
let
gather_tokens
basename
input_lines
=
(* DEPRECATED
let old_gather_tokens basename input_lines =
let find_tokens tokens_table regexp =
~~ List.iteri input_lines (fun line input ->
let r = Str.regexp regexp in
...
...
@@ -113,8 +114,9 @@ let gather_tokens basename input_lines =
find_tokens tokens_start "#<\\([0-9]*\\)#";
find_tokens tokens_stop "#\\([0-9]*\\)>#";
tokens := (basename, tokens_start, tokens_stop)::!tokens
*)
let
new_
gather_tokens
basename
input_lines
=
let
gather_tokens
basename
input_lines
=
let
tokens_start
=
Hashtbl
.
create
50
in
let
tokens_stop
=
Hashtbl
.
create
50
in
~~
List
.
iteri
input_lines
(
fun
line
input
->
...
...
@@ -127,13 +129,17 @@ let new_gather_tokens basename input_lines =
try
while
true
do
(* Printf.printf "search from %d\n" !i; *)
let
j1
=
Str
.
search_forward
r1
input
!
i
in
let
j2
=
Str
.
search_forward
r2
input
!
i
in
let
max_int
=
1000000000
in
let
j1
=
try
Str
.
search_forward
r1
input
!
i
with
Not_found
->
max_int
in
let
j2
=
try
Str
.
search_forward
r2
input
!
i
with
Not_found
->
max_int
in
if
j1
=
max_int
&&
j2
=
max_int
then
raise
Not_found
;
let
(
j
,
tokens_table
)
=
if
j1
<
j2
then
(
j1
,
tokens_start
)
else
(
j2
,
tokens_stop
)
in
if
j1
<
j2
then
(
Str
.
search_forward
r1
input
!
i
,
tokens_start
)
else
(
Str
.
search_forward
r2
input
!
i
,
tokens_stop
)
in
i
:=
j
;
let
key
=
Str
.
matched_group
1
input
in
(* Printf.printf "matched
key: %s\n"
key; *)
(* Printf.printf "matched
j1=%d j2=%d j=%d %s key: %s\n" j1 j2 j (if j1 < j2 then "start" else "stop")
key; *)
let
pos
=
mk_pos
()
in
Hashtbl
.
add
tokens_table
(
int_of_string
key
)
pos
;
i
:=
j
+
1
;
...
...
@@ -144,6 +150,10 @@ let new_gather_tokens basename input_lines =
);
tokens
:=
(
basename
,
tokens_start
,
tokens_stop
)
::!
tokens
(* FOR DEBUG
let _ =
gather_tokens "foo" [ "#<1978#case ::: var l = #1977># _switch_arg_19.head, l0 = _switch_arg_19.tail; #1978># fdsf #<1977#return let_binding(prog_intro_strictness(p), #<1976#function (str)#1976>#ffds" ]; exit 0
*)
(* BUG WITH REGEXP
let _ =
...
...
This diff is collapsed.
Click to expand it.
navig-driver.js
+
1
−
0
View file @
b0172890
...
...
@@ -381,6 +381,7 @@ function ctxToHtml(ctx) {
function
itemToHtml
(
item
)
{
var
s
=
''
;
s
+=
htmlDiv
(
"
token:
"
+
item
.
loc
.
token
+
JSON
.
stringify
(
item
.
loc
.
start
)
+
JSON
.
stringify
(
item
.
loc
.
end
));
s
+=
htmlDiv
(
"
type:
"
+
item
.
type
);
s
+=
ctxToHtml
(
item
.
ctx
);
return
s
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment