Skip to content

Commit

Permalink
Revert "revert fix parse_js"
Browse files Browse the repository at this point in the history
This reverts commit b3e2bfc.
  • Loading branch information
hhugo committed Apr 7, 2020
1 parent b3e2bfc commit ad51177
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions compiler/lib/parse_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,26 @@ let lexer_aux ?(rm_comment = true) lines_info lexbuf =
let tokinfo lexbuf =
let pi = Parse_info.t_of_lexbuf lines_info lexbuf in
let pi =
match prev with
| None -> { pi with Parse_info.fol = Some true }
| Some prev ->
let prev_pi = Js_token.info_of_tok prev in
if prev_pi.Parse_info.line <> pi.Parse_info.line
then { pi with Parse_info.fol = Some true }
else pi
match extra with
| None -> pi
| Some (file, offset) ->
let src = Parse_info.relative_path lines_info file in
{ pi with
Parse_info.src
; name = Some file
; line = pi.Parse_info.line - offset
}
in
match extra with
| None -> pi
| Some (file, offset) ->
let src = Parse_info.relative_path lines_info file in
{ pi with Parse_info.src; name = Some file; line = pi.Parse_info.line - offset }
match prev with
| None -> { pi with Parse_info.fol = Some true }
| Some prev ->
let prev_pi = Js_token.info_of_tok prev in
if prev_pi.Parse_info.line <> pi.Parse_info.line
&& Option.equal String.equal prev_pi.Parse_info.name pi.Parse_info.name
then { pi with Parse_info.fol = Some true }
else pi
in

let t = Js_lexer.initial tokinfo prev lexbuf in
match t with
| Js_token.EOF _ -> List.rev acc
Expand Down

0 comments on commit ad51177

Please sign in to comment.