==================
UPDATE with line markers
==================

UPDATE FILE "/app/main.py"
INSERT AFTER LINE 5
WITH CONTENT "...";

UPDATE FILE "/app/main.py"
INSERT AFTER 5
WITH CONTENT "...";

UPDATE FILE "/app/main.py"
INSERT AFTER LINE REGEX ".."
WITH CONTENT "...";

UPDATE FILE "/app/main.py"
INSERT AFTER REGEX ".."
WITH CONTENT "...";

UPDATE FILE "/app/main.py"
INSERT AFTER LINE PREFIX ".."
WITH CONTENT "...";

UPDATE FILE "/app/main.py"
INSERT AFTER LINE SUFFIX ".."
WITH CONTENT "...";

---

(source_file
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (insert_clause
      (relpos_bai
        (relpos_beforeafter
          (marker
            (line_matcher
              (line_base
                (number)))))))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (insert_clause
      (relpos_bai
        (relpos_beforeafter
          (marker
            (line_matcher
              (line_base
                (number)))))))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (insert_clause
      (relpos_bai
        (relpos_beforeafter
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string))))))))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (insert_clause
      (relpos_bai
        (relpos_beforeafter
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string))))))))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (insert_clause
      (relpos_bai
        (relpos_beforeafter
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string))))))))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (insert_clause
      (relpos_bai
        (relpos_beforeafter
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string))))))))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator))


==================
UPDATE PROJECT
==================

UPDATE PROJECT
  REFACTOR LANGUAGE "rope"
  WITH PATTERN '''
<rope-line pattern expression>
'''
  WITH GOAL '''
<rope-like goal expression>
''';

---

(source_file
  (update_command
    (update_project_clause
      (refactor_language_field
        (string
          (single_quoted_string)))
      (pattern_field
        (string
          (multi_line_string)))
      (goal_field
        (string
          (multi_line_string)))))
  (command_separator))


==================
UPDATE Single File
==================

-- Remarks
UPDATE FILE "/path/to/file.js"
REPLACE LINE "old" WITH CONTENT "new line content";

UPDATE FILE "/app/main.py"
INSERT AFTER LINE "def main():" OFFSET 1
WITH CONTENT "@1:print('Hello, World!')";

UPDATE FILE "/app/main.py"
INSERT INTO FUNCTION "func1" OFFSET 1 BOTTOM
WITH CONTENT "@1:print('Hello, World!')"

UPDATE FILE "my_code.py"
REPLACE FUNCTION "my_function"
WITH CONTENT """
def other_function(x):
"""

UPDATE FILE "file" REPLACE WHOLE WITH CONTENT "Single line"; -- Preferred
UPDATE FILE "file" REPLACE BODY WITH CONTENT "Single line"; --   Synonym

UPDATE FILE "/config/settings.json"
REPLACE SEGMENT
    STARTING AT LINE "\"database\": {" OFFSET 1
    ENDING BEFORE LINE "}"
WITH CONTENT '''
    "host": "localhost",
    "port": 5432,
    "user": "admin"
''';

UPDATE FILE "/config/settings.json"
REPLACE SEGMENT
    STARTING AT LINE "\"database\": {" OFFSET 1
    ENDING BEFORE LINE "}"
WITH FILE "my/file" SEGMENT
    STARTING AT LINE "\"database\": {" OFFSET 1
    ENDING BEFORE LINE "}"
    RELATIVE INDENTATION 2;

UPDATE FILE "file"
DELETE LINE "line";

UPDATE FILE "file"
DELETE VARIABLE "var1";

UPDATE FILE "file"
DELETE FUNCTION "fun";

UPDATE FILE "file"
DELETE CLASS "cls1";

UPDATE FILE "file"
DELETE SEGMENT
    STARTING AT LINE "\"database\": {" OFFSET 1
    ENDING BEFORE LINE "}";

UPDATE FILE "file" DELETE WHOLE -- Preferred;
UPDATE FILE "file" DELETE BODY  --   Synonym;

---

