Skip to content

Commit

Permalink
Merge pull request #106 from nberth/continue-ignoring-words-in-right-…
Browse files Browse the repository at this point in the history
…margin

Bugfix: missing semantic tokens for words on the right of separators in the right margin
  • Loading branch information
nberth authored Nov 2, 2023
2 parents bbd3976 + 66e4540 commit 5b353fa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lsp/cobol_preproc/src_lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,15 @@ and free_nominal state

and gobble_line state
= parse
| (nnl* newline)
| (nnl+)
{
gobble_line (Src_lexing.skip state lexbuf) lexbuf
}
| newline
{
Src_lexing.new_line state lexbuf
}
| (nnl* eof)
| eof
{
Src_lexing.(flush @@ eof state lexbuf)
}
Expand Down
5 changes: 5 additions & 0 deletions src/lsp/cobol_preproc/src_lexing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ let raw_loc ~start_pos ~end_pos { newline; config = { source_format; _ }; _ } =
let ignore_lexloc ~start_pos ~end_pos state =
{ state with ignored = (start_pos, end_pos) :: state.ignored }

let skip state lexbuf =
ignore_lexloc state
~start_pos:(Lexing.lexeme_start_p lexbuf)
~end_pos:(Lexing.lexeme_end_p lexbuf)

let emit prod ({ pseudotext; cdir_seen; _ } as state) =
match pseudotext with
| None ->
Expand Down
1 change: 1 addition & 0 deletions src/lsp/cobol_preproc/src_lexing.mli
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ val flush: 'a state -> 'a state * Text.text
val flush_continued: ?force:bool -> 'a state -> 'a state
val eof: 'a state -> Lexing.lexbuf -> 'a state
val new_line: 'a state -> Lexing.lexbuf -> 'a state * Text.text
val skip: 'a state -> Lexing.lexbuf -> 'a state

val comment
: ?marker:string
Expand Down

0 comments on commit 5b353fa

Please sign in to comment.