Skip to content

Commit

Permalink
Fix #68.
Browse files Browse the repository at this point in the history
  • Loading branch information
yurug committed Feb 27, 2019
1 parent 73ef408 commit 9801c9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/patternMatchingRecognizer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let recognize_re_bracket_expression s start =
String.sub s start (!current_position - start)

let current_position () =
lexbuf.Lexing.lex_start_p.pos_cnum
start + lexbuf.Lexing.lex_start_p.pos_cnum

let lexing_position () = lexbuf.Lexing.lex_start_p

Expand Down Expand Up @@ -189,6 +189,7 @@ let recognize_re_bracket_expression s start =
let process s : (string * word_component) list =
let b = Buffer.create 31 in
let rec analyze output i =

let flush () =
if Buffer.length b > 0 then
let w = Buffer.contents b in
Expand All @@ -197,8 +198,9 @@ let process s : (string * word_component) list =
output
in
let produce ?(next=i+1) char ast =
let output = flush () in
Buffer.clear b;
analyze ((char, ast) :: flush ()) next
analyze ((char, ast) :: output) next
in
let push char =
Buffer.add_char b char;
Expand All @@ -218,4 +220,4 @@ let process s : (string * word_component) list =
end
| c -> push c
in
analyze [] 0
analyze [] 0 |> List.rev
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
[
[
"WordLiteral",
"]"
"a"
],
[
"WordReBracketExpression",
Expand Down Expand Up @@ -490,7 +490,7 @@
[
[
"WordLiteral",
"]"
"a"
],
[
"WordReBracketExpression",
Expand Down

0 comments on commit 9801c9e

Please sign in to comment.