(source_file
  (comment)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field
        (marker_or_segment
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string))))))))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (insert_clause
      (relpos_bai
        (relpos_beforeafter
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string)))
              (offset_clause
                (number)))))))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (insert_clause
      (relpos_bai
        (relpos_into
          (identifier_matcher
            (string
              (single_quoted_string))
            (offset_clause
              (number))))))
    (content_literal
      (string
        (single_quoted_string))))
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field
        (marker_or_segment
          (marker
            (identifier_matcher
              (string
                (single_quoted_string)))))))
    (content_literal
      (string
        (multi_line_string))))
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (comment)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (comment)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field
        (marker_or_segment
          (segment
            (relpos_segment_start
              (relpos_at
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string
                          (escape_sequence)
                          (escape_sequence))))
                    (offset_clause
                      (number))))))
            (relpos_segment_end
              (relpos_beforeafter
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string)))))))))))
    (content_literal
      (string
        (multi_line_string))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field
        (marker_or_segment
          (segment
            (relpos_segment_start
              (relpos_at
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string
                          (escape_sequence)
                          (escape_sequence))))
                    (offset_clause
                      (number))))))
            (relpos_segment_end
              (relpos_beforeafter
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string)))))))))))
    (content_from_segment
      (singlefile_clause
        (string
          (single_quoted_string)))
      (marker_or_segment
        (segment
          (relpos_segment_start
            (relpos_at
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string
                        (escape_sequence)
                        (escape_sequence))))
                  (offset_clause
                    (number))))))
          (relpos_segment_end
            (relpos_beforeafter
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))))))))
      (relative_indentation
        (number))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (update_delete_region_clause
      (region_field
        (marker_or_segment
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string)))))))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (update_delete_region_clause
      (region_field
        (marker_or_segment
          (marker
            (identifier_matcher
              (string
                (single_quoted_string))))))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (update_delete_region_clause
      (region_field
        (marker_or_segment
          (marker
            (identifier_matcher
              (string
                (single_quoted_string))))))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (update_delete_region_clause
      (region_field
        (marker_or_segment
          (marker
            (identifier_matcher
              (string
                (single_quoted_string))))))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (update_delete_region_clause
      (region_field
        (marker_or_segment
          (segment
            (relpos_segment_start
              (relpos_at
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string
                          (escape_sequence)
                          (escape_sequence))))
                    (offset_clause
                      (number))))))
            (relpos_segment_end
              (relpos_beforeafter
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string))))))))))))
  (command_separator)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (update_delete_region_clause
      (region_field)))
  (comment)
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (update_delete_region_clause
      (region_field)))
  (comment))



==================
UPDATE Function/Class From File
==================

UPDATE FUNCTION "calculateTotal"
FROM FILE "/src/utils.js"
REPLACE BODY
WITH CONTENT '''
  return items.reduce((sum, item) => sum + item.price, 0);
''';

UPDATE FUNCTION "calculateTotal"
FROM FILE "/src/utils.js"
REPLACE WHOLE
WITH CONTENT '''
...
''';

UPDATE FUNCTION "calculateTotal"
FROM FILE "file.py"
REPLACE PARAMETERS
WITH CONTENT '''
@1:a: int,
@1:b: str
''';

UPDATE FUNCTION "calculateTotal"
FROM FILE "file.py"
REPLACE TYPE
WITH CONTENT "list[int]";

UPDATE VARIABLE "my_var"
FROM FILE "file.py"
REPLACE TYPE
WITH CONTENT "list[int]";

UPDATE CLASS "Validate*" OFFSET 2
  FROM FILE "/lib/helpers.py"
  INSERT
    BEFORE LINE "return" OFFSET 1
  WITH CONTENT "@1:something..."

UPDATE FUNCTION "validate*" OFFSET 2
  FROM FILE "/lib/helpers.py"
  DELETE WHOLE

UPDATE FUNCTION "validate*" OFFSET 2
  FROM FILE "/lib/helpers.py"
  DELETE BODY

UPDATE FUNCTION "validate*" OFFSET 2
  FROM FILE "/lib/helpers.py"
  DELETE LINE "line inside function"

UPDATE FUNCTION "validate*" OFFSET 2
  FROM FILE "/lib/helpers.py"
DELETE SEGMENT
    STARTING AT LINE "\"database\": {" OFFSET 1
    ENDING BEFORE LINE "}"

UPDATE CLASS "A"
  FROM FILE "/lib/helpers.py"
DELETE SEGMENT
    STARTING AT FUNCTION "m1"
    ENDING BEFORE FUNCTION "m2"

---

