prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Can't parse `trim` in TrinoSQL
  **Fully reproducible code snippet**
  Please include a fully reproducible code snippet or the input sql, dialect, and expected output.
  ```python
  import sqlglot
  print(sqlglot.__version__)
  sql = "SELECT trim(',' FROM some_col);"
  result = sqlglot.parse(sql, read="trino")
  print(repr(result))
  ```
  
  Expected:
  ```
  23.12.2
  [Select(
    expressions=[
      Trim(
        this=Column(
          this=Identifier(this=some_col, quoted=False)),
        expression=Literal(this=,, is_string=True))])]
  ```
  
  Got:
  ```
  23.12.2
  Traceback (most recent call last):
    File "proof.py", line 7, in <module>
      result = sqlglot.parse(sql, read="trino")
    File ".../python3.8/site-packages/sqlglot/__init__.py", line 102, in parse
      return Dialect.get_or_raise(read or dialect).parse(sql, **opts)
    File ".../python3.8/site-packages/sqlglot/dialects/dialect.py", line 506, in parse
      return self.parser(**opts).parse(self.tokenize(sql), sql)
    File ".../python3.8/site-packages/sqlglot/parser.py", line 1175, in parse
      return self._parse(
    File ".../python3.8/site-packages/sqlglot/parser.py", line 1241, in _parse
      expressions.append(parse_method(self))
    File ".../python3.8/site-packages/sqlglot/parser.py", line 1476, in _parse_statement
      expression = self._parse_set_operations(expression) if expression else self._parse_select()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 2532, in _parse_select
      projections = self._parse_projections()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 2480, in _parse_projections
      return self._parse_expressions()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 5695, in _parse_expressions
      return self._parse_csv(self._parse_expression)
    File ".../python3.8/site-packages/sqlglot/parser.py", line 5649, in _parse_csv
      parse_result = parse_method()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3805, in _parse_expression
      return self._parse_alias(self._parse_conjunction())
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3808, in _parse_conjunction
      return self._parse_tokens(self._parse_equality, self.CONJUNCTION)
    File ".../python3.8/site-packages/sqlglot/parser.py", line 5663, in _parse_tokens
      this = parse_method()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3811, in _parse_equality
      return self._parse_tokens(self._parse_comparison, self.EQUALITY)
    File ".../python3.8/site-packages/sqlglot/parser.py", line 5663, in _parse_tokens
      this = parse_method()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3814, in _parse_comparison
      return self._parse_tokens(self._parse_range, self.COMPARISON)
    File ".../python3.8/site-packages/sqlglot/parser.py", line 5663, in _parse_tokens
      this = parse_method()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3817, in _parse_range
      this = this or self._parse_bitwise()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3941, in _parse_bitwise
      this = self._parse_term()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3973, in _parse_term
      return self._parse_tokens(self._parse_factor, self.TERM)
    File ".../python3.8/site-packages/sqlglot/parser.py", line 5663, in _parse_tokens
      this = parse_method()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3977, in _parse_factor
      this = parse_method()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 3998, in _parse_unary
      return self._parse_at_time_zone(self._parse_type())
    File ".../python3.8/site-packages/sqlglot/parser.py", line 4020, in _parse_type
      this = self._parse_column()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 4220, in _parse_column
      this = self._parse_column_reference()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 4224, in _parse_column_reference
      this = self._parse_field()
    File ".../python3.8/site-packages/sqlglot/parser.py", line 4347, in _parse_field
      field = self._parse_primary() or self._parse_function(
    File ".../python3.8/site-packages/sqlglot/parser.py", line 4370, in _parse_function
      func = self._parse_function_call(
    File ".../python3.8/site-packages/sqlglot/parser.py", line 4458, in _parse_function_call
      self._match_r_paren(this)
    File ".../python3.8/site-packages/sqlglot/parser.py", line 6196, in _match_r_paren
      self.raise_error("Expecting )")
    File ".../python3.8/site-packages/sqlglot/parser.py", line 1285, in raise_error
      raise error
  sqlglot.errors.ParseError: Expecting ). Line 1, Col: 20.
    SELECT trim(',' FROM some_col);
  ```
  
  **Official Documentation**
  https://trino.io/docs/current/functions/string.html?highlight=trim#trim
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `sqlglot/dialects/trino.py`
  Content:
  ```
  1 from __future__ import annotations
  2 
  3 from sqlglot import exp
  4 from sqlglot.dialects.dialect import merge_without_target_sql
  5 from sqlglot.dialects.presto import Presto
  6 
  7 
  8 class Trino(Presto):
  9     SUPPORTS_USER_DEFINED_TYPES = False
  10     LOG_BASE_FIRST = True
  11 
  12     class Generator(Presto.Generator):
  13         TRANSFORMS = {
  14             **Presto.Generator.TRANSFORMS,
  15             exp.ArraySum: lambda self,
  16             e: f"REDUCE({self.sql(e, 'this')}, 0, (acc, x) -> acc + x, acc -> acc)",
  17             exp.Merge: merge_without_target_sql,
  18         }
  19 
  20         SUPPORTED_JSON_PATH_PARTS = {
  21             exp.JSONPathKey,
  22             exp.JSONPathRoot,
  23             exp.JSONPathSubscript,
  24         }
  25 
  26     class Tokenizer(Presto.Tokenizer):
  27         HEX_STRINGS = [("X'", "'")]
  28
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/sqlglot/dialects/trino.py b/sqlglot/dialects/trino.py
  --- a/sqlglot/dialects/trino.py
  +++ b/sqlglot/dialects/trino.py
  @@ -1,7 +1,7 @@
   from __future__ import annotations
   
   from sqlglot import exp
  -from sqlglot.dialects.dialect import merge_without_target_sql
  +from sqlglot.dialects.dialect import merge_without_target_sql, trim_sql
   from sqlglot.dialects.presto import Presto
   
   
  @@ -9,12 +9,19 @@
       SUPPORTS_USER_DEFINED_TYPES = False
       LOG_BASE_FIRST = True
   
  +    class Parser(Presto.Parser):
  +        FUNCTION_PARSERS = {
  +            **Presto.Parser.FUNCTION_PARSERS,
  +            "TRIM": lambda self: self._parse_trim(),
  +        }
  +
       class Generator(Presto.Generator):
           TRANSFORMS = {
               **Presto.Generator.TRANSFORMS,
               exp.ArraySum: lambda self,
               e: f"REDUCE({self.sql(e, 'this')}, 0, (acc, x) -> acc + x, acc -> acc)",
               exp.Merge: merge_without_target_sql,
  +            exp.Trim: trim_sql,
           }
   
           SUPPORTED_JSON_PATH_PARTS = {
  
verification_info: {"golden_diff": "diff --git a/sqlglot/dialects/trino.py b/sqlglot/dialects/trino.py\n--- a/sqlglot/dialects/trino.py\n+++ b/sqlglot/dialects/trino.py\n@@ -1,7 +1,7 @@\n from __future__ import annotations\n \n from sqlglot import exp\n-from sqlglot.dialects.dialect import merge_without_target_sql\n+from sqlglot.dialects.dialect import merge_without_target_sql, trim_sql\n from sqlglot.dialects.presto import Presto\n \n \n@@ -9,12 +9,19 @@\n     SUPPORTS_USER_DEFINED_TYPES = False\n     LOG_BASE_FIRST = True\n \n+    class Parser(Presto.Parser):\n+        FUNCTION_PARSERS = {\n+            **Presto.Parser.FUNCTION_PARSERS,\n+            \"TRIM\": lambda self: self._parse_trim(),\n+        }\n+\n     class Generator(Presto.Generator):\n         TRANSFORMS = {\n             **Presto.Generator.TRANSFORMS,\n             exp.ArraySum: lambda self,\n             e: f\"REDUCE({self.sql(e, 'this')}, 0, (acc, x) -> acc + x, acc -> acc)\",\n             exp.Merge: merge_without_target_sql,\n+            exp.Trim: trim_sql,\n         }\n \n         SUPPORTED_JSON_PATH_PARTS = {\n", "issue": "Can't parse `trim` in TrinoSQL\n**Fully reproducible code snippet**\r\nPlease include a fully reproducible code snippet or the input sql, dialect, and expected output.\r\n```python\r\nimport sqlglot\r\nprint(sqlglot.__version__)\r\nsql = \"SELECT trim(',' FROM some_col);\"\r\nresult = sqlglot.parse(sql, read=\"trino\")\r\nprint(repr(result))\r\n```\r\n\r\nExpected:\r\n```\r\n23.12.2\r\n[Select(\r\n  expressions=[\r\n    Trim(\r\n      this=Column(\r\n        this=Identifier(this=some_col, quoted=False)),\r\n      expression=Literal(this=,, is_string=True))])]\r\n```\r\n\r\nGot:\r\n```\r\n23.12.2\r\nTraceback (most recent call last):\r\n  File \"proof.py\", line 7, in <module>\r\n    result = sqlglot.parse(sql, read=\"trino\")\r\n  File \".../python3.8/site-packages/sqlglot/__init__.py\", line 102, in parse\r\n    return Dialect.get_or_raise(read or dialect).parse(sql, **opts)\r\n  File \".../python3.8/site-packages/sqlglot/dialects/dialect.py\", line 506, in parse\r\n    return self.parser(**opts).parse(self.tokenize(sql), sql)\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 1175, in parse\r\n    return self._parse(\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 1241, in _parse\r\n    expressions.append(parse_method(self))\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 1476, in _parse_statement\r\n    expression = self._parse_set_operations(expression) if expression else self._parse_select()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 2532, in _parse_select\r\n    projections = self._parse_projections()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 2480, in _parse_projections\r\n    return self._parse_expressions()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 5695, in _parse_expressions\r\n    return self._parse_csv(self._parse_expression)\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 5649, in _parse_csv\r\n    parse_result = parse_method()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3805, in _parse_expression\r\n    return self._parse_alias(self._parse_conjunction())\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3808, in _parse_conjunction\r\n    return self._parse_tokens(self._parse_equality, self.CONJUNCTION)\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 5663, in _parse_tokens\r\n    this = parse_method()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3811, in _parse_equality\r\n    return self._parse_tokens(self._parse_comparison, self.EQUALITY)\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 5663, in _parse_tokens\r\n    this = parse_method()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3814, in _parse_comparison\r\n    return self._parse_tokens(self._parse_range, self.COMPARISON)\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 5663, in _parse_tokens\r\n    this = parse_method()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3817, in _parse_range\r\n    this = this or self._parse_bitwise()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3941, in _parse_bitwise\r\n    this = self._parse_term()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3973, in _parse_term\r\n    return self._parse_tokens(self._parse_factor, self.TERM)\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 5663, in _parse_tokens\r\n    this = parse_method()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3977, in _parse_factor\r\n    this = parse_method()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 3998, in _parse_unary\r\n    return self._parse_at_time_zone(self._parse_type())\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 4020, in _parse_type\r\n    this = self._parse_column()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 4220, in _parse_column\r\n    this = self._parse_column_reference()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 4224, in _parse_column_reference\r\n    this = self._parse_field()\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 4347, in _parse_field\r\n    field = self._parse_primary() or self._parse_function(\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 4370, in _parse_function\r\n    func = self._parse_function_call(\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 4458, in _parse_function_call\r\n    self._match_r_paren(this)\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 6196, in _match_r_paren\r\n    self.raise_error(\"Expecting )\")\r\n  File \".../python3.8/site-packages/sqlglot/parser.py\", line 1285, in raise_error\r\n    raise error\r\nsqlglot.errors.ParseError: Expecting ). Line 1, Col: 20.\r\n  SELECT trim(',' FROM some_col);\r\n```\r\n\r\n**Official Documentation**\r\nhttps://trino.io/docs/current/functions/string.html?highlight=trim#trim\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom sqlglot import exp\nfrom sqlglot.dialects.dialect import merge_without_target_sql\nfrom sqlglot.dialects.presto import Presto\n\n\nclass Trino(Presto):\n    SUPPORTS_USER_DEFINED_TYPES = False\n    LOG_BASE_FIRST = True\n\n    class Generator(Presto.Generator):\n        TRANSFORMS = {\n            **Presto.Generator.TRANSFORMS,\n            exp.ArraySum: lambda self,\n            e: f\"REDUCE({self.sql(e, 'this')}, 0, (acc, x) -> acc + x, acc -> acc)\",\n            exp.Merge: merge_without_target_sql,\n        }\n\n        SUPPORTED_JSON_PATH_PARTS = {\n            exp.JSONPathKey,\n            exp.JSONPathRoot,\n            exp.JSONPathSubscript,\n        }\n\n    class Tokenizer(Presto.Tokenizer):\n        HEX_STRINGS = [(\"X'\", \"'\")]\n", "path": "sqlglot/dialects/trino.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom sqlglot import exp\nfrom sqlglot.dialects.dialect import merge_without_target_sql, trim_sql\nfrom sqlglot.dialects.presto import Presto\n\n\nclass Trino(Presto):\n    SUPPORTS_USER_DEFINED_TYPES = False\n    LOG_BASE_FIRST = True\n\n    class Parser(Presto.Parser):\n        FUNCTION_PARSERS = {\n            **Presto.Parser.FUNCTION_PARSERS,\n            \"TRIM\": lambda self: self._parse_trim(),\n        }\n\n    class Generator(Presto.Generator):\n        TRANSFORMS = {\n            **Presto.Generator.TRANSFORMS,\n            exp.ArraySum: lambda self,\n            e: f\"REDUCE({self.sql(e, 'this')}, 0, (acc, x) -> acc + x, acc -> acc)\",\n            exp.Merge: merge_without_target_sql,\n            exp.Trim: trim_sql,\n        }\n\n        SUPPORTED_JSON_PATH_PARTS = {\n            exp.JSONPathKey,\n            exp.JSONPathRoot,\n            exp.JSONPathSubscript,\n        }\n\n    class Tokenizer(Presto.Tokenizer):\n        HEX_STRINGS = [(\"X'\", \"'\")]\n", "path": "sqlglot/dialects/trino.py"}]}