diff --git a/src/sqlfluff/parser/lexer.py b/src/sqlfluff/parser/lexer.py
index 1eb4da37..ebbcb859 100644
--- a/src/sqlfluff/parser/lexer.py
+++ b/src/sqlfluff/parser/lexer.py
@@ -69,6 +69,10 @@ class SingletonMatcher:
                     )
                     idx = trim_span[1]
                     cont_pos_buff = cont_pos_buff.advance_by(matched[:trim_span[1]])
+                    # Have we consumed the whole string? This avoids us having
+                    # an empty string on the end.
+                    if idx == len(matched):
+                        break
                 # Is it at the end?
                 if trim_span[1] == len(matched):
                     seg_buff += (

FileSegment error raised when using tabs
Hey,
I got the following error:

TypeError: In constructing <class 'sqlfluff.parser.segments_file.FileSegment'>, found an element of the segments tuple which isn't contigious with previous: <whitespace_RawSegment: ([4](1, 2, 2)) '\t'> > <newline_RawSegment: ([4](1, 2, 2)) '\n'>. End pos: [5](1, 2, 3). Prev String: '\t'

By using this input file 
/*
	
*/

Please note that in the comment is an invisible tab in the otherwise empty line.

diff --git a/test/parser_lexer_test.py b/test/parser_lexer_test.py
index 6b8ba2a9..8fbd5301 100644
--- a/test/parser_lexer_test.py
+++ b/test/parser_lexer_test.py
@@ -46,8 +46,9 @@ def assert_matches(instring, matcher, matchstring):
         ("abc -- comment \nblah", ['abc', ' ', "-- comment ", "\n", "blah"]),
         ("abc # comment \nblah", ['abc', ' ', "# comment ", "\n", "blah"]),
         # Note the more complicated parsing of block comments.
-        # This tests subdivision and trimming
+        # This tests subdivision and trimming (incl the empty case)
         ("abc /* comment \nblah*/", ['abc', ' ', "/* comment", " ", "\n", "blah*/"]),
+        ("abc /*\n\t\n*/", ['abc', ' ', "/*", "\n", "\t", "\n", "*/"]),
         # Test Singletons
         ("*-+bd/", ['*', '-', '+', 'bd', '/']),
         # Test Negatives and Minus

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
bench-it==1.0.1
certifi @ file:///croot/certifi_1671487769961/work/certifi
click==8.1.8
colorama==0.4.6
configparser==5.3.0
coverage==7.2.7
diff-cover==2.6.1
exceptiongroup==1.2.2
importlib-metadata==6.7.0
inflect==6.0.5
iniconfig==2.0.0
Jinja2==3.1.6
jinja2-pluralize==0.3.0
MarkupSafe==2.1.5
oyaml==1.0
packaging==24.0
pluggy==1.2.0
pydantic==1.10.21
Pygments==2.17.2
pytest==7.4.4
pytest-cov==4.1.0
PyYAML==6.0.1
six==1.17.0
-e git+https://github.com/alanmcruickshank/sqlfluff.git@8618eedb6a986dc873fbff5c14709fe0e07cd0e8#egg=sqlfluff
tomli==2.0.1
typing_extensions==4.7.1
zipp==3.15.0

name: sqlfluff
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - bench-it==1.0.1
      - click==8.1.8
      - colorama==0.4.6
      - configparser==5.3.0
      - coverage==7.2.7
      - diff-cover==2.6.1
      - exceptiongroup==1.2.2
      - importlib-metadata==6.7.0
      - inflect==6.0.5
      - iniconfig==2.0.0
      - jinja2==3.1.6
      - jinja2-pluralize==0.3.0
      - markupsafe==2.1.5
      - oyaml==1.0
      - packaging==24.0
      - pluggy==1.2.0
      - pydantic==1.10.21
      - pygments==2.17.2
      - pytest==7.4.4
      - pytest-cov==4.1.0
      - pyyaml==6.0.1
      - six==1.17.0
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - zipp==3.15.0
prefix: /opt/conda/envs/sqlfluff

test/parser_lexer_test.py::test__parser__lexer_obj[abc
test/parser_lexer_test.py::test__parser__lexer_obj[a test/parser_lexer_test.py::test__parser__lexer_obj[b.c-res1] test/parser_lexer_test.py::test__parser__lexer_obj[abc'\n test/parser_lexer_test.py::test__parser__lexer_obj[*-+bd/-res8] test/parser_lexer_test.py::test__parser__lexer_obj[2+4 test/parser_lexer_test.py::test__parser__lexer_singleton[.fsaljk-.] test/parser_lexer_test.py::test__parser__lexer_singleton[fsaljk-None] test/parser_lexer_test.py::test__parser__lexer_regex[fsaljk-f-f0] test/parser_lexer_test.py::test__parser__lexer_regex[fsaljk-f-f1] test/parser_lexer_test.py::test__parser__lexer_regex[fsaljk-[fas]*-fsa] test/parser_lexer_test.py::test__parser__lexer_regex[ test/parser_lexer_test.py::test__parser__lexer_regex['something test/parser_lexer_test.py::test__parser__lexer_regex[' test/parser_lexer_test.py::test__parser__lexer_multimatcher test/parser_lexer_test.py::test__parser__lexer_fail test/parser_lexer_test.py::test__parser__lexer_fail_via_parse
src/sqlfluff/parser/lexer.py
src/sqlfluff/parser/lexer.py