(source_file
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (replace_region_clause
      (region_field))
    (content_literal
      (string
        (multi_line_string))))
  (command_separator)
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (replace_region_clause
      (region_field))
    (content_literal
      (string
        (multi_line_string))))
  (command_separator)
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (replace_region_clause
      (region_field))
    (content_literal
      (string
        (multi_line_string))))
  (command_separator)
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (replace_region_clause
      (region_field))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (replace_region_clause
      (region_field))
    (content_literal
      (string
        (single_quoted_string))))
  (command_separator)
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string))
        (offset_clause
          (number)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (insert_clause
      (relpos_bai
        (relpos_beforeafter
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string)))
              (offset_clause
                (number)))))))
    (content_literal
      (string
        (single_quoted_string))))
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string))
        (offset_clause
          (number)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_delete_region_clause
      (region_field)))
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string))
        (offset_clause
          (number)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_delete_region_clause
      (region_field)))
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string))
        (offset_clause
          (number)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_delete_region_clause
      (region_field
        (marker_or_segment
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string)))))))))
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string))
        (offset_clause
          (number)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_delete_region_clause
      (region_field
        (marker_or_segment
          (segment
            (relpos_segment_start
              (relpos_at
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string
                          (escape_sequence)
                          (escape_sequence))))
                    (offset_clause
                      (number))))))
            (relpos_segment_end
              (relpos_beforeafter
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string))))))))))))
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_delete_region_clause
      (region_field
        (marker_or_segment
          (segment
            (relpos_segment_start
              (relpos_at
                (marker
                  (identifier_matcher
                    (string
                      (single_quoted_string))))))
            (relpos_segment_end
              (relpos_beforeafter
                (marker
                  (identifier_matcher
                    (string
                      (single_quoted_string))))))))))))


==================
UPDATE Move Segment
==================

UPDATE FILE "/src/component.tsx"
MOVE SEGMENT
STARTING AT LINE "import React" OFFSET 0
ENDING BEFORE LINE "function Component"
INSERT AFTER LINE "export default Component;";

UPDATE FUNCTION "index"
FROM FILE "/app/views.py"
MOVE SEGMENT
STARTING AFTER LINE "def index():" OFFSET 1
ENDING BEFORE LINE "return"
INSERT BEFORE LINE "return" OFFSET 1;

---

(source_file
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (update_move_mos_clause
      (marker_or_segment
        (segment
          (relpos_segment_start
            (relpos_at
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))
                  (offset_clause
                    (number))))))
          (relpos_segment_end
            (relpos_beforeafter
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))))))))
      (update_move_clause_destination
        (insert_clause
          (relpos_bai
            (relpos_beforeafter
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))))))))))
  (command_separator)
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_move_region_clause
      (region_field
        (marker_or_segment
          (segment
            (relpos_segment_start
              (relpos_beforeafter
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string)))
                    (offset_clause
                      (number))))))
            (relpos_segment_end
              (relpos_beforeafter
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string))))))))))
      (update_move_clause_destination
        (insert_clause
          (relpos_bai
            (relpos_beforeafter
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))
                  (offset_clause
                    (number))))))))))
  (command_separator))



==================
UPDATE Move BODY / WHOLE / LINE
==================

UPDATE FUNCTION "index"
FROM FILE "/app/views.py"
MOVE WHOLE
INSERT BEFORE CLASS "TopClass" OFFSET 1
RELATIVE INDENTATION 2;

UPDATE FUNCTION "index"
FROM FILE "/app/views.py"
MOVE BODY
INSERT INTO FUNCTION "otherFunc" OFFSET 2 BOTTOM

UPDATE FUNCTION "index"
FROM FILE "/app/views.py"
MOVE LINE "a line"
INSERT AFTER 4

---

(source_file
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_move_region_clause
      (region_field)
      (update_move_clause_destination
        (insert_clause
          (relpos_bai
            (relpos_beforeafter
              (marker
                (identifier_matcher
                  (string
                    (single_quoted_string))
                  (offset_clause
                    (number)))))))
        (relative_indentation
          (number)))))
  (command_separator)
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_move_region_clause
      (region_field)
      (update_move_clause_destination
        (insert_clause
          (relpos_bai
            (relpos_into
              (identifier_matcher
                (string
                  (single_quoted_string))
                (offset_clause
                  (number)))))))))
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (update_move_region_clause
      (region_field
        (marker_or_segment
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string)))))))
      (update_move_clause_destination
        (insert_clause
          (relpos_bai
            (relpos_beforeafter
              (marker
                (line_matcher
                  (line_base
                    (number)))))))))))

==================
UPDATE Replace With Segment
==================

UPDATE FILE "/src/index.js"
REPLACE "SS"
WITH FILE "/src/template.js"
SEGMENT
STARTING AT LINE "// START TEMPLATE"
ENDING BEFORE LINE "// END TEMPLATE"

UPDATE FUNCTION "calculate_average"
FROM FILE "/lib/math.py"
REPLACE BODY
WITH SEGMENT
STARTING AFTER "def efficient_average(numbers):"
ENDING AT LINE "return";

---

(source_file
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field
        (marker_or_segment
          (marker
            (line_matcher
              (line_base
                (string
                  (single_quoted_string))))))))
    (content_from_segment
      (singlefile_clause
        (string
          (single_quoted_string)))
      (marker_or_segment
        (segment
          (relpos_segment_start
            (relpos_at
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))))))
          (relpos_segment_end
            (relpos_beforeafter
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))))))))))
  (update_command
    (identifier_from_file
      (identifier_matcher
        (string
          (single_quoted_string)))
      (singlefile_clause
        (string
          (single_quoted_string))))
    (replace_region_clause
      (region_field))
    (content_from_segment
      (marker_or_segment
        (segment
          (relpos_segment_start
            (relpos_beforeafter
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))))))
          (relpos_segment_end
            (relpos_at
              (marker
                (line_matcher
                  (line_base
                    (string
                      (single_quoted_string)))))))))))
  (command_separator))


==================
UPDATE REPLACE WITH ED
==================

UPDATE FILE "/app/main.py"
REPLACE FUNCTION "calculate_total"
WITH ED '''
-- Add type hints to parameters
1s/calculate_total(base_amount, tax_rate, discount, apply_shipping)/calculate_total(base_amount: float, tax_rate: float, discount: float, apply_shipping: bool) -> float/

-- Add docstring after function definition
1a
    """
    Calculate the total amount including tax, shipping, and discount.
    """
.

-- Add logging before return
/return/i
    logger.info(f"Calculated total amount: {subtotal:.2f}")
.
''';

---

(source_file
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field
        (marker_or_segment
          (marker
            (identifier_matcher
              (string
                (single_quoted_string)))))))
    (ed_stmt
      (string
        (multi_line_string))))
  (command_separator))

==================
UPDATE REPLACE WITH CASE
==================

UPDATE FILE "/app/main.py"
REPLACE SEGMENT STARTING AT LINE 1 ENDING BEFORE LINE REGEX "ASDF"
WITH CASE
  WHEN EMPTY THEN REMOVE
  WHEN LINE EMPTY THEN REMOVE
  WHEN LINE 4 THEN SUB r"pattern" r"replacement" CONTINUE
  WHEN 5 THEN CONTINUE
  WHEN LINE "asdf" THEN BREAK
  WHEN "asdf" THEN BREAK
  WHEN LINE REGEX r"asdf" THEN SUB r"pattern" r"replacement" BREAK
  WHEN PREFIX r"asdf" THEN INDENT 4
  WHEN LINE PREFIX r"asdf" THEN INDENT 4
  WHEN REGEX r"asdf" THEN BREAK
  ELSE SUB r"pattern" r'replacement'
END;

---

(source_file
  (update_command
    (singlefile_clause
      (string
        (single_quoted_string)))
    (replace_region_clause
      (region_field
        (marker_or_segment
          (segment
            (relpos_segment_start
              (relpos_at
                (marker
                  (line_matcher
                    (line_base
                      (number))))))
            (relpos_segment_end
              (relpos_beforeafter
                (marker
                  (line_matcher
                    (line_base
                      (string
                        (single_quoted_string)))))))))))
    (case_stmt
      (line_base)
      (case_action)
      (line_base)
      (case_action)
      (line_base
        (number))
      (case_action
        (string
          (raw_string))
        (string
          (raw_string))
        (loop_control
          (loop_continue)))
      (line_base
        (number))
      (case_action
        (loop_control
          (loop_continue)))
      (line_base
        (string
          (single_quoted_string)))
      (case_action
        (loop_control
          (loop_break)))
      (line_base
        (string
          (single_quoted_string)))
      (case_action
        (loop_control
          (loop_break)))
      (line_base
        (string
          (raw_string)))
      (case_action
        (string
          (raw_string))
        (string
          (raw_string))
        (loop_control
          (loop_break)))
      (line_base
        (string
          (raw_string)))
      (case_action
        (number))
      (line_base
        (string
          (raw_string)))
      (case_action
        (number))
      (line_base
        (string
          (raw_string)))
      (case_action
        (loop_control
          (loop_break)))
      (case_action
        (string
          (raw_string))
        (string
          (raw_string)))))
  (command_separator))


==================
UPDATE Edge Cases and Combinations
==================

UPDATE FILE "/very/long/path/to/file/with/many/directories/example.txt"
REPLACE SEGMENT
STARTING BEFORE LINE "Section 1" OFFSET 5
ENDING AFTER LINE "End of Section 1" OFFSET 10
WITH CONTENT '''
@0:This is a very long
@1:multiline content
@-1:with "quotes" and other 'special' chars
@2:like backslashes and   multiple   spaces
''';

UPDATE FUNCTION "*Controller" FROM FILE "/src/complex_file.js"
MOVE SEGMENT
STARTING AT LINE "constructor(" OFFSET 0
ENDING BEFORE LINE "}"
INSERT AFTER LINE "methods: {" OFFSET 1;

UPDATE FILE "/config.json"
REPLACE SEGMENT
STARTING AT LINE "\"environment\": {"
ENDING AFTER LINE "}"
WITH FILE "/default_config.json"
SEGMENT
  STARTING AT LINE "\"environment\": {"
  ENDING AFTER LINE"}";

---

    (source_file
      (update_command
        (singlefile_clause
          (string
            (single_quoted_string)))
        (replace_region_clause
          (region_field
            (marker_or_segment
              (segment
                (relpos_segment_start
                  (relpos_beforeafter
                    (marker
                      (line_matcher
                        (line_base
                          (string
                            (single_quoted_string)))
                        (offset_clause
                          (number))))))
                (relpos_segment_end
                  (relpos_beforeafter
                    (marker
                      (line_matcher
                        (line_base
                          (string
                            (single_quoted_string)))
                        (offset_clause
                          (number))))))))))
        (content_literal
          (string
            (multi_line_string))))
      (command_separator)
      (update_command
        (identifier_from_file
          (identifier_matcher
            (string
              (single_quoted_string)))
          (singlefile_clause
            (string
              (single_quoted_string))))
        (update_move_region_clause
          (region_field
            (marker_or_segment
              (segment
                (relpos_segment_start
                  (relpos_at
                    (marker
                      (line_matcher
                        (line_base
                          (string
                            (single_quoted_string)))
                        (offset_clause
                          (number))))))
                (relpos_segment_end
                  (relpos_beforeafter
                    (marker
                      (line_matcher
                        (line_base
                          (string
                            (single_quoted_string))))))))))
          (update_move_clause_destination
            (insert_clause
              (relpos_bai
                (relpos_beforeafter
                  (marker
                    (line_matcher
                      (line_base
                        (string
                          (single_quoted_string)))
                      (offset_clause
                        (number))))))))))
      (command_separator)
      (update_command
        (singlefile_clause
          (string
            (single_quoted_string)))
        (replace_region_clause
          (region_field
            (marker_or_segment
              (segment
                (relpos_segment_start
                  (relpos_at
                    (marker
                      (line_matcher
                        (line_base
                          (string
                            (single_quoted_string
                              (escape_sequence)
                              (escape_sequence))))))))
                (relpos_segment_end
                  (relpos_beforeafter
                    (marker
                      (line_matcher
                        (line_base
                          (string
                            (single_quoted_string)))))))))))
        (content_from_segment
          (singlefile_clause
            (string
              (single_quoted_string)))
          (marker_or_segment
            (segment
              (relpos_segment_start
                (relpos_at
                  (marker
                    (line_matcher
                      (line_base
                        (string
                          (single_quoted_string
                            (escape_sequence)
                            (escape_sequence))))))))
              (relpos_segment_end
                (relpos_beforeafter
                  (marker
                    (line_matcher
                      (line_base
                        (string
                          (single_quoted_string)))))))))))
      (command_separator))
