diff --git a/sqlglot/dialects/snowflake.py b/sqlglot/dialects/snowflake.py
index 01f7512a..62b1cd0c 100644
--- a/sqlglot/dialects/snowflake.py
+++ b/sqlglot/dialects/snowflake.py
@@ -349,7 +349,7 @@ class Snowflake(Dialect):
             table: t.Optional[exp.Expression] = None
             if self._match_text_seq("@"):
                 table_name = "@"
-                while True:
+                while self._curr:
                     self._advance()
                     table_name += self._prev.text
                     if not self._match_set(self.STAGED_FILE_SINGLE_TOKENS, advance=False):

diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
index ede42f47..7452a8c9 100644
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -552,6 +552,7 @@ class TestSnowflake(Validator):
             staged_file.sql(dialect="snowflake"),
         )
 
+        self.validate_identity("SELECT metadata$filename FROM @s1/")
         self.validate_identity("SELECT * FROM @~")
         self.validate_identity("SELECT * FROM @~/some/path/to/file.csv")
         self.validate_identity("SELECT * FROM @mystage")

List index out of range for Snowflake SQL transpilation
Ran the issue using the latest `main` build `sqlglot-19.0.4.dev18`

Read: `snowflake`
Write `spark` 

When running the following query on Snowflake's publically available documentation, we get an `IndexError: list index out of range`. It's unclear which part of the query is unable to be tokenized. 

Code snippet 

https://docs.snowflake.com/en/sql-reference/sql/create-external-table

```
query_1666 = 'SELECT metadata$filename FROM @s1/;'

transpiled_sqls = transpile(query_1666, read='snowflake', write='spark', pretty=True, error_level=None)
```

tests/dialects/test_snowflake.py::TestSnowflake::test_staged_files
tests/dialects/test_snowflake.py::TestSnowflake::test_ddl tests/dialects/test_snowflake.py::TestSnowflake::test_describe_table tests/dialects/test_snowflake.py::TestSnowflake::test_flatten tests/dialects/test_snowflake.py::TestSnowflake::test_match_recognize tests/dialects/test_snowflake.py::TestSnowflake::test_minus tests/dialects/test_snowflake.py::TestSnowflake::test_null_treatment tests/dialects/test_snowflake.py::TestSnowflake::test_parse_like_any tests/dialects/test_snowflake.py::TestSnowflake::test_regexp_replace tests/dialects/test_snowflake.py::TestSnowflake::test_regexp_substr tests/dialects/test_snowflake.py::TestSnowflake::test_sample tests/dialects/test_snowflake.py::TestSnowflake::test_semi_structured_types tests/dialects/test_snowflake.py::TestSnowflake::test_show tests/dialects/test_snowflake.py::TestSnowflake::test_snowflake tests/dialects/test_snowflake.py::TestSnowflake::test_stored_procedures tests/dialects/test_snowflake.py::TestSnowflake::test_swap tests/dialects/test_snowflake.py::TestSnowflake::test_table_literal tests/dialects/test_snowflake.py::TestSnowflake::test_timestamps tests/dialects/test_snowflake.py::TestSnowflake::test_user_defined_functions tests/dialects/test_snowflake.py::TestSnowflake::test